Jelajahi Sumber

Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into develop

Laurent Destailleur 1 tahun lalu
induk
melakukan
fb65ad919e

+ 1 - 0
htdocs/fourn/facture/card.php

@@ -2655,6 +2655,7 @@ if ($action == 'create') {
 
 	// Vat reverse-charge by default
 	if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
+		require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
 		print '<tr><td>' . $langs->trans('VATReverseCharge') . '</td><td>';
 		// Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed
 		if ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) {

+ 26 - 27
htdocs/includes/odtphp/odf.php

@@ -25,7 +25,6 @@ class OdfExceptionSegmentNotFound extends Exception
  * @copyright  2010-2015 - Laurent Destailleur - eldy@users.sourceforge.net
  * @copyright  2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
  * @copyright  2012 - Stephen Larroque - lrq3000@gmail.com
- * @copyright  2023 - Thomas Negre - contact@open-dsi.fr
  * @license    https://www.gnu.org/copyleft/gpl.html  GPL License
  * @version 1.5.0
  */
@@ -54,7 +53,7 @@ class Odf
 	public $userdefined=array();
 
 	const PIXEL_TO_CM = 0.026458333;
-	const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/';
+	const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/s';
 	const FIND_ENCODED_TAGS_REGEX = '/&lt;([A-Za-z]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/&gt;)|(?:&gt;(.*)&lt;\/\1&gt;))/';
 
 
@@ -227,14 +226,14 @@ class Odf
 	}
 
 	/**
-     * Replaces html tags in with odt tags and returns an odt string. Encodes and converts inner text.
+	 * Replaces html tags in with odt tags and returns an odt string. Encodes and converts inner text.
 	 * @param array 	$tags   			An array with html tags generated by the getDataFromHtml() function
 	 * @param array 	$customStyles   	An array of style defenitions that should be included inside the odt file
 	 * @param array 	$fontDeclarations   An array of font declarations that should be included inside the odt file
 	 * @param bool     	$encode     		If true, special XML characters are encoded
 	 * @param string   	$charset    		Charset. See encode_chars()
-     * @return string
-     */
+	 * @return string
+	 */
 	private function _replaceHtmlWithOdtTag($tags, &$customStyles, &$fontDeclarations, $encode = false, $charset = '')
 	{
 		if ($customStyles == null) $customStyles = array();
@@ -325,7 +324,7 @@ class Odf
 	 * @param string   $text       The text to encode or not
 	 * @param bool     $encode     If true, special XML characters are encoded
 	 * @param string   $charset    Charset
-     * @return string	The converted text
+	 * @return string	The converted text
 	 * @see self::convertVarToOdf()
 	 */
 	private function encode_chars($text, $encode = false, $charset = '')
@@ -335,15 +334,15 @@ class Odf
 		return $newtext;
 	}
 
-    /**
-     * Checks if the given text is a html string
-     * @param string    $text   The text to check
-     * @return bool
-     */
-    private function _isHtmlTag($text)
+	/**
+	 * Checks if the given text is a html string
+	 * @param string    $text   The text to check
+	 * @return bool
+	 */
+	private function _isHtmlTag($text)
 	{
-        return preg_match(self::FIND_TAGS_REGEX, $text);
-    }
+		return preg_match(self::FIND_TAGS_REGEX, $text);
+	}
 
 	/**
 	 * Checks if the given text includes a html string
@@ -537,10 +536,10 @@ IMG;
 				$balise = str_replace('row.', '', $matches2[1]);
 				// Move segment tags around the row
 				$replace = array(
-				'[!-- BEGIN ' . $matches2[1] . ' --]'	=> '',
-				'[!-- END ' . $matches2[1] . ' --]'		=> '',
-				'<table:table-row'							=> '[!-- BEGIN ' . $balise . ' --]<table:table-row',
-				'</table:table-row>'						=> '</table:table-row>[!-- END ' . $balise . ' --]'
+					'[!-- BEGIN ' . $matches2[1] . ' --]'	=> '',
+					'[!-- END ' . $matches2[1] . ' --]'		=> '',
+					'<table:table-row'							=> '[!-- BEGIN ' . $balise . ' --]<table:table-row',
+					'</table:table-row>'						=> '</table:table-row>[!-- END ' . $balise . ' --]'
 				);
 				$replacedXML = str_replace(array_keys($replace), array_values($replace), $matches[0][$i]);
 				$this->contentXml = str_replace($matches[0][$i], $replacedXML, $this->contentXml);
@@ -583,10 +582,10 @@ IMG;
 				$reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
 				$this->contentXml = preg_replace($reg, '', $this->contentXml);
 				/*if ($sav != $this->contentXml)
-				{
-					dol_syslog("We found a IF and it was processed");
-					//var_dump($sav);exit;
-				}*/
+				 {
+				 dol_syslog("We found a IF and it was processed");
+				 //var_dump($sav);exit;
+				 }*/
 			} else {
 				// Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it
 
@@ -601,10 +600,10 @@ IMG;
 				// Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether)
 				$this->contentXml = preg_replace($reg, '', $this->contentXml);
 				/*if ($sav != $this->contentXml)
-				{
-					dol_syslog("We found a IF and it was processed");
-					//var_dump($sav);exit;
-				}*/
+				 {
+				 dol_syslog("We found a IF and it was processed");
+				 //var_dump($sav);exit;
+				 }*/
 			}
 		}
 
@@ -1025,4 +1024,4 @@ IMG;
 		$this->contentXml = preg_replace($searchreg, "", $this->contentXml);
 		return  $matches[1];
 	}
-}
+}

+ 1 - 1
htdocs/projet/tasks/time.php

@@ -1580,7 +1580,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
 		$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
 		$sql .= $hookmanager->resPrint;
 		$sql .= " WHERE elementtype = 'task'";
-		$sql .= " ND p.entity IN (".getEntity('project').")";
+		$sql .= " AND p.entity IN (".getEntity('project').")";
 		if (empty($projectidforalltimes) && empty($allprojectforuser)) {
 			// Limit on one task
 			$sql .= " AND t.fk_element =".((int) $object->id);