Completed
Branch develop (90201c)
by
unknown
14:03
created
htdocs/includes/odtphp/odf.php 2 patches
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
 class Odf
32 32
 {
33 33
 	protected $config = array(
34
-		'ZIP_PROXY' => 'PclZipProxy',	// PclZipProxy, PhpZipProxy
34
+		'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy
35 35
 		'DELIMITER_LEFT' => '{',
36 36
 		'DELIMITER_RIGHT' => '}',
37 37
 		'PATH_TO_TMP' => '/tmp'
38 38
 	);
39 39
 	protected $file;
40
-	protected $contentXml;			// To store content of content.xml file
41
-	protected $metaXml;			    // To store content of meta.xml file
42
-	protected $stylesXml;			// To store content of styles.xml file
43
-	protected $manifestXml;			// To store content of META-INF/manifest.xml file
40
+	protected $contentXml; // To store content of content.xml file
41
+	protected $metaXml; // To store content of meta.xml file
42
+	protected $stylesXml; // To store content of styles.xml file
43
+	protected $manifestXml; // To store content of META-INF/manifest.xml file
44 44
 	protected $tmpfile;
45
-	protected $tmpdir='';
45
+	protected $tmpdir = '';
46 46
 	protected $images = array();
47 47
 	protected $vars = array();
48 48
 	protected $segments = array();
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	public $creator;
51 51
 	public $title;
52 52
 	public $subject;
53
-	public $userdefined=array();
53
+	public $userdefined = array();
54 54
 
55 55
 	const PIXEL_TO_CM = 0.026458333;
56 56
 	const FIND_TAGS_REGEX = '/<([A-Za-z0-9]+)(?:\s([A-Za-z]+(?:\-[A-Za-z]+)?(?:=(?:".*?")|(?:[0-9]+))))*(?:(?:\s\/>)|(?:>(.*)<\/\1>))/s';
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	{
69 69
 		clearstatcache();
70 70
 
71
-		if (! is_array($config)) {
71
+		if (!is_array($config)) {
72 72
 			throw new OdfException('Configuration data must be provided as array');
73 73
 		}
74 74
 		foreach ($config as $configKey => $configValue) {
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 		}
79 79
 
80 80
 		$md5uniqid = md5(uniqid());
81
-		if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']);	// Remove last \ or /
82
-		$this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid;
83
-		$this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt';	// We keep .odt extension to allow OpenOffice usage during debug.
81
+		if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']); // Remove last \ or /
82
+		$this->tmpdir .= ($this->tmpdir ? '/' : '').$md5uniqid;
83
+		$this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt'; // We keep .odt extension to allow OpenOffice usage during debug.
84 84
 
85 85
 		// A working directory is required for some zip proxy like PclZipProxy
86
-		if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && ! is_dir($this->config['PATH_TO_TMP'])) {
86
+		if (in_array($this->config['ZIP_PROXY'], array('PclZipProxy')) && !is_dir($this->config['PATH_TO_TMP'])) {
87 87
 			throw new OdfException('Temporary directory '.$this->config['PATH_TO_TMP'].' must exists');
88 88
 		}
89 89
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 		$zipHandler = $this->config['ZIP_PROXY'];
97 97
 		if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir);
98 98
 		include_once 'zip/'.$zipHandler.'.php';
99
-		if (! class_exists($this->config['ZIP_PROXY'])) {
100
-			throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings');
99
+		if (!class_exists($this->config['ZIP_PROXY'])) {
100
+			throw new OdfException($this->config['ZIP_PROXY'].' class not found - check your php settings');
101 101
 		}
102 102
 		$this->file = new $zipHandler($this->tmpdir);
103 103
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
146 146
 	{
147
-		$tag = $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT'];
147
+		$tag = $this->config['DELIMITER_LEFT'].$key.$this->config['DELIMITER_RIGHT'];
148 148
 
149 149
 		// TODO Warning string may be:
150 150
 		// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
 		// Check if the value includes html tags
181 181
 		if ($this->_hasHtmlTag($value) === true) {
182
-			$value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>');	// remove html tags except the one into the list in second parameter
182
+			$value = strip_tags($value, '<br><strong><b><i><em><u><s><sub><sup><span>'); // remove html tags except the one into the list in second parameter
183 183
 
184 184
 			// Default styles for strong/b, i/em, u, s, sub & sup
185 185
 			$automaticStyles = array(
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			$convertedValue = $this->_replaceHtmlWithOdtTag($this->_getDataFromHtml($value), $customStyles, $fontDeclarations, $encode, $charset);
198 198
 
199 199
 			foreach ($customStyles as $key => $val) {
200
-				array_push($automaticStyles, '<style:style style:name="customStyle' . $key . '" style:family="text">' . $val . '</style:style>');
200
+				array_push($automaticStyles, '<style:style style:name="customStyle'.$key.'" style:family="text">'.$val.'</style:style>');
201 201
 			}
202 202
 
203 203
 			// Join the styles and add them to the content xml
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
 					$styles .= $style;
208 208
 				}
209 209
 			}
210
-			$this->contentXml = str_replace('</office:automatic-styles>', $styles . '</office:automatic-styles>', $this->contentXml);
210
+			$this->contentXml = str_replace('</office:automatic-styles>', $styles.'</office:automatic-styles>', $this->contentXml);
211 211
 
212 212
 			// Join the font declarations and add them to the content xml
213 213
 			$fonts = '';
214 214
 			foreach ($fontDeclarations as $font) {
215
-				if (strpos($this->contentXml, 'style:name="' . $font . '"') === false) {
216
-					$fonts .= '<style:font-face style:name="' . $font . '" svg:font-family="\'' . $font . '\'" />';
215
+				if (strpos($this->contentXml, 'style:name="'.$font.'"') === false) {
216
+					$fonts .= '<style:font-face style:name="'.$font.'" svg:font-family="\''.$font.'\'" />';
217 217
 				}
218 218
 			}
219
-			$this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml);
219
+			$this->contentXml = str_replace('</office:font-face-decls>', $fonts.'</office:font-face-decls>', $this->contentXml);
220 220
 		} else {
221 221
 			$convertedValue = $this->encode_chars($convertedValue, $encode, $charset);
222 222
 			$convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $convertedValue);
@@ -253,23 +253,23 @@  discard block
 block discarded – undo
253 253
 						break;
254 254
 					case 'strong':
255 255
 					case 'b':
256
-						$odtResult .= '<text:span text:style-name="boldText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
256
+						$odtResult .= '<text:span text:style-name="boldText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
257 257
 						break;
258 258
 					case 'i':
259 259
 					case 'em':
260
-						$odtResult .= '<text:span text:style-name="italicText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
260
+						$odtResult .= '<text:span text:style-name="italicText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
261 261
 						break;
262 262
 					case 'u':
263
-						$odtResult .= '<text:span text:style-name="underlineText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
263
+						$odtResult .= '<text:span text:style-name="underlineText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
264 264
 						break;
265 265
 					case 's':
266
-						$odtResult .= '<text:span text:style-name="strikethroughText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
266
+						$odtResult .= '<text:span text:style-name="strikethroughText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
267 267
 						break;
268 268
 					case 'sub':
269
-						$odtResult .= '<text:span text:style-name="subText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
269
+						$odtResult .= '<text:span text:style-name="subText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
270 270
 						break;
271 271
 					case 'sup':
272
-						$odtResult .= '<text:span text:style-name="supText">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
272
+						$odtResult .= '<text:span text:style-name="supText">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
273 273
 						break;
274 274
 					case 'span':
275 275
 						if (isset($tag['attributes']['style'])) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 										if (!in_array($fontName, $fontDeclarations)) {
285 285
 											array_push($fontDeclarations, $fontName);
286 286
 										}
287
-										$odtStyles .= '<style:text-properties style:font-name="' . $fontName . '" />';
287
+										$odtStyles .= '<style:text-properties style:font-name="'.$fontName.'" />';
288 288
 										break;
289 289
 									case 'font-size':
290 290
 										if (preg_match('/([0-9]+)\s?(px|pt)/', $styleValue, $matches)) {
@@ -292,21 +292,21 @@  discard block
 block discarded – undo
292 292
 											if ($matches[2] == 'px') {
293 293
 												$fontSize = round($fontSize * 0.75);
294 294
 											}
295
-											$odtStyles .= '<style:text-properties fo:font-size="' . $fontSize . 'pt" style:font-size-asian="' . $fontSize . 'pt" style:font-size-complex="' . $fontSize . 'pt" />';
295
+											$odtStyles .= '<style:text-properties fo:font-size="'.$fontSize.'pt" style:font-size-asian="'.$fontSize.'pt" style:font-size-complex="'.$fontSize.'pt" />';
296 296
 										}
297 297
 										break;
298 298
 									case 'color':
299 299
 										if (preg_match('/#[0-9A-Fa-f]{3}(?:[0-9A-Fa-f]{3})?/', $styleValue)) {
300
-											$odtStyles .= '<style:text-properties fo:color="' . $styleValue . '" />';
300
+											$odtStyles .= '<style:text-properties fo:color="'.$styleValue.'" />';
301 301
 										}
302 302
 										break;
303 303
 								}
304 304
 							}
305 305
 							if (strlen($odtStyles) > 0) {
306 306
 								// Generate a unique id for the style (using microtime and random because some CPUs are really fast...)
307
-								$key = str_replace('.', '', (string) microtime(true)) . uniqid(mt_rand());
307
+								$key = str_replace('.', '', (string) microtime(true)).uniqid(mt_rand());
308 308
 								$customStyles[$key] = $odtStyles;
309
-								$odtResult .= '<text:span text:style-name="customStyle' . $key . '">' . ($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)) . '</text:span>';
309
+								$odtResult .= '<text:span text:style-name="customStyle'.$key.'">'.($tag['children'] != null ? $this->_replaceHtmlWithOdtTag($tag['children'], $customStyles, $fontDeclarations, $encode) : $this->encode_chars($tag['innerText'], $encode, $charset)).'</text:span>';
310 310
 							}
311 311
 						}
312 312
 						break;
@@ -443,24 +443,24 @@  discard block
 block discarded – undo
443 443
 	public function htmlToUTFAndPreOdf($value)
444 444
 	{
445 445
 		// We decode into utf8, entities
446
-		$value=dol_html_entity_decode($value, ENT_QUOTES|ENT_HTML5);
446
+		$value = dol_html_entity_decode($value, ENT_QUOTES | ENT_HTML5);
447 447
 
448 448
 		// We convert html tags
449
-		$ishtml=dol_textishtml($value);
449
+		$ishtml = dol_textishtml($value);
450 450
 		if ($ishtml) {
451 451
 			// If string is "MYPODUCT - Desc <strong>bold</strong> with &eacute; accent<br />\n<br />\nUn texto en espa&ntilde;ol ?"
452 452
 			// Result after clean must be "MYPODUCT - Desc bold with é accent\n\nUn texto en espa&ntilde;ol ?"
453 453
 
454 454
 			// We want to ignore \n and we want all <br> to be \n
455
-			$value=preg_replace('/(\r\n|\r|\n)/i', '', $value);
456
-			$value=preg_replace('/<br>/i', "\n", $value);
457
-			$value=preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value);
458
-			$value=preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value);
455
+			$value = preg_replace('/(\r\n|\r|\n)/i', '', $value);
456
+			$value = preg_replace('/<br>/i', "\n", $value);
457
+			$value = preg_replace('/<br\s+[^<>\/]*>/i', "\n", $value);
458
+			$value = preg_replace('/<br\s+[^<>\/]*\/>/i', "\n", $value);
459 459
 
460 460
 			//$value=preg_replace('/<strong>/','__lt__text:p text:style-name=__quot__bold__quot____gt__',$value);
461 461
 			//$value=preg_replace('/<\/strong>/','__lt__/text:p__gt__',$value);
462 462
 
463
-			$value=dol_string_nohtmltag($value, 0);
463
+			$value = dol_string_nohtmltag($value, 0);
464 464
 		}
465 465
 
466 466
 		return $value;
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
 				$balise = str_replace('row.', '', $matches2[1]);
537 537
 				// Move segment tags around the row
538 538
 				$replace = array(
539
-					'[!-- BEGIN ' . $matches2[1] . ' --]'	=> '',
540
-					'[!-- END ' . $matches2[1] . ' --]'		=> '',
541
-					'<table:table-row'							=> '[!-- BEGIN ' . $balise . ' --]<table:table-row',
542
-					'</table:table-row>'						=> '</table:table-row>[!-- END ' . $balise . ' --]'
539
+					'[!-- BEGIN '.$matches2[1].' --]'	=> '',
540
+					'[!-- END '.$matches2[1].' --]'		=> '',
541
+					'<table:table-row'							=> '[!-- BEGIN '.$balise.' --]<table:table-row',
542
+					'</table:table-row>'						=> '</table:table-row>[!-- END '.$balise.' --]'
543 543
 				);
544 544
 				$replacedXML = str_replace(array_keys($replace), array_values($replace), $matches[0][$i]);
545 545
 				$this->contentXml = str_replace($matches[0][$i], $replacedXML, $this->contentXml);
@@ -562,14 +562,14 @@  discard block
 block discarded – undo
562 562
 		else return;
563 563
 
564 564
 		// Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined
565
-		$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
565
+		$reg = '@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
566 566
 		$matches = array();
567 567
 		preg_match_all($reg, $xml, $matches, PREG_SET_ORDER);
568 568
 
569 569
 		//var_dump($this->vars);exit;
570 570
 		foreach ($matches as $match) {   // For each match, if there is no entry into this->vars, we add it
571
-			if (! empty($match[1]) && ! isset($this->vars[$match[1]])) {
572
-				$this->vars[$match[1]] = '';     // Not defined, so we set it to '', we just need entry into this->vars for next loop
571
+			if (!empty($match[1]) && !isset($this->vars[$match[1]])) {
572
+				$this->vars[$match[1]] = ''; // Not defined, so we set it to '', we just need entry into this->vars for next loop
573 573
 			}
574 574
 		}
575 575
 		//var_dump($this->vars);exit;
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 				// Remove the IF tag
585 585
 				$xml = str_replace('[!-- IF '.$key.' --]', '', $xml);
586 586
 				// Remove everything between the ELSE tag (if it exists) and the ENDIF tag
587
-				$reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
587
+				$reg = '@(\[!--\sELSE\s'.$key.'\s--\](.*))?\[!--\sENDIF\s'.$key.'\s--\]@smU'; // U modifier = all quantifiers are non-greedy
588 588
 				$xml = preg_replace($reg, '', $xml);
589 589
 				/*if ($sav != $xml)
590 590
 				 {
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 				//dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF ");
598 598
 				//$sav=$xml;
599 599
 				// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
600
-				$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
600
+				$reg = '@\[!--\sIF\s'.$key.'\s--\](.*)(\[!--\sELSE\s'.$key.'\s--\](.*))?\[!--\sENDIF\s'.$key.'\s--\]@smU'; // U modifier = all quantifiers are non-greedy
601 601
 				preg_match_all($reg, $xml, $matches, PREG_SET_ORDER);
602 602
 				foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
603 603
 					if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml);
@@ -625,12 +625,12 @@  discard block
 block discarded – undo
625 625
 	 */
626 626
 	public function mergeSegment(Segment $segment)
627 627
 	{
628
-		if (! array_key_exists($segment->getName(), $this->segments)) {
629
-			throw new OdfException($segment->getName() . 'cannot be parsed, has it been set yet ?');
628
+		if (!array_key_exists($segment->getName(), $this->segments)) {
629
+			throw new OdfException($segment->getName().'cannot be parsed, has it been set yet ?');
630 630
 		}
631 631
 		$string = $segment->getName();
632 632
 		// $reg = '@<text:p[^>]*>\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]<\/text:p>@smU';
633
-		$reg = '@\[!--\sBEGIN\s' . $string . '\s--\](.*)\[!--.+END\s' . $string . '\s--\]@smU';
633
+		$reg = '@\[!--\sBEGIN\s'.$string.'\s--\](.*)\[!--.+END\s'.$string.'\s--\]@smU';
634 634
 		$this->contentXml = preg_replace($reg, $segment->getXmlParsed(), $this->contentXml);
635 635
 		return $this;
636 636
 	}
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	 */
643 643
 	public function printVars()
644 644
 	{
645
-		return print_r('<pre>' . print_r($this->vars, true) . '</pre>', true);
645
+		return print_r('<pre>'.print_r($this->vars, true).'</pre>', true);
646 646
 	}
647 647
 
648 648
 	/**
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 */
664 664
 	public function printDeclaredSegments()
665 665
 	{
666
-		return '<pre>' . print_r(implode(' ', array_keys($this->segments)), true) . '</pre>';
666
+		return '<pre>'.print_r(implode(' ', array_keys($this->segments)), true).'</pre>';
667 667
 	}
668 668
 
669 669
 	/**
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	{
700 700
 		if ($file !== null && is_string($file)) {
701 701
 			if (file_exists($file) && !(is_file($file) && is_writable($file))) {
702
-				throw new OdfException('Permission denied : can\'t create ' . $file);
702
+				throw new OdfException('Permission denied : can\'t create '.$file);
703 703
 			}
704 704
 			$this->_save();
705 705
 			copy($this->tmpfile, $file);
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 	 */
717 717
 	private function _save()
718 718
 	{
719
-		$res=$this->file->open($this->tmpfile);    // tmpfile is odt template
719
+		$res = $this->file->open($this->tmpfile); // tmpfile is odt template
720 720
 		$this->_parse('content');
721 721
 		$this->_parse('styles');
722 722
 		$this->_parse('meta');
@@ -724,23 +724,23 @@  discard block
 block discarded – undo
724 724
 		$this->setMetaData();
725 725
 		//print $this->metaXml;exit;
726 726
 
727
-		if (! $this->file->addFromString('content.xml', $this->contentXml)) {
727
+		if (!$this->file->addFromString('content.xml', $this->contentXml)) {
728 728
 			throw new OdfException('Error during file export addFromString content');
729 729
 		}
730
-		if (! $this->file->addFromString('meta.xml', $this->metaXml)) {
730
+		if (!$this->file->addFromString('meta.xml', $this->metaXml)) {
731 731
 			throw new OdfException('Error during file export addFromString meta');
732 732
 		}
733
-		if (! $this->file->addFromString('styles.xml', $this->stylesXml)) {
733
+		if (!$this->file->addFromString('styles.xml', $this->stylesXml)) {
734 734
 			throw new OdfException('Error during file export addFromString styles');
735 735
 		}
736 736
 
737 737
 		foreach ($this->images as $imageKey => $imageValue) {
738 738
 			// Add the image inside the ODT document
739
-			$this->file->addFile($imageKey, 'Pictures/' . $imageValue);
739
+			$this->file->addFile($imageKey, 'Pictures/'.$imageValue);
740 740
 			// Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice)
741 741
 			$this->addImageToManifest($imageValue);
742 742
 		}
743
-		if (! $this->file->addFromString('./META-INF/manifest.xml', $this->manifestXml)) {
743
+		if (!$this->file->addFromString('./META-INF/manifest.xml', $this->manifestXml)) {
744 744
 			throw new OdfException('Error during file export: manifest.xml');
745 745
 		}
746 746
 		$this->file->close();
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	 */
755 755
 	public function setMetaData()
756 756
 	{
757
-		if (empty($this->creator)) $this->creator='';
757
+		if (empty($this->creator)) $this->creator = '';
758 758
 
759 759
 		$this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml);
760 760
 		$this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml);
@@ -800,8 +800,8 @@  discard block
 block discarded – undo
800 800
 			throw new OdfException("headers already sent ($filename at $linenum)");
801 801
 		}
802 802
 
803
-		if ( $name == "" ) {
804
-			$name = md5(uniqid()) . ".odt";
803
+		if ($name == "") {
804
+			$name = md5(uniqid()).".odt";
805 805
 		}
806 806
 
807 807
 		header('Content-type: application/vnd.oasis.opendocument.text');
@@ -822,18 +822,18 @@  discard block
 block discarded – undo
822 822
 	{
823 823
 		global $conf;
824 824
 
825
-		if ( $name == "" ) $name = "temp".md5(uniqid());
825
+		if ($name == "") $name = "temp".md5(uniqid());
826 826
 
827 827
 		dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG);
828 828
 		$this->saveToDisk($name);
829 829
 
830
-		$execmethod=(empty($conf->global->MAIN_EXEC_USE_POPEN)?1:2);	// 1 or 2
830
+		$execmethod = (empty($conf->global->MAIN_EXEC_USE_POPEN) ? 1 : 2); // 1 or 2
831 831
 		// Method 1 sometimes hang the server.
832 832
 
833 833
 
834 834
 		// Export to PDF using LibreOffice
835 835
 		if (getDolGlobalString('MAIN_ODT_AS_PDF') == 'libreoffice') {
836
-			dol_mkdir($conf->user->dir_temp);	// We must be sure the directory exists and is writable
836
+			dol_mkdir($conf->user->dir_temp); // We must be sure the directory exists and is writable
837 837
 
838 838
 			// We delete and recreate a subdir because the soffice may have change pemrissions on it
839 839
 			dol_delete_dir_recursive($conf->user->dir_temp.'/odtaspdf');
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 			// using windows libreoffice that must be in path
844 844
 			// using linux/mac libreoffice that must be in path
845 845
 			// Note PHP Config "fastcgi.impersonate=0" must set to 0 - Default is 1
846
-			$command ='soffice --headless -env:UserInstallation=file:\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '. escapeshellarg(dirname($name)). " ".escapeshellarg($name);
846
+			$command = 'soffice --headless -env:UserInstallation=file:\''.$conf->user->dir_temp.'/odtaspdf\' --convert-to pdf --outdir '.escapeshellarg(dirname($name))." ".escapeshellarg($name);
847 847
 		} elseif (preg_match('/unoconv/', getDolGlobalString('MAIN_ODT_AS_PDF'))) {
848 848
 			// If issue with unoconv, see https://github.com/dagwieers/unoconv/issues/87
849 849
 
@@ -873,13 +873,13 @@  discard block
 block discarded – undo
873 873
 			//$command = '/usr/bin/unoconv -vvv '.escapeshellcmd($name);
874 874
 		} else {
875 875
 			// deprecated old method using odt2pdf.sh (native, jodconverter, ...)
876
-			$tmpname=preg_replace('/\.odt/i', '', $name);
876
+			$tmpname = preg_replace('/\.odt/i', '', $name);
877 877
 
878 878
 			if (getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT')) {
879
-				$command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
879
+				$command = getDolGlobalString('MAIN_DOL_SCRIPTS_ROOT').'/scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF'));
880 880
 			} else {
881 881
 				dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING);
882
-				$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF'))?'jodconverter':getDolGlobalString('MAIN_ODT_AS_PDF'));
882
+				$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($tmpname).' '.(is_numeric(getDolGlobalString('MAIN_ODT_AS_PDF')) ? 'jodconverter' : getDolGlobalString('MAIN_ODT_AS_PDF'));
883 883
 			}
884 884
 		}
885 885
 
@@ -892,14 +892,14 @@  discard block
 block discarded – undo
892 892
 		// $result = $utils->executeCLI($command, $outputfile);  and replace test on $execmethod.
893 893
 		// $retval will be $result['result']
894 894
 		// $errorstring will be $result['output']
895
-		$retval=0; $output_arr=array();
895
+		$retval = 0; $output_arr = array();
896 896
 		if ($execmethod == 1) {
897 897
 			exec($command, $output_arr, $retval);
898 898
 		}
899 899
 		if ($execmethod == 2) {
900 900
 			$outputfile = DOL_DATA_ROOT.'/odt2pdf.log';
901 901
 
902
-			$ok=0;
902
+			$ok = 0;
903 903
 			$handle = fopen($outputfile, 'w');
904 904
 			if ($handle) {
905 905
 				dol_syslog(get_class($this)."Run command ".$command, LOG_DEBUG);
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 				while (!feof($handlein)) {
909 909
 					$read = fgets($handlein);
910 910
 					fwrite($handle, $read);
911
-					$output_arr[]=$read;
911
+					$output_arr[] = $read;
912 912
 				}
913 913
 				pclose($handlein);
914 914
 				fclose($handle);
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 
919 919
 		if ($retval == 0) {
920 920
 			dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG);
921
-			$filename=''; $linenum=0;
921
+			$filename = ''; $linenum = 0;
922 922
 
923 923
 			if (php_sapi_name() != 'cli') {	// If we are in a web context (not into CLI context)
924 924
 				if (headers_sent($filename, $linenum)) {
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 				}
927 927
 
928 928
 				if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
929
-					$name=preg_replace('/\.od(x|t)/i', '', $name);
929
+					$name = preg_replace('/\.od(x|t)/i', '', $name);
930 930
 					header('Content-type: application/pdf');
931 931
 					header('Content-Disposition: attachment; filename="'.$name.'.pdf"');
932 932
 					readfile($name.".pdf");
@@ -941,13 +941,13 @@  discard block
 block discarded – undo
941 941
 			dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG);
942 942
 
943 943
 			if ($retval == 126) {
944
-				throw new OdfException('Permission execute convert script : ' . $command);
944
+				throw new OdfException('Permission execute convert script : '.$command);
945 945
 			} else {
946
-				$errorstring='';
946
+				$errorstring = '';
947 947
 				foreach ($output_arr as $line) {
948
-					$errorstring.= $line."<br>";
948
+					$errorstring .= $line."<br>";
949 949
 				}
950
-				throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : ' . $errorstring);
950
+				throw new OdfException('ODT to PDF convert fail (option MAIN_ODT_AS_PDF is '.$conf->global->MAIN_ODT_AS_PDF.', command was '.$command.', retval='.$retval.') : '.$errorstring);
951 951
 			}
952 952
 		}
953 953
 	}
@@ -1001,11 +1001,11 @@  discard block
 block discarded – undo
1001 1001
 		if ($handle = opendir($dir)) {
1002 1002
 			while (($file = readdir($handle)) !== false) {
1003 1003
 				if ($file != '.' && $file != '..') {
1004
-					if (is_dir($dir . '/' . $file)) {
1005
-						$this->_rrmdir($dir . '/' . $file);
1006
-						rmdir($dir . '/' . $file);
1004
+					if (is_dir($dir.'/'.$file)) {
1005
+						$this->_rrmdir($dir.'/'.$file);
1006
+						rmdir($dir.'/'.$file);
1007 1007
 					} else {
1008
-						unlink($dir . '/' . $file);
1008
+						unlink($dir.'/'.$file);
1009 1009
 					}
1010 1010
 				}
1011 1011
 			}
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	 */
1022 1022
 	public function getvalue($valuename)
1023 1023
 	{
1024
-		$searchreg="/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/";
1024
+		$searchreg = "/\\[".$valuename."\\](.*)\\[\\/".$valuename."\\]/";
1025 1025
 		$matches = array();
1026 1026
 		preg_match($searchreg, $this->contentXml, $matches);
1027 1027
 		$this->contentXml = preg_replace($searchreg, "", $this->contentXml);
Please login to merge, or discard this patch.
Braces   +31 added lines, -11 removed lines patch added patch discarded remove patch
@@ -78,7 +78,10 @@  discard block
 block discarded – undo
78 78
 		}
79 79
 
80 80
 		$md5uniqid = md5(uniqid());
81
-		if ($this->config['PATH_TO_TMP']) $this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']);	// Remove last \ or /
81
+		if ($this->config['PATH_TO_TMP']) {
82
+			$this->tmpdir = preg_replace('|[\/]$|', '', $this->config['PATH_TO_TMP']);
83
+		}
84
+		// Remove last \ or /
82 85
 		$this->tmpdir .= ($this->tmpdir?'/':'').$md5uniqid;
83 86
 		$this->tmpfile = $this->tmpdir.'/'.$md5uniqid.'.odt';	// We keep .odt extension to allow OpenOffice usage during debug.
84 87
 
@@ -94,7 +97,9 @@  discard block
 block discarded – undo
94 97
 
95 98
 		// Load zip proxy
96 99
 		$zipHandler = $this->config['ZIP_PROXY'];
97
-		if (!defined('PCLZIP_TEMPORARY_DIR')) define('PCLZIP_TEMPORARY_DIR', $this->tmpdir);
100
+		if (!defined('PCLZIP_TEMPORARY_DIR')) {
101
+			define('PCLZIP_TEMPORARY_DIR', $this->tmpdir);
102
+		}
98 103
 		include_once 'zip/'.$zipHandler.'.php';
99 104
 		if (! class_exists($this->config['ZIP_PROXY'])) {
100 105
 			throw new OdfException($this->config['ZIP_PROXY'] . ' class not found - check your php settings');
@@ -236,8 +241,12 @@  discard block
 block discarded – undo
236 241
 	 */
237 242
 	private function _replaceHtmlWithOdtTag($tags, &$customStyles, &$fontDeclarations, $encode = false, $charset = '')
238 243
 	{
239
-		if ($customStyles == null) $customStyles = array();
240
-		if ($fontDeclarations == null) $fontDeclarations = array();
244
+		if ($customStyles == null) {
245
+			$customStyles = array();
246
+		}
247
+		if ($fontDeclarations == null) {
248
+			$fontDeclarations = array();
249
+		}
241 250
 
242 251
 		$odtResult = '';
243 252
 
@@ -556,10 +565,15 @@  discard block
 block discarded – undo
556 565
 	 */
557 566
 	private function _parse($type = 'content')
558 567
 	{
559
-		if ($type == 'content') $xml = &$this->contentXml;
560
-		elseif ($type == 'styles') $xml = &$this->stylesXml;
561
-		elseif ($type == 'meta') $xml = &$this->metaXml;
562
-		else return;
568
+		if ($type == 'content') {
569
+			$xml = &$this->contentXml;
570
+		} elseif ($type == 'styles') {
571
+			$xml = &$this->stylesXml;
572
+		} elseif ($type == 'meta') {
573
+			$xml = &$this->metaXml;
574
+		} else {
575
+			return;
576
+		}
563 577
 
564 578
 		// Search all tags found into condition to complete $this->vars, so we will proceed all tests even if not defined
565 579
 		$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
@@ -600,7 +614,9 @@  discard block
 block discarded – undo
600 614
 				$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
601 615
 				preg_match_all($reg, $xml, $matches, PREG_SET_ORDER);
602 616
 				foreach ($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause
603
-					if (!empty($match[3])) $xml = str_replace($match[0], $match[3], $xml);
617
+					if (!empty($match[3])) {
618
+						$xml = str_replace($match[0], $match[3], $xml);
619
+					}
604 620
 				}
605 621
 				// Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether)
606 622
 				$xml = preg_replace($reg, '', $xml);
@@ -754,7 +770,9 @@  discard block
 block discarded – undo
754 770
 	 */
755 771
 	public function setMetaData()
756 772
 	{
757
-		if (empty($this->creator)) $this->creator='';
773
+		if (empty($this->creator)) {
774
+			$this->creator='';
775
+		}
758 776
 
759 777
 		$this->metaXml = preg_replace('/<dc:date>.*<\/dc:date>/', '<dc:date>'.gmdate("Y-m-d\TH:i:s").'</dc:date>', $this->metaXml);
760 778
 		$this->metaXml = preg_replace('/<dc:creator>.*<\/dc:creator>/', '<dc:creator>'.htmlspecialchars($this->creator).'</dc:creator>', $this->metaXml);
@@ -822,7 +840,9 @@  discard block
 block discarded – undo
822 840
 	{
823 841
 		global $conf;
824 842
 
825
-		if ( $name == "" ) $name = "temp".md5(uniqid());
843
+		if ( $name == "" ) {
844
+			$name = "temp".md5(uniqid());
845
+		}
826 846
 
827 847
 		dol_syslog(get_class($this).'::exportAsAttachedPDF $name='.$name, LOG_DEBUG);
828 848
 		$this->saveToDisk($name);
Please login to merge, or discard this patch.
htdocs/product/stock/replenish.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 
31 31
 // Load Dolibarr environment
32 32
 require '../../main.inc.php';
33
-require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
38 38
 require_once './lib/replenishment.lib.php';
39 39
 
40 40
 // Load translation files required by the page
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 $fk_entrepot = GETPOSTINT('fk_entrepot');
69 69
 
70 70
 // List all visible warehouses
71
-$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) . ")");
71
+$resWar = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (".$db->sanitize(getEntity('stock')).")");
72 72
 $listofqualifiedwarehousesid = "";
73 73
 $count = 0;
74 74
 while ($tmpobj = $db->fetch_object($resWar)) {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		$db->begin();
162 162
 
163 163
 		$suppliers = array();
164
-		require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
164
+		require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
165 165
 		$productsupplier = new ProductFournisseur($db);
166 166
 		for ($i = 0; $i < $linecount; $i++) {
167 167
 			if (GETPOST('choose'.$i) === 'on' && GETPOSTINT('fourn'.$i) > 0) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 					dol_print_error($db);
216 216
 				}
217 217
 
218
-				unset($_POST['fourn' . $i]);
218
+				unset($_POST['fourn'.$i]);
219 219
 			}
220 220
 			unset($_POST[$i]);
221 221
 		}
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 			$order = new CommandeFournisseur($db);
230 230
 
231 231
 			// Check if an order for the supplier exists
232
-			$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "commande_fournisseur";
233
-			$sql .= " WHERE fk_soc = " . ((int) $suppliersid[$i]);
234
-			$sql .= " AND source = " . ((int) $order::SOURCE_ID_REPLENISHMENT) . " AND fk_statut = " . ((int) $order::STATUS_DRAFT);
235
-			$sql .= " AND entity IN (" . getEntity('commande_fournisseur') . ")";
232
+			$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur";
233
+			$sql .= " WHERE fk_soc = ".((int) $suppliersid[$i]);
234
+			$sql .= " AND source = ".((int) $order::SOURCE_ID_REPLENISHMENT)." AND fk_statut = ".((int) $order::STATUS_DRAFT);
235
+			$sql .= " AND entity IN (".getEntity('commande_fournisseur').")";
236 236
 			$sql .= " ORDER BY date_creation DESC";
237 237
 			$resql = $db->query($sql);
238 238
 			if ($resql && $db->num_rows($resql) > 0) {
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				}
270 270
 				if ($result < 0) {
271 271
 					$fail++;
272
-					$msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
272
+					$msg = $langs->trans('OrderFail')."&nbsp;:&nbsp;";
273 273
 					$msg .= $order->error;
274 274
 					setEventMessages($msg, null, 'errors');
275 275
 				} else {
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 				$id = $order->create($user);
295 295
 				if ($id < 0) {
296 296
 					$fail++;
297
-					$msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
297
+					$msg = $langs->trans('OrderFail')."&nbsp;:&nbsp;";
298 298
 					$msg .= $order->error;
299 299
 					setEventMessages($msg, null, 'errors');
300 300
 				}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
348 348
 	$sql .= ' pse.desiredstock as desiredstockpse, pse.seuil_stock_alerte as seuil_stock_alertepse,';
349 349
 }
350
-$sql .= " " . $sqldesiredtock . " as desiredstockcombined, " . $sqlalertstock . " as seuil_stock_alertecombined,";
350
+$sql .= " ".$sqldesiredtock." as desiredstockcombined, ".$sqlalertstock." as seuil_stock_alertecombined,";
351 351
 $sql .= ' s.fk_product,';
352 352
 $sql .= " SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique';
353 353
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -361,12 +361,12 @@  discard block
 block discarded – undo
361 361
 
362 362
 $list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid);
363 363
 
364
-$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
365
-$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s ON p.rowid = s.fk_product';
366
-$sql .= ' AND s.fk_entrepot  IN (' . $db->sanitize($list_warehouse) . ')';
364
+$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
365
+$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
366
+$sql .= ' AND s.fk_entrepot  IN ('.$db->sanitize($list_warehouse).')';
367 367
 
368 368
 $list_warehouse_selected = ($fk_entrepot < 0) ? '0' : $fk_entrepot;
369
-$sql .= ' AND s.fk_entrepot  IN (' . $db->sanitize($list_warehouse_selected) . ')';
369
+$sql .= ' AND s.fk_entrepot  IN ('.$db->sanitize($list_warehouse_selected).')';
370 370
 
371 371
 
372 372
 //$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 $reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook
379 379
 $sql .= $hookmanager->resPrint;
380 380
 
381
-$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
381
+$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
382 382
 if ($sall) {
383 383
 	$sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall);
384 384
 }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	$sql .= ' AND p.rowid NOT IN (SELECT pac.fk_product_parent FROM '.MAIN_DB_PREFIX.'product_attribute_combination as pac WHERE pac.entity IN ('.getEntity('product').'))';
402 402
 }
403 403
 if ($fk_supplier > 0) {
404
-	$sql .= ' AND EXISTS (SELECT pfp.rowid FROM ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = ' . ((int) $fk_supplier) . ' AND pfp.entity IN (' . getEntity('product_fournisseur_price') . '))';
404
+	$sql .= ' AND EXISTS (SELECT pfp.rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = '.((int) $fk_supplier).' AND pfp.entity IN ('.getEntity('product_fournisseur_price').'))';
405 405
 }
406 406
 // Add where from hooks
407 407
 $parameters = array();
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
 	}
447 447
 
448 448
 	if (isModEnabled("supplier_order")) {
449
-		$sqlCommandesFourn = "(SELECT " . $db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)") . " as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
450
-		$sqlCommandesFourn .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd3,";
451
-		$sqlCommandesFourn .= " " . MAIN_DB_PREFIX . "commande_fournisseur as c3";
449
+		$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
450
+		$sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,";
451
+		$sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3";
452 452
 		$sqlCommandesFourn .= " WHERE c3.rowid = cd3.fk_commande";
453 453
 		$sqlCommandesFourn .= " AND c3.entity IN (".getEntity(getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")";
454 454
 		$sqlCommandesFourn .= " AND cd3.fk_product = p.rowid";
@@ -487,15 +487,15 @@  discard block
 block discarded – undo
487 487
 	}
488 488
 
489 489
 	$sql .= ' HAVING (';
490
-	$sql .= " (" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')';
491
-	$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))";
490
+	$sql .= " (".$sqldesiredtock." >= 0 AND (".$sqldesiredtock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
491
+	$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume.")))";
492 492
 	$sql .= ' OR';
493 493
 	if ($includeproductswithoutdesiredqty == 'on') {
494
-		$sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
494
+		$sql .= " ((".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
495 495
 	} else {
496
-		$sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')';
496
+		$sql .= " (".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
497 497
 	}
498
-	$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))";
498
+	$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume.")))";
499 499
 	$sql .= ")";
500 500
 	if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
501 501
 		$sql .= " AND (";
@@ -505,22 +505,22 @@  discard block
 block discarded – undo
505 505
 	if ($salert == 'on') {    // Option to see when stock is lower than alert
506 506
 		$sql .= ' AND (';
507 507
 		if ($includeproductswithoutdesiredqty == 'on') {
508
-			$sql .= "(" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
508
+			$sql .= "(".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
509 509
 		} else {
510
-			$sql .= $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
510
+			$sql .= $sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
511 511
 		}
512
-		$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ")  + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . "))";
512
+		$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.")  + (".$sqlProductionToProduce." - ".$sqlProductionToConsume."))";
513 513
 		$sql .= ")";
514 514
 		$alertchecked = 'checked';
515 515
 	}
516 516
 } else {
517 517
 	$sql .= ' HAVING (';
518
-	$sql .= "(" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")))";
518
+	$sql .= "(".$sqldesiredtock." >= 0 AND (".$sqldesiredtock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")))";
519 519
 	$sql .= ' OR';
520 520
 	if ($includeproductswithoutdesiredqty == 'on') {
521
-		$sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')))';
521
+		$sql .= " ((".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
522 522
 	} else {
523
-		$sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')))';
523
+		$sql .= " (".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
524 524
 	}
525 525
 	$sql .= ')';
526 526
 	if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
 	if ($salert == 'on') {    // Option to see when stock is lower than alert
532 532
 		$sql .= " AND (";
533 533
 		if ($includeproductswithoutdesiredqty == 'on') {
534
-			$sql .= " (" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . "))";
534
+			$sql .= " (".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel")."))";
535 535
 		} else {
536
-			$sql .= " " . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . '))';
536
+			$sql .= " ".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").'))';
537 537
 		}
538 538
 		$sql .= ')';
539 539
 		$alertchecked = 'checked';
@@ -575,11 +575,11 @@  discard block
 block discarded – undo
575 575
 
576 576
 $head = array();
577 577
 
578
-$head[0][0] = DOL_URL_ROOT . '/product/stock/replenish.php';
578
+$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
579 579
 $head[0][1] = $title;
580 580
 $head[0][2] = 'replenish';
581 581
 
582
-$head[1][0] = DOL_URL_ROOT . '/product/stock/replenishorders.php';
582
+$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
583 583
 $head[1][1] = $langs->trans("ReplenishmentOrders");
584 584
 $head[1][2] = 'replenishorders';
585 585
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 
589 589
 print dol_get_fiche_head($head, 'replenish', '', -1, '');
590 590
 
591
-print '<span class="opacitymedium">' . $langs->trans("ReplenishmentStatusDesc") . '</span>' . "\n";
591
+print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
592 592
 
593 593
 //$link = '<a title=' .$langs->trans("MenuNewWarehouse"). ' href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("MenuNewWarehouse").'</a>';
594 594
 
@@ -597,39 +597,39 @@  discard block
 block discarded – undo
597 597
 }
598 598
 print '<br><br>';
599 599
 if ($usevirtualstock == 1) {
600
-	print $langs->trans("CurentSelectionMode") . ': ';
601
-	print '<span class="a-mesure">' . $langs->trans("UseVirtualStock") . '</span>';
602
-	print ' <a class="a-mesure-disabled" href="' . $_SERVER["PHP_SELF"] . '?mode=physical' . ($fk_supplier > 0 ? '&fk_supplier=' . $fk_supplier : '') . ($fk_entrepot > 0 ? '&fk_entrepot=' . $fk_entrepot : '') . '">' . $langs->trans("UsePhysicalStock") . '</a>';
600
+	print $langs->trans("CurentSelectionMode").': ';
601
+	print '<span class="a-mesure">'.$langs->trans("UseVirtualStock").'</span>';
602
+	print ' <a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=physical'.($fk_supplier > 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UsePhysicalStock").'</a>';
603 603
 	print '<br>';
604 604
 }
605 605
 if ($usevirtualstock == 0) {
606
-	print $langs->trans("CurentSelectionMode") . ': ';
607
-	print '<a class="a-mesure-disabled" href="' . $_SERVER["PHP_SELF"] . '?mode=virtual' . ($fk_supplier > 0 ? '&fk_supplier=' . $fk_supplier : '') . ($fk_entrepot > 0 ? '&fk_entrepot=' . $fk_entrepot : '') . '">' . $langs->trans("UseVirtualStock") . '</a>';
608
-	print ' <span class="a-mesure">' . $langs->trans("UsePhysicalStock") . '</span>';
606
+	print $langs->trans("CurentSelectionMode").': ';
607
+	print '<a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=virtual'.($fk_supplier > 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UseVirtualStock").'</a>';
608
+	print ' <span class="a-mesure">'.$langs->trans("UsePhysicalStock").'</span>';
609 609
 	print '<br>';
610 610
 }
611
-print '<br>' . "\n";
611
+print '<br>'."\n";
612 612
 
613
-print '<form name="formFilterWarehouse" method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
614
-print '<input type="hidden" name="token" value="' . newToken() . '">';
613
+print '<form name="formFilterWarehouse" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
614
+print '<input type="hidden" name="token" value="'.newToken().'">';
615 615
 print '<input type="hidden" name="action" value="filter">';
616
-print '<input type="hidden" name="search_ref" value="' . $search_ref . '">';
617
-print '<input type="hidden" name="search_label" value="' . $search_label . '">';
618
-print '<input type="hidden" name="salert" value="' . $salert . '">';
619
-print '<input type="hidden" name="includeproductswithoutdesiredqty" value="' . $includeproductswithoutdesiredqty . '">';
620
-print '<input type="hidden" name="draftorder" value="' . $draftorder . '">';
621
-print '<input type="hidden" name="mode" value="' . $mode . '">';
616
+print '<input type="hidden" name="search_ref" value="'.$search_ref.'">';
617
+print '<input type="hidden" name="search_label" value="'.$search_label.'">';
618
+print '<input type="hidden" name="salert" value="'.$salert.'">';
619
+print '<input type="hidden" name="includeproductswithoutdesiredqty" value="'.$includeproductswithoutdesiredqty.'">';
620
+print '<input type="hidden" name="draftorder" value="'.$draftorder.'">';
621
+print '<input type="hidden" name="mode" value="'.$mode.'">';
622 622
 if ($limit > 0 && $limit != $conf->liste_limit) {
623
-	print '<input type="hidden" name="limit" value="' . $limit . '">';
623
+	print '<input type="hidden" name="limit" value="'.$limit.'">';
624 624
 }
625 625
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE')) {
626 626
 	print '<div class="inline-block valignmiddle" style="padding-right: 20px;">';
627
-	print $langs->trans('Warehouse') . ' ' . $formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1);
627
+	print $langs->trans('Warehouse').' '.$formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1);
628 628
 	print '</div>';
629 629
 }
630 630
 print '<div class="inline-block valignmiddle" style="padding-right: 20px;">';
631 631
 $filter = '(fournisseur:=:1)';
632
-print $langs->trans('Supplier') . ' ' . $form->select_company($fk_supplier, 'fk_supplier', $filter, 1);
632
+print $langs->trans('Supplier').' '.$form->select_company($fk_supplier, 'fk_supplier', $filter, 1);
633 633
 print '</div>';
634 634
 
635 635
 $parameters = array();
@@ -639,29 +639,29 @@  discard block
 block discarded – undo
639 639
 }
640 640
 
641 641
 print '<div class="inline-block valignmiddle">';
642
-print '<input type="submit" class="button smallpaddingimp" name="valid" value="' . $langs->trans('ToFilter') . '">';
642
+print '<input type="submit" class="button smallpaddingimp" name="valid" value="'.$langs->trans('ToFilter').'">';
643 643
 print '</div>';
644 644
 
645 645
 print '</form>';
646 646
 
647
-print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formulaire">';
648
-print '<input type="hidden" name="token" value="' . newToken() . '">';
649
-print '<input type="hidden" name="fk_supplier" value="' . $fk_supplier . '">';
650
-print '<input type="hidden" name="fk_entrepot" value="' . $fk_entrepot . '">';
651
-print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
652
-print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
653
-print '<input type="hidden" name="type" value="' . $type . '">';
654
-print '<input type="hidden" name="linecount" value="' . $num . '">';
647
+print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">';
648
+print '<input type="hidden" name="token" value="'.newToken().'">';
649
+print '<input type="hidden" name="fk_supplier" value="'.$fk_supplier.'">';
650
+print '<input type="hidden" name="fk_entrepot" value="'.$fk_entrepot.'">';
651
+print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
652
+print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
653
+print '<input type="hidden" name="type" value="'.$type.'">';
654
+print '<input type="hidden" name="linecount" value="'.$num.'">';
655 655
 print '<input type="hidden" name="action" value="order">';
656
-print '<input type="hidden" name="mode" value="' . $mode . '">';
656
+print '<input type="hidden" name="mode" value="'.$mode.'">';
657 657
 
658 658
 
659 659
 if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) {
660
-	$filters = '&search_ref=' . urlencode($search_ref) . '&search_label=' . urlencode($search_label);
661
-	$filters .= '&sall=' . urlencode($sall);
662
-	$filters .= '&salert=' . urlencode($salert);
663
-	$filters .= '&draftorder=' . urlencode($draftorder);
664
-	$filters .= '&mode=' . urlencode($mode);
660
+	$filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label);
661
+	$filters .= '&sall='.urlencode($sall);
662
+	$filters .= '&salert='.urlencode($salert);
663
+	$filters .= '&draftorder='.urlencode($draftorder);
664
+	$filters .= '&mode='.urlencode($mode);
665 665
 	if ($fk_supplier > 0) {
666 666
 		$filters .= '&fk_supplier='.urlencode((string) ($fk_supplier));
667 667
 	}
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 	}
684 684
 }
685 685
 if ($limit > 0 && $limit != $conf->liste_limit) {
686
-	$filters .= '&limit=' . ((int) $limit);
686
+	$filters .= '&limit='.((int) $limit);
687 687
 }
688 688
 if (!empty($includeproductswithoutdesiredqty)) {
689 689
 	$filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
@@ -763,12 +763,12 @@  discard block
 block discarded – undo
763 763
 // Fields title search
764 764
 print '<tr class="liste_titre_filter">';
765 765
 print '<td class="liste_titre">&nbsp;</td>';
766
-print '<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="' . dol_escape_htmltag($search_ref) . '"></td>';
767
-print '<td class="liste_titre"><input class="flat" type="text" name="search_label" size="8" value="' . dol_escape_htmltag($search_label) . '"></td>';
766
+print '<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'"></td>';
767
+print '<td class="liste_titre"><input class="flat" type="text" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).'"></td>';
768 768
 if (isModEnabled("service") && $type == 1) {
769 769
 	print '<td class="liste_titre">&nbsp;</td>';
770 770
 }
771
-print '<td class="liste_titre right">' . $form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')) . '&nbsp;<input type="checkbox" id="includeproductswithoutdesiredqty" name="includeproductswithoutdesiredqty" ' . (!empty($includeproductswithoutdesiredqtychecked) ? $includeproductswithoutdesiredqtychecked : '') . '></td>';
771
+print '<td class="liste_titre right">'.$form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')).'&nbsp;<input type="checkbox" id="includeproductswithoutdesiredqty" name="includeproductswithoutdesiredqty" '.(!empty($includeproductswithoutdesiredqtychecked) ? $includeproductswithoutdesiredqtychecked : '').'></td>';
772 772
 print '<td class="liste_titre right"></td>';
773 773
 print '<td class="liste_titre right">'.$langs->trans('AlertOnly').'&nbsp;<input type="checkbox" id="salert" name="salert" '.(!empty($alertchecked) ? $alertchecked : '').'></td>';
774 774
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -831,9 +831,9 @@  discard block
 block discarded – undo
831 831
 		// Multilangs
832 832
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
833 833
 			$sql = 'SELECT label,description';
834
-			$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product_lang';
835
-			$sql .= ' WHERE fk_product = ' . ((int) $objp->rowid);
836
-			$sql .= " AND lang = '" . $db->escape($langs->getDefaultLang()) . "'";
834
+			$sql .= ' FROM '.MAIN_DB_PREFIX.'product_lang';
835
+			$sql .= ' WHERE fk_product = '.((int) $objp->rowid);
836
+			$sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
837 837
 			$sql .= ' LIMIT 1';
838 838
 
839 839
 			$resqlm = $db->query($sql);
@@ -885,11 +885,11 @@  discard block
 block discarded – undo
885 885
 
886 886
 		$warning = '';
887 887
 		if ($alertstock && ($stock < $alertstock)) {
888
-			$warning = img_warning($langs->trans('StockTooLow')) . ' ';
888
+			$warning = img_warning($langs->trans('StockTooLow')).' ';
889 889
 		}
890 890
 		$warningwarehouse = '';
891 891
 		if ($alertstockwarehouse && ($stockwarehouse < $alertstockwarehouse)) {
892
-			$warningwarehouse = img_warning($langs->trans('StockTooLow')) . ' ';
892
+			$warningwarehouse = img_warning($langs->trans('StockTooLow')).' ';
893 893
 		}
894 894
 
895 895
 		//depending on conf, use either physical stock or
@@ -922,27 +922,27 @@  discard block
 block discarded – undo
922 922
 		print '<tr class="oddeven">';
923 923
 
924 924
 		// Select field
925
-		print '<td><input type="checkbox" class="check" name="choose' . $i . '"></td>';
925
+		print '<td><input type="checkbox" class="check" name="choose'.$i.'"></td>';
926 926
 
927
-		print '<td class="nowrap">' . $prod->getNomUrl(1, 'stock') . '</td>';
927
+		print '<td class="nowrap">'.$prod->getNomUrl(1, 'stock').'</td>';
928 928
 
929
-		print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag($objp->label) . '">';
929
+		print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->label).'">';
930 930
 		print dol_escape_htmltag($objp->label);
931
-		print '<input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp->description) . '">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
931
+		print '<input type="hidden" name="desc'.$i.'" value="'.dol_escape_htmltag($objp->description).'">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
932 932
 		print '</td>';
933 933
 
934 934
 		if (isModEnabled("service") && $type == 1) {
935 935
 			$regs = array();
936 936
 			if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
937
-				$duration = $regs[1] . ' ' . $langs->trans('DurationYear');
937
+				$duration = $regs[1].' '.$langs->trans('DurationYear');
938 938
 			} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
939
-				$duration = $regs[1] . ' ' . $langs->trans('DurationMonth');
939
+				$duration = $regs[1].' '.$langs->trans('DurationMonth');
940 940
 			} elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
941
-				$duration = $regs[1] . ' ' . $langs->trans('DurationDay');
941
+				$duration = $regs[1].' '.$langs->trans('DurationDay');
942 942
 			} else {
943 943
 				$duration = $objp->duration;
944 944
 			}
945
-			print '<td class="center">' . $duration . '</td>';
945
+			print '<td class="center">'.$duration.'</td>';
946 946
 		}
947 947
 
948 948
 		// Desired stock
@@ -952,8 +952,8 @@  discard block
 block discarded – undo
952 952
 		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? $alertstockwarehouse : $alertstock).'</td>';
953 953
 
954 954
 		// Current stock (all warehouses)
955
-		print '<td class="right">' . $warning . $stock;
956
-		print '<!-- stock returned by main sql is ' . $objp->stock_physique . ' -->';
955
+		print '<td class="right">'.$warning.$stock;
956
+		print '<!-- stock returned by main sql is '.$objp->stock_physique.' -->';
957 957
 		print '</td>';
958 958
 
959 959
 		// Current stock (warehouse selected only)
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 		}
963 963
 
964 964
 		// Already ordered
965
-		print '<td class="right"><a href="replenishorders.php?search_product=' . $prod->id . '">' . $ordered . '</a> ' . $picto . '</td>';
965
+		print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
966 966
 
967 967
 		// To order
968 968
 		$tobuy = ((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy);
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 
971 971
 		// Supplier
972 972
 		print '<td class="right">';
973
-		print $form->select_product_fourn_price($prod->id, 'fourn' . $i, $fk_supplier);
973
+		print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier);
974 974
 		print '</td>';
975 975
 
976 976
 		// Fields from hook
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 	if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
992 992
 		$colspan++;
993 993
 	}
994
-	print '<tr><td colspan="' . $colspan . '">';
994
+	print '<tr><td colspan="'.$colspan.'">';
995 995
 	print '<span class="opacitymedium">';
996 996
 	print $langs->trans("None");
997 997
 	print '</span>';
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
 
1013 1013
 $value = $langs->trans("CreateOrders");
1014
-print '<div class="center"><input type="submit" class="button" name="valid" value="' . $value . '"></div>';
1014
+print '<div class="center"><input type="submit" class="button" name="valid" value="'.$value.'"></div>';
1015 1015
 
1016 1016
 
1017 1017
 print '</form>';
Please login to merge, or discard this patch.
htdocs/fourn/commande/card.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 $result = restrictedArea($user, 'fournisseur', $object, 'commande_fournisseur', 'commande', 'fk_soc', 'rowid', $isdraft);
140 140
 
141 141
 // Common permissions
142
-$usercanread	= ($user->hasRight("fournisseur", "commande", "lire") || $user->hasRight("supplier_order", "lire"));
142
+$usercanread = ($user->hasRight("fournisseur", "commande", "lire") || $user->hasRight("supplier_order", "lire"));
143 143
 $usercancreate	= ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer"));
144 144
 $usercandelete	= (($user->hasRight("fournisseur", "commande", "supprimer") || $user->hasRight("supplier_order", "supprimer")) || ($usercancreate && isset($object->statut) && $object->statut == $object::STATUS_DRAFT));
145 145
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 $usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight("fournisseur", "supplier_order_advance", "validate")));
148 148
 
149 149
 // Additional area permissions
150
-$usercanapprove			= $user->hasRight("fournisseur", "commande", "approuver");
151
-$usercanapprovesecond	= $user->hasRight("fournisseur", "commande", "approve2");
152
-$usercanorder			= $user->hasRight("fournisseur", "commande", "commander");
150
+$usercanapprove = $user->hasRight("fournisseur", "commande", "approuver");
151
+$usercanapprovesecond = $user->hasRight("fournisseur", "commande", "approve2");
152
+$usercanorder = $user->hasRight("fournisseur", "commande", "commander");
153 153
 if (empty($conf->reception->enabled)) {
154 154
 	$usercanreceive = $user->hasRight("fournisseur", "commande", "receptionner");
155 155
 } else {
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 
159 159
 // Permissions for includes
160 160
 $permissionnote		= $usercancreate; // Used by the include of actions_setnotes.inc.php
161
-$permissiondellink	= $usercancreate; // Used by the include of actions_dellink.inc.php
162
-$permissiontoedit	= $usercancreate; // Used by the include of actions_lineupdown.inc.php
161
+$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
162
+$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
163 163
 $permissiontoadd	= $usercancreate; // Used by the include of actions_addupdatedelete.inc.php
164 164
 
165 165
 // Project permission
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 			$idprod = GETPOSTINT('idprod');
438 438
 		}
439 439
 
440
-		$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);		// Can be '1.2' or '1.2 (CODE)'
440
+		$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)'
441 441
 
442 442
 		$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
443 443
 		$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 			$object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
1241 1241
 			$object->fk_account        = GETPOSTINT('fk_account');
1242 1242
 			$object->note_private = GETPOST('note_private', 'restricthtml');
1243
-			$object->note_public   	= GETPOST('note_public', 'restricthtml');
1243
+			$object->note_public = GETPOST('note_public', 'restricthtml');
1244 1244
 			$object->delivery_date = $datelivraison;
1245 1245
 			$object->fk_incoterms = GETPOSTINT('incoterm_id');
1246 1246
 			$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 			$cond_reglement_id	= (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
1672 1672
 			$mode_reglement_id	= (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
1673 1673
 			$fk_account         = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
1674
-			$availability_id	= (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0));
1674
+			$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0));
1675 1675
 			$shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0));
1676 1676
 			$demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
1677 1677
 			//$remise_percent		= (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0));
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 		// Payment term
1793 1793
 		print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
1794 1794
 		print img_picto('', 'payment', 'class="pictofixedwidth"');
1795
-		print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') &&  GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1);
1795
+		print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1);
1796 1796
 		print '</td></tr>';
1797 1797
 
1798 1798
 		// Payment mode
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 				'morecss' => 'minwidth300'
2043 2043
 			)
2044 2044
 		);
2045
-		$formconfirm  = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1);
2045
+		$formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1);
2046 2046
 	}
2047 2047
 
2048 2048
 	// Confirmation of cancellation
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
 	$morehtmlref = '<div class="refidno">';
2096 2096
 	// Ref supplier
2097 2097
 	$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
2098
-	$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
2098
+	$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
2099 2099
 	// Thirdparty
2100 2100
 	$morehtmlref .= '<br>';
2101 2101
 	if (getDolGlobalString('MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER') && !empty($usercancreate) && $action == 'edit_thirdparty') {
@@ -2381,40 +2381,40 @@  discard block
 block discarded – undo
2381 2381
 
2382 2382
 		print '<tr>';
2383 2383
 		// Amount HT
2384
-		print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
2385
-		print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
2384
+		print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
2385
+		print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
2386 2386
 		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2387 2387
 			// Multicurrency Amount HT
2388
-			print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2388
+			print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2389 2389
 		}
2390 2390
 		print '</tr>';
2391 2391
 
2392 2392
 		print '<tr>';
2393 2393
 		// Amount VAT
2394
-		print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>';
2395
-		print '<td class="nowrap amountcard right">' . price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
2394
+		print '<td class="titlefieldmiddle">'.$langs->trans('AmountVAT').'</td>';
2395
+		print '<td class="nowrap amountcard right">'.price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
2396 2396
 		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2397 2397
 			// Multicurrency Amount VAT
2398
-			print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2398
+			print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2399 2399
 		}
2400 2400
 		print '</tr>';
2401 2401
 
2402 2402
 		// Amount Local Taxes
2403 2403
 		if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) {
2404 2404
 			print '<tr>';
2405
-			print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
2406
-			print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
2405
+			print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
2406
+			print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
2407 2407
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2408
-				print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2408
+				print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2409 2409
 			}
2410 2410
 			print '</tr>';
2411 2411
 
2412 2412
 			if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
2413 2413
 				print '<tr>';
2414
-				print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
2415
-				print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
2414
+				print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
2415
+				print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
2416 2416
 				if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2417
-					print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2417
+					print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2418 2418
 				}
2419 2419
 				print '</tr>';
2420 2420
 			}
@@ -2422,16 +2422,16 @@  discard block
 block discarded – undo
2422 2422
 
2423 2423
 		$alert = '';
2424 2424
 		if (getDolGlobalString('ORDER_MANAGE_MIN_AMOUNT') && $object->total_ht < $object->thirdparty->supplier_order_min_amount) {
2425
-			$alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->supplier_order_min_amount));
2425
+			$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->supplier_order_min_amount));
2426 2426
 		}
2427 2427
 
2428 2428
 		print '<tr>';
2429 2429
 		// Amount TTC
2430
-		print '<td>' . $langs->trans('AmountTTC') . '</td>';
2431
-		print '<td class="nowrap amountcard right">' . price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . $alert . '</td>';
2430
+		print '<td>'.$langs->trans('AmountTTC').'</td>';
2431
+		print '<td class="nowrap amountcard right">'.price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency).$alert.'</td>';
2432 2432
 		if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
2433 2433
 			// Multicurrency Amount TTC
2434
-			print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
2434
+			print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
2435 2435
 		}
2436 2436
 		print '</tr>';
2437 2437
 
Please login to merge, or discard this patch.
htdocs/takepos/invoice.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 
173 173
 $parameters = array();
174
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
174
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks
175 175
 if ($reshook < 0) {
176 176
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
177 177
 }
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 			$bankaccount = GETPOSTINT('accountid');
187 187
 		} else {
188 188
 			if ($pay == 'LIQ') {
189
-				$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]);            // For backward compatibility
189
+				$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility
190 190
 			} elseif ($pay == "CHQ") {
191
-				$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]);    // For backward compatibility
191
+				$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility
192 192
 			} else {
193 193
 				$accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"];
194 194
 				$bankaccount = getDolGlobalInt($accountname);
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 			$savconst = getDolGlobalString('STOCK_CALCULATE_ON_BILL');
250 250
 
251 251
 			if (isModEnabled('productbatch') && !getDolGlobalInt('CASHDESK_FORCE_DECREASE_STOCK')) {
252
-				$conf->global->STOCK_CALCULATE_ON_BILL = 0;	// To not change the stock (not yet compatible with batch management)
252
+				$conf->global->STOCK_CALCULATE_ON_BILL = 0; // To not change the stock (not yet compatible with batch management)
253 253
 			} else {
254
-				$conf->global->STOCK_CALCULATE_ON_BILL = 1;	// To force the change of stock
254
+				$conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock
255 255
 			}
256 256
 
257 257
 			$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		}
330 330
 		// Update stock for batch products
331 331
 		if (isModEnabled('productbatch')) {
332
-			require_once DOL_DOCUMENT_ROOT . "/product/stock/class/mouvementstock.class.php";
332
+			require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
333 333
 			$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
334 334
 			foreach ($invoice->lines as $line) {
335 335
 				if ($line->batch && $line->fk_warehouse > 0) {
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		$creditnote->socid = $invoice->socid;
352 352
 		$creditnote->date = dol_now();
353 353
 		$creditnote->module_source = 'takepos';
354
-		$creditnote->pos_source =  isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
354
+		$creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '';
355 355
 		$creditnote->type = Facture::TYPE_CREDIT_NOTE;
356 356
 		$creditnote->fk_facture_source = $placeid;
357 357
 		//$creditnote->remise_absolue = $invoice->remise_absolue;
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 	// If we add a line and no invoice yet, we create the invoice
503 503
 	if (($action == "addline" || $action == "freezone") && $placeid == 0 && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) {
504 504
 		$invoice->socid = getDolGlobalInt($constforcompanyid);
505
-		$invoice->date = dol_now('tzuserrel');		// We use the local date, only the day will be saved.
505
+		$invoice->date = dol_now('tzuserrel'); // We use the local date, only the day will be saved.
506 506
 		$invoice->module_source = 'takepos';
507
-		$invoice->pos_source =  isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;
507
+		$invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '';
508 508
 		$invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity;
509 509
 
510 510
 		if ($invoice->socid <= 0) {
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 
682 682
 			// complete line by hook
683 683
 			$parameters = array('prod' => $prod, 'line' => $line);
684
-			$reshook = $hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action);    // Note that $action and $line may have been modified by some hooks
684
+			$reshook = $hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks
685 685
 			if ($reshook < 0) {
686 686
 				setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
687 687
 			}
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 					}
876 876
 					if (!$permissiontoupdateline) {
877 877
 						dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateprice', null, 1);
878
-					} elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT')  == 1) {
878
+					} elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) {
879 879
 						$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
880 880
 					} else {
881 881
 						$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 		$sectionwithinvoicelink .= '</span><br>';
1087 1087
 		if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) {
1088
-			$sectionwithinvoicelink .= ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>';
1088
+			$sectionwithinvoicelink .= ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>';
1089 1089
 		} elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
1090 1090
 			if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) {
1091 1091
 				$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.')">'.$langs->trans('PrintTicket').'</button>';
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
1125 1125
 	$title = 'TakePOS - Dolibarr '.DOL_VERSION;
1126 1126
 	if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
1127
-		$title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE');
1127
+		$title = 'TakePOS - '.getDolGlobalString('MAIN_APPLICATION_TITLE');
1128 1128
 	}
1129 1129
 	$head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
1130 1130
 	<meta name="apple-mobile-web-app-capable" content="yes">
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 			if ($contactid > 0) {
1350 1350
 				$contact = new Contact($db);
1351 1351
 				$contact->fetch($contactid);
1352
-				$s .= " - " . $contact->getFullName($langs);
1352
+				$s .= " - ".$contact->getFullName($langs);
1353 1353
 			}
1354 1354
 		}
1355 1355
 	}
@@ -1410,10 +1410,10 @@  discard block
 block discarded – undo
1410 1410
 	$s = '';
1411 1411
 
1412 1412
 	$idwarehouse = 0;
1413
-	$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
1413
+	$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
1414 1414
 	if (isModEnabled('stock')) {
1415 1415
 		if (getDolGlobalString($constantforkey) != "1") {
1416
-			$constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
1416
+			$constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '');
1417 1417
 			$idwarehouse = getDolGlobalString($constantforkey);
1418 1418
 			if ($idwarehouse > 0) {
1419 1419
 				$s = '<span class="small">';
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 
1562 1562
 // Complete header by hook
1563 1563
 $parameters = array();
1564
-$reshook = $hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1564
+$reshook = $hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks
1565 1565
 if ($reshook < 0) {
1566 1566
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1567 1567
 }
@@ -1575,16 +1575,16 @@  discard block
 block discarded – undo
1575 1575
 	print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
1576 1576
 	if (getDolGlobalString('TAKEPOS_SHOW_HT')) {
1577 1577
 		print '<td class="linecolht right nowraponall">';
1578
-		print '<span class="opacitymedium small">' . $langs->trans('TotalHTShort') . '</span><br>';
1578
+		print '<span class="opacitymedium small">'.$langs->trans('TotalHTShort').'</span><br>';
1579 1579
 		// In phone version only show when it is invoice page
1580 1580
 		if (empty($mobilepage) || $mobilepage == "invoice") {
1581
-			print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . '</span>';
1581
+			print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">'.price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency).'</span>';
1582 1582
 			if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) {
1583 1583
 				//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
1584
-				include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php';
1584
+				include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
1585 1585
 				$multicurrency = new MultiCurrency($db);
1586 1586
 				$multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]);
1587
-				print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">(' . price($invoice->total_ht * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>';
1587
+				print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">('.price($invoice->total_ht * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>';
1588 1588
 			}
1589 1589
 		}
1590 1590
 		print '</td>';
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
 
1728 1728
 				// complete line by hook
1729 1729
 				$parameters = array('line' => $line);
1730
-				$reshook = $hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1730
+				$reshook = $hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks
1731 1731
 				if ($reshook < 0) {
1732 1732
 					setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1733 1733
 				}
@@ -1776,7 +1776,7 @@  discard block
 block discarded – undo
1776 1776
 					}
1777 1777
 				}
1778 1778
 				if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) {
1779
-					$htmlforlines .= $form->textwithpicto($line->product_label ? '<b>' . $line->product_ref . '</b> - ' . $line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext);
1779
+					$htmlforlines .= $form->textwithpicto($line->product_label ? '<b>'.$line->product_ref.'</b> - '.$line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext);
1780 1780
 				} elseif (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) {
1781 1781
 					$htmlforlines .= $form->textwithpicto($line->product_ref ? '<b>'.$line->product_ref.'<b>' : dolGetFirstLineOfText($line->desc, 1), $tooltiptext);
1782 1782
 				} else {
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
 
1824 1824
 				// complete line by hook
1825 1825
 				$parameters = array('line' => $line);
1826
-				$reshook = $hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1826
+				$reshook = $hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks
1827 1827
 				if ($reshook < 0) {
1828 1828
 					setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1829 1829
 				}
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
 if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && !getDolGlobalString('TAKEPOS_NO_CREDITNOTE')) {
1930 1930
 	print '<button id="buttonprint" type="button" onclick="ModalBox(\'ModalCreditNote\')">'.$langs->trans('CreateCreditNote').'</button>';
1931 1931
 	if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) {
1932
-		print ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>';
1932
+		print ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>';
1933 1933
 	}
1934 1934
 }
1935 1935
 
Please login to merge, or discard this patch.
htdocs/core/tpl/objectline_view.tpl.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 	if ($line->fk_product > 0) {
146 146
 		if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
147
-			print (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '') . $text;
147
+			print (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '').$text;
148 148
 		} else {
149 149
 			print $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
150 150
 		}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 			// we need to fetch product associated to line for some test
204 204
 			if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'facture' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') {
205 205
 				$res = $line->fetch_product();
206
-				if ($res  > 0) {
206
+				if ($res > 0) {
207 207
 					if ($line->product->isService() && $line->product->isMandatoryPeriod()) {
208 208
 						print '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSet").'</span></div>';
209 209
 					}
@@ -403,10 +403,10 @@  discard block
 block discarded – undo
403 403
 // Price total without tax
404 404
 if ($line->special_code == 3) {
405 405
 	$coldisplay++;
406
-	$colspanOptions	= '';
406
+	$colspanOptions = '';
407 407
 	if (!empty($conf->multicurrency->enabled) && $object->multicurrency_code != $conf->currency) {
408 408
 		$coldisplay++;
409
-		$colspanOptions	= ' colspan="2"';
409
+		$colspanOptions = ' colspan="2"';
410 410
 	}
411 411
 	print '<td class="linecoloption nowrap right"'.$colspanOptions.'>'.$langs->trans('Option').'</td>';
412 412
 } else {
@@ -449,25 +449,25 @@  discard block
 block discarded – undo
449 449
 			$accountancy_category_asset = getDolGlobalString('ASSET_ACCOUNTANCY_CATEGORY');
450 450
 			$filters = array();
451 451
 			if (!empty($product_static->accountancy_code_buy)) {
452
-				$filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy) . "'";
452
+				$filters[] = "account_number = '".$this->db->escape($product_static->accountancy_code_buy)."'";
453 453
 			}
454 454
 			if (!empty($product_static->accountancy_code_buy_intra)) {
455
-				$filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_intra) . "'";
455
+				$filters[] = "account_number = '".$this->db->escape($product_static->accountancy_code_buy_intra)."'";
456 456
 			}
457 457
 			if (!empty($product_static->accountancy_code_buy_export)) {
458
-				$filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_export) . "'";
458
+				$filters[] = "account_number = '".$this->db->escape($product_static->accountancy_code_buy_export)."'";
459 459
 			}
460 460
 			$sql = "SELECT COUNT(*) AS found";
461
-			$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account";
462
-			$sql .= " WHERE pcg_type = '" . $this->db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY) . "'";
463
-			$sql .= " AND (" . implode(' OR ', $filters). ")";
461
+			$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account";
462
+			$sql .= " WHERE pcg_type = '".$this->db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY)."'";
463
+			$sql .= " AND (".implode(' OR ', $filters).")";
464 464
 			$resql_asset = $this->db->query($sql);
465 465
 			if (!$resql_asset) {
466
-				print 'Error SQL: ' . $this->db->lasterror();
466
+				print 'Error SQL: '.$this->db->lasterror();
467 467
 			} elseif ($obj = $this->db->fetch_object($resql_asset)) {
468 468
 				if (!empty($obj->found)) {
469
-					print '<a class="reposition" href="' . DOL_URL_ROOT . '/asset/card.php?action=create&token='.newToken().'&supplier_invoice_id='.$object->id.'">';
470
-					print img_edit_add() . '</a>';
469
+					print '<a class="reposition" href="'.DOL_URL_ROOT.'/asset/card.php?action=create&token='.newToken().'&supplier_invoice_id='.$object->id.'">';
470
+					print img_edit_add().'</a>';
471 471
 				}
472 472
 			}
473 473
 		}
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 1 patch
Spacing   +1223 added lines, -1223 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) {
123 123
 			if (!empty($perm)) {
124 124
 				$tmp = explode(':', $typeofdata);
125
-				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
125
+				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
126 126
 				if ($fieldrequired) {
127 127
 					$ret .= '<span class="fieldrequired">';
128 128
 				}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 				if ($fieldrequired) {
135 135
 					$ret .= '</span>';
136 136
 				}
137
-				$ret .= '</div>' . "\n";
137
+				$ret .= '</div>'."\n";
138 138
 			} else {
139 139
 				if ($fieldrequired) {
140 140
 					$ret .= '<span class="fieldrequired">';
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 			if (empty($notabletag) && $perm) {
173 173
 				$ret .= '<td class="right">';
174 174
 			}
175
-			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
176
-				$ret .= '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=edit' . $htmlname . '&token=' . newToken() . '&' . $paramid . '=' . $object->id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '</a>';
175
+			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
176
+				$ret .= '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&token='.newToken().'&'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>';
177 177
 			}
178 178
 			if (!empty($notabletag) && $notabletag == 1) {
179 179
 				if ($text) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			} elseif ($reg[1] == 'int') {
241 241
 				$typeofdata = 'numeric';
242 242
 			} else {
243
-				return 'ErrorBadParameter ' . $typeofdata;
243
+				return 'ErrorBadParameter '.$typeofdata;
244 244
 			}
245 245
 		}
246 246
 
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 			if ($editaction == '') {
252 252
 				$editaction = GETPOST('action', 'aZ09');
253 253
 			}
254
-			$editmode = ($editaction == 'edit' . $htmlname);
254
+			$editmode = ($editaction == 'edit'.$htmlname);
255 255
 			if ($editmode) {	// edit mode
256 256
 				$ret .= "\n";
257
-				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';
258
-				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
259
-				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
260
-				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
257
+				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
258
+				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
259
+				$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
260
+				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
261 261
 				if (empty($notabletag)) {
262 262
 					$ret .= '<table class="nobordernopadding centpercent">';
263 263
 				}
@@ -266,28 +266,28 @@  discard block
 block discarded – undo
266 266
 				}
267 267
 				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) {
268 268
 					$tmp = explode(':', $typeofdata);
269
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
269
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
270 270
 				} elseif (preg_match('/^(integer)/', $typeofdata)) {
271 271
 					$tmp = explode(':', $typeofdata);
272 272
 					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);
273
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
273
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
274 274
 				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
275 275
 					$tmp = explode(':', $typeofdata);
276 276
 					$valuetoshow = price2num($editvalue ? $editvalue : $value);
277
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
277
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
278 278
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
279 279
 					$tmp = explode(':', $typeofdata);
280
-					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
280
+					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';
281 281
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor'
282 282
 					$tmp = explode(':', $typeofdata);
283 283
 					$cols = (empty($tmp[2]) ? '' : $tmp[2]);
284 284
 					$morealt = '';
285 285
 					if (preg_match('/%/', $cols)) {
286
-						$morealt = ' style="width: ' . $cols . '"';
286
+						$morealt = ' style="width: '.$cols.'"';
287 287
 						$cols = '';
288 288
 					}
289 289
 					$valuetoshow = ($editvalue ? $editvalue : $value);
290
-					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';
290
+					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
291 291
 					// textarea convert automatically entities chars into simple chars.
292 292
 					// So we convert & into &amp; so a string like 'a &lt; <b>b</b><br>é<br>&lt;script&gt;alert('X');&lt;script&gt;' stay a correct html and is not converted by textarea component when wysiwig is off.
293 293
 					$valuetoshow = str_replace('&', '&amp;', $valuetoshow);
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
298 298
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
299 299
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
300
-					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
300
+					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
301 301
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
302 302
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
303 303
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
304 304
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
305
-					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
305
+					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
306 306
 				} elseif (preg_match('/^select;/', $typeofdata)) {
307 307
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
308 308
 					$arraylist = array();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 					// TODO Not yet implemented. See code for extrafields
317 317
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
318 318
 					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
319
-					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
319
+					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
320 320
 					$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? '100' : $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? 0 : $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? '20' : $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));
321 321
 					$ret .= $doleditor->Create(1);
322 322
 				} elseif ($typeofdata == 'asis') {
@@ -331,19 +331,19 @@  discard block
 block discarded – undo
331 331
 					$ret .= '<td>';
332 332
 				}
333 333
 				//else $ret.='<div class="clearboth"></div>';
334
-				$ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
334
+				$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
335 335
 				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) {
336
-					$ret .= '<br>' . "\n";
336
+					$ret .= '<br>'."\n";
337 337
 				}
338
-				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
338
+				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
339 339
 				if (empty($notabletag)) {
340 340
 					$ret .= '</td>';
341 341
 				}
342 342
 
343 343
 				if (empty($notabletag)) {
344
-					$ret .= '</tr></table>' . "\n";
344
+					$ret .= '</tr></table>'."\n";
345 345
 				}
346
-				$ret .= '</form>' . "\n";
346
+				$ret .= '</form>'."\n";
347 347
 			} else {		// view mode
348 348
 				if (preg_match('/^email/', $typeofdata)) {
349 349
 					$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
@@ -355,15 +355,15 @@  discard block
 block discarded – undo
355 355
 					$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : '');
356 356
 				} elseif (preg_match('/^checkbox/', $typeofdata)) {
357 357
 					$tmp = explode(':', $typeofdata);
358
-					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
358
+					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';
359 359
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
360 360
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));
361 361
 				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring'
362 362
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));
363 363
 				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
364
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';
364
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';
365 365
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
366
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';
366
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';
367 367
 				} elseif (preg_match('/^select;/', $typeofdata)) {
368 368
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
369 369
 					$arraylist = array();
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 					$ret .= $arraylist[$value];
375 375
 					if ($htmlname == 'fk_product_type') {
376 376
 						if ($value == 0) {
377
-							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
377
+							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
378 378
 						} else {
379
-							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
379
+							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
380 380
 						}
381 381
 					}
382 382
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
385 385
 						$firstline = preg_replace('/<br>.*/', '', $tmpcontent);
386 386
 						$firstline = preg_replace('/[\n\r].*/', '', $firstline);
387
-						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
387
+						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
388 388
 					}
389 389
 					// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also
390 390
 					// clean data from some dangerous html
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 					if (empty($moreoptions['valuealreadyhtmlescaped'])) {
394 394
 						$ret .= dol_escape_htmltag($value);
395 395
 					} else {
396
-						$ret .= $value;        // $value must be already html escaped.
396
+						$ret .= $value; // $value must be already html escaped.
397 397
 					}
398 398
 				}
399 399
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
 		if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
433 433
 			if (!is_object($extralanguages)) {
434
-				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
434
+				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
435 435
 				$extralanguages = new ExtraLanguages($this->db);
436 436
 			}
437 437
 			$extralanguages->fetch_name_extralanguages('societe');
@@ -440,17 +440,17 @@  discard block
 block discarded – undo
440 440
 				return ''; // No extralang field to show
441 441
 			}
442 442
 
443
-			$result .= '<!-- Widget for translation -->' . "\n";
444
-			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';
443
+			$result .= '<!-- Widget for translation -->'."\n";
444
+			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
445 445
 			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang');
446 446
 			$result .= $s;
447 447
 			$result .= '</div>';
448 448
 
449
-			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';
449
+			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
450 450
 
451 451
 			$resultforextrlang = '';
452 452
 			foreach ($arrayoflangcode as $langcode) {
453
-				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : '';
453
+				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
454 454
 				if (empty($valuetoshow)) {
455 455
 					$object->fetchValuesForExtraLanguages();
456 456
 					//var_dump($object->array_languages);
@@ -462,17 +462,17 @@  discard block
 block discarded – undo
462 462
 
463 463
 				// TODO Use the showInputField() method of ExtraLanguages object
464 464
 				if ($typeofdata == 'textarea') {
465
-					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';
465
+					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
466 466
 					$resultforextrlang .= $valuetoshow;
467 467
 					$resultforextrlang .= '</textarea>';
468 468
 				} else {
469
-					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';
469
+					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
470 470
 				}
471 471
 			}
472 472
 			$result .= $resultforextrlang;
473 473
 
474 474
 			$result .= '</div>';
475
-			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>';
475
+			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
476 476
 		}
477 477
 
478 478
 		return $result;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 				if (!empty($tmp[2])) {
536 536
 					$savemethod = $tmp[2];
537 537
 				}
538
-				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
538
+				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
539 539
 			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
540 540
 				$tmp = explode(':', $inputType);
541 541
 				$inputType = $tmp[0];
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 					$savemethod = $tmp[2];
547 547
 				}
548 548
 
549
-				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
549
+				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
550 550
 			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
551 551
 				$tmp = explode(':', $inputType);
552 552
 				$inputType = $tmp[0];
@@ -577,40 +577,40 @@  discard block
 block discarded – undo
577 577
 				}
578 578
 
579 579
 				if (isModEnabled('fckeditor')) {
580
-					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
580
+					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";
581 581
 				} else {
582 582
 					$inputType = 'textarea';
583 583
 				}
584 584
 			}
585 585
 
586
-			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";
587
-			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
588
-			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
589
-			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
586
+			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";
587
+			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";
588
+			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";
589
+			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
590 590
 			if (!empty($savemethod)) {
591
-				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
591
+				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
592 592
 			}
593 593
 			if (!empty($ext_element)) {
594
-				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
594
+				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
595 595
 			}
596 596
 			if (!empty($custommsg)) {
597 597
 				if (is_array($custommsg)) {
598 598
 					if (!empty($custommsg['success'])) {
599
-						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
599
+						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
600 600
 					}
601 601
 					if (!empty($custommsg['error'])) {
602
-						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
602
+						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
603 603
 					}
604 604
 				} else {
605
-					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
605
+					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
606 606
 				}
607 607
 			}
608 608
 			if ($inputType == 'textarea') {
609
-				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
610
-				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";
609
+				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
610
+				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
611 611
 			}
612
-			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";
613
-			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";
612
+			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
613
+			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";
614 614
 		} else {
615 615
 			$out = $value;
616 616
 		}
@@ -639,12 +639,12 @@  discard block
 block discarded – undo
639 639
 	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
640 640
 	{
641 641
 		if ($incbefore) {
642
-			$text = $incbefore . $text;
642
+			$text = $incbefore.$text;
643 643
 		}
644 644
 		if (!$htmltext) {
645 645
 			return $text;
646 646
 		}
647
-		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0
647
+		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
648 648
 
649 649
 		$tag = 'td';
650 650
 		if ($notabs == 2) {
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
 
659 659
 		$extrastyle = '';
660 660
 		if ($direction < 0) {
661
-			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
661
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
662 662
 			$extrastyle = 'padding: 0px; padding-left: 3px;';
663 663
 		}
664 664
 		if ($direction > 0) {
665
-			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
665
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
666 666
 			$extrastyle = 'padding: 0px; padding-right: 3px;';
667 667
 		}
668 668
 
@@ -675,53 +675,53 @@  discard block
 block discarded – undo
675 675
 			$htmltext = str_replace('"', '&quot;', $htmltext);
676 676
 		} else {
677 677
 			$classfortooltip = 'classfortooltiponclick';
678
-			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';
678
+			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
679 679
 		}
680 680
 		if ($tooltipon == 2 || $tooltipon == 3) {
681
-			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
681
+			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
682 682
 			if ($tooltiptrigger == '') {
683
-				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip
683
+				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip
684 684
 			} else {
685
-				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
685
+				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
686 686
 			}
687 687
 		} else {
688
-			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
688
+			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
689 689
 		}
690 690
 		if ($tooltipon == 1 || $tooltipon == 3) {
691
-			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
691
+			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
692 692
 			if ($tooltiptrigger == '') {
693
-				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip
693
+				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip
694 694
 			} else {
695
-				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
695
+				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
696 696
 			}
697 697
 		} else {
698
-			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
698
+			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
699 699
 		}
700 700
 		if (empty($notabs)) {
701 701
 			$s .= '<table class="nobordernopadding"><tr style="height: auto;">';
702 702
 		} elseif ($notabs == 2) {
703
-			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';
703
+			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';
704 704
 		}
705 705
 		// Define value if value is before
706 706
 		if ($direction < 0) {
707
-			$s .= '<' . $tag . $paramfortooltipimg;
707
+			$s .= '<'.$tag.$paramfortooltipimg;
708 708
 			if ($tag == 'td') {
709 709
 				$s .= ' class="valigntop" width="14"';
710 710
 			}
711
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
711
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
712 712
 		}
713 713
 		// Use another method to help avoid having a space in value in order to use this value with jquery
714 714
 		// Define label
715 715
 		if ((string) $text != '') {
716
-			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
716
+			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
717 717
 		}
718 718
 		// Define value if value is after
719 719
 		if ($direction > 0) {
720
-			$s .= '<' . $tag . $paramfortooltipimg;
720
+			$s .= '<'.$tag.$paramfortooltipimg;
721 721
 			if ($tag == 'td') {
722 722
 				$s .= ' class="valignmiddle" width="14"';
723 723
 			}
724
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
724
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
725 725
 		}
726 726
 		if (empty($notabs)) {
727 727
 			$s .= '</tr></table>';
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 
829 829
 		$disabled = 0;
830 830
 		$ret = '<div class="centpercent center">';
831
-		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';
831
+		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';
832 832
 
833 833
 		// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.
834 834
 		$parameters = array();
@@ -839,10 +839,10 @@  discard block
 block discarded – undo
839 839
 			return;
840 840
 		}
841 841
 		if (empty($reshook)) {
842
-			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>';
842
+			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';
843 843
 			if (is_array($arrayofaction)) {
844 844
 				foreach ($arrayofaction as $code => $label) {
845
-					$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';
845
+					$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
846 846
 				}
847 847
 			}
848 848
 		}
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 		$ret .= '</select>';
852 852
 
853 853
 		if (empty($conf->dol_optimize_smallscreen)) {
854
-			$ret .= ajax_combobox('.' . $name . 'select');
854
+			$ret .= ajax_combobox('.'.$name.'select');
855 855
 		}
856 856
 
857 857
 		// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
858 858
 		$ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
859
-		$ret .= '<input type="submit" disabled name="confirmmassaction"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display: none"') . ' class="reposition button smallpaddingimp' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'confirmed" value="' . dol_escape_htmltag($langs->trans("Confirm")) . '">';
859
+		$ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="reposition button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
860 860
 		$ret .= '</div>';
861 861
 
862 862
 		if (!empty($conf->use_javascript_ajax)) {
863 863
 			$ret .= '<!-- JS CODE TO ENABLE mass action select -->
864
-    		<script nonce="' . getNonce() . '">
864
+    		<script nonce="' . getNonce().'">
865 865
                         function initCheckForSelect(mode, name, cssclass)	/* mode is 0 during init of page or click all, 1 when we click on 1 checkboxi, "name" refers to the class of the massaction button, "cssclass" to the class of the checkfor select boxes */
866 866
         		{
867 867
         			atleastoneselected=0;
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 
873 873
 					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected);
874 874
 
875
-    	  			if (atleastoneselected || ' . $alwaysvisible . ')
875
+    	  			if (atleastoneselected || ' . $alwaysvisible.')
876 876
     	  			{
877 877
                                     jQuery("."+name).show();
878
-        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . '
879
-        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . '
878
+        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').'
879
+        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').'
880 880
     	  			}
881 881
     	  			else
882 882
     	  			{
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
         		}
887 887
 
888 888
         	jQuery(document).ready(function () {
889
-                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");
890
-                    jQuery(".' . $cssclass . '").click(function() {
891
-                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");
889
+                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");
890
+                    jQuery(".' . $cssclass.'").click(function() {
891
+                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");
892 892
                     });
893
-                        jQuery(".' . $name . 'select").change(function() {
893
+                        jQuery(".' . $name.'select").change(function() {
894 894
         			var massaction = $( this ).val();
895 895
         			var urlform = $( this ).closest("form").attr("action").replace("#show_files","");
896 896
         			if (massaction == "builddoc")
@@ -898,18 +898,18 @@  discard block
 block discarded – undo
898 898
                         urlform = urlform + "#show_files";
899 899
     	            }
900 900
         			$( this ).closest("form").attr("action", urlform);
901
-                    console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform);
901
+                    console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform);
902 902
         	        /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */
903 903
         			if ($(this).val() != \'0\')
904 904
     	  			{
905
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false);
906
-										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */
907
-                                        jQuery(".' . $name . '"+massaction).show();
905
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false);
906
+										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */
907
+                                        jQuery(".' . $name.'"+massaction).show();
908 908
     	  			}
909 909
     	  			else
910 910
     	  			{
911
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true);
912
-										jQuery(".' . $name . 'other").hide();	/* To disable any div open */
911
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true);
912
+										jQuery(".' . $name.'other").hide();	/* To disable any div open */
913 913
     	  			}
914 914
     	        });
915 915
         	});
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
 		$atleastonefavorite = 0;
953 953
 
954 954
 		$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";
955
-		$sql .= " FROM " . $this->db->prefix() . "c_country";
955
+		$sql .= " FROM ".$this->db->prefix()."c_country";
956 956
 		$sql .= " WHERE active > 0";
957 957
 		//$sql.= " ORDER BY code ASC";
958 958
 
959
-		dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);
959
+		dol_syslog(get_class($this)."::select_country", LOG_DEBUG);
960 960
 		$resql = $this->db->query($sql);
961 961
 		if ($resql) {
962
-			$out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';
962
+			$out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';
963 963
 			$num = $this->db->num_rows($resql);
964 964
 			$i = 0;
965 965
 			if ($num) {
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 					$countryArray[$i]['rowid'] = $obj->rowid;
970 970
 					$countryArray[$i]['code_iso'] = $obj->code_iso;
971 971
 					$countryArray[$i]['code_iso3'] = $obj->code_iso3;
972
-					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
972
+					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
973 973
 					$countryArray[$i]['favorite'] = $obj->favorite;
974 974
 					$countryArray[$i]['eec'] = $obj->eec;
975 975
 					$favorite[$i] = $obj->favorite;
@@ -987,20 +987,20 @@  discard block
 block discarded – undo
987 987
 
988 988
 				if ($showempty) {
989 989
 					if (is_numeric($showempty)) {
990
-						$out .= '<option value="">&nbsp;</option>' . "\n";
990
+						$out .= '<option value="">&nbsp;</option>'."\n";
991 991
 					} else {
992
-						$out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";
992
+						$out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";
993 993
 					}
994 994
 				}
995 995
 
996 996
 				if ($addspecialentries) {    // Add dedicated entries for groups of countries
997 997
 					//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
998
-					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
999
-					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>';
998
+					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
999
+					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>';
1000 1000
 					if ($mysoc->isInEEC()) {
1001
-						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
1001
+						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
1002 1002
 					}
1003
-					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>';
1003
+					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>';
1004 1004
 					$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';
1005 1005
 				}
1006 1006
 
@@ -1028,20 +1028,20 @@  discard block
 block discarded – undo
1028 1028
 						$labeltoshow .= '&nbsp;';
1029 1029
 					}
1030 1030
 					if ($row['code_iso']) {
1031
-						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>';
1031
+						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>';
1032 1032
 						if (empty($hideflags)) {
1033 1033
 							$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);
1034
-							$labeltoshow = $tmpflag . ' ' . $labeltoshow;
1034
+							$labeltoshow = $tmpflag.' '.$labeltoshow;
1035 1035
 						}
1036 1036
 					}
1037 1037
 
1038 1038
 					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
1039
-						$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';
1039
+						$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
1040 1040
 					} else {
1041
-						$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';
1041
+						$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
1042 1042
 					}
1043 1043
 					$out .= $labeltoshow;
1044
-					$out .= '</option>' . "\n";
1044
+					$out .= '</option>'."\n";
1045 1045
 				}
1046 1046
 			}
1047 1047
 			$out .= '</select>';
@@ -1050,8 +1050,8 @@  discard block
 block discarded – undo
1050 1050
 		}
1051 1051
 
1052 1052
 		// Make select dynamic
1053
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1054
-		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve');
1053
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1054
+		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve');
1055 1055
 
1056 1056
 		return $out;
1057 1057
 	}
@@ -1083,25 +1083,25 @@  discard block
 block discarded – undo
1083 1083
 		$incotermArray = array();
1084 1084
 
1085 1085
 		$sql = "SELECT rowid, code";
1086
-		$sql .= " FROM " . $this->db->prefix() . "c_incoterms";
1086
+		$sql .= " FROM ".$this->db->prefix()."c_incoterms";
1087 1087
 		$sql .= " WHERE active > 0";
1088 1088
 		$sql .= " ORDER BY code ASC";
1089 1089
 
1090
-		dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);
1090
+		dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
1091 1091
 		$resql = $this->db->query($sql);
1092 1092
 		if ($resql) {
1093 1093
 			if ($conf->use_javascript_ajax && !$forcecombo) {
1094
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1094
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1095 1095
 				$out .= ajax_combobox($htmlname, $events);
1096 1096
 			}
1097 1097
 
1098 1098
 			if (!empty($page)) {
1099
-				$out .= '<form method="post" action="' . $page . '">';
1099
+				$out .= '<form method="post" action="'.$page.'">';
1100 1100
 				$out .= '<input type="hidden" name="action" value="set_incoterms">';
1101
-				$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
1101
+				$out .= '<input type="hidden" name="token" value="'.newToken().'">';
1102 1102
 			}
1103 1103
 
1104
-			$out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';
1104
+			$out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';
1105 1105
 			$out .= '<option value="0">&nbsp;</option>';
1106 1106
 			$num = $this->db->num_rows($resql);
1107 1107
 			$i = 0;
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
 				foreach ($incotermArray as $row) {
1117 1117
 					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) {
1118
-						$out .= '<option value="' . $row['rowid'] . '" selected>';
1118
+						$out .= '<option value="'.$row['rowid'].'" selected>';
1119 1119
 					} else {
1120
-						$out .= '<option value="' . $row['rowid'] . '">';
1120
+						$out .= '<option value="'.$row['rowid'].'">';
1121 1121
 					}
1122 1122
 
1123 1123
 					if ($row['code']) {
@@ -1130,13 +1130,13 @@  discard block
 block discarded – undo
1130 1130
 			$out .= '</select>';
1131 1131
 
1132 1132
 			if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
1133
-				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
1133
+				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n";
1134 1134
 				$moreattrib .= ' autocomplete="off"';
1135 1135
 			}
1136
-			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";
1136
+			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";
1137 1137
 
1138 1138
 			if (!empty($page)) {
1139
-				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>';
1139
+				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
1140 1140
 			}
1141 1141
 		} else {
1142 1142
 			dol_print_error($this->db);
@@ -1167,9 +1167,9 @@  discard block
 block discarded – undo
1167 1167
 		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service"))
1168 1168
 			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) {
1169 1169
 			if (empty($hidetext)) {
1170
-				print $langs->trans("Type") . ': ';
1170
+				print $langs->trans("Type").': ';
1171 1171
 			}
1172
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
1172
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
1173 1173
 			if ($showempty) {
1174 1174
 				print '<option value="-1"';
1175 1175
 				if ($selected == -1) {
@@ -1188,28 +1188,28 @@  discard block
 block discarded – undo
1188 1188
 			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) {
1189 1189
 				print ' selected';
1190 1190
 			}
1191
-			print '>' . $langs->trans("Product");
1191
+			print '>'.$langs->trans("Product");
1192 1192
 
1193 1193
 			print '<option value="1"';
1194 1194
 			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) {
1195 1195
 				print ' selected';
1196 1196
 			}
1197
-			print '>' . $langs->trans("Service");
1197
+			print '>'.$langs->trans("Service");
1198 1198
 
1199 1199
 			print '</select>';
1200
-			print ajax_combobox('select_' . $htmlname);
1200
+			print ajax_combobox('select_'.$htmlname);
1201 1201
 			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
1202 1202
 		}
1203 1203
 		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {
1204 1204
 			print $langs->trans("Service");
1205
-			print '<input type="hidden" name="' . $htmlname . '" value="1">';
1205
+			print '<input type="hidden" name="'.$htmlname.'" value="1">';
1206 1206
 		}
1207 1207
 		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) {
1208 1208
 			print $langs->trans("Product");
1209
-			print '<input type="hidden" name="' . $htmlname . '" value="0">';
1209
+			print '<input type="hidden" name="'.$htmlname.'" value="0">';
1210 1210
 		}
1211 1211
 		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled.
1212
-			print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
1212
+			print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
1213 1213
 		}
1214 1214
 	}
1215 1215
 
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 		$langs->load("trips");
1236 1236
 
1237 1237
 		$sql = "SELECT c.code, c.label";
1238
-		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";
1238
+		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";
1239 1239
 		$sql .= " WHERE active > 0";
1240 1240
 
1241 1241
 		$resql = $this->db->query($sql);
@@ -1276,11 +1276,11 @@  discard block
 block discarded – undo
1276 1276
 		// phpcs:enable
1277 1277
 		global $user, $langs;
1278 1278
 
1279
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
1279
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
1280 1280
 
1281 1281
 		$this->load_cache_types_fees();
1282 1282
 
1283
-		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1283
+		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';
1284 1284
 		if ($showempty) {
1285 1285
 			print '<option value="-1"';
1286 1286
 			if ($selected == -1) {
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 		}
1291 1291
 
1292 1292
 		foreach ($this->cache_types_fees as $key => $value) {
1293
-			print '<option value="' . $key . '"';
1293
+			print '<option value="'.$key.'"';
1294 1294
 			if ($key == $selected) {
1295 1295
 				print ' selected';
1296 1296
 			}
@@ -1341,12 +1341,12 @@  discard block
 block discarded – undo
1341 1341
 				$ajaxoptions = array();
1342 1342
 			}
1343 1343
 
1344
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1344
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1345 1345
 
1346 1346
 			// No immediate load of all database
1347 1347
 			$placeholder = '';
1348 1348
 			if ($selected && empty($selected_input_value)) {
1349
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1349
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1350 1350
 				$societetmp = new Societe($this->db);
1351 1351
 				$societetmp->fetch($selected);
1352 1352
 				$selected_input_value = $societetmp->name;
@@ -1354,25 +1354,25 @@  discard block
 block discarded – undo
1354 1354
 			}
1355 1355
 
1356 1356
 			// mode 1
1357
-			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : '');
1357
+			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($excludeids) ? '' : '&excludeids='.implode(',', $excludeids)).($showtype ? '&showtype='.urlencode((string) ($showtype)) : '').($showcode ? '&showcode='.urlencode((string) ($showcode)) : '');
1358 1358
 
1359 1359
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1360 1360
 			if (empty($hidelabel)) {
1361
-				print $langs->trans("RefOrLabel") . ' : ';
1361
+				print $langs->trans("RefOrLabel").' : ';
1362 1362
 			} elseif ($hidelabel > 1) {
1363 1363
 				$placeholder = $langs->trans("RefOrLabel");
1364 1364
 				if ($hidelabel == 2) {
1365 1365
 					$out .= img_picto($langs->trans("Search"), 'search');
1366 1366
 				}
1367 1367
 			}
1368
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
1368
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
1369 1369
 			if ($hidelabel == 3) {
1370 1370
 				$out .= img_picto($langs->trans("Search"), 'search');
1371 1371
 			}
1372 1372
 
1373 1373
 			$out .= ajax_event($htmlname, $events);
1374 1374
 
1375
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1375
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1376 1376
 		} else {
1377 1377
 			// Immediate load of all database
1378 1378
 			$out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids, $showcode);
@@ -1457,30 +1457,30 @@  discard block
 block discarded – undo
1457 1457
 			$sql .= ", s.address, s.zip, s.town";
1458 1458
 			$sql .= ", dictp.code as country_code";
1459 1459
 		}
1460
-		$sql .= " FROM " . $this->db->prefix() . "societe as s";
1460
+		$sql .= " FROM ".$this->db->prefix()."societe as s";
1461 1461
 		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1462
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
1462
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
1463 1463
 		}
1464 1464
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1465
-			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
1465
+			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
1466 1466
 		}
1467
-		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1467
+		$sql .= " WHERE s.entity IN (".getEntity('societe').")";
1468 1468
 		if (!empty($user->socid)) {
1469
-			$sql .= " AND s.rowid = " . ((int) $user->socid);
1469
+			$sql .= " AND s.rowid = ".((int) $user->socid);
1470 1470
 		}
1471 1471
 		if ($filter) {
1472 1472
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1473 1473
 			// if not, by testSqlAndScriptInject() only.
1474
-			$sql .= " AND (" . $filter . ")";
1474
+			$sql .= " AND (".$filter.")";
1475 1475
 		}
1476 1476
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1477
-			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
1477
+			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1478 1478
 		}
1479 1479
 		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) {
1480 1480
 			$sql .= " AND s.status <> 0";
1481 1481
 		}
1482 1482
 		if (!empty($excludeids)) {
1483
-			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")";
1483
+			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")";
1484 1484
 		}
1485 1485
 		// Add where from hooks
1486 1486
 		$parameters = array();
@@ -1500,17 +1500,17 @@  discard block
 block discarded – undo
1500 1500
 				if ($i > 0) {
1501 1501
 					$sql .= " AND ";
1502 1502
 				}
1503
-				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1503
+				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
1504 1504
 				$i++;
1505 1505
 			}
1506 1506
 			if (count($search_crit) > 1) {
1507 1507
 				$sql .= ")";
1508 1508
 			}
1509 1509
 			if (isModEnabled('barcode')) {
1510
-				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1510
+				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1511 1511
 			}
1512
-			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1513
-			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1512
+			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1513
+			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1514 1514
 			$sql .= ")";
1515 1515
 		}
1516 1516
 		$sql .= $this->db->order("nom", "ASC");
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 		$resql = $this->db->query($sql);
1522 1522
 		if ($resql) {
1523 1523
 			// Construct $out and $outarray
1524
-			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
1524
+			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
1525 1525
 
1526 1526
 			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');
1527 1527
 			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 				}
1535 1535
 			}
1536 1536
 			if ($showempty) {
1537
-				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : '&nbsp;') . '</span>') . '">' . $textifempty . '</option>' . "\n";
1537
+				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
1538 1538
 			}
1539 1539
 
1540 1540
 			$companytemp = new Societe($this->db);
@@ -1547,18 +1547,18 @@  discard block
 block discarded – undo
1547 1547
 					$label = '';
1548 1548
 					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
1549 1549
 						if (($obj->client) && (!empty($obj->code_client))) {
1550
-							$label = $obj->code_client . ' - ';
1550
+							$label = $obj->code_client.' - ';
1551 1551
 						}
1552 1552
 						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
1553
-							$label .= $obj->code_fournisseur . ' - ';
1553
+							$label .= $obj->code_fournisseur.' - ';
1554 1554
 						}
1555
-						$label .= ' ' . $obj->name;
1555
+						$label .= ' '.$obj->name;
1556 1556
 					} else {
1557 1557
 						$label = $obj->name;
1558 1558
 					}
1559 1559
 
1560 1560
 					if (!empty($obj->name_alias)) {
1561
-						$label .= ' (' . $obj->name_alias . ')';
1561
+						$label .= ' ('.$obj->name_alias.')';
1562 1562
 					}
1563 1563
 
1564 1564
 					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) {
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
 						$companytemp->fournisseur = $obj->fournisseur;
1574 1574
 						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');
1575 1575
 						if ($tmptype) {
1576
-							$labelhtml .= ' ' . $tmptype;
1576
+							$labelhtml .= ' '.$tmptype;
1577 1577
 						}
1578 1578
 
1579 1579
 						if ($obj->client || $obj->fournisseur) {
@@ -1583,10 +1583,10 @@  discard block
 block discarded – undo
1583 1583
 							$label .= $langs->trans("Customer");
1584 1584
 						}
1585 1585
 						if ($obj->client == 2 || $obj->client == 3) {
1586
-							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1586
+							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect");
1587 1587
 						}
1588 1588
 						if ($obj->fournisseur) {
1589
-							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1589
+							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier");
1590 1590
 						}
1591 1591
 						if ($obj->client || $obj->fournisseur) {
1592 1592
 							$label .= ')';
@@ -1594,9 +1594,9 @@  discard block
 block discarded – undo
1594 1594
 					}
1595 1595
 
1596 1596
 					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1597
-						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');
1597
+						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
1598 1598
 						if (!empty($obj->country_code)) {
1599
-							$s .= ', ' . $langs->trans('Country' . $obj->country_code);
1599
+							$s .= ', '.$langs->trans('Country'.$obj->country_code);
1600 1600
 						}
1601 1601
 						$label .= $s;
1602 1602
 						$labelhtml .= $s;
@@ -1604,9 +1604,9 @@  discard block
 block discarded – undo
1604 1604
 
1605 1605
 					if (empty($outputmode)) {
1606 1606
 						if (in_array($obj->rowid, $selected)) {
1607
-							$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1607
+							$out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1608 1608
 						} else {
1609
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1609
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1610 1610
 						}
1611 1611
 					} else {
1612 1612
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@@ -1618,9 +1618,9 @@  discard block
 block discarded – undo
1618 1618
 					}
1619 1619
 				}
1620 1620
 			}
1621
-			$out .= '</select>' . "\n";
1621
+			$out .= '</select>'."\n";
1622 1622
 			if (!$forcecombo) {
1623
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1623
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1624 1624
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT"));
1625 1625
 			}
1626 1626
 		} else {
@@ -1656,18 +1656,18 @@  discard block
 block discarded – undo
1656 1656
 		// On recherche les remises
1657 1657
 		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
1658 1658
 		$sql .= " re.description, re.fk_facture_source";
1659
-		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
1660
-		$sql .= " WHERE re.fk_soc = " . (int) $socid;
1661
-		$sql .= " AND re.entity = " . $conf->entity;
1659
+		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";
1660
+		$sql .= " WHERE re.fk_soc = ".(int) $socid;
1661
+		$sql .= " AND re.entity = ".$conf->entity;
1662 1662
 		if ($filter) {
1663
-			$sql .= " AND " . $filter;
1663
+			$sql .= " AND ".$filter;
1664 1664
 		}
1665 1665
 		$sql .= " ORDER BY re.description ASC";
1666 1666
 
1667
-		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
1667
+		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
1668 1668
 		$resql = $this->db->query($sql);
1669 1669
 		if ($resql) {
1670
-			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';
1670
+			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
1671 1671
 			$num = $this->db->num_rows($resql);
1672 1672
 
1673 1673
 			$qualifiedlines = $num;
@@ -1705,16 +1705,16 @@  discard block
 block discarded – undo
1705 1705
 					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) {
1706 1706
 						$tmpfac = new Facture($this->db);
1707 1707
 						if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
1708
-							$desc = $desc . ' - ' . $tmpfac->ref;
1708
+							$desc = $desc.' - '.$tmpfac->ref;
1709 1709
 						}
1710 1710
 					}
1711 1711
 
1712
-					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
1712
+					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
1713 1713
 					$i++;
1714 1714
 				}
1715 1715
 			}
1716 1716
 			print '</select>';
1717
-			print ajax_combobox('select_' . $htmlname);
1717
+			print ajax_combobox('select_'.$htmlname);
1718 1718
 
1719 1719
 			return $qualifiedlines;
1720 1720
 		} else {
@@ -1795,7 +1795,7 @@  discard block
 block discarded – undo
1795 1795
 		$out = '';
1796 1796
 
1797 1797
 		if (!is_object($hookmanager)) {
1798
-			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1798
+			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1799 1799
 			$hookmanager = new HookManager($this->db);
1800 1800
 		}
1801 1801
 
@@ -1804,13 +1804,13 @@  discard block
 block discarded – undo
1804 1804
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1805 1805
 			$sql .= ", s.nom as company, s.town AS company_town";
1806 1806
 		}
1807
-		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
1807
+		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
1808 1808
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1809
-			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
1809
+			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
1810 1810
 		}
1811
-		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
1811
+		$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
1812 1812
 		if ($socid > 0 || $socid == -1) {
1813
-			$sql .= " AND sp.fk_soc = " . ((int) $socid);
1813
+			$sql .= " AND sp.fk_soc = ".((int) $socid);
1814 1814
 		}
1815 1815
 		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) {
1816 1816
 			$sql .= " AND sp.statut <> 0";
@@ -1821,30 +1821,30 @@  discard block
 block discarded – undo
1821 1821
 		$sql .= $hookmanager->resPrint;
1822 1822
 		$sql .= " ORDER BY sp.lastname ASC";
1823 1823
 
1824
-		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);
1824
+		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
1825 1825
 		$resql = $this->db->query($sql);
1826 1826
 		if ($resql) {
1827 1827
 			$num = $this->db->num_rows($resql);
1828 1828
 
1829 1829
 			if ($htmlname != 'none' && !$options_only) {
1830
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1830
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1831 1831
 			}
1832 1832
 
1833 1833
 			if ($showempty && !is_numeric($showempty)) {
1834 1834
 				$textforempty = $showempty;
1835
-				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';
1835
+				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
1836 1836
 			} else {
1837 1837
 				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1838
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1838
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1839 1839
 				}
1840 1840
 				if ($showempty == 2) {
1841
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>';
1841
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
1842 1842
 				}
1843 1843
 			}
1844 1844
 
1845 1845
 			$i = 0;
1846 1846
 			if ($num) {
1847
-				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1847
+				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1848 1848
 				$contactstatic = new Contact($this->db);
1849 1849
 
1850 1850
 				while ($i < $num) {
@@ -1880,7 +1880,7 @@  discard block
 block discarded – undo
1880 1880
 						}
1881 1881
 						$extendedInfos = implode(' - ', $extendedInfos);
1882 1882
 						if (!empty($extendedInfos)) {
1883
-							$extendedInfos = ' - ' . $extendedInfos;
1883
+							$extendedInfos = ' - '.$extendedInfos;
1884 1884
 						}
1885 1885
 					}
1886 1886
 
@@ -1897,42 +1897,42 @@  discard block
 block discarded – undo
1897 1897
 								$disabled = 1;
1898 1898
 							}
1899 1899
 							if (!empty($selected) && in_array($obj->rowid, $selected)) {
1900
-								$out .= '<option value="' . $obj->rowid . '"';
1900
+								$out .= '<option value="'.$obj->rowid.'"';
1901 1901
 								if ($disabled) {
1902 1902
 									$out .= ' disabled';
1903 1903
 								}
1904 1904
 								$out .= ' selected>';
1905
-								$out .= $contactstatic->getFullName($langs) . $extendedInfos;
1905
+								$out .= $contactstatic->getFullName($langs).$extendedInfos;
1906 1906
 								if ($showfunction && $obj->poste) {
1907
-									$out .= ' (' . $obj->poste . ')';
1907
+									$out .= ' ('.$obj->poste.')';
1908 1908
 								}
1909 1909
 								if (($showsoc > 0) && $obj->company) {
1910
-									$out .= ' - (' . $obj->company . ')';
1910
+									$out .= ' - ('.$obj->company.')';
1911 1911
 								}
1912 1912
 								$out .= '</option>';
1913 1913
 							} else {
1914
-								$out .= '<option value="' . $obj->rowid . '"';
1914
+								$out .= '<option value="'.$obj->rowid.'"';
1915 1915
 								if ($disabled) {
1916 1916
 									$out .= ' disabled';
1917 1917
 								}
1918 1918
 								$out .= '>';
1919
-								$out .= $contactstatic->getFullName($langs) . $extendedInfos;
1919
+								$out .= $contactstatic->getFullName($langs).$extendedInfos;
1920 1920
 								if ($showfunction && $obj->poste) {
1921
-									$out .= ' (' . $obj->poste . ')';
1921
+									$out .= ' ('.$obj->poste.')';
1922 1922
 								}
1923 1923
 								if (($showsoc > 0) && $obj->company) {
1924
-									$out .= ' - (' . $obj->company . ')';
1924
+									$out .= ' - ('.$obj->company.')';
1925 1925
 								}
1926 1926
 								$out .= '</option>';
1927 1927
 							}
1928 1928
 						} else {
1929 1929
 							if (in_array($obj->rowid, $selected)) {
1930
-								$out .= $contactstatic->getFullName($langs) . $extendedInfos;
1930
+								$out .= $contactstatic->getFullName($langs).$extendedInfos;
1931 1931
 								if ($showfunction && $obj->poste) {
1932
-									$out .= ' (' . $obj->poste . ')';
1932
+									$out .= ' ('.$obj->poste.')';
1933 1933
 								}
1934 1934
 								if (($showsoc > 0) && $obj->company) {
1935
-									$out .= ' - (' . $obj->company . ')';
1935
+									$out .= ' - ('.$obj->company.')';
1936 1936
 								}
1937 1937
 							}
1938 1938
 						}
@@ -1941,7 +1941,7 @@  discard block
 block discarded – undo
1941 1941
 				}
1942 1942
 			} else {
1943 1943
 				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1944
-				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';
1944
+				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';
1945 1945
 				$out .= $labeltoshow;
1946 1946
 				$out .= '</option>';
1947 1947
 			}
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
 			}
1963 1963
 
1964 1964
 			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
1965
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1965
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1966 1966
 				$out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT"));
1967 1967
 			}
1968 1968
 
@@ -2071,14 +2071,14 @@  discard block
 block discarded – undo
2071 2071
 		if ($showlabelofentity) {
2072 2072
 			$sql .= ", e.label";
2073 2073
 		}
2074
-		$sql .= " FROM " . $this->db->prefix() . "user as u";
2074
+		$sql .= " FROM ".$this->db->prefix()."user as u";
2075 2075
 		if ($showlabelofentity) {
2076
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
2076
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
2077 2077
 		}
2078 2078
 		// Condition here should be the same than into societe->getSalesRepresentatives().
2079 2079
 		if ($userissuperadminentityone && $force_entity != 'default') {
2080 2080
 			if (!empty($force_entity)) {
2081
-				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
2081
+				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
2082 2082
 			} else {
2083 2083
 				$sql .= " WHERE u.entity IS NOT NULL";
2084 2084
 			}
@@ -2086,18 +2086,18 @@  discard block
 block discarded – undo
2086 2086
 			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) {
2087 2087
 				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))";
2088 2088
 			} else {
2089
-				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
2089
+				$sql .= " WHERE u.entity IN (".getEntity('user').")";
2090 2090
 			}
2091 2091
 		}
2092 2092
 
2093 2093
 		if (!empty($user->socid)) {
2094
-			$sql .= " AND u.fk_soc = " . ((int) $user->socid);
2094
+			$sql .= " AND u.fk_soc = ".((int) $user->socid);
2095 2095
 		}
2096 2096
 		if (is_array($exclude) && $excludeUsers) {
2097
-			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
2097
+			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")";
2098 2098
 		}
2099 2099
 		if ($includeUsers) {
2100
-			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")";
2100
+			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")";
2101 2101
 		}
2102 2102
 		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
2103 2103
 			$sql .= " AND u.statut <> 0";
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
 			$sql .= " AND u.fk_soc IS NULL";
2110 2110
 		}
2111 2111
 		if (!empty($morefilter)) {
2112
-			$sql .= " " . $morefilter;
2112
+			$sql .= " ".$morefilter;
2113 2113
 		}
2114 2114
 
2115 2115
 		//Add hook to filter on user (for example on usergroup define in custom modules)
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
 			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
2125 2125
 		}
2126 2126
 
2127
-		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);
2127
+		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
2128 2128
 
2129 2129
 		$resql = $this->db->query($sql);
2130 2130
 		if ($resql) {
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
 			$i = 0;
2133 2133
 			if ($num) {
2134 2134
 				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
2135
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
2135
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
2136 2136
 				if ($show_empty && !$multiple) {
2137 2137
 					$textforempty = ' ';
2138 2138
 					if (!empty($conf->use_javascript_ajax)) {
@@ -2141,10 +2141,10 @@  discard block
 block discarded – undo
2141 2141
 					if (!is_numeric($show_empty)) {
2142 2142
 						$textforempty = $show_empty;
2143 2143
 					}
2144
-					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
2144
+					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
2145 2145
 				}
2146 2146
 				if ($show_every) {
2147
-					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
2147
+					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
2148 2148
 				}
2149 2149
 
2150 2150
 				$userstatic = new User($this->db);
@@ -2191,21 +2191,21 @@  discard block
 block discarded – undo
2191 2191
 					}
2192 2192
 					if ($showstatus >= 0) {
2193 2193
 						if ($obj->status == 1 && $showstatus == 1) {
2194
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
2195
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled');
2194
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
2195
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
2196 2196
 						}
2197 2197
 						if ($obj->status == 0 && $showstatus == 1) {
2198
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
2199
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled');
2198
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
2199
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
2200 2200
 						}
2201 2201
 					}
2202 2202
 					if ($showlabelofentity) {
2203 2203
 						if (empty($obj->entity)) {
2204
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
2205
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
2204
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
2205
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
2206 2206
 						} else {
2207 2207
 							if ($obj->entity != $conf->entity) {
2208
-								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2208
+								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2209 2209
 								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2210 2210
 							}
2211 2211
 						}
@@ -2214,13 +2214,13 @@  discard block
 block discarded – undo
2214 2214
 					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');
2215 2215
 					if (!empty($disableline) && $disableline != '1') {
2216 2216
 						// Add text from $enableonlytext parameter
2217
-						$moreinfo .= ' - ' . $disableline;
2218
-						$moreinfohtml .= ' - ' . $disableline;
2217
+						$moreinfo .= ' - '.$disableline;
2218
+						$moreinfohtml .= ' - '.$disableline;
2219 2219
 					}
2220 2220
 					$labeltoshow .= $moreinfo;
2221 2221
 					$labeltoshowhtml .= $moreinfohtml;
2222 2222
 
2223
-					$out .= '<option value="' . $obj->rowid . '"';
2223
+					$out .= '<option value="'.$obj->rowid.'"';
2224 2224
 					if (!empty($disableline)) {
2225 2225
 						$out .= ' disabled';
2226 2226
 					}
@@ -2228,7 +2228,7 @@  discard block
 block discarded – undo
2228 2228
 						$out .= ' selected';
2229 2229
 					}
2230 2230
 					$out .= ' data-html="';
2231
-					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';
2231
+					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
2232 2232
 					if ($showstatus >= 0 && $obj->status == 0) {
2233 2233
 						$outhtml .= '<strike class="opacitymediumxxx">';
2234 2234
 					}
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
 					$out .= $labeltoshow;
2242 2242
 					$out .= '</option>';
2243 2243
 
2244
-					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
2244
+					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
2245 2245
 					$outarray2[$userstatic->id] = array(
2246 2246
 						'id' => $userstatic->id,
2247 2247
 						'label' => $labeltoshow,
@@ -2253,14 +2253,14 @@  discard block
 block discarded – undo
2253 2253
 					$i++;
2254 2254
 				}
2255 2255
 			} else {
2256
-				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
2257
-				$out .= '<option value="">' . $langs->trans("None") . '</option>';
2256
+				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
2257
+				$out .= '<option value="">'.$langs->trans("None").'</option>';
2258 2258
 			}
2259 2259
 			$out .= '</select>';
2260 2260
 
2261 2261
 			if ($num && !$forcecombo) {
2262 2262
 				// Enhance with select2
2263
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2263
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2264 2264
 				$out .= ajax_combobox($htmlname);
2265 2265
 			}
2266 2266
 		} else {
@@ -2334,16 +2334,16 @@  discard block
 block discarded – undo
2334 2334
 			$out .= $userstatic->getNomUrl(-1);
2335 2335
 			if ($i == 0) {
2336 2336
 				$ownerid = $value['id'];
2337
-				$out .= ' (' . $langs->trans("Owner") . ')';
2337
+				$out .= ' ('.$langs->trans("Owner").')';
2338 2338
 			}
2339 2339
 			if ($nbassignetouser > 1 && $action != 'view') {
2340
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned reposition" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">';
2340
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned reposition" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
2341 2341
 			}
2342 2342
 			// Show my availability
2343 2343
 			if ($showproperties) {
2344 2344
 				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
2345 2345
 					$out .= '<div class="myavailability inline-block">';
2346
-					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">' . $langs->trans("Availability") . ':</span>  </span><input id="transparency" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofuserid[$ownerid]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>';
2346
+					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">'.$langs->trans("Availability").':</span>  </span><input id="transparency" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>';
2347 2347
 					$out .= '</div>';
2348 2348
 				}
2349 2349
 			}
@@ -2360,15 +2360,15 @@  discard block
 block discarded – undo
2360 2360
 		// Method with no ajax
2361 2361
 		if ($action != 'view') {
2362 2362
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
2363
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2363
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2364 2364
 			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
2365 2365
 			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
2366
-			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }';
2367
-			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }';
2366
+			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';
2367
+			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }';
2368 2368
 			$out .= '});';
2369 2369
 			$out .= '})</script>';
2370 2370
 			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2371
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2371
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2372 2372
 			$out .= '<br>';
2373 2373
 		}
2374 2374
 
@@ -2427,13 +2427,13 @@  discard block
 block discarded – undo
2427 2427
 			$resourcestatic->fetch($value['id']);
2428 2428
 			$out .= $resourcestatic->getNomUrl(-1);
2429 2429
 			if ($nbassignetoresource > 1 && $action != 'view') {
2430
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassigned reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">';
2430
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassigned reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">';
2431 2431
 			}
2432 2432
 			// Show my availability
2433 2433
 			if ($showproperties) {
2434 2434
 				if (is_array($listofresourceid) && count($listofresourceid)) {
2435 2435
 					$out .= '<div class="myavailability inline-block">';
2436
-					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">' . $langs->trans("Availability") . ':</span>  </span><input id="transparencyresource" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofresourceid[$value['id']]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>';
2436
+					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">'.$langs->trans("Availability").':</span>  </span><input id="transparencyresource" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofresourceid[$value['id']]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>';
2437 2437
 					$out .= '</div>';
2438 2438
 				}
2439 2439
 			}
@@ -2450,11 +2450,11 @@  discard block
 block discarded – undo
2450 2450
 		// Method with no ajax
2451 2451
 		if ($action != 'view') {
2452 2452
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">';
2453
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2453
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2454 2454
 			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });';
2455 2455
 			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());';
2456
-			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }';
2457
-			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }';
2456
+			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }';
2457
+			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }';
2458 2458
 			$out .= '});';
2459 2459
 			$out .= '})</script>';
2460 2460
 
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
 			$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
2463 2463
 			$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);
2464 2464
 			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2465
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2465
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2466 2466
 			$out .= '<br>';
2467 2467
 		}
2468 2468
 
@@ -2523,7 +2523,7 @@  discard block
 block discarded – undo
2523 2523
 			$placeholder = '';
2524 2524
 
2525 2525
 			if ($selected && empty($selected_input_value)) {
2526
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2526
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2527 2527
 				$producttmpselect = new Product($this->db);
2528 2528
 				$producttmpselect->fetch($selected);
2529 2529
 				$selected_input_value = $producttmpselect->ref;
@@ -2538,17 +2538,17 @@  discard block
 block discarded – undo
2538 2538
 				}
2539 2539
 			}
2540 2540
 			// mode=1 means customers products
2541
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=1&status=' . $status . '&status_purchase=' . $status_purchase . '&finished=' . $finished . '&hidepriceinlabel=' . $hidepriceinlabel . '&warehousestatus=' . $warehouseStatus;
2542
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
2541
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
2542
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
2543 2543
 
2544 2544
 			if (isModEnabled('variants') && is_array($selected_combinations)) {
2545 2545
 				// Code to automatically insert with javascript the select of attributes under the select of product
2546 2546
 				// when a parent of variant has been selected.
2547 2547
 				$out .= '
2548 2548
 				<!-- script to auto show attributes select tags if a variant was selected -->
2549
-				<script nonce="' . getNonce() . '">
2549
+				<script nonce="' . getNonce().'">
2550 2550
 					// auto show attributes fields
2551
-					selected = ' . json_encode($selected_combinations) . ';
2551
+					selected = ' . json_encode($selected_combinations).';
2552 2552
 					combvalues = {};
2553 2553
 
2554 2554
 					jQuery(document).ready(function () {
@@ -2559,7 +2559,7 @@  discard block
 block discarded – undo
2559 2559
 							}
2560 2560
 						});
2561 2561
 
2562
-						jQuery("input#' . $htmlname . '").change(function () {
2562
+						jQuery("input#' . $htmlname.'").change(function () {
2563 2563
 
2564 2564
 							if (!jQuery(this).val()) {
2565 2565
 								jQuery(\'div#attributes_box\').empty();
@@ -2568,7 +2568,7 @@  discard block
 block discarded – undo
2568 2568
 
2569 2569
 							console.log("A change has started. We get variants fields to inject html select");
2570 2570
 
2571
-							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", {
2571
+							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
2572 2572
 								id: jQuery(this).val()
2573 2573
 							}, function (data) {
2574 2574
 								jQuery(\'div#attributes_box\').empty();
@@ -2611,21 +2611,21 @@  discard block
 block discarded – undo
2611 2611
 							})
2612 2612
 						});
2613 2613
 
2614
-						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . '
2614
+						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').'
2615 2615
 					});
2616 2616
 				</script>
2617 2617
                 ';
2618 2618
 			}
2619 2619
 
2620 2620
 			if (empty($hidelabel)) {
2621
-				$out .= $langs->trans("RefOrLabel") . ' : ';
2621
+				$out .= $langs->trans("RefOrLabel").' : ';
2622 2622
 			} elseif ($hidelabel > 1) {
2623
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
2623
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
2624 2624
 				if ($hidelabel == 2) {
2625 2625
 					$out .= img_picto($langs->trans("Search"), 'search');
2626 2626
 				}
2627 2627
 			}
2628
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
2628
+			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
2629 2629
 			if ($hidelabel == 3) {
2630 2630
 				$out .= img_picto($langs->trans("Search"), 'search');
2631 2631
 			}
@@ -2662,33 +2662,33 @@  discard block
 block discarded – undo
2662 2662
 		// phpcs:enable
2663 2663
 		global $conf, $user, $langs, $db;
2664 2664
 
2665
-		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2665
+		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2666 2666
 
2667 2667
 		$error = 0;
2668 2668
 		$out = '';
2669 2669
 
2670 2670
 		if (!$forcecombo) {
2671
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2671
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2672 2672
 			$events = array();
2673 2673
 			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2674 2674
 		}
2675 2675
 
2676
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2676
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2677 2677
 
2678 2678
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2679
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2680
-		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2679
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2680
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2681 2681
 		if (!empty($status)) {
2682
-			$sql .= ' AND status = ' . (int) $status;
2682
+			$sql .= ' AND status = '.(int) $status;
2683 2683
 		}
2684 2684
 		if (!empty($type)) {
2685
-			$sql .= ' AND bomtype = ' . (int) $type;
2685
+			$sql .= ' AND bomtype = '.(int) $type;
2686 2686
 		}
2687 2687
 		if (!empty($TProducts)) {
2688
-			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2688
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2689 2689
 		}
2690 2690
 		if (!empty($limit)) {
2691
-			$sql .= ' LIMIT ' . (int) $limit;
2691
+			$sql .= ' LIMIT '.(int) $limit;
2692 2692
 		}
2693 2693
 		$resql = $db->query($sql);
2694 2694
 		if ($resql) {
@@ -2702,11 +2702,11 @@  discard block
 block discarded – undo
2702 2702
 			while ($obj = $db->fetch_object($resql)) {
2703 2703
 				$product = new Product($db);
2704 2704
 				$res = $product->fetch($obj->fk_product);
2705
-				$out .= '<option value="' . $obj->rowid . '"';
2705
+				$out .= '<option value="'.$obj->rowid.'"';
2706 2706
 				if ($obj->rowid == $selected) {
2707 2707
 					$out .= 'selected';
2708 2708
 				}
2709
-				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2709
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2710 2710
 			}
2711 2711
 		} else {
2712 2712
 			$error++;
@@ -2763,7 +2763,7 @@  discard block
 block discarded – undo
2763 2763
 
2764 2764
 		$warehouseStatusArray = array();
2765 2765
 		if (!empty($warehouseStatus)) {
2766
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2766
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2767 2767
 			if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2768 2768
 				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2769 2769
 			}
@@ -2777,9 +2777,9 @@  discard block
 block discarded – undo
2777 2777
 
2778 2778
 		$selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.duration, p.fk_price_expression";
2779 2779
 		if (count($warehouseStatusArray)) {
2780
-			$selectFieldsGrouped = ", sum(" . $this->db->ifsql("e.statut IS NULL", "0", "ps.reel") . ") as stock"; // e.statut is null if there is no record in stock
2780
+			$selectFieldsGrouped = ", sum(".$this->db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock
2781 2781
 		} else {
2782
-			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
2782
+			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
2783 2783
 		}
2784 2784
 
2785 2785
 		$sql = "SELECT ";
@@ -2795,9 +2795,9 @@  discard block
 block discarded – undo
2795 2795
 
2796 2796
 		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
2797 2797
 			//Product category
2798
-			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
2799
-						FROM " . $this->db->prefix() . "categorie_product
2800
-						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
2798
+			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
2799
+						FROM " . $this->db->prefix()."categorie_product
2800
+						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid
2801 2801
 						LIMIT 1
2802 2802
 				) AS categorie_product_id ";
2803 2803
 		}
@@ -2823,15 +2823,15 @@  discard block
 block discarded – undo
2823 2823
 		}
2824 2824
 		// Price by quantity
2825 2825
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2826
-			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
2826
+			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
2827 2827
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2828
-				$sql .= " AND price_level = " . ((int) $price_level);
2828
+				$sql .= " AND price_level = ".((int) $price_level);
2829 2829
 			}
2830 2830
 			$sql .= " ORDER BY date_price";
2831 2831
 			$sql .= " DESC LIMIT 1) as price_rowid";
2832
-			$sql .= ", (SELECT pp.price_by_qty FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2832
+			$sql .= ", (SELECT pp.price_by_qty FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2833 2833
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2834
-				$sql .= " AND price_level = " . ((int) $price_level);
2834
+				$sql .= " AND price_level = ".((int) $price_level);
2835 2835
 			}
2836 2836
 			$sql .= " ORDER BY date_price";
2837 2837
 			$sql .= " DESC LIMIT 1) as price_by_qty";
@@ -2840,58 +2840,58 @@  discard block
 block discarded – undo
2840 2840
 
2841 2841
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2842 2842
 		// Add from (left join) from hooks
2843
-		$parameters = array();  // @phan-suppress-current-line PhanPluginRedundantAssignment
2843
+		$parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment
2844 2844
 		$reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook
2845 2845
 		$sql .= $hookmanager->resPrint;
2846 2846
 
2847 2847
 		if (count($warehouseStatusArray)) {
2848
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
2849
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
2850
-			$sql .= ' AND e.statut IN (' . $this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))) . ')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
2848
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
2849
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
2850
+			$sql .= ' AND e.statut IN ('.$this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
2851 2851
 		}
2852 2852
 
2853 2853
 		// include search in supplier ref
2854 2854
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
2855
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2855
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2856 2856
 		}
2857 2857
 
2858 2858
 		//Price by customer
2859 2859
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
2860
-			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
2860
+			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
2861 2861
 		}
2862 2862
 		// Units
2863 2863
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
2864
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
2864
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
2865 2865
 		}
2866 2866
 		// Multilang : we add translation
2867 2867
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
2868
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
2868
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
2869 2869
 			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) {
2870
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
2870
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
2871 2871
 				$soc = new Societe($this->db);
2872 2872
 				$result = $soc->fetch($socid);
2873 2873
 				if ($result > 0 && !empty($soc->default_lang)) {
2874
-					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
2874
+					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
2875 2875
 				} else {
2876
-					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
2876
+					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
2877 2877
 				}
2878 2878
 			} else {
2879
-				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
2879
+				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
2880 2880
 			}
2881 2881
 		}
2882 2882
 
2883 2883
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
2884
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
2884
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
2885 2885
 		}
2886 2886
 
2887
-		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
2887
+		$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
2888 2888
 
2889 2889
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
2890 2890
 			$sql .= " AND pac.rowid IS NULL";
2891 2891
 		}
2892 2892
 
2893 2893
 		if ($finished == 0) {
2894
-			$sql .= " AND p.finished = " . ((int) $finished);
2894
+			$sql .= " AND p.finished = ".((int) $finished);
2895 2895
 		} elseif ($finished == 1) {
2896 2896
 			$sql .= " AND p.finished = ".((int) $finished);
2897 2897
 		}
@@ -2899,18 +2899,18 @@  discard block
 block discarded – undo
2899 2899
 			$sql .= " AND p.tosell = ".((int) $status);
2900 2900
 		}
2901 2901
 		if ($status_purchase >= 0) {
2902
-			$sql .= " AND p.tobuy = " . ((int) $status_purchase);
2902
+			$sql .= " AND p.tobuy = ".((int) $status_purchase);
2903 2903
 		}
2904 2904
 		// Filter by product type
2905 2905
 		if (strval($filtertype) != '') {
2906
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
2906
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
2907 2907
 		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
2908 2908
 			$sql .= " AND p.fk_product_type = 1";
2909 2909
 		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
2910 2910
 			$sql .= " AND p.fk_product_type = 0";
2911 2911
 		}
2912 2912
 		// Add where from hooks
2913
-		$parameters = array();  // @phan-suppress-current-line PhanPluginRedundantAssignment
2913
+		$parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment
2914 2914
 		$reshook = $hookmanager->executeHooks('selectProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook
2915 2915
 		$sql .= $hookmanager->resPrint;
2916 2916
 		// Add criteria on ref/label
@@ -2927,21 +2927,21 @@  discard block
 block discarded – undo
2927 2927
 				if ($i > 0) {
2928 2928
 					$sql .= " AND ";
2929 2929
 				}
2930
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2930
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
2931 2931
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
2932
-					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2932
+					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
2933 2933
 				}
2934 2934
 				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
2935
-					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2935
+					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
2936 2936
 				}
2937 2937
 				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) {
2938
-					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2938
+					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
2939 2939
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
2940
-						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2940
+						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
2941 2941
 					}
2942 2942
 				}
2943 2943
 				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
2944
-					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2944
+					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
2945 2945
 				}
2946 2946
 				$sql .= ")";
2947 2947
 				$i++;
@@ -2950,12 +2950,12 @@  discard block
 block discarded – undo
2950 2950
 				$sql .= ")";
2951 2951
 			}
2952 2952
 			if (isModEnabled('barcode')) {
2953
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
2953
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
2954 2954
 			}
2955 2955
 			$sql .= ')';
2956 2956
 		}
2957 2957
 		if (count($warehouseStatusArray)) {
2958
-			$sql .= " GROUP BY " . $selectFields;
2958
+			$sql .= " GROUP BY ".$selectFields;
2959 2959
 		}
2960 2960
 
2961 2961
 		//Sort by category
@@ -2970,23 +2970,23 @@  discard block
 block discarded – undo
2970 2970
 		$sql .= $this->db->plimit($limit, 0);
2971 2971
 
2972 2972
 		// Build output string
2973
-		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
2973
+		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
2974 2974
 		$result = $this->db->query($sql);
2975 2975
 		if ($result) {
2976
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2977
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
2978
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
2976
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2977
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
2978
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
2979 2979
 
2980 2980
 			$num = $this->db->num_rows($result);
2981 2981
 
2982 2982
 			$events = array();
2983 2983
 
2984 2984
 			if (!$forcecombo) {
2985
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2985
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2986 2986
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2987 2987
 			}
2988 2988
 
2989
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2989
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2990 2990
 
2991 2991
 			$textifempty = '';
2992 2992
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
 				}
3004 3004
 			}
3005 3005
 			if ($showempty) {
3006
-				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : '&nbsp;') . '</option>';
3006
+				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
3007 3007
 			}
3008 3008
 
3009 3009
 			$i = 0;
@@ -3014,11 +3014,11 @@  discard block
 block discarded – undo
3014 3014
 
3015 3015
 				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
3016 3016
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
3017
-					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
3018
-					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
3017
+					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
3018
+					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
3019 3019
 					$sql .= " ORDER BY quantity ASC";
3020 3020
 
3021
-					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
3021
+					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
3022 3022
 					$result2 = $this->db->query($sql);
3023 3023
 					if ($result2) {
3024 3024
 						$nb_prices = $this->db->num_rows($result2);
@@ -3056,7 +3056,7 @@  discard block
 block discarded – undo
3056 3056
 						$price_product = new Product($this->db);
3057 3057
 						$price_product->fetch($objp->rowid, '', '', 1);
3058 3058
 
3059
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3059
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3060 3060
 						$priceparser = new PriceParser($this->db);
3061 3061
 						$price_result = $priceparser->parseProduct($price_product);
3062 3062
 						if ($price_result >= 0) {
@@ -3140,7 +3140,7 @@  discard block
 block discarded – undo
3140 3140
 			$label = $objp->label_translated;
3141 3141
 		}
3142 3142
 		if (!empty($filterkey) && $filterkey != '') {
3143
-			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3143
+			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3144 3144
 		}
3145 3145
 
3146 3146
 		$outkey = $objp->rowid;
@@ -3161,32 +3161,32 @@  discard block
 block discarded – undo
3161 3161
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
3162 3162
 
3163 3163
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3164
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
3164
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
3165 3165
 		}
3166 3166
 
3167 3167
 		// Units
3168 3168
 		$outvalUnits = '';
3169 3169
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3170 3170
 			if (!empty($objp->unit_short)) {
3171
-				$outvalUnits .= ' - ' . $objp->unit_short;
3171
+				$outvalUnits .= ' - '.$objp->unit_short;
3172 3172
 			}
3173 3173
 		}
3174 3174
 		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) {
3175 3175
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
3176 3176
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3177
-				$outvalUnits .= ' - ' . $unitToShow;
3177
+				$outvalUnits .= ' - '.$unitToShow;
3178 3178
 			}
3179 3179
 			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3180
-				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3181
-				$outvalUnits .= ' - ' . $unitToShow;
3180
+				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3181
+				$outvalUnits .= ' - '.$unitToShow;
3182 3182
 			}
3183 3183
 			if (!empty($objp->surface) && $objp->surface_units !== null) {
3184 3184
 				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3185
-				$outvalUnits .= ' - ' . $unitToShow;
3185
+				$outvalUnits .= ' - '.$unitToShow;
3186 3186
 			}
3187 3187
 			if (!empty($objp->volume) && $objp->volume_units !== null) {
3188 3188
 				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3189
-				$outvalUnits .= ' - ' . $unitToShow;
3189
+				$outvalUnits .= ' - '.$unitToShow;
3190 3190
 			}
3191 3191
 		}
3192 3192
 		if ($outdurationvalue && $outdurationunit) {
@@ -3198,14 +3198,14 @@  discard block
 block discarded – undo
3198 3198
 				'y' => $langs->trans('Year')
3199 3199
 			);
3200 3200
 			if (isset($da[$outdurationunit])) {
3201
-				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3201
+				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3202 3202
 			}
3203 3203
 		}
3204 3204
 
3205
-		$opt = '<option value="' . $objp->rowid . '"';
3205
+		$opt = '<option value="'.$objp->rowid.'"';
3206 3206
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
3207 3207
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
3208
-			$opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqup="' . $objp->price_by_qty_unitprice . '" data-pbqbase="' . $objp->price_by_qty_price_base_type . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"';
3208
+			$opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"';
3209 3209
 		}
3210 3210
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3211 3211
 			if ($user->hasRight('stock', 'lire')) {
@@ -3217,36 +3217,36 @@  discard block
 block discarded – undo
3217 3217
 			}
3218 3218
 		}
3219 3219
 		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
3220
-			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
3221
-			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
3220
+			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
3221
+			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
3222 3222
 		}
3223 3223
 		$opt .= '>';
3224 3224
 		$opt .= $objp->ref;
3225 3225
 		if (!empty($objp->custref)) {
3226
-			$opt .= ' (' . $objp->custref . ')';
3226
+			$opt .= ' ('.$objp->custref.')';
3227 3227
 		}
3228 3228
 		if ($outbarcode) {
3229
-			$opt .= ' (' . $outbarcode . ')';
3229
+			$opt .= ' ('.$outbarcode.')';
3230 3230
 		}
3231
-		$opt .= ' - ' . dol_trunc($label, $maxlengtharticle);
3231
+		$opt .= ' - '.dol_trunc($label, $maxlengtharticle);
3232 3232
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3233
-			$opt .= ' (' . getCountry($outorigin, 1) . ')';
3233
+			$opt .= ' ('.getCountry($outorigin, 1).')';
3234 3234
 		}
3235 3235
 
3236 3236
 		$objRef = $objp->ref;
3237 3237
 		if (!empty($objp->custref)) {
3238
-			$objRef .= ' (' . $objp->custref . ')';
3238
+			$objRef .= ' ('.$objp->custref.')';
3239 3239
 		}
3240 3240
 		if (!empty($filterkey) && $filterkey != '') {
3241
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3241
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3242 3242
 		}
3243 3243
 		$outval .= $objRef;
3244 3244
 		if ($outbarcode) {
3245
-			$outval .= ' (' . $outbarcode . ')';
3245
+			$outval .= ' ('.$outbarcode.')';
3246 3246
 		}
3247
-		$outval .= ' - ' . dol_trunc($label, $maxlengtharticle);
3247
+		$outval .= ' - '.dol_trunc($label, $maxlengtharticle);
3248 3248
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3249
-			$outval .= ' (' . getCountry($outorigin, 1) . ')';
3249
+			$outval .= ' ('.getCountry($outorigin, 1).')';
3250 3250
 		}
3251 3251
 
3252 3252
 		// Units
@@ -3259,35 +3259,35 @@  discard block
 block discarded – undo
3259 3259
 		// If we need a particular price level (from 1 to n)
3260 3260
 		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) {
3261 3261
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
3262
-			$sql .= " FROM " . $this->db->prefix() . "product_price";
3263
-			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
3264
-			$sql .= " AND entity IN (" . getEntity('productprice') . ")";
3265
-			$sql .= " AND price_level = " . ((int) $price_level);
3262
+			$sql .= " FROM ".$this->db->prefix()."product_price";
3263
+			$sql .= " WHERE fk_product = ".((int) $objp->rowid);
3264
+			$sql .= " AND entity IN (".getEntity('productprice').")";
3265
+			$sql .= " AND price_level = ".((int) $price_level);
3266 3266
 			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
3267 3267
 			$sql .= " LIMIT 1";
3268 3268
 
3269
-			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);
3269
+			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
3270 3270
 			$result2 = $this->db->query($sql);
3271 3271
 			if ($result2) {
3272 3272
 				$objp2 = $this->db->fetch_object($result2);
3273 3273
 				if ($objp2) {
3274 3274
 					$found = 1;
3275 3275
 					if ($objp2->price_base_type == 'HT') {
3276
-						$opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3277
-						$outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3276
+						$opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3277
+						$outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3278 3278
 					} else {
3279
-						$opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3280
-						$outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3279
+						$opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3280
+						$outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3281 3281
 					}
3282 3282
 					$outprice_ht = price($objp2->price);
3283 3283
 					$outprice_ttc = price($objp2->price_ttc);
3284 3284
 					$outpricebasetype = $objp2->price_base_type;
3285 3285
 					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility
3286
-						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
3287
-						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
3286
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3287
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3288 3288
 					} else {
3289
-						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice
3290
-						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice
3289
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3290
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3291 3291
 					}
3292 3292
 				}
3293 3293
 			} else {
@@ -3301,13 +3301,13 @@  discard block
 block discarded – undo
3301 3301
 			$outqty = $objp->quantity;
3302 3302
 			$outdiscount = $objp->remise_percent;
3303 3303
 			if ($objp->quantity == 1) {
3304
-				$opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";
3305
-				$outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";
3304
+				$opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
3305
+				$outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
3306 3306
 				$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3307 3307
 				$outval .= $langs->transnoentities("Unit");
3308 3308
 			} else {
3309
-				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3310
-				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3309
+				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3310
+				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3311 3311
 				$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3312 3312
 				$outval .= $langs->transnoentities("Units");
3313 3313
 			}
@@ -3315,16 +3315,16 @@  discard block
 block discarded – undo
3315 3315
 			$outprice_ht = price($objp->unitprice);
3316 3316
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3317 3317
 			$outpricebasetype = $objp->price_base_type;
3318
-			$outtva_tx = $objp->tva_tx;                            // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3319
-			$outdefault_vat_code = $objp->default_vat_code;        // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3318
+			$outtva_tx = $objp->tva_tx; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3319
+			$outdefault_vat_code = $objp->default_vat_code; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3320 3320
 		}
3321 3321
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3322
-			$opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3323
-			$outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3322
+			$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3323
+			$outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3324 3324
 		}
3325 3325
 		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
3326
-			$opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3327
-			$outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3326
+			$opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3327
+			$outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3328 3328
 		}
3329 3329
 
3330 3330
 		// Price by customer
@@ -3333,11 +3333,11 @@  discard block
 block discarded – undo
3333 3333
 				$found = 1;
3334 3334
 
3335 3335
 				if ($objp->custprice_base_type == 'HT') {
3336
-					$opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3337
-					$outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3336
+					$opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3337
+					$outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3338 3338
 				} else {
3339
-					$opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3340
-					$outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3339
+					$opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3340
+					$outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3341 3341
 				}
3342 3342
 
3343 3343
 				$outprice_ht = price($objp->custprice);
@@ -3351,11 +3351,11 @@  discard block
 block discarded – undo
3351 3351
 		// If level no defined or multiprice not found, we used the default price
3352 3352
 		if (empty($hidepriceinlabel) && !$found) {
3353 3353
 			if ($objp->price_base_type == 'HT') {
3354
-				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3355
-				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3354
+				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3355
+				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3356 3356
 			} else {
3357
-				$opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3358
-				$outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3357
+				$opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3358
+				$outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3359 3359
 			}
3360 3360
 			$outprice_ht = price($objp->price);
3361 3361
 			$outprice_ttc = price($objp->price_ttc);
@@ -3366,14 +3366,14 @@  discard block
 block discarded – undo
3366 3366
 
3367 3367
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3368 3368
 			if ($user->hasRight('stock', 'lire')) {
3369
-				$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3369
+				$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
3370 3370
 
3371 3371
 				if ($objp->stock > 0) {
3372 3372
 					$outval .= ' - <span class="product_line_stock_ok">';
3373 3373
 				} elseif ($objp->stock <= 0) {
3374 3374
 					$outval .= ' - <span class="product_line_stock_too_low">';
3375 3375
 				}
3376
-				$outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3376
+				$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'));
3377 3377
 				$outval .= '</span>';
3378 3378
 				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
3379 3379
 					$langs->load("stocks");
@@ -3383,9 +3383,9 @@  discard block
 block discarded – undo
3383 3383
 					$tmpproduct->load_virtual_stock();
3384 3384
 					$virtualstock = $tmpproduct->stock_theorique;
3385 3385
 
3386
-					$opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3386
+					$opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3387 3387
 
3388
-					$outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3388
+					$outval .= ' - '.$langs->transnoentities("VirtualStock").':';
3389 3389
 					if ($virtualstock > 0) {
3390 3390
 						$outval .= '<span class="product_line_stock_ok">';
3391 3391
 					} elseif ($virtualstock <= 0) {
@@ -3463,7 +3463,7 @@  discard block
 block discarded – undo
3463 3463
 		$selected_input_value = '';
3464 3464
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
3465 3465
 			if ($selected > 0) {
3466
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3466
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3467 3467
 				$producttmpselect = new Product($this->db);
3468 3468
 				$producttmpselect->fetch($selected);
3469 3469
 				$selected_input_value = $producttmpselect->ref;
@@ -3471,10 +3471,10 @@  discard block
 block discarded – undo
3471 3471
 			}
3472 3472
 
3473 3473
 			// mode=2 means suppliers products
3474
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
3475
-			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
3474
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
3475
+			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
3476 3476
 
3477
-			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="minwidth300" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>';
3477
+			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
3478 3478
 		} else {
3479 3479
 			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
3480 3480
 		}
@@ -3534,25 +3534,25 @@  discard block
 block discarded – undo
3534 3534
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3535 3535
 			$sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units";
3536 3536
 		}
3537
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3538
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
3537
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3538
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
3539 3539
 		if ($socid > 0) {
3540
-			$sql .= " AND pfp.fk_soc = " . ((int) $socid);
3540
+			$sql .= " AND pfp.fk_soc = ".((int) $socid);
3541 3541
 		}
3542
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3542
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3543 3543
 		// Units
3544 3544
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3545
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3545
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3546 3546
 		}
3547
-		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
3547
+		$sql .= " WHERE p.entity IN (".getEntity('product').")";
3548 3548
 		if ($statut != -1) {
3549
-			$sql .= " AND p.tobuy = " . ((int) $statut);
3549
+			$sql .= " AND p.tobuy = ".((int) $statut);
3550 3550
 		}
3551 3551
 		if (strval($filtertype) != '') {
3552
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3552
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3553 3553
 		}
3554 3554
 		if (!empty($filtre)) {
3555
-			$sql .= " " . $filtre;
3555
+			$sql .= " ".$filtre;
3556 3556
 		}
3557 3557
 		// Add where from hooks
3558 3558
 		$parameters = array();
@@ -3572,9 +3572,9 @@  discard block
 block discarded – undo
3572 3572
 				if ($i > 0) {
3573 3573
 					$sql .= " AND ";
3574 3574
 				}
3575
-				$sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3575
+				$sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3576 3576
 				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
3577
-					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3577
+					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3578 3578
 				}
3579 3579
 				$sql .= ")";
3580 3580
 				$i++;
@@ -3583,8 +3583,8 @@  discard block
 block discarded – undo
3583 3583
 				$sql .= ")";
3584 3584
 			}
3585 3585
 			if (isModEnabled('barcode')) {
3586
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3587
-				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3586
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3587
+				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3588 3588
 			}
3589 3589
 			$sql .= ')';
3590 3590
 		}
@@ -3593,20 +3593,20 @@  discard block
 block discarded – undo
3593 3593
 
3594 3594
 		// Build output string
3595 3595
 
3596
-		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
3596
+		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
3597 3597
 		$result = $this->db->query($sql);
3598 3598
 		if ($result) {
3599
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3600
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3599
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3600
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3601 3601
 
3602 3602
 			$num = $this->db->num_rows($result);
3603 3603
 
3604 3604
 			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
3605
-			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
3605
+			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
3606 3606
 			if (!$selected) {
3607
-				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3607
+				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3608 3608
 			} else {
3609
-				$out .= '<option value="-1">' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3609
+				$out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3610 3610
 			}
3611 3611
 
3612 3612
 			$i = 0;
@@ -3621,7 +3621,7 @@  discard block
 block discarded – undo
3621 3621
 
3622 3622
 				$outkey = $objp->idprodfournprice; // id in table of price
3623 3623
 				if (!$outkey && $alsoproductwithnosupplierprice) {
3624
-					$outkey = 'idprod_' . $objp->rowid; // id of product
3624
+					$outkey = 'idprod_'.$objp->rowid; // id of product
3625 3625
 				}
3626 3626
 
3627 3627
 				$outref = $objp->ref;
@@ -3636,23 +3636,23 @@  discard block
 block discarded – undo
3636 3636
 				$outvalUnits = '';
3637 3637
 				if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3638 3638
 					if (!empty($objp->unit_short)) {
3639
-						$outvalUnits .= ' - ' . $objp->unit_short;
3639
+						$outvalUnits .= ' - '.$objp->unit_short;
3640 3640
 					}
3641 3641
 					if (!empty($objp->weight) && $objp->weight_units !== null) {
3642 3642
 						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3643
-						$outvalUnits .= ' - ' . $unitToShow;
3643
+						$outvalUnits .= ' - '.$unitToShow;
3644 3644
 					}
3645 3645
 					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3646
-						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3647
-						$outvalUnits .= ' - ' . $unitToShow;
3646
+						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3647
+						$outvalUnits .= ' - '.$unitToShow;
3648 3648
 					}
3649 3649
 					if (!empty($objp->surface) && $objp->surface_units !== null) {
3650 3650
 						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3651
-						$outvalUnits .= ' - ' . $unitToShow;
3651
+						$outvalUnits .= ' - '.$unitToShow;
3652 3652
 					}
3653 3653
 					if (!empty($objp->volume) && $objp->volume_units !== null) {
3654 3654
 						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3655
-						$outvalUnits .= ' - ' . $unitToShow;
3655
+						$outvalUnits .= ' - '.$unitToShow;
3656 3656
 					}
3657 3657
 					if ($outdurationvalue && $outdurationunit) {
3658 3658
 						$da = array(
@@ -3663,22 +3663,22 @@  discard block
 block discarded – undo
3663 3663
 							'y' => $langs->trans('Year')
3664 3664
 						);
3665 3665
 						if (isset($da[$outdurationunit])) {
3666
-							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3666
+							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3667 3667
 						}
3668 3668
 					}
3669 3669
 				}
3670 3670
 
3671 3671
 				$objRef = $objp->ref;
3672 3672
 				if ($filterkey && $filterkey != '') {
3673
-					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3673
+					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3674 3674
 				}
3675 3675
 				$objRefFourn = $objp->ref_fourn;
3676 3676
 				if ($filterkey && $filterkey != '') {
3677
-					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
3677
+					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1);
3678 3678
 				}
3679 3679
 				$label = $objp->label;
3680 3680
 				if ($filterkey && $filterkey != '') {
3681
-					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3681
+					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3682 3682
 				}
3683 3683
 
3684 3684
 				switch ($objp->fk_product_type) {
@@ -3701,21 +3701,21 @@  discard block
 block discarded – undo
3701 3701
 
3702 3702
 				$optlabel .= $objp->ref;
3703 3703
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3704
-					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
3704
+					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>';
3705 3705
 				}
3706 3706
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3707
-					$optlabel .= ' (' . $outbarcode . ')';
3707
+					$optlabel .= ' ('.$outbarcode.')';
3708 3708
 				}
3709
-				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3709
+				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3710 3710
 
3711 3711
 				$outvallabel = $objRef;
3712 3712
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3713
-					$outvallabel .= ' (' . $objRefFourn . ')';
3713
+					$outvallabel .= ' ('.$objRefFourn.')';
3714 3714
 				}
3715 3715
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3716
-					$outvallabel .= ' (' . $outbarcode . ')';
3716
+					$outvallabel .= ' ('.$outbarcode.')';
3717 3717
 				}
3718
-				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3718
+				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3719 3719
 
3720 3720
 				// Units
3721 3721
 				$optlabel .= $outvalUnits;
@@ -3732,7 +3732,7 @@  discard block
 block discarded – undo
3732 3732
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3733 3733
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3734 3734
 
3735
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3735
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3736 3736
 						$priceparser = new PriceParser($this->db);
3737 3737
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3738 3738
 						if ($price_result >= 0) {
@@ -3743,57 +3743,57 @@  discard block
 block discarded – undo
3743 3743
 						}
3744 3744
 					}
3745 3745
 					if ($objp->quantity == 1) {
3746
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3747
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
3746
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3747
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
3748 3748
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3749 3749
 						$outvallabel .= $langs->transnoentities("Unit");
3750 3750
 					} else {
3751
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3752
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3753
-						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3754
-						$outvallabel .= ' ' . $langs->transnoentities("Units");
3751
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3752
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3753
+						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3754
+						$outvallabel .= ' '.$langs->transnoentities("Units");
3755 3755
 					}
3756 3756
 
3757 3757
 					if ($objp->quantity > 1) {
3758
-						$optlabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3759
-						$outvallabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3758
+						$optlabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3759
+						$outvallabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3760 3760
 					}
3761 3761
 					if ($objp->remise_percent >= 1) {
3762
-						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3763
-						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3762
+						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3763
+						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3764 3764
 					}
3765 3765
 					if ($objp->duration) {
3766
-						$optlabel .= " - " . $objp->duration;
3767
-						$outvallabel .= " - " . $objp->duration;
3766
+						$optlabel .= " - ".$objp->duration;
3767
+						$outvallabel .= " - ".$objp->duration;
3768 3768
 					}
3769 3769
 					if (!$socid) {
3770
-						$optlabel .= " - " . dol_trunc($objp->name, 8);
3771
-						$outvallabel .= " - " . dol_trunc($objp->name, 8);
3770
+						$optlabel .= " - ".dol_trunc($objp->name, 8);
3771
+						$outvallabel .= " - ".dol_trunc($objp->name, 8);
3772 3772
 					}
3773 3773
 					if ($objp->supplier_reputation) {
3774 3774
 						//TODO dictionary
3775 3775
 						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
3776 3776
 
3777
-						$optlabel .= " - " . $reputations[$objp->supplier_reputation];
3778
-						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
3777
+						$optlabel .= " - ".$reputations[$objp->supplier_reputation];
3778
+						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];
3779 3779
 					}
3780 3780
 				} else {
3781
-					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
3782
-					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
3781
+					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
3782
+					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
3783 3783
 				}
3784 3784
 
3785 3785
 				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3786 3786
 					$novirtualstock = ($showstockinlist == 2);
3787 3787
 
3788 3788
 					if ($user->hasRight('stock', 'lire')) {
3789
-						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3789
+						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
3790 3790
 
3791 3791
 						if ($objp->stock > 0) {
3792 3792
 							$optlabel .= ' - <span class="product_line_stock_ok">';
3793 3793
 						} elseif ($objp->stock <= 0) {
3794 3794
 							$optlabel .= ' - <span class="product_line_stock_too_low">';
3795 3795
 						}
3796
-						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
3796
+						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
3797 3797
 						$optlabel .= '</span>';
3798 3798
 						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
3799 3799
 							$langs->load("stocks");
@@ -3803,9 +3803,9 @@  discard block
 block discarded – undo
3803 3803
 							$tmpproduct->load_virtual_stock();
3804 3804
 							$virtualstock = $tmpproduct->stock_theorique;
3805 3805
 
3806
-							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3806
+							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3807 3807
 
3808
-							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3808
+							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
3809 3809
 							if ($virtualstock > 0) {
3810 3810
 								$optlabel .= '<span class="product_line_stock_ok">';
3811 3811
 							} elseif ($virtualstock <= 0) {
@@ -3819,7 +3819,7 @@  discard block
 block discarded – undo
3819 3819
 					}
3820 3820
 				}
3821 3821
 
3822
-				$optstart = '<option value="' . $outkey . '"';
3822
+				$optstart = '<option value="'.$outkey.'"';
3823 3823
 				if ($selected && $selected == $objp->idprodfournprice) {
3824 3824
 					$optstart .= ' selected';
3825 3825
 				}
@@ -3828,31 +3828,31 @@  discard block
 block discarded – undo
3828 3828
 				}
3829 3829
 
3830 3830
 				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
3831
-					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
3832
-					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
3833
-					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
3834
-					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
3835
-					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
3836
-					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
3837
-					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
3838
-					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
3839
-					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
3840
-					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
3831
+					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
3832
+					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
3833
+					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
3834
+					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
3835
+					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
3836
+					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
3837
+					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
3838
+					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
3839
+					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
3840
+					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';
3841 3841
 					if (isModEnabled('multicurrency')) {
3842
-						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
3843
-						$optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
3842
+						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';
3843
+						$optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';
3844 3844
 					}
3845 3845
 				}
3846
-				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
3846
+				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
3847 3847
 
3848 3848
 				$outarrayentry = array(
3849 3849
 					'key' => $outkey,
3850 3850
 					'value' => $outref,
3851 3851
 					'label' => $outvallabel,
3852 3852
 					'qty' => $outqty,
3853
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty
3854
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
3855
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
3853
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
3854
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
3855
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
3856 3856
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
3857 3857
 					'tva_tx' => price2num($objp->tva_tx),
3858 3858
 					'default_vat_code' => $objp->default_vat_code,
@@ -3881,17 +3881,17 @@  discard block
 block discarded – undo
3881 3881
 				// Add new entry
3882 3882
 				// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
3883 3883
 				// "label" value of json key array is used by jQuery automatically as text for combo box
3884
-				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
3884
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
3885 3885
 				$outarraypush = array(
3886 3886
 					'key' => $outkey,
3887 3887
 					'value' => $outref,
3888 3888
 					'label' => $outvallabel,
3889 3889
 					'qty' => $outqty,
3890
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty
3890
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
3891 3891
 					'price_qty_ht_locale' => price($objp->fprice),
3892
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
3892
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
3893 3893
 					'price_unit_ht_locale' => price($objp->unitprice),
3894
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
3894
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
3895 3895
 					'tva_tx_formated' => price($objp->tva_tx),
3896 3896
 					'tva_tx' => price2num($objp->tva_tx),
3897 3897
 					'default_vat_code' => $objp->default_vat_code,
@@ -3923,7 +3923,7 @@  discard block
 block discarded – undo
3923 3923
 
3924 3924
 			$this->db->free($result);
3925 3925
 
3926
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
3926
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
3927 3927
 			$out .= ajax_combobox($htmlname);
3928 3928
 		} else {
3929 3929
 			dol_print_error($this->db);
@@ -3955,43 +3955,43 @@  discard block
 block discarded – undo
3955 3955
 		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
3956 3956
 		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
3957 3957
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
3958
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3959
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3960
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3961
-		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
3958
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3959
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3960
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3961
+		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
3962 3962
 		$sql .= " AND p.tobuy = 1";
3963 3963
 		$sql .= " AND s.fournisseur = 1";
3964
-		$sql .= " AND p.rowid = " . ((int) $productid);
3964
+		$sql .= " AND p.rowid = ".((int) $productid);
3965 3965
 		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) {
3966 3966
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
3967 3967
 		} else {
3968 3968
 			$sql .= " ORDER BY pfp.unitprice ASC";
3969 3969
 		}
3970 3970
 
3971
-		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
3971
+		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
3972 3972
 		$result = $this->db->query($sql);
3973 3973
 
3974 3974
 		if ($result) {
3975 3975
 			$num = $this->db->num_rows($result);
3976 3976
 
3977
-			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
3977
+			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
3978 3978
 
3979 3979
 			if (!$num) {
3980
-				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
3980
+				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
3981 3981
 			} else {
3982
-				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3982
+				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3983 3983
 				$form .= '<option value="0">&nbsp;</option>';
3984 3984
 
3985 3985
 				$i = 0;
3986 3986
 				while ($i < $num) {
3987 3987
 					$objp = $this->db->fetch_object($result);
3988 3988
 
3989
-					$opt = '<option value="' . $objp->idprodfournprice . '"';
3989
+					$opt = '<option value="'.$objp->idprodfournprice.'"';
3990 3990
 					//if there is only one supplier, preselect it
3991 3991
 					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) {
3992 3992
 						$opt .= ' selected';
3993 3993
 					}
3994
-					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
3994
+					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
3995 3995
 
3996 3996
 					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) {
3997 3997
 						$prod_supplier = new ProductFournisseur($this->db);
@@ -4001,7 +4001,7 @@  discard block
 block discarded – undo
4001 4001
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
4002 4002
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
4003 4003
 
4004
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4004
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4005 4005
 						$priceparser = new PriceParser($this->db);
4006 4006
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
4007 4007
 						if ($price_result >= 0) {
@@ -4012,10 +4012,10 @@  discard block
 block discarded – undo
4012 4012
 						}
4013 4013
 					}
4014 4014
 					if ($objp->quantity == 1) {
4015
-						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
4015
+						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
4016 4016
 					}
4017 4017
 
4018
-					$opt .= $objp->quantity . ' ';
4018
+					$opt .= $objp->quantity.' ';
4019 4019
 
4020 4020
 					if ($objp->quantity == 1) {
4021 4021
 						$opt .= $langs->trans("Unit");
@@ -4024,10 +4024,10 @@  discard block
 block discarded – undo
4024 4024
 					}
4025 4025
 					if ($objp->quantity > 1) {
4026 4026
 						$opt .= " - ";
4027
-						$opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit");
4027
+						$opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit");
4028 4028
 					}
4029 4029
 					if ($objp->duration) {
4030
-						$opt .= " - " . $objp->duration;
4030
+						$opt .= " - ".$objp->duration;
4031 4031
 					}
4032 4032
 					$opt .= "</option>\n";
4033 4033
 
@@ -4065,8 +4065,8 @@  discard block
 block discarded – undo
4065 4065
 		dol_syslog(__METHOD__, LOG_DEBUG);
4066 4066
 
4067 4067
 		$sql = "SELECT rowid, code, libelle as label, deposit_percent";
4068
-		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
4069
-		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
4068
+		$sql .= " FROM ".$this->db->prefix().'c_payment_term';
4069
+		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
4070 4070
 		$sql .= " AND active > 0";
4071 4071
 		$sql .= " ORDER BY sortorder";
4072 4072
 
@@ -4078,7 +4078,7 @@  discard block
 block discarded – undo
4078 4078
 				$obj = $this->db->fetch_object($resql);
4079 4079
 
4080 4080
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4081
-				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4081
+				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4082 4082
 				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
4083 4083
 				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
4084 4084
 				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -4106,7 +4106,7 @@  discard block
 block discarded – undo
4106 4106
 		// phpcs:enable
4107 4107
 		global $langs;
4108 4108
 
4109
-		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4109
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4110 4110
 		if ($num > 0) {
4111 4111
 			return 0; // Cache already loaded
4112 4112
 		}
@@ -4116,7 +4116,7 @@  discard block
 block discarded – undo
4116 4116
 		$langs->load('propal');
4117 4117
 
4118 4118
 		$sql = "SELECT rowid, code, label, position";
4119
-		$sql .= " FROM " . $this->db->prefix() . 'c_availability';
4119
+		$sql .= " FROM ".$this->db->prefix().'c_availability';
4120 4120
 		$sql .= " WHERE active > 0";
4121 4121
 
4122 4122
 		$resql = $this->db->query($sql);
@@ -4127,7 +4127,7 @@  discard block
 block discarded – undo
4127 4127
 				$obj = $this->db->fetch_object($resql);
4128 4128
 
4129 4129
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4130
-				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4130
+				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4131 4131
 				$this->cache_availability[$obj->rowid]['code'] = $obj->code;
4132 4132
 				$this->cache_availability[$obj->rowid]['label'] = $label;
4133 4133
 				$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -4159,17 +4159,17 @@  discard block
 block discarded – undo
4159 4159
 
4160 4160
 		$this->load_cache_availability();
4161 4161
 
4162
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4162
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4163 4163
 
4164
-		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4164
+		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4165 4165
 		if ($addempty) {
4166 4166
 			print '<option value="0">&nbsp;</option>';
4167 4167
 		}
4168 4168
 		foreach ($this->cache_availability as $id => $arrayavailability) {
4169 4169
 			if ($selected == $id) {
4170
-				print '<option value="' . $id . '" selected>';
4170
+				print '<option value="'.$id.'" selected>';
4171 4171
 			} else {
4172
-				print '<option value="' . $id . '">';
4172
+				print '<option value="'.$id.'">';
4173 4173
 			}
4174 4174
 			print dol_escape_htmltag($arrayavailability['label']);
4175 4175
 			print '</option>';
@@ -4190,13 +4190,13 @@  discard block
 block discarded – undo
4190 4190
 	{
4191 4191
 		global $langs;
4192 4192
 
4193
-		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4193
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4194 4194
 		if ($num > 0) {
4195 4195
 			return 0; // Cache already loaded
4196 4196
 		}
4197 4197
 
4198 4198
 		$sql = "SELECT rowid, code, label";
4199
-		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
4199
+		$sql .= " FROM ".$this->db->prefix().'c_input_reason';
4200 4200
 		$sql .= " WHERE active > 0";
4201 4201
 
4202 4202
 		$resql = $this->db->query($sql);
@@ -4209,8 +4209,8 @@  discard block
 block discarded – undo
4209 4209
 
4210 4210
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4211 4211
 				$label = ($obj->label != '-' ? $obj->label : '');
4212
-				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) {
4213
-					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4212
+				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) {
4213
+					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4214 4214
 				}
4215 4215
 				if ($langs->trans($obj->code) != $obj->code) {
4216 4216
 					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
@@ -4250,9 +4250,9 @@  discard block
 block discarded – undo
4250 4250
 
4251 4251
 		$this->loadCacheInputReason();
4252 4252
 
4253
-		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4253
+		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4254 4254
 		if ($addempty) {
4255
-			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
4255
+			print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
4256 4256
 		}
4257 4257
 		foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
4258 4258
 			if ($arraydemandreason['code'] == $exclude) {
@@ -4260,9 +4260,9 @@  discard block
 block discarded – undo
4260 4260
 			}
4261 4261
 
4262 4262
 			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
4263
-				print '<option value="' . $arraydemandreason['id'] . '" selected>';
4263
+				print '<option value="'.$arraydemandreason['id'].'" selected>';
4264 4264
 			} else {
4265
-				print '<option value="' . $arraydemandreason['id'] . '">';
4265
+				print '<option value="'.$arraydemandreason['id'].'">';
4266 4266
 			}
4267 4267
 			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
4268 4268
 			print $langs->trans($label);
@@ -4272,7 +4272,7 @@  discard block
 block discarded – undo
4272 4272
 		if ($user->admin && empty($notooltip)) {
4273 4273
 			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4274 4274
 		}
4275
-		print ajax_combobox('select_' . $htmlname);
4275
+		print ajax_combobox('select_'.$htmlname);
4276 4276
 	}
4277 4277
 
4278 4278
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -4287,7 +4287,7 @@  discard block
 block discarded – undo
4287 4287
 		// phpcs:enable
4288 4288
 		global $langs;
4289 4289
 
4290
-		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4290
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4291 4291
 		if ($num > 0) {
4292 4292
 			return $num; // Cache already loaded
4293 4293
 		}
@@ -4297,8 +4297,8 @@  discard block
 block discarded – undo
4297 4297
 		$this->cache_types_paiements = array();
4298 4298
 
4299 4299
 		$sql = "SELECT id, code, libelle as label, type, active";
4300
-		$sql .= " FROM " . $this->db->prefix() . "c_paiement";
4301
-		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
4300
+		$sql .= " FROM ".$this->db->prefix()."c_paiement";
4301
+		$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
4302 4302
 
4303 4303
 		$resql = $this->db->query($sql);
4304 4304
 		if ($resql) {
@@ -4308,7 +4308,7 @@  discard block
 block discarded – undo
4308 4308
 				$obj = $this->db->fetch_object($resql);
4309 4309
 
4310 4310
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4311
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4311
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4312 4312
 				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;
4313 4313
 				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;
4314 4314
 				$this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -4380,17 +4380,17 @@  discard block
 block discarded – undo
4380 4380
 		global $langs, $user, $conf;
4381 4381
 
4382 4382
 		$out = '';
4383
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4383
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4384 4384
 
4385 4385
 		$this->load_cache_conditions_paiements();
4386 4386
 
4387 4387
 		// Set default value if not already set by caller
4388 4388
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
4389
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4389
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4390 4390
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
4391 4391
 		}
4392 4392
 
4393
-		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4393
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4394 4394
 		if ($addempty) {
4395 4395
 			$out .= '<option value="0">&nbsp;</option>';
4396 4396
 		}
@@ -4404,9 +4404,9 @@  discard block
 block discarded – undo
4404 4404
 
4405 4405
 			if ($selected == $id) {
4406 4406
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4407
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4407
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4408 4408
 			} else {
4409
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4409
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4410 4410
 			}
4411 4411
 			$label = $arrayconditions['label'];
4412 4412
 
@@ -4424,21 +4424,21 @@  discard block
 block discarded – undo
4424 4424
 		$out .= ajax_combobox($htmlname);
4425 4425
 
4426 4426
 		if ($deposit_percent >= 0) {
4427
-			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4428
-			$out .= $langs->trans('DepositPercent') . ' : ';
4429
-			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';
4427
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4428
+			$out .= $langs->trans('DepositPercent').' : ';
4429
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';
4430 4430
 			$out .= '</span>';
4431 4431
 			$out .= '
4432
-				<script nonce="' . getNonce() . '">
4432
+				<script nonce="' . getNonce().'">
4433 4433
 					$(document).ready(function () {
4434
-						$("#' . $htmlname . '").change(function () {
4434
+						$("#' . $htmlname.'").change(function () {
4435 4435
 							let $selected = $(this).find("option:selected");
4436 4436
 							let depositPercent = $selected.attr("data-deposit_percent");
4437 4437
 
4438 4438
 							if (depositPercent.length > 0) {
4439
-								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
4439
+								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent);
4440 4440
 							} else {
4441
-								$("#' . $htmlname . '_deposit_percent_container").hide();
4441
+								$("#' . $htmlname.'_deposit_percent_container").hide();
4442 4442
 							}
4443 4443
 
4444 4444
 							return true;
@@ -4476,7 +4476,7 @@  discard block
 block discarded – undo
4476 4476
 
4477 4477
 		$out = '';
4478 4478
 
4479
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
4479
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
4480 4480
 
4481 4481
 		$filterarray = array();
4482 4482
 		if ($filtertype == 'CRDT') {
@@ -4491,11 +4491,11 @@  discard block
 block discarded – undo
4491 4491
 
4492 4492
 		// Set default value if not already set by caller
4493 4493
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) {
4494
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4494
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4495 4495
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID');
4496 4496
 		}
4497 4497
 
4498
-		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4498
+		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4499 4499
 		if ($empty) {
4500 4500
 			$out .= '<option value="">&nbsp;</option>';
4501 4501
 		}
@@ -4516,13 +4516,13 @@  discard block
 block discarded – undo
4516 4516
 			}
4517 4517
 
4518 4518
 			if ($format == 0) {
4519
-				$out .= '<option value="' . $id . '"';
4519
+				$out .= '<option value="'.$id.'"';
4520 4520
 			} elseif ($format == 1) {
4521
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4521
+				$out .= '<option value="'.$arraytypes['code'].'"';
4522 4522
 			} elseif ($format == 2) {
4523
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4523
+				$out .= '<option value="'.$arraytypes['code'].'"';
4524 4524
 			} elseif ($format == 3) {
4525
-				$out .= '<option value="' . $id . '"';
4525
+				$out .= '<option value="'.$id.'"';
4526 4526
 			}
4527 4527
 			// Print attribute selected or not
4528 4528
 			if ($format == 1 || $format == 2) {
@@ -4552,7 +4552,7 @@  discard block
 block discarded – undo
4552 4552
 		if ($user->admin && !$noadmininfo) {
4553 4553
 			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4554 4554
 		}
4555
-		$out .= ajax_combobox('select' . $htmlname);
4555
+		$out .= ajax_combobox('select'.$htmlname);
4556 4556
 
4557 4557
 		if (empty($nooutput)) {
4558 4558
 			print $out;
@@ -4574,22 +4574,22 @@  discard block
 block discarded – undo
4574 4574
 	{
4575 4575
 		global $langs;
4576 4576
 
4577
-		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4577
+		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4578 4578
 		$options = array(
4579 4579
 			'HT' => $langs->trans("HT"),
4580 4580
 			'TTC' => $langs->trans("TTC")
4581 4581
 		);
4582 4582
 		foreach ($options as $id => $value) {
4583 4583
 			if ($selected == $id) {
4584
-				$return .= '<option value="' . $id . '" selected>' . $value;
4584
+				$return .= '<option value="'.$id.'" selected>'.$value;
4585 4585
 			} else {
4586
-				$return .= '<option value="' . $id . '">' . $value;
4586
+				$return .= '<option value="'.$id.'">'.$value;
4587 4587
 			}
4588 4588
 			$return .= '</option>';
4589 4589
 		}
4590 4590
 		$return .= '</select>';
4591 4591
 		if ($addjscombo) {
4592
-			$return .= ajax_combobox('select_' . $htmlname);
4592
+			$return .= ajax_combobox('select_'.$htmlname);
4593 4593
 		}
4594 4594
 
4595 4595
 		return $return;
@@ -4607,7 +4607,7 @@  discard block
 block discarded – undo
4607 4607
 		// phpcs:enable
4608 4608
 		global $langs;
4609 4609
 
4610
-		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4610
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4611 4611
 		if ($num > 0) {
4612 4612
 			return $num; // Cache already loaded
4613 4613
 		}
@@ -4617,8 +4617,8 @@  discard block
 block discarded – undo
4617 4617
 		$this->cache_transport_mode = array();
4618 4618
 
4619 4619
 		$sql = "SELECT rowid, code, label, active";
4620
-		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";
4621
-		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")";
4620
+		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
4621
+		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
4622 4622
 
4623 4623
 		$resql = $this->db->query($sql);
4624 4624
 		if ($resql) {
@@ -4628,7 +4628,7 @@  discard block
 block discarded – undo
4628 4628
 				$obj = $this->db->fetch_object($resql);
4629 4629
 
4630 4630
 				// If traduction exist, we use it else we take the default label
4631
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4631
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4632 4632
 				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
4633 4633
 				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
4634 4634
 				$this->cache_transport_mode[$obj->rowid]['label'] = $label;
@@ -4662,11 +4662,11 @@  discard block
 block discarded – undo
4662 4662
 	{
4663 4663
 		global $langs, $user;
4664 4664
 
4665
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);
4665
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
4666 4666
 
4667 4667
 		$this->load_cache_transport_mode();
4668 4668
 
4669
-		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4669
+		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4670 4670
 		if ($empty) {
4671 4671
 			print '<option value="">&nbsp;</option>';
4672 4672
 		}
@@ -4682,13 +4682,13 @@  discard block
 block discarded – undo
4682 4682
 			}
4683 4683
 
4684 4684
 			if ($format == 0) {
4685
-				print '<option value="' . $id . '"';
4685
+				print '<option value="'.$id.'"';
4686 4686
 			} elseif ($format == 1) {
4687
-				print '<option value="' . $arraytypes['code'] . '"';
4687
+				print '<option value="'.$arraytypes['code'].'"';
4688 4688
 			} elseif ($format == 2) {
4689
-				print '<option value="' . $arraytypes['code'] . '"';
4689
+				print '<option value="'.$arraytypes['code'].'"';
4690 4690
 			} elseif ($format == 3) {
4691
-				print '<option value="' . $id . '"';
4691
+				print '<option value="'.$id.'"';
4692 4692
 			}
4693 4693
 			// If text is selected, we compare with code, else with id
4694 4694
 			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
@@ -4736,31 +4736,31 @@  discard block
 block discarded – undo
4736 4736
 		$langs->load("deliveries");
4737 4737
 
4738 4738
 		$sql = "SELECT rowid, code, libelle as label";
4739
-		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";
4739
+		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
4740 4740
 		$sql .= " WHERE active > 0";
4741 4741
 		if ($filtre) {
4742
-			$sql .= " AND " . $filtre;
4742
+			$sql .= " AND ".$filtre;
4743 4743
 		}
4744 4744
 		$sql .= " ORDER BY libelle ASC";
4745 4745
 
4746
-		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
4746
+		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
4747 4747
 		$result = $this->db->query($sql);
4748 4748
 		if ($result) {
4749 4749
 			$num = $this->db->num_rows($result);
4750 4750
 			$i = 0;
4751 4751
 			if ($num) {
4752
-				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4752
+				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4753 4753
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4754 4754
 					print '<option value="-1">&nbsp;</option>';
4755 4755
 				}
4756 4756
 				while ($i < $num) {
4757 4757
 					$obj = $this->db->fetch_object($result);
4758 4758
 					if ($selected == $obj->rowid) {
4759
-						print '<option value="' . $obj->rowid . '" selected>';
4759
+						print '<option value="'.$obj->rowid.'" selected>';
4760 4760
 					} else {
4761
-						print '<option value="' . $obj->rowid . '">';
4761
+						print '<option value="'.$obj->rowid.'">';
4762 4762
 					}
4763
-					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
4763
+					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
4764 4764
 					print '</option>';
4765 4765
 					$i++;
4766 4766
 				}
@@ -4769,7 +4769,7 @@  discard block
 block discarded – undo
4769 4769
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4770 4770
 				}
4771 4771
 
4772
-				print ajax_combobox('select' . $htmlname);
4772
+				print ajax_combobox('select'.$htmlname);
4773 4773
 			} else {
4774 4774
 				print $langs->trans("NoShippingMethodDefined");
4775 4775
 			}
@@ -4794,16 +4794,16 @@  discard block
 block discarded – undo
4794 4794
 		$langs->load("deliveries");
4795 4795
 
4796 4796
 		if ($htmlname != "none") {
4797
-			print '<form method="POST" action="' . $page . '">';
4797
+			print '<form method="POST" action="'.$page.'">';
4798 4798
 			print '<input type="hidden" name="action" value="setshippingmethod">';
4799
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
4799
+			print '<input type="hidden" name="token" value="'.newToken().'">';
4800 4800
 			$this->selectShippingMethod($selected, $htmlname, '', $addempty);
4801
-			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4801
+			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4802 4802
 			print '</form>';
4803 4803
 		} else {
4804 4804
 			if ($selected) {
4805 4805
 				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
4806
-				print $langs->trans("SendingMethod" . strtoupper($code));
4806
+				print $langs->trans("SendingMethod".strtoupper($code));
4807 4807
 			} else {
4808 4808
 				print "&nbsp;";
4809 4809
 			}
@@ -4826,10 +4826,10 @@  discard block
 block discarded – undo
4826 4826
 
4827 4827
 		$opt = '<option value="" selected></option>';
4828 4828
 		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
4829
-		$sql .= ' FROM ' . $this->db->prefix() . 'facture';
4830
-		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
4829
+		$sql .= ' FROM '.$this->db->prefix().'facture';
4830
+		$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
4831 4831
 		$sql .= ' AND situation_counter >= 1';
4832
-		$sql .= ' AND fk_soc = ' . (int) $socid;
4832
+		$sql .= ' AND fk_soc = '.(int) $socid;
4833 4833
 		$sql .= ' AND type <> 2';
4834 4834
 		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
4835 4835
 		$resql = $this->db->query($sql);
@@ -4847,19 +4847,19 @@  discard block
 block discarded – undo
4847 4847
 						//Not prov?
4848 4848
 						if (substr($obj->ref, 1, 4) != 'PROV') {
4849 4849
 							if ($selected == $obj->rowid) {
4850
-								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
4850
+								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
4851 4851
 							} else {
4852
-								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
4852
+								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
4853 4853
 							}
4854 4854
 						}
4855 4855
 					}
4856 4856
 				}
4857 4857
 			}
4858 4858
 		} else {
4859
-			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
4859
+			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
4860 4860
 		}
4861 4861
 		if ($opt == '<option value ="" selected></option>') {
4862
-			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
4862
+			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
4863 4863
 		}
4864 4864
 		return $opt;
4865 4865
 	}
@@ -4879,12 +4879,12 @@  discard block
 block discarded – undo
4879 4879
 
4880 4880
 		$langs->load('products');
4881 4881
 
4882
-		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
4882
+		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
4883 4883
 
4884
-		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";
4884
+		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
4885 4885
 		$sql .= ' WHERE active > 0';
4886 4886
 		if (!empty($unit_type)) {
4887
-			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";
4887
+			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
4888 4888
 		}
4889 4889
 		$sql .= " ORDER BY sortorder";
4890 4890
 
@@ -4896,14 +4896,14 @@  discard block
 block discarded – undo
4896 4896
 
4897 4897
 			while ($res = $this->db->fetch_object($resql)) {
4898 4898
 				$unitLabel = $res->label;
4899
-				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before
4900
-					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
4899
+				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before
4900
+					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
4901 4901
 				}
4902 4902
 
4903 4903
 				if ($selected == $res->rowid) {
4904
-					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
4904
+					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
4905 4905
 				} else {
4906
-					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
4906
+					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
4907 4907
 				}
4908 4908
 			}
4909 4909
 			$return .= '</select>';
@@ -4938,23 +4938,23 @@  discard block
 block discarded – undo
4938 4938
 		$num = 0;
4939 4939
 
4940 4940
 		$sql = "SELECT rowid, label, bank, clos as status, currency_code";
4941
-		$sql .= " FROM " . $this->db->prefix() . "bank_account";
4942
-		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
4941
+		$sql .= " FROM ".$this->db->prefix()."bank_account";
4942
+		$sql .= " WHERE entity IN (".getEntity('bank_account').")";
4943 4943
 		if ($status != 2) {
4944
-			$sql .= " AND clos = " . (int) $status;
4944
+			$sql .= " AND clos = ".(int) $status;
4945 4945
 		}
4946 4946
 		if ($filtre) {	// TODO Support USF
4947
-			$sql .= " AND " . $filtre;
4947
+			$sql .= " AND ".$filtre;
4948 4948
 		}
4949 4949
 		$sql .= " ORDER BY label";
4950 4950
 
4951
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
4951
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
4952 4952
 		$result = $this->db->query($sql);
4953 4953
 		if ($result) {
4954 4954
 			$num = $this->db->num_rows($result);
4955 4955
 			$i = 0;
4956 4956
 			if ($num) {
4957
-				$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4957
+				$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4958 4958
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4959 4959
 					$out .= '<option value="-1">&nbsp;</option>';
4960 4960
 				}
@@ -4962,27 +4962,27 @@  discard block
 block discarded – undo
4962 4962
 				while ($i < $num) {
4963 4963
 					$obj = $this->db->fetch_object($result);
4964 4964
 					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
4965
-						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';
4965
+						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';
4966 4966
 					} else {
4967
-						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';
4967
+						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';
4968 4968
 					}
4969 4969
 					$out .= trim($obj->label);
4970 4970
 					if ($showcurrency) {
4971
-						$out .= ' (' . $obj->currency_code . ')';
4971
+						$out .= ' ('.$obj->currency_code.')';
4972 4972
 					}
4973 4973
 					if ($status == 2 && $obj->status == 1) {
4974
-						$out .= ' (' . $langs->trans("Closed") . ')';
4974
+						$out .= ' ('.$langs->trans("Closed").')';
4975 4975
 					}
4976 4976
 					$out .= '</option>';
4977 4977
 					$i++;
4978 4978
 				}
4979 4979
 				$out .= "</select>";
4980
-				$out .= ajax_combobox('select' . $htmlname);
4980
+				$out .= ajax_combobox('select'.$htmlname);
4981 4981
 			} else {
4982 4982
 				if ($status == 0) {
4983
-					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
4983
+					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
4984 4984
 				} else {
4985
-					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>';
4985
+					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
4986 4986
 				}
4987 4987
 			}
4988 4988
 		} else {
@@ -5018,23 +5018,23 @@  discard block
 block discarded – undo
5018 5018
 		$num = 0;
5019 5019
 
5020 5020
 		$sql = "SELECT rowid, name, fk_country, status, entity";
5021
-		$sql .= " FROM " . $this->db->prefix() . "establishment";
5021
+		$sql .= " FROM ".$this->db->prefix()."establishment";
5022 5022
 		$sql .= " WHERE 1=1";
5023 5023
 		if ($status != 2) {
5024
-			$sql .= " AND status = " . (int) $status;
5024
+			$sql .= " AND status = ".(int) $status;
5025 5025
 		}
5026 5026
 		if ($filtre) {	// TODO Support USF
5027
-			$sql .= " AND " . $filtre;
5027
+			$sql .= " AND ".$filtre;
5028 5028
 		}
5029 5029
 		$sql .= " ORDER BY name";
5030 5030
 
5031
-		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);
5031
+		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
5032 5032
 		$result = $this->db->query($sql);
5033 5033
 		if ($result) {
5034 5034
 			$num = $this->db->num_rows($result);
5035 5035
 			$i = 0;
5036 5036
 			if ($num) {
5037
-				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5037
+				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5038 5038
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5039 5039
 					print '<option value="-1">&nbsp;</option>';
5040 5040
 				}
@@ -5042,13 +5042,13 @@  discard block
 block discarded – undo
5042 5042
 				while ($i < $num) {
5043 5043
 					$obj = $this->db->fetch_object($result);
5044 5044
 					if ($selected == $obj->rowid) {
5045
-						print '<option value="' . $obj->rowid . '" selected>';
5045
+						print '<option value="'.$obj->rowid.'" selected>';
5046 5046
 					} else {
5047
-						print '<option value="' . $obj->rowid . '">';
5047
+						print '<option value="'.$obj->rowid.'">';
5048 5048
 					}
5049 5049
 					print trim($obj->name);
5050 5050
 					if ($status == 2 && $obj->status == 1) {
5051
-						print ' (' . $langs->trans("Closed") . ')';
5051
+						print ' ('.$langs->trans("Closed").')';
5052 5052
 					}
5053 5053
 					print '</option>';
5054 5054
 					$i++;
@@ -5056,9 +5056,9 @@  discard block
 block discarded – undo
5056 5056
 				print "</select>";
5057 5057
 			} else {
5058 5058
 				if ($status == 0) {
5059
-					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>';
5059
+					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
5060 5060
 				} else {
5061
-					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>';
5061
+					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
5062 5062
 				}
5063 5063
 			}
5064 5064
 
@@ -5082,20 +5082,20 @@  discard block
 block discarded – undo
5082 5082
 	{
5083 5083
 		global $langs;
5084 5084
 		if ($htmlname != "none") {
5085
-			print '<form method="POST" action="' . $page . '">';
5085
+			print '<form method="POST" action="'.$page.'">';
5086 5086
 			print '<input type="hidden" name="action" value="setbankaccount">';
5087
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5087
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5088 5088
 			print img_picto('', 'bank_account', 'class="pictofixedwidth"');
5089 5089
 			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
5090 5090
 			if ($nbaccountfound > 0) {
5091
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5091
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5092 5092
 			}
5093 5093
 			print '</form>';
5094 5094
 		} else {
5095 5095
 			$langs->load('banks');
5096 5096
 
5097 5097
 			if ($selected) {
5098
-				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
5098
+				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
5099 5099
 				$bankstatic = new Account($this->db);
5100 5100
 				$result = $bankstatic->fetch($selected);
5101 5101
 				if ($result) {
@@ -5134,19 +5134,19 @@  discard block
 block discarded – undo
5134 5134
 		global $conf, $langs;
5135 5135
 		$langs->load("categories");
5136 5136
 
5137
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5137
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5138 5138
 
5139 5139
 		// For backward compatibility
5140 5140
 		if (is_numeric($type)) {
5141
-			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5141
+			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5142 5142
 		}
5143 5143
 
5144 5144
 		if ($type === Categorie::TYPE_BANK_LINE) {
5145 5145
 			// TODO Move this into common category feature
5146 5146
 			$cate_arbo = array();
5147 5147
 			$sql = "SELECT c.label, c.rowid";
5148
-			$sql .= " FROM " . $this->db->prefix() . "bank_categ as c";
5149
-			$sql .= " WHERE entity = " . $conf->entity;
5148
+			$sql .= " FROM ".$this->db->prefix()."bank_categ as c";
5149
+			$sql .= " WHERE entity = ".$conf->entity;
5150 5150
 			$sql .= " ORDER BY c.label";
5151 5151
 			$result = $this->db->query($sql);
5152 5152
 			if ($result) {
@@ -5172,12 +5172,12 @@  discard block
 block discarded – undo
5172 5172
 		$outarrayrichhtml = array();
5173 5173
 
5174 5174
 
5175
-		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
5175
+		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
5176 5176
 		if (is_array($cate_arbo)) {
5177 5177
 			$num = count($cate_arbo);
5178 5178
 
5179 5179
 			if (!$num) {
5180
-				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
5180
+				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
5181 5181
 			} else {
5182 5182
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5183 5183
 					$output .= '<option value="-1">&nbsp;</option>';
@@ -5189,15 +5189,15 @@  discard block
 block discarded – undo
5189 5189
 						$add = '';
5190 5190
 					}
5191 5191
 
5192
-					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"');
5192
+					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"');
5193 5193
 					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5194 5194
 
5195 5195
 					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
5196 5196
 
5197 5197
 					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;
5198 5198
 
5199
-					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';
5200
-					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';
5199
+					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
5200
+					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
5201 5201
 					$output .= '>';
5202 5202
 					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5203 5203
 					$output .= '</option>';
@@ -5239,7 +5239,7 @@  discard block
 block discarded – undo
5239 5239
 	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
5240 5240
 	{
5241 5241
 		// phpcs:enable
5242
-		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5242
+		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5243 5243
 		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
5244 5244
 	}
5245 5245
 
@@ -5274,7 +5274,7 @@  discard block
 block discarded – undo
5274 5274
 	{
5275 5275
 		global $langs, $conf;
5276 5276
 
5277
-		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';
5277
+		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';
5278 5278
 		$formconfirm = '';
5279 5279
 		$inputok = array();
5280 5280
 		$inputko = array();
@@ -5298,27 +5298,27 @@  discard block
 block discarded – undo
5298 5298
 			foreach ($formquestion as $key => $input) {
5299 5299
 				if (is_array($input) && !empty($input)) {
5300 5300
 					if ($input['type'] == 'hidden') {
5301
-						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5302
-						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5301
+						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5302
+						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5303 5303
 
5304
-						$more .= '<input type="hidden" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '" value="' . dol_escape_htmltag($input['value']) . '" class="' . $morecss . '"' . $moreattr . '>' . "\n";
5304
+						$more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'" class="'.$morecss.'"'.$moreattr.'>'."\n";
5305 5305
 					}
5306 5306
 				}
5307 5307
 			}
5308 5308
 
5309 5309
 			// Now add questions
5310 5310
 			$moreonecolumn = '';
5311
-			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";
5311
+			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5312 5312
 			foreach ($formquestion as $key => $input) {
5313 5313
 				if (is_array($input) && !empty($input)) {
5314
-					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.
5315
-					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5316
-					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5314
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5315
+					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5316
+					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5317 5317
 
5318 5318
 					if ($input['type'] == 'text') {
5319
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div><div class="tagtd"><input type="text" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $size . ' value="' . (empty($input['value']) ? '' : $input['value']) . '"' . $moreattr . ' /></div></div>' . "\n";
5319
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
5320 5320
 					} elseif ($input['type'] == 'password') {
5321
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div><div class="tagtd"><input type="password" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $size . ' value="' . (empty($input['value']) ? '' : $input['value']) . '"' . $moreattr . ' /></div></div>' . "\n";
5321
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
5322 5322
 					} elseif ($input['type'] == 'textarea') {
5323 5323
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
5324 5324
 						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
@@ -5326,8 +5326,8 @@  discard block
 block discarded – undo
5326 5326
 						$more .= '</textarea>';
5327 5327
 						$more .= '</div></div>'."\n";*/
5328 5328
 						$moreonecolumn .= '<div class="margintoponly">';
5329
-						$moreonecolumn .= $input['label'] . '<br>';
5330
-						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';
5329
+						$moreonecolumn .= $input['label'].'<br>';
5330
+						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
5331 5331
 						$moreonecolumn .= $input['value'];
5332 5332
 						$moreonecolumn .= '</textarea>';
5333 5333
 						$moreonecolumn .= '</div>';
@@ -5344,20 +5344,20 @@  discard block
 block discarded – undo
5344 5344
 						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
5345 5345
 						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
5346 5346
 
5347
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">';
5347
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5348 5348
 						if (!empty($input['label'])) {
5349
-							$more .= $input['label'] . '</div><div class="tagtd left">';
5349
+							$more .= $input['label'].'</div><div class="tagtd left">';
5350 5350
 						}
5351 5351
 						if ($input['type'] == 'select') {
5352 5352
 							$more .= $this->selectarray($input['name'], $input['values'], isset($input['default']) ? $input['default'] : '-1', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
5353 5353
 						} else {
5354 5354
 							$more .= $this->multiselectarray($input['name'], $input['values'], is_array($input['default']) ? $input['default'] : [$input['default']], $key_in_label, $value_as_key, $morecss, $translate, $maxlen, $moreattr);
5355 5355
 						}
5356
-						$more .= '</div></div>' . "\n";
5356
+						$more .= '</div></div>'."\n";
5357 5357
 					} elseif ($input['type'] == 'checkbox') {
5358 5358
 						$more .= '<div class="tagtr">';
5359
-						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">';
5360
-						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;
5359
+						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
5360
+						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
5361 5361
 						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
5362 5362
 							$more .= ' checked';
5363 5363
 						}
@@ -5368,19 +5368,19 @@  discard block
 block discarded – undo
5368 5368
 							$more .= ' disabled';
5369 5369
 						}
5370 5370
 						$more .= ' /></div>';
5371
-						$more .= '</div>' . "\n";
5371
+						$more .= '</div>'."\n";
5372 5372
 					} elseif ($input['type'] == 'radio') {
5373 5373
 						$i = 0;
5374 5374
 						foreach ($input['values'] as $selkey => $selval) {
5375 5375
 							$more .= '<div class="tagtr">';
5376 5376
 							if (isset($input['label'])) {
5377 5377
 								if ($i == 0) {
5378
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5378
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
5379 5379
 								} else {
5380
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
5380
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
5381 5381
 								}
5382 5382
 							}
5383
-							$more .= '<div class="tagtd' . ($i == 0 ? ' tdtop' : '') . '"><input type="radio" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name'] . $selkey) . '" name="' . dol_escape_htmltag($input['name']) . '" value="' . $selkey . '"' . $moreattr;
5383
+							$more .= '<div class="tagtd'.($i == 0 ? ' tdtop' : '').'"><input type="radio" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name'].$selkey).'" name="'.dol_escape_htmltag($input['name']).'" value="'.$selkey.'"'.$moreattr;
5384 5384
 							if (!empty($input['disabled'])) {
5385 5385
 								$more .= ' disabled';
5386 5386
 							}
@@ -5388,12 +5388,12 @@  discard block
 block discarded – undo
5388 5388
 								$more .= ' checked="checked"';
5389 5389
 							}
5390 5390
 							$more .= ' /> ';
5391
-							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';
5392
-							$more .= '</div></div>' . "\n";
5391
+							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
5392
+							$more .= '</div></div>'."\n";
5393 5393
 							$i++;
5394 5394
 						}
5395 5395
 					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') {
5396
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5396
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
5397 5397
 						$more .= '<div class="tagtd">';
5398 5398
 						$addnowlink = (empty($input['datenow']) ? 0 : 1);
5399 5399
 						$h = $m = 0;
@@ -5411,24 +5411,24 @@  discard block
 block discarded – undo
5411 5411
 					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
5412 5412
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5413 5413
 						if (!empty($input['label'])) {
5414
-							$more .= $input['label'] . '</div><div class="tagtd">';
5414
+							$more .= $input['label'].'</div><div class="tagtd">';
5415 5415
 						}
5416 5416
 						$more .= $input['value'];
5417
-						$more .= '</div></div>' . "\n";
5417
+						$more .= '</div></div>'."\n";
5418 5418
 					} elseif ($input['type'] == 'onecolumn') {
5419 5419
 						$moreonecolumn .= '<div class="margintoponly">';
5420 5420
 						$moreonecolumn .= $input['value'];
5421
-						$moreonecolumn .= '</div>' . "\n";
5421
+						$moreonecolumn .= '</div>'."\n";
5422 5422
 					} elseif ($input['type'] == 'hidden') {
5423 5423
 						// Do nothing more, already added by a previous loop
5424 5424
 					} elseif ($input['type'] == 'separator') {
5425 5425
 						$more .= '<br>';
5426 5426
 					} else {
5427
-						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';
5427
+						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
5428 5428
 					}
5429 5429
 				}
5430 5430
 			}
5431
-			$more .= '</div>' . "\n";
5431
+			$more .= '</div>'."\n";
5432 5432
 			$more .= $moreonecolumn;
5433 5433
 		}
5434 5434
 
@@ -5450,10 +5450,10 @@  discard block
 block discarded – undo
5450 5450
 				$button = $useajax;
5451 5451
 				$useajax = 1;
5452 5452
 				$autoOpen = false;
5453
-				$dialogconfirm .= '-' . $button;
5453
+				$dialogconfirm .= '-'.$button;
5454 5454
 			}
5455
-			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes';
5456
-			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : '');
5455
+			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes';
5456
+			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : '');
5457 5457
 
5458 5458
 			// Add input fields into list of fields to read during submit (inputok and inputko)
5459 5459
 			if (is_array($formquestion)) {
@@ -5476,24 +5476,24 @@  discard block
 block discarded – undo
5476 5476
 			}
5477 5477
 
5478 5478
 			// Show JQuery confirm box.
5479
-			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
5479
+			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
5480 5480
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5481
-				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";
5481
+				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
5482 5482
 			}
5483 5483
 			if (!empty($more)) {
5484
-				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";
5484
+				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";
5485 5485
 			}
5486
-			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');
5487
-			$formconfirm .= '</div>' . "\n";
5486
+			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');
5487
+			$formconfirm .= '</div>'."\n";
5488 5488
 
5489
-			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";
5490
-			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5489
+			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
5490
+			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5491 5491
 			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
5492 5492
 			$formconfirm .= 'jQuery(document).ready(function() {
5493 5493
             $(function() {
5494
-            	$( "#' . $dialogconfirm . '" ).dialog(
5494
+            	$( "#' . $dialogconfirm.'" ).dialog(
5495 5495
             	{
5496
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
5496
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
5497 5497
 			if ($newselectedchoice == 'no') {
5498 5498
 				$formconfirm .= '
5499 5499
 						open: function() {
@@ -5503,24 +5503,24 @@  discard block
 block discarded – undo
5503 5503
 
5504 5504
 			$jsforcursor = '';
5505 5505
 			if ($useajax == 1) {
5506
-				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";
5507
-				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n";
5506
+				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
5507
+				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
5508 5508
 			}
5509 5509
 
5510 5510
 			$postconfirmas = 'GET';
5511 5511
 
5512 5512
 			$formconfirm .= '
5513 5513
                     resizable: false,
5514
-                    height: "' . $height . '",
5515
-                    width: "' . $width . '",
5514
+                    height: "' . $height.'",
5515
+                    width: "' . $width.'",
5516 5516
                     modal: true,
5517 5517
                     closeOnEscape: false,
5518 5518
                     buttons: {
5519
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
5520
-							var options = "token=' . urlencode(newToken()) . '";
5521
-                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */
5522
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5523
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
5519
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
5520
+							var options = "token=' . urlencode(newToken()).'";
5521
+                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */
5522
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5523
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
5524 5524
 
5525 5525
                          	if (inputok.length > 0) {
5526 5526
                          		$.each(inputok, function(i, inputname) {
@@ -5554,11 +5554,11 @@  discard block
 block discarded – undo
5554 5554
 							}
5555 5555
 	                        $(this).dialog("close");
5556 5556
                         },
5557
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() {
5558
-                        	var options = "token=' . urlencode(newToken()) . '";
5559
-                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */
5560
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5561
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
5557
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
5558
+                        	var options = "token=' . urlencode(newToken()).'";
5559
+                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */
5560
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5561
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
5562 5562
                          	if (inputko.length > 0) {
5563 5563
                          		$.each(inputko, function(i, inputname) {
5564 5564
                          			var more = "";
@@ -5590,10 +5590,10 @@  discard block
 block discarded – undo
5590 5590
                 }
5591 5591
                 );
5592 5592
 
5593
-            	var button = "' . $button . '";
5593
+            	var button = "' . $button.'";
5594 5594
             	if (button.length > 0) {
5595 5595
                 	$( "#" + button ).click(function() {
5596
-                		$("#' . $dialogconfirm . '").dialog("open");
5596
+                		$("#' . $dialogconfirm.'").dialog("open");
5597 5597
         			});
5598 5598
                 }
5599 5599
             });
@@ -5601,44 +5601,44 @@  discard block
 block discarded – undo
5601 5601
             </script>';
5602 5602
 			$formconfirm .= "<!-- end ajax formconfirm -->\n";
5603 5603
 		} else {
5604
-			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";
5604
+			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";
5605 5605
 
5606 5606
 			if (empty($disableformtag)) {
5607
-				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
5607
+				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
5608 5608
 			}
5609 5609
 
5610
-			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
5611
-			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";
5610
+			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
5611
+			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
5612 5612
 
5613
-			$formconfirm .= '<table class="valid centpercent">' . "\n";
5613
+			$formconfirm .= '<table class="valid centpercent">'."\n";
5614 5614
 
5615 5615
 			// Line title
5616 5616
 			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';
5617
-			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title;
5618
-			$formconfirm .= '</td></tr>' . "\n";
5617
+			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title;
5618
+			$formconfirm .= '</td></tr>'."\n";
5619 5619
 
5620 5620
 			// Line text
5621 5621
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5622
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
5622
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
5623 5623
 			}
5624 5624
 
5625 5625
 			// Line form fields
5626 5626
 			if ($more) {
5627
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";
5627
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";
5628 5628
 				$formconfirm .= $more;
5629
-				$formconfirm .= '</td></tr>' . "\n";
5629
+				$formconfirm .= '</td></tr>'."\n";
5630 5630
 			}
5631 5631
 
5632 5632
 			// Line with question
5633 5633
 			$formconfirm .= '<tr class="valid">';
5634
-			$formconfirm .= '<td class="valid">' . $question . '</td>';
5634
+			$formconfirm .= '<td class="valid">'.$question.'</td>';
5635 5635
 			$formconfirm .= '<td class="valid center">';
5636 5636
 			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
5637
-			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">';
5637
+			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
5638 5638
 			$formconfirm .= '</td>';
5639
-			$formconfirm .= '</tr>' . "\n";
5639
+			$formconfirm .= '</tr>'."\n";
5640 5640
 
5641
-			$formconfirm .= '</table>' . "\n";
5641
+			$formconfirm .= '</table>'."\n";
5642 5642
 
5643 5643
 			if (empty($disableformtag)) {
5644 5644
 				$formconfirm .= "</form>\n";
@@ -5647,7 +5647,7 @@  discard block
 block discarded – undo
5647 5647
 
5648 5648
 			if (!empty($conf->use_javascript_ajax)) {
5649 5649
 				$formconfirm .= '<!-- code to disable button to avoid double clic -->';
5650
-				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5650
+				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5651 5651
 				$formconfirm .= '
5652 5652
 				$(document).ready(function () {
5653 5653
 					$(".confirmvalidatebutton").on("click", function() {
@@ -5659,7 +5659,7 @@  discard block
 block discarded – undo
5659 5659
 					});
5660 5660
 				});
5661 5661
 				';
5662
-				$formconfirm .= '</script>' . "\n";
5662
+				$formconfirm .= '</script>'."\n";
5663 5663
 			}
5664 5664
 
5665 5665
 			$formconfirm .= "<!-- end formconfirm -->\n";
@@ -5691,8 +5691,8 @@  discard block
 block discarded – undo
5691 5691
 		// phpcs:enable
5692 5692
 		global $langs;
5693 5693
 
5694
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
5695
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
5694
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
5695
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
5696 5696
 
5697 5697
 		$out = '';
5698 5698
 
@@ -5700,11 +5700,11 @@  discard block
 block discarded – undo
5700 5700
 
5701 5701
 		$langs->load("project");
5702 5702
 		if ($htmlname != "none") {
5703
-			$out .= '<form method="post" action="' . $page . '">';
5703
+			$out .= '<form method="post" action="'.$page.'">';
5704 5704
 			$out .= '<input type="hidden" name="action" value="classin">';
5705
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5705
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5706 5706
 			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);
5707
-			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5707
+			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5708 5708
 			$out .= '</form>';
5709 5709
 		} else {
5710 5710
 			$out .= '<span class="project_head_block">';
@@ -5713,7 +5713,7 @@  discard block
 block discarded – undo
5713 5713
 				$projet->fetch($selected);
5714 5714
 				$out .= $projet->getNomUrl(0, '', 1);
5715 5715
 			} else {
5716
-				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
5716
+				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';
5717 5717
 			}
5718 5718
 			$out .= '</span>';
5719 5719
 		}
@@ -5750,14 +5750,14 @@  discard block
 block discarded – undo
5750 5750
 		$out = '';
5751 5751
 
5752 5752
 		if ($htmlname != "none") {
5753
-			$out .= '<form method="POST" action="' . $page . '">';
5753
+			$out .= '<form method="POST" action="'.$page.'">';
5754 5754
 			$out .= '<input type="hidden" name="action" value="setconditions">';
5755
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5755
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5756 5756
 			if ($type) {
5757
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
5757
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
5758 5758
 			}
5759 5759
 			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
5760
-			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5760
+			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
5761 5761
 			$out .= '</form>';
5762 5762
 		} else {
5763 5763
 			if ($selected) {
@@ -5802,12 +5802,12 @@  discard block
 block discarded – undo
5802 5802
 		// phpcs:enable
5803 5803
 		global $langs;
5804 5804
 		if ($htmlname != "none") {
5805
-			print '<form method="post" action="' . $page . '">';
5805
+			print '<form method="post" action="'.$page.'">';
5806 5806
 			print '<input type="hidden" name="action" value="setavailability">';
5807
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5807
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5808 5808
 			$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);
5809
-			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5810
-			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">';
5809
+			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5810
+			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">';
5811 5811
 			print '</form>';
5812 5812
 		} else {
5813 5813
 			if ($selected) {
@@ -5833,11 +5833,11 @@  discard block
 block discarded – undo
5833 5833
 	{
5834 5834
 		global $langs;
5835 5835
 		if ($htmlname != "none") {
5836
-			print '<form method="post" action="' . $page . '">';
5836
+			print '<form method="post" action="'.$page.'">';
5837 5837
 			print '<input type="hidden" name="action" value="setdemandreason">';
5838
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5838
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5839 5839
 			$this->selectInputReason($selected, $htmlname, -1, $addempty);
5840
-			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5840
+			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5841 5841
 			print '</form>';
5842 5842
 		} else {
5843 5843
 			if ($selected) {
@@ -5877,17 +5877,17 @@  discard block
 block discarded – undo
5877 5877
 		$ret = '';
5878 5878
 
5879 5879
 		if ($htmlname != "none") {
5880
-			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
5881
-			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
5882
-			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
5880
+			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
5881
+			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
5882
+			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
5883 5883
 			if ($type) {
5884
-				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
5884
+				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
5885 5885
 			}
5886 5886
 			$ret .= '<table class="nobordernopadding">';
5887 5887
 			$ret .= '<tr><td>';
5888
-			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
5888
+			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
5889 5889
 			$ret .= '</td>';
5890
-			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
5890
+			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
5891 5891
 			$ret .= '</tr></table></form>';
5892 5892
 		} else {
5893 5893
 			if ($displayhour) {
@@ -5922,15 +5922,15 @@  discard block
 block discarded – undo
5922 5922
 		global $langs;
5923 5923
 
5924 5924
 		if ($htmlname != "none") {
5925
-			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
5926
-			print '<input type="hidden" name="action" value="set' . $htmlname . '">';
5927
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5925
+			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
5926
+			print '<input type="hidden" name="action" value="set'.$htmlname.'">';
5927
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5928 5928
 			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
5929
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5929
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5930 5930
 			print '</form>';
5931 5931
 		} else {
5932 5932
 			if ($selected) {
5933
-				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
5933
+				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
5934 5934
 				$theuser = new User($this->db);
5935 5935
 				$theuser->fetch($selected);
5936 5936
 				print $theuser->getNomUrl(1);
@@ -5963,14 +5963,14 @@  discard block
 block discarded – undo
5963 5963
 
5964 5964
 		$out = '';
5965 5965
 		if ($htmlname != "none") {
5966
-			$out .= '<form method="POST" action="' . $page . '">';
5966
+			$out .= '<form method="POST" action="'.$page.'">';
5967 5967
 			$out .= '<input type="hidden" name="action" value="setmode">';
5968
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5968
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5969 5969
 			if ($type) {
5970
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
5970
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
5971 5971
 			}
5972 5972
 			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
5973
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5973
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5974 5974
 			$out .= '</form>';
5975 5975
 		} else {
5976 5976
 			if ($selected) {
@@ -6003,11 +6003,11 @@  discard block
 block discarded – undo
6003 6003
 	{
6004 6004
 		global $langs;
6005 6005
 		if ($htmlname != "none") {
6006
-			print '<form method="POST" action="' . $page . '">';
6006
+			print '<form method="POST" action="'.$page.'">';
6007 6007
 			print '<input type="hidden" name="action" value="settransportmode">';
6008
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6008
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6009 6009
 			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
6010
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6010
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6011 6011
 			print '</form>';
6012 6012
 		} else {
6013 6013
 			if ($selected) {
@@ -6034,14 +6034,14 @@  discard block
 block discarded – undo
6034 6034
 		// phpcs:enable
6035 6035
 		global $langs;
6036 6036
 		if ($htmlname != "none") {
6037
-			print '<form method="POST" action="' . $page . '">';
6037
+			print '<form method="POST" action="'.$page.'">';
6038 6038
 			print '<input type="hidden" name="action" value="setmulticurrencycode">';
6039
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6039
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6040 6040
 			print $this->selectMultiCurrency($selected, $htmlname, 0);
6041
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6041
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6042 6042
 			print '</form>';
6043 6043
 		} else {
6044
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6044
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6045 6045
 			print !empty($selected) ? currency_name($selected, 1) : '&nbsp;';
6046 6046
 		}
6047 6047
 	}
@@ -6063,21 +6063,21 @@  discard block
 block discarded – undo
6063 6063
 		global $langs, $mysoc, $conf;
6064 6064
 
6065 6065
 		if ($htmlname != "none") {
6066
-			print '<form method="POST" action="' . $page . '">';
6066
+			print '<form method="POST" action="'.$page.'">';
6067 6067
 			print '<input type="hidden" name="action" value="setmulticurrencyrate">';
6068
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6069
-			print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';
6068
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6069
+			print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
6070 6070
 			print '<select name="calculation_mode">';
6071
-			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>';
6072
-			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>';
6071
+			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
6072
+			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
6073 6073
 			print '</select> ';
6074
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6074
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6075 6075
 			print '</form>';
6076 6076
 		} else {
6077 6077
 			if (!empty($rate)) {
6078 6078
 				print price($rate, 1, $langs, 0, 0);
6079 6079
 				if ($currency && $rate != 1) {
6080
-					print ' &nbsp; (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')';
6080
+					print ' &nbsp; ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')';
6081 6081
 				}
6082 6082
 			} else {
6083 6083
 				print 1;
@@ -6108,9 +6108,9 @@  discard block
 block discarded – undo
6108 6108
 		// phpcs:enable
6109 6109
 		global $conf, $langs;
6110 6110
 		if ($htmlname != "none") {
6111
-			print '<form method="post" action="' . $page . '">';
6111
+			print '<form method="post" action="'.$page.'">';
6112 6112
 			print '<input type="hidden" name="action" value="setabsolutediscount">';
6113
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6113
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6114 6114
 			print '<div class="inline-block">';
6115 6115
 			if (!empty($discount_type)) {
6116 6116
 				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
@@ -6148,24 +6148,24 @@  discard block
 block discarded – undo
6148 6148
 			print '</div>';
6149 6149
 			if (empty($hidelist)) {
6150 6150
 				print '<div class="inline-block" style="padding-right: 10px">';
6151
-				$newfilter = 'discount_type=' . intval($discount_type);
6151
+				$newfilter = 'discount_type='.intval($discount_type);
6152 6152
 				if (!empty($discount_type)) {
6153 6153
 					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
6154 6154
 				} else {
6155 6155
 					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
6156 6156
 				}
6157 6157
 				if ($filter) {
6158
-					$newfilter .= ' AND (' . $filter . ')';
6158
+					$newfilter .= ' AND ('.$filter.')';
6159 6159
 				}
6160 6160
 				// output the combo of discounts
6161 6161
 				$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);
6162 6162
 				if ($nbqualifiedlines > 0) {
6163
-					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"';
6163
+					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
6164 6164
 					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
6165
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6165
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6166 6166
 					}
6167 6167
 					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
6168
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6168
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6169 6169
 					}
6170 6170
 
6171 6171
 					print '>';
@@ -6205,23 +6205,23 @@  discard block
 block discarded – undo
6205 6205
 		global $langs, $conf;
6206 6206
 
6207 6207
 		if ($htmlname != "none") {
6208
-			print '<form method="post" action="' . $page . '">';
6208
+			print '<form method="post" action="'.$page.'">';
6209 6209
 			print '<input type="hidden" name="action" value="set_contact">';
6210
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6210
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6211 6211
 			print '<table class="nobordernopadding">';
6212 6212
 			print '<tr><td>';
6213 6213
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
6214 6214
 			$num = $this->num;
6215 6215
 			if ($num == 0) {
6216 6216
 				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
6217
-				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
6217
+				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$addcontact.'</a>';
6218 6218
 			}
6219 6219
 			print '</td>';
6220
-			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6220
+			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6221 6221
 			print '</tr></table></form>';
6222 6222
 		} else {
6223 6223
 			if ($selected) {
6224
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
6224
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
6225 6225
 				$contact = new Contact($this->db);
6226 6226
 				$contact->fetch($selected);
6227 6227
 				print $contact->getFullName($langs);
@@ -6256,20 +6256,20 @@  discard block
 block discarded – undo
6256 6256
 
6257 6257
 		$out = '';
6258 6258
 		if ($htmlname != "none") {
6259
-			$out .= '<form method="post" action="' . $page . '">';
6259
+			$out .= '<form method="post" action="'.$page.'">';
6260 6260
 			$out .= '<input type="hidden" name="action" value="set_thirdparty">';
6261
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6261
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6262 6262
 			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);
6263
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6263
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6264 6264
 			$out .= '</form>';
6265 6265
 		} else {
6266 6266
 			if ($selected) {
6267
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
6267
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
6268 6268
 				$soc = new Societe($this->db);
6269 6269
 				$soc->fetch($selected);
6270 6270
 				$out .= $soc->getNomUrl(0, '');
6271 6271
 			} else {
6272
-				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
6272
+				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
6273 6273
 			}
6274 6274
 		}
6275 6275
 
@@ -6319,22 +6319,22 @@  discard block
 block discarded – undo
6319 6319
 			$selected = 'EUR'; // Pour compatibilite
6320 6320
 		}
6321 6321
 
6322
-		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
6322
+		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
6323 6323
 		if ($useempty) {
6324 6324
 			$out .= '<option value="-1" selected></option>';
6325 6325
 		}
6326 6326
 		foreach ($langs->cache_currencies as $code_iso => $currency) {
6327 6327
 			$labeltoshow = $currency['label'];
6328 6328
 			if ($mode == 1) {
6329
-				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>';
6329
+				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>';
6330 6330
 			} else {
6331
-				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>';
6331
+				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>';
6332 6332
 			}
6333 6333
 
6334 6334
 			if ($selected && $selected == $code_iso) {
6335
-				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6335
+				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
6336 6336
 			} else {
6337
-				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6337
+				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
6338 6338
 			}
6339 6339
 			$out .= $labeltoshow;
6340 6340
 			$out .= '</option>';
@@ -6345,7 +6345,7 @@  discard block
 block discarded – undo
6345 6345
 		}
6346 6346
 
6347 6347
 		// Make select dynamic
6348
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6348
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6349 6349
 		$out .= ajax_combobox($htmlname);
6350 6350
 
6351 6351
 		return $out;
@@ -6371,10 +6371,10 @@  discard block
 block discarded – undo
6371 6371
 
6372 6372
 		$TCurrency = array();
6373 6373
 
6374
-		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
6375
-		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
6374
+		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
6375
+		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
6376 6376
 		if ($filter) {
6377
-			$sql .= " AND " . $filter;
6377
+			$sql .= " AND ".$filter;
6378 6378
 		}
6379 6379
 		$resql = $this->db->query($sql);
6380 6380
 		if ($resql) {
@@ -6384,7 +6384,7 @@  discard block
 block discarded – undo
6384 6384
 		}
6385 6385
 
6386 6386
 		$out = '';
6387
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
6387
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
6388 6388
 		if ($useempty) {
6389 6389
 			$out .= '<option value="">&nbsp;</option>';
6390 6390
 		}
@@ -6396,13 +6396,13 @@  discard block
 block discarded – undo
6396 6396
 			foreach ($langs->cache_currencies as $code_iso => $currency) {
6397 6397
 				if (isset($TCurrency[$code_iso])) {
6398 6398
 					if (!empty($selected) && $selected == $code_iso) {
6399
-						$out .= '<option value="' . $code_iso . '" selected="selected">';
6399
+						$out .= '<option value="'.$code_iso.'" selected="selected">';
6400 6400
 					} else {
6401
-						$out .= '<option value="' . $code_iso . '">';
6401
+						$out .= '<option value="'.$code_iso.'">';
6402 6402
 					}
6403 6403
 
6404 6404
 					$out .= $currency['label'];
6405
-					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
6405
+					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
6406 6406
 					$out .= '</option>';
6407 6407
 				}
6408 6408
 			}
@@ -6411,7 +6411,7 @@  discard block
 block discarded – undo
6411 6411
 		$out .= '</select>';
6412 6412
 
6413 6413
 		// Make select dynamic
6414
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6414
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6415 6415
 		$out .= ajax_combobox($htmlname);
6416 6416
 
6417 6417
 		return $out;
@@ -6442,7 +6442,7 @@  discard block
 block discarded – undo
6442 6442
 		$sql .= " WHERE t.fk_pays = c.rowid";
6443 6443
 		$sql .= " AND t.active > 0";
6444 6444
 		$sql .= " AND t.entity IN (".getEntity('c_tva').")";
6445
-		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
6445
+		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
6446 6446
 		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
6447 6447
 
6448 6448
 		$resql = $this->db->query($sql);
@@ -6454,30 +6454,30 @@  discard block
 block discarded – undo
6454 6454
 
6455 6455
 					$tmparray = array();
6456 6456
 					$tmparray['rowid']			= $obj->rowid;
6457
-					$tmparray['type_vat']		= $obj->type_vat;
6458
-					$tmparray['code']			= $obj->code;
6457
+					$tmparray['type_vat'] = $obj->type_vat;
6458
+					$tmparray['code'] = $obj->code;
6459 6459
 					$tmparray['txtva']			= $obj->taux;
6460
-					$tmparray['nprtva']			= $obj->recuperableonly;
6460
+					$tmparray['nprtva'] = $obj->recuperableonly;
6461 6461
 					$tmparray['localtax1']	    = $obj->localtax1;
6462 6462
 					$tmparray['localtax1_type']	= $obj->localtax1_type;
6463 6463
 					$tmparray['localtax2']	    = $obj->localtax2;
6464 6464
 					$tmparray['localtax2_type']	= $obj->localtax1_type;
6465
-					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or *
6466
-					$tmparray['labelallrates']	= $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6465
+					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
6466
+					$tmparray['labelallrates']	= $obj->taux.'/'.($obj->localtax1 ? $obj->localtax1 : '0').'/'.($obj->localtax2 ? $obj->localtax2 : '0').($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6467 6467
 					$positiverates = '';
6468 6468
 					if ($obj->taux) {
6469
-						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;
6469
+						$positiverates .= ($positiverates ? '/' : '').$obj->taux;
6470 6470
 					}
6471 6471
 					if ($obj->localtax1) {
6472
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
6472
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
6473 6473
 					}
6474 6474
 					if ($obj->localtax2) {
6475
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
6475
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
6476 6476
 					}
6477 6477
 					if (empty($positiverates)) {
6478 6478
 						$positiverates = '0';
6479 6479
 					}
6480
-					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6480
+					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6481 6481
 
6482 6482
 					$this->cache_vatrates[$obj->rowid] = $tmparray;
6483 6483
 				}
@@ -6497,7 +6497,7 @@  discard block
 block discarded – undo
6497 6497
 				return -1;
6498 6498
 			}
6499 6499
 		} else {
6500
-			$this->error = '<span class="error">' . $this->db->error() . '</span>';
6500
+			$this->error = '<span class="error">'.$this->db->error().'</span>';
6501 6501
 			return -2;
6502 6502
 		}
6503 6503
 	}
@@ -6550,9 +6550,9 @@  discard block
 block discarded – undo
6550 6550
 		// Check parameters
6551 6551
 		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
6552 6552
 			if ($societe_vendeuse->id == $mysoc->id) {
6553
-				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>';
6553
+				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
6554 6554
 			} else {
6555
-				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>';
6555
+				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
6556 6556
 			}
6557 6557
 			return $return;
6558 6558
 		}
@@ -6564,12 +6564,12 @@  discard block
 block discarded – undo
6564 6564
 		// Define list of countries to use to search VAT rates to show
6565 6565
 		// First we defined code_country to use to find list
6566 6566
 		if (is_object($societe_vendeuse)) {
6567
-			$code_country = "'" . $societe_vendeuse->country_code . "'";
6567
+			$code_country = "'".$societe_vendeuse->country_code."'";
6568 6568
 		} else {
6569
-			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
6569
+			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
6570 6570
 		}
6571 6571
 		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on
6572
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6572
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6573 6573
 			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
6574 6574
 			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
6575 6575
 			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
@@ -6579,27 +6579,27 @@  discard block
 block discarded – undo
6579 6579
 					if ($type == 1) { // We know product is a service
6580 6580
 						switch ($selectVatComboMode) {
6581 6581
 							case '1':
6582
-								$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6582
+								$code_country .= ",'".$societe_acheteuse->country_code."'";
6583 6583
 								break;
6584 6584
 							case '2':
6585
-								$code_country = "'" . $societe_acheteuse->country_code . "'";
6585
+								$code_country = "'".$societe_acheteuse->country_code."'";
6586 6586
 								break;
6587 6587
 						}
6588 6588
 					}
6589 6589
 				} elseif (!$idprod) {  // We don't know type of product
6590 6590
 					switch ($selectVatComboMode) {
6591 6591
 						case '1':
6592
-							$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6592
+							$code_country .= ",'".$societe_acheteuse->country_code."'";
6593 6593
 							break;
6594 6594
 						case '2':
6595
-							$code_country = "'" . $societe_acheteuse->country_code . "'";
6595
+							$code_country = "'".$societe_acheteuse->country_code."'";
6596 6596
 							break;
6597 6597
 					}
6598 6598
 				} else {
6599 6599
 					$prodstatic = new Product($this->db);
6600 6600
 					$prodstatic->fetch($idprod);
6601 6601
 					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
6602
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6602
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6603 6603
 					}
6604 6604
 				}
6605 6605
 			}
@@ -6661,13 +6661,13 @@  discard block
 block discarded – undo
6661 6661
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
6662 6662
 				// of using supplier invoices (this is a very bad idea !)
6663 6663
 				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) {
6664
-					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
6664
+					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
6665 6665
 					$disabled = true;
6666 6666
 				}
6667 6667
 			}
6668 6668
 
6669 6669
 			if (!$options_only) {
6670
-				$return .= '<select class="flat minwidth50imp maxwidth100" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
6670
+				$return .= '<select class="flat minwidth50imp maxwidth100" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
6671 6671
 			}
6672 6672
 
6673 6673
 			$selectedfound = false;
@@ -6681,13 +6681,13 @@  discard block
 block discarded – undo
6681 6681
 				$key = $rate['txtva'];
6682 6682
 				$key .= $rate['nprtva'] ? '*' : '';
6683 6683
 				if ($mode > 0 && $rate['code']) {
6684
-					$key .= ' (' . $rate['code'] . ')';
6684
+					$key .= ' ('.$rate['code'].')';
6685 6685
 				}
6686 6686
 				if ($mode < 0) {
6687 6687
 					$key = $rate['rowid'];
6688 6688
 				}
6689 6689
 
6690
-				$return .= '<option value="' . $key . '"';
6690
+				$return .= '<option value="'.$key.'"';
6691 6691
 				if (!$selectedfound) {
6692 6692
 					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
6693 6693
 						if ($defaultcode == $rate['code']) {
@@ -6758,7 +6758,7 @@  discard block
 block discarded – undo
6758 6758
 	public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = 0, $addplusone = '', $adddateof = '')
6759 6759
 	{
6760 6760
 		// phpcs:enable
6761
-		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
6761
+		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
6762 6762
 		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);
6763 6763
 		if (!empty($nooutput)) {
6764 6764
 			return $retstring;
@@ -6787,11 +6787,11 @@  discard block
 block discarded – undo
6787 6787
 	{
6788 6788
 		global $langs;
6789 6789
 
6790
-		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
6790
+		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
6791 6791
 		if ($forcenewline) {
6792 6792
 			$ret .= '<br>';
6793 6793
 		}
6794
-		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
6794
+		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
6795 6795
 		return $ret;
6796 6796
 	}
6797 6797
 
@@ -6857,7 +6857,7 @@  discard block
 block discarded – undo
6857 6857
 		$orig_set_time = $set_time;
6858 6858
 
6859 6859
 		if ($set_time === '' && $emptydate == 0) {
6860
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
6860
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
6861 6861
 			if ($gm == 'tzuser' || $gm == 'tzuserrel') {
6862 6862
 				$set_time = dol_now($gm);
6863 6863
 			} else {
@@ -6929,38 +6929,38 @@  discard block
 block discarded – undo
6929 6929
 				// Calendrier popup version eldy
6930 6930
 				if ($usecalendar == "eldy") {
6931 6931
 					// Input area to enter date manually
6932
-					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"';
6932
+					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
6933 6933
 					$retstring .= ($disabled ? ' disabled' : '');
6934
-					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
6934
+					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
6935 6935
 					$retstring .= ' autocomplete="off">';
6936 6936
 
6937 6937
 					// Icon calendar
6938 6938
 					$retstringbuttom = '';
6939 6939
 					if (!$disabled) {
6940
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
6941
-						$base = DOL_URL_ROOT . '/core/';
6942
-						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
6943
-						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
6940
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
6941
+						$base = DOL_URL_ROOT.'/core/';
6942
+						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
6943
+						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
6944 6944
 					} else {
6945
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
6945
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
6946 6946
 					}
6947
-					$retstring = $retstringbuttom . $retstring;
6947
+					$retstring = $retstringbuttom.$retstring;
6948 6948
 
6949
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
6950
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
6951
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
6949
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
6950
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
6951
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
6952 6952
 				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') {
6953 6953
 					if (!$disabled && $usecalendar != 'html') {
6954 6954
 						// Output javascript for datepicker
6955 6955
 						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100));
6956 6956
 						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100));
6957 6957
 
6958
-						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';
6959
-						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
6960
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
6958
+						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';
6959
+						$retstring .= "$(function(){ $('#".$prefix."').datepicker({
6960
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
6961 6961
 							autoclose: true,
6962 6962
 							todayHighlight: true,
6963
-							yearRange: '" . $minYear . ":" . $maxYear . "',";
6963
+							yearRange: '" . $minYear.":".$maxYear."',";
6964 6964
 						if (!empty($conf->dol_use_jmobile)) {
6965 6965
 							$retstring .= "
6966 6966
 								beforeShow: function (input, datePicker) {
@@ -6975,7 +6975,7 @@  discard block
 block discarded – undo
6975 6975
 						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
6976 6976
 							$retstring .= "
6977 6977
 								showOn: 'button',	/* both has problem with autocompletion */
6978
-								buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',
6978
+								buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',
6979 6979
 								buttonImageOnly: true";
6980 6980
 						}
6981 6981
 						$retstring .= "
@@ -6987,46 +6987,46 @@  discard block
 block discarded – undo
6987 6987
 					$retstring .= '<div class="nowraponall inline-block divfordateinput">';
6988 6988
 					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
6989 6989
 					$retstring .= ($disabled ? ' disabled' : '');
6990
-					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
6991
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
6990
+					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
6991
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
6992 6992
 					$retstring .= ' autocomplete="off">';
6993 6993
 
6994 6994
 					// Icone calendrier
6995 6995
 					if ($disabled) {
6996
-						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
6997
-						$retstring = $retstringbutton . $retstring;
6996
+						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
6997
+						$retstring = $retstringbutton.$retstring;
6998 6998
 					}
6999 6999
 
7000 7000
 					$retstring .= '</div>';
7001
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7002
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7003
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7001
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7002
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7003
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7004 7004
 				} else {
7005 7005
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
7006 7006
 				}
7007 7007
 			} else {
7008 7008
 				// Show date with combo selects
7009 7009
 				// Day
7010
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
7010
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
7011 7011
 
7012 7012
 				if ($emptydate || $set_time == -1) {
7013 7013
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7014 7014
 				}
7015 7015
 
7016 7016
 				for ($day = 1; $day <= 31; $day++) {
7017
-					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
7017
+					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
7018 7018
 				}
7019 7019
 
7020 7020
 				$retstring .= "</select>";
7021 7021
 
7022
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
7022
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
7023 7023
 				if ($emptydate || $set_time == -1) {
7024 7024
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7025 7025
 				}
7026 7026
 
7027 7027
 				// Month
7028 7028
 				for ($month = 1; $month <= 12; $month++) {
7029
-					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
7029
+					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
7030 7030
 					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
7031 7031
 					$retstring .= "</option>";
7032 7032
 				}
@@ -7034,13 +7034,13 @@  discard block
 block discarded – undo
7034 7034
 
7035 7035
 				// Year
7036 7036
 				if ($emptydate || $set_time == -1) {
7037
-					$retstring .= '<input' . ($disabled ? ' disabled' : '') . ' placeholder="' . dol_escape_htmltag($langs->trans("Year")) . '" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">';
7037
+					$retstring .= '<input'.($disabled ? ' disabled' : '').' placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">';
7038 7038
 				} else {
7039
-					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
7039
+					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
7040 7040
 
7041 7041
 					$syear = (int) $syear;
7042 7042
 					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) {
7043
-						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
7043
+						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
7044 7044
 					}
7045 7045
 					$retstring .= "</select>\n";
7046 7046
 				}
@@ -7064,15 +7064,15 @@  discard block
 block discarded – undo
7064 7064
 				}
7065 7065
 			}
7066 7066
 			// Show hour
7067
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
7067
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
7068 7068
 			if ($emptyhours) {
7069 7069
 				$retstring .= '<option value="-1">&nbsp;</option>';
7070 7070
 			}
7071 7071
 			for ($hour = $hourstart; $hour < $hourend; $hour++) {
7072 7072
 				if (strlen($hour) < 2) {
7073
-					$hour = "0" . $hour;
7073
+					$hour = "0".$hour;
7074 7074
 				}
7075
-				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;
7075
+				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
7076 7076
 				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
7077 7077
 				$retstring .= '</option>';
7078 7078
 			}
@@ -7085,17 +7085,17 @@  discard block
 block discarded – undo
7085 7085
 
7086 7086
 		if ($m) {
7087 7087
 			// Show minutes
7088
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
7088
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
7089 7089
 			if ($emptyhours) {
7090 7090
 				$retstring .= '<option value="-1">&nbsp;</option>';
7091 7091
 			}
7092 7092
 			for ($min = 0; $min < 60; $min += $stepminutes) {
7093 7093
 				$min_str = sprintf("%02d", $min);
7094
-				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';
7094
+				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';
7095 7095
 			}
7096 7096
 			$retstring .= '</select>';
7097 7097
 
7098
-			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
7098
+			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
7099 7099
 		}
7100 7100
 
7101 7101
 		if ($d && $h) {
@@ -7118,10 +7118,10 @@  discard block
 block discarded – undo
7118 7118
 
7119 7119
 			// Generate the date part, depending on the use or not of the javascript calendar
7120 7120
 			if ($addnowlink == 1) { // server time expressed in user time setup
7121
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7122
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7123
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7124
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7121
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7122
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7123
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7124
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7125 7125
 			} elseif ($addnowlink == 2) {
7126 7126
 				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
7127 7127
 				 * This break application for foreign languages.
@@ -7130,10 +7130,10 @@  discard block
 block discarded – undo
7130 7130
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
7131 7131
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
7132 7132
 				*/
7133
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7134
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7135
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7136
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7133
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7134
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7135
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7136
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7137 7137
 			}
7138 7138
 			/*if ($usecalendar == "eldy")
7139 7139
 			{
@@ -7153,11 +7153,11 @@  discard block
 block discarded – undo
7153 7153
 				}
7154 7154
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
7155 7155
 				if ($addnowlink == 1) {
7156
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7157
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7156
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7157
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7158 7158
 				} elseif ($addnowlink == 2) {
7159
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';
7160
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7159
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
7160
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7161 7161
 				}
7162 7162
 
7163 7163
 				if ($fullday) {
@@ -7171,11 +7171,11 @@  discard block
 block discarded – undo
7171 7171
 				}
7172 7172
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
7173 7173
 				if ($addnowlink == 1) {
7174
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7175
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7174
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7175
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7176 7176
 				} elseif ($addnowlink == 2) {
7177
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';
7178
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7177
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
7178
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7179 7179
 				}
7180 7180
 				if ($fullday) {
7181 7181
 					$reset_scripts .= ' } ';
@@ -7183,7 +7183,7 @@  discard block
 block discarded – undo
7183 7183
 			}
7184 7184
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7185 7185
 			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
7186
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
7186
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
7187 7187
 				$retstring .= $langs->trans("Now");
7188 7188
 				$retstring .= '</button> ';
7189 7189
 			}
@@ -7195,16 +7195,16 @@  discard block
 block discarded – undo
7195 7195
 			$reset_scripts = "";
7196 7196
 
7197 7197
 			// Generate the date part, depending on the use or not of the javascript calendar
7198
-			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';
7199
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7200
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7201
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7198
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
7199
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7200
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7201
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7202 7202
 			// Update the hour part
7203 7203
 			if ($h) {
7204 7204
 				if ($fullday) {
7205 7205
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7206 7206
 				}
7207
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7207
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7208 7208
 				if ($fullday) {
7209 7209
 					$reset_scripts .= ' } ';
7210 7210
 				}
@@ -7214,14 +7214,14 @@  discard block
 block discarded – undo
7214 7214
 				if ($fullday) {
7215 7215
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7216 7216
 				}
7217
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7217
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7218 7218
 				if ($fullday) {
7219 7219
 					$reset_scripts .= ' } ';
7220 7220
 				}
7221 7221
 			}
7222 7222
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7223 7223
 			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
7224
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
7224
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
7225 7225
 				$retstring .= $langs->trans("DateStartPlusOne");
7226 7226
 				$retstring .= '</button> ';
7227 7227
 			}
@@ -7279,17 +7279,17 @@  discard block
 block discarded – undo
7279 7279
 			unset($TDurationTypes[$value]);
7280 7280
 		}
7281 7281
 
7282
-		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';
7282
+		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
7283 7283
 		foreach ($TDurationTypes as $key => $typeduration) {
7284
-			$retstring .= '<option value="' . $key . '"';
7284
+			$retstring .= '<option value="'.$key.'"';
7285 7285
 			if ($key == $selected) {
7286 7286
 				$retstring .= " selected";
7287 7287
 			}
7288
-			$retstring .= ">" . $typeduration . "</option>";
7288
+			$retstring .= ">".$typeduration."</option>";
7289 7289
 		}
7290 7290
 		$retstring .= "</select>";
7291 7291
 
7292
-		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration');
7292
+		$retstring .= ajax_combobox('select_'.$prefix.'type_duration');
7293 7293
 
7294 7294
 		return $retstring;
7295 7295
 	}
@@ -7321,30 +7321,30 @@  discard block
 block discarded – undo
7321 7321
 
7322 7322
 		// Hours
7323 7323
 		if ($iSecond != '') {
7324
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7324
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7325 7325
 
7326 7326
 			$hourSelected = convertSecondToTime($iSecond, 'allhour');
7327 7327
 			$minSelected = convertSecondToTime($iSecond, 'min');
7328 7328
 		}
7329 7329
 
7330 7330
 		if ($typehour == 'select') {
7331
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
7331
+			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
7332 7332
 			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours
7333
-				$retstring .= '<option value="' . $hour . '"';
7333
+				$retstring .= '<option value="'.$hour.'"';
7334 7334
 				if (is_numeric($hourSelected) && $hourSelected == $hour) {
7335 7335
 					$retstring .= " selected";
7336 7336
 				}
7337
-				$retstring .= ">" . $hour . "</option>";
7337
+				$retstring .= ">".$hour."</option>";
7338 7338
 			}
7339 7339
 			$retstring .= "</select>";
7340 7340
 		} elseif ($typehour == 'text' || $typehour == 'textselect') {
7341
-			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
7341
+			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
7342 7342
 		} else {
7343 7343
 			return 'BadValueForParameterTypeHour';
7344 7344
 		}
7345 7345
 
7346 7346
 		if ($typehour != 'text') {
7347
-			$retstring .= ' ' . $langs->trans('HourShort');
7347
+			$retstring .= ' '.$langs->trans('HourShort');
7348 7348
 		} else {
7349 7349
 			$retstring .= '<span class="">:</span>';
7350 7350
 		}
@@ -7359,21 +7359,21 @@  discard block
 block discarded – undo
7359 7359
 		}
7360 7360
 
7361 7361
 		if ($typehour == 'select' || $typehour == 'textselect') {
7362
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
7362
+			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
7363 7363
 			for ($min = 0; $min <= 55; $min += 5) {
7364
-				$retstring .= '<option value="' . $min . '"';
7364
+				$retstring .= '<option value="'.$min.'"';
7365 7365
 				if (is_numeric($minSelected) && $minSelected == $min) {
7366 7366
 					$retstring .= ' selected';
7367 7367
 				}
7368
-				$retstring .= '>' . $min . '</option>';
7368
+				$retstring .= '>'.$min.'</option>';
7369 7369
 			}
7370 7370
 			$retstring .= "</select>";
7371 7371
 		} elseif ($typehour == 'text') {
7372
-			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
7372
+			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
7373 7373
 		}
7374 7374
 
7375 7375
 		if ($typehour != 'text') {
7376
-			$retstring .= ' ' . $langs->trans('MinuteShort');
7376
+			$retstring .= ' '.$langs->trans('MinuteShort');
7377 7377
 		}
7378 7378
 
7379 7379
 		$retstring .= "</span>";
@@ -7421,7 +7421,7 @@  discard block
 block discarded – undo
7421 7421
 			$placeholder = '';
7422 7422
 
7423 7423
 			if ($selected && empty($selected_input_value)) {
7424
-				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7424
+				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7425 7425
 				$tickettmpselect = new Ticket($this->db);
7426 7426
 				$tickettmpselect->fetch($selected);
7427 7427
 				$selected_input_value = $tickettmpselect->ref;
@@ -7429,17 +7429,17 @@  discard block
 block discarded – undo
7429 7429
 			}
7430 7430
 
7431 7431
 			$urloption = '';
7432
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7432
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7433 7433
 
7434 7434
 			if (empty($hidelabel)) {
7435
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7435
+				$out .= $langs->trans("RefOrLabel").' : ';
7436 7436
 			} elseif ($hidelabel > 1) {
7437
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7437
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7438 7438
 				if ($hidelabel == 2) {
7439 7439
 					$out .= img_picto($langs->trans("Search"), 'search');
7440 7440
 				}
7441 7441
 			}
7442
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7442
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7443 7443
 			if ($hidelabel == 3) {
7444 7444
 				$out .= img_picto($langs->trans("Search"), 'search');
7445 7445
 			}
@@ -7483,8 +7483,8 @@  discard block
 block discarded – undo
7483 7483
 
7484 7484
 		$sql = "SELECT ";
7485 7485
 		$sql .= $selectFields;
7486
-		$sql .= " FROM " . $this->db->prefix() . "ticket as p";
7487
-		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')';
7486
+		$sql .= " FROM ".$this->db->prefix()."ticket as p";
7487
+		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
7488 7488
 
7489 7489
 		// Add criteria on ref/label
7490 7490
 		if ($filterkey != '') {
@@ -7500,7 +7500,7 @@  discard block
 block discarded – undo
7500 7500
 				if ($i > 0) {
7501 7501
 					$sql .= " AND ";
7502 7502
 				}
7503
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7503
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7504 7504
 				$sql .= ")";
7505 7505
 				$i++;
7506 7506
 			}
@@ -7513,22 +7513,22 @@  discard block
 block discarded – undo
7513 7513
 		$sql .= $this->db->plimit($limit, 0);
7514 7514
 
7515 7515
 		// Build output string
7516
-		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);
7516
+		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);
7517 7517
 		$result = $this->db->query($sql);
7518 7518
 		if ($result) {
7519
-			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7520
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
7519
+			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7520
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
7521 7521
 
7522 7522
 			$num = $this->db->num_rows($result);
7523 7523
 
7524 7524
 			$events = array();
7525 7525
 
7526 7526
 			if (!$forcecombo) {
7527
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7527
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7528 7528
 				$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);
7529 7529
 			}
7530 7530
 
7531
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7531
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7532 7532
 
7533 7533
 			$textifempty = '';
7534 7534
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7545,7 +7545,7 @@  discard block
 block discarded – undo
7545 7545
 				}
7546 7546
 			}
7547 7547
 			if ($showempty) {
7548
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7548
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7549 7549
 			}
7550 7550
 
7551 7551
 			$i = 0;
@@ -7600,13 +7600,13 @@  discard block
 block discarded – undo
7600 7600
 		$outref = $objp->ref;
7601 7601
 		$outtype = $objp->fk_product_type;
7602 7602
 
7603
-		$opt = '<option value="' . $objp->rowid . '"';
7603
+		$opt = '<option value="'.$objp->rowid.'"';
7604 7604
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7605 7605
 		$opt .= '>';
7606 7606
 		$opt .= $objp->ref;
7607 7607
 		$objRef = $objp->ref;
7608 7608
 		if (!empty($filterkey) && $filterkey != '') {
7609
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7609
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7610 7610
 		}
7611 7611
 
7612 7612
 		$opt .= "</option>\n";
@@ -7647,7 +7647,7 @@  discard block
 block discarded – undo
7647 7647
 			$placeholder = '';
7648 7648
 
7649 7649
 			if ($selected && empty($selected_input_value)) {
7650
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7650
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7651 7651
 				$projecttmpselect = new Project($this->db);
7652 7652
 				$projecttmpselect->fetch($selected);
7653 7653
 				$selected_input_value = $projecttmpselect->ref;
@@ -7655,17 +7655,17 @@  discard block
 block discarded – undo
7655 7655
 			}
7656 7656
 
7657 7657
 			$urloption = '';
7658
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7658
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7659 7659
 
7660 7660
 			if (empty($hidelabel)) {
7661
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7661
+				$out .= $langs->trans("RefOrLabel").' : ';
7662 7662
 			} elseif ($hidelabel > 1) {
7663
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7663
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7664 7664
 				if ($hidelabel == 2) {
7665 7665
 					$out .= img_picto($langs->trans("Search"), 'search');
7666 7666
 				}
7667 7667
 			}
7668
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7668
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7669 7669
 			if ($hidelabel == 3) {
7670 7670
 				$out .= img_picto($langs->trans("Search"), 'search');
7671 7671
 			}
@@ -7708,8 +7708,8 @@  discard block
 block discarded – undo
7708 7708
 
7709 7709
 		$sql = "SELECT ";
7710 7710
 		$sql .= $selectFields;
7711
-		$sql .= " FROM " . $this->db->prefix() . "projet as p";
7712
-		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')';
7711
+		$sql .= " FROM ".$this->db->prefix()."projet as p";
7712
+		$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
7713 7713
 
7714 7714
 		// Add criteria on ref/label
7715 7715
 		if ($filterkey != '') {
@@ -7725,7 +7725,7 @@  discard block
 block discarded – undo
7725 7725
 				if ($i > 0) {
7726 7726
 					$sql .= " AND ";
7727 7727
 				}
7728
-				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7728
+				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
7729 7729
 				$sql .= "";
7730 7730
 				$i++;
7731 7731
 			}
@@ -7738,22 +7738,22 @@  discard block
 block discarded – undo
7738 7738
 		$sql .= $this->db->plimit($limit, 0);
7739 7739
 
7740 7740
 		// Build output string
7741
-		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);
7741
+		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
7742 7742
 		$result = $this->db->query($sql);
7743 7743
 		if ($result) {
7744
-			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7745
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
7744
+			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7745
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
7746 7746
 
7747 7747
 			$num = $this->db->num_rows($result);
7748 7748
 
7749 7749
 			$events = array();
7750 7750
 
7751 7751
 			if (!$forcecombo) {
7752
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7752
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7753 7753
 				$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
7754 7754
 			}
7755 7755
 
7756
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7756
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7757 7757
 
7758 7758
 			$textifempty = '';
7759 7759
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7770,7 +7770,7 @@  discard block
 block discarded – undo
7770 7770
 				}
7771 7771
 			}
7772 7772
 			if ($showempty) {
7773
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7773
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7774 7774
 			}
7775 7775
 
7776 7776
 			$i = 0;
@@ -7828,13 +7828,13 @@  discard block
 block discarded – undo
7828 7828
 		$outlabel = $objp->label;
7829 7829
 		$outtype = $objp->fk_product_type;
7830 7830
 
7831
-		$opt = '<option value="' . $objp->rowid . '"';
7831
+		$opt = '<option value="'.$objp->rowid.'"';
7832 7832
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7833 7833
 		$opt .= '>';
7834 7834
 		$opt .= $objp->ref;
7835 7835
 		$objRef = $objp->ref;
7836 7836
 		if (!empty($filterkey) && $filterkey != '') {
7837
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7837
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7838 7838
 		}
7839 7839
 
7840 7840
 		$opt .= "</option>\n";
@@ -7876,7 +7876,7 @@  discard block
 block discarded – undo
7876 7876
 			$placeholder = '';
7877 7877
 
7878 7878
 			if ($selected && empty($selected_input_value)) {
7879
-				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
7879
+				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
7880 7880
 				$adherenttmpselect = new Adherent($this->db);
7881 7881
 				$adherenttmpselect->fetch($selected);
7882 7882
 				$selected_input_value = $adherenttmpselect->ref;
@@ -7885,17 +7885,17 @@  discard block
 block discarded – undo
7885 7885
 
7886 7886
 			$urloption = '';
7887 7887
 
7888
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7888
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7889 7889
 
7890 7890
 			if (empty($hidelabel)) {
7891
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7891
+				$out .= $langs->trans("RefOrLabel").' : ';
7892 7892
 			} elseif ($hidelabel > 1) {
7893
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7893
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7894 7894
 				if ($hidelabel == 2) {
7895 7895
 					$out .= img_picto($langs->trans("Search"), 'search');
7896 7896
 				}
7897 7897
 			}
7898
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7898
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7899 7899
 			if ($hidelabel == 3) {
7900 7900
 				$out .= img_picto($langs->trans("Search"), 'search');
7901 7901
 			}
@@ -7940,8 +7940,8 @@  discard block
 block discarded – undo
7940 7940
 
7941 7941
 		$sql = "SELECT ";
7942 7942
 		$sql .= $selectFields;
7943
-		$sql .= " FROM " . $this->db->prefix() . "adherent as p";
7944
-		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')';
7943
+		$sql .= " FROM ".$this->db->prefix()."adherent as p";
7944
+		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
7945 7945
 
7946 7946
 		// Add criteria on ref/label
7947 7947
 		if ($filterkey != '') {
@@ -7957,8 +7957,8 @@  discard block
 block discarded – undo
7957 7957
 				if ($i > 0) {
7958 7958
 					$sql .= " AND ";
7959 7959
 				}
7960
-				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7961
-				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
7960
+				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
7961
+				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
7962 7962
 				$i++;
7963 7963
 			}
7964 7964
 			if (count($search_crit) > 1) {
@@ -7967,27 +7967,27 @@  discard block
 block discarded – undo
7967 7967
 			$sql .= ')';
7968 7968
 		}
7969 7969
 		if ($status != -1) {
7970
-			$sql .= ' AND statut = ' . ((int) $status);
7970
+			$sql .= ' AND statut = '.((int) $status);
7971 7971
 		}
7972 7972
 		$sql .= $this->db->plimit($limit, 0);
7973 7973
 
7974 7974
 		// Build output string
7975
-		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);
7975
+		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
7976 7976
 		$result = $this->db->query($sql);
7977 7977
 		if ($result) {
7978
-			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
7979
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
7978
+			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
7979
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
7980 7980
 
7981 7981
 			$num = $this->db->num_rows($result);
7982 7982
 
7983 7983
 			$events = array();
7984 7984
 
7985 7985
 			if (!$forcecombo) {
7986
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7986
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7987 7987
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
7988 7988
 			}
7989 7989
 
7990
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7990
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7991 7991
 
7992 7992
 			$textifempty = '';
7993 7993
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8004,7 +8004,7 @@  discard block
 block discarded – undo
8004 8004
 				}
8005 8005
 			}
8006 8006
 			if ($showempty) {
8007
-				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
8007
+				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
8008 8008
 			}
8009 8009
 
8010 8010
 			$i = 0;
@@ -8060,11 +8060,11 @@  discard block
 block discarded – undo
8060 8060
 		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);
8061 8061
 		$outtype = $objp->fk_adherent_type;
8062 8062
 
8063
-		$opt = '<option value="' . $objp->rowid . '"';
8063
+		$opt = '<option value="'.$objp->rowid.'"';
8064 8064
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8065 8065
 		$opt .= '>';
8066 8066
 		if (!empty($filterkey) && $filterkey != '') {
8067
-			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1);
8067
+			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1);
8068 8068
 		}
8069 8069
 		$opt .= $outlabel;
8070 8070
 		$opt .= "</option>\n";
@@ -8099,8 +8099,8 @@  discard block
 block discarded – undo
8099 8099
 		$objectdescorig = $objectdesc;
8100 8100
 		$objecttmp = null;
8101 8101
 		$InfoFieldList = array();
8102
-		$filter = '';  // Ensure filter has value (for static analysis)
8103
-		$sortfield = '';  // Ensure filter has value (for static analysis)
8102
+		$filter = ''; // Ensure filter has value (for static analysis)
8103
+		$sortfield = ''; // Ensure filter has value (for static analysis)
8104 8104
 
8105 8105
 		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield
8106 8106
 			// Example: $objectfield = 'product:options_package'
@@ -8141,9 +8141,9 @@  discard block
 block discarded – undo
8141 8141
 			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
8142 8142
 			$reg = array();
8143 8143
 			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
8144
-				$InfoFieldList[4] = $reg[1];    // take the sort field
8144
+				$InfoFieldList[4] = $reg[1]; // take the sort field
8145 8145
 			}
8146
-			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field
8146
+			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
8147 8147
 
8148 8148
 			$classname = $InfoFieldList[0];
8149 8149
 			$classpath = $InfoFieldList[1];
@@ -8174,8 +8174,8 @@  discard block
 block discarded – undo
8174 8174
 		);
8175 8175
 
8176 8176
 		if (!is_object($objecttmp)) {
8177
-			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8178
-			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8177
+			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8178
+			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8179 8179
 		}
8180 8180
 		'@phan-var-force CommonObject $objecttmp';
8181 8181
 
@@ -8187,9 +8187,9 @@  discard block
 block discarded – undo
8187 8187
 		if ($prefixforautocompletemode == 'product') {
8188 8188
 			$prefixforautocompletemode = 'produit';
8189 8189
 		}
8190
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8190
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8191 8191
 
8192
-		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
8192
+		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);
8193 8193
 
8194 8194
 		// Generate the combo HTML component
8195 8195
 		$out = '';
@@ -8218,13 +8218,13 @@  discard block
 block discarded – undo
8218 8218
 			}
8219 8219
 
8220 8220
 			// Set url and param to call to get json of the search results
8221
-			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
8222
-			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
8221
+			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
8222
+			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
8223 8223
 
8224 8224
 			// Activate the auto complete using ajax call.
8225 8225
 			$out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0);
8226 8226
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
8227
-			$out .= '<input type="text" class="' . $morecss . '"' . ($disabled ? ' disabled="disabled"' : '') . ' name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' />';
8227
+			$out .= '<input type="text" class="'.$morecss.'"'.($disabled ? ' disabled="disabled"' : '').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' />';
8228 8228
 		} else {
8229 8229
 			// Immediate load of table record.
8230 8230
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8264,16 +8264,16 @@  discard block
 block discarded – undo
8264 8264
 		if ($prefixforautocompletemode == 'societe') {
8265 8265
 			$prefixforautocompletemode = 'company';
8266 8266
 		}
8267
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8267
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8268 8268
 
8269 8269
 		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...)
8270 8270
 			$tmpfieldstoshow = '';
8271 8271
 			foreach ($objecttmp->fields as $key => $val) {
8272
-				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) {
8272
+				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) {
8273 8273
 					continue;
8274 8274
 				}
8275 8275
 				if (!empty($val['showoncombobox'])) {
8276
-					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
8276
+					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
8277 8277
 				}
8278 8278
 			}
8279 8279
 			if ($tmpfieldstoshow) {
@@ -8301,18 +8301,18 @@  discard block
 block discarded – undo
8301 8301
 		$num = 0;
8302 8302
 
8303 8303
 		// Search data
8304
-		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";
8304
+		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";
8305 8305
 		if (!empty($objecttmp->isextrafieldmanaged)) {
8306
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object";
8306
+			$sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object";
8307 8307
 		}
8308 8308
 		if (isset($objecttmp->ismultientitymanaged)) {
8309 8309
 			if (!is_numeric($objecttmp->ismultientitymanaged)) {
8310 8310
 				$tmparray = explode('@', $objecttmp->ismultientitymanaged);
8311
-				$sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];
8311
+				$sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
8312 8312
 			}
8313 8313
 			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8314 8314
 				if (!$user->hasRight('societe', 'client', 'voir')) {
8315
-					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
8315
+					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
8316 8316
 				}
8317 8317
 			}
8318 8318
 		}
@@ -8332,21 +8332,21 @@  discard block
 block discarded – undo
8332 8332
 			$sql .= " WHERE 1=1";
8333 8333
 			if (isset($objecttmp->ismultientitymanaged)) {
8334 8334
 				if ($objecttmp->ismultientitymanaged == 1) {
8335
-					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
8335
+					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
8336 8336
 				}
8337 8337
 				if (!is_numeric($objecttmp->ismultientitymanaged)) {
8338
-					$sql .= " AND parenttable.entity = t." . $tmparray[0];
8338
+					$sql .= " AND parenttable.entity = t.".$tmparray[0];
8339 8339
 				}
8340 8340
 				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
8341 8341
 					if ($objecttmp->element == 'societe') {
8342
-						$sql .= " AND t.rowid = " . ((int) $user->socid);
8342
+						$sql .= " AND t.rowid = ".((int) $user->socid);
8343 8343
 					} else {
8344
-						$sql .= " AND t.fk_soc = " . ((int) $user->socid);
8344
+						$sql .= " AND t.fk_soc = ".((int) $user->socid);
8345 8345
 					}
8346 8346
 				}
8347 8347
 				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8348 8348
 					if (!$user->hasRight('societe', 'client', 'voir')) {
8349
-						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
8349
+						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
8350 8350
 					}
8351 8351
 				}
8352 8352
 			}
@@ -8358,7 +8358,7 @@  discard block
 block discarded – undo
8358 8358
 				$errormessage = '';
8359 8359
 				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
8360 8360
 				if ($errormessage) {
8361
-					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;
8361
+					return 'Error forging a SQL request from an universal criteria: '.$errormessage;
8362 8362
 				}
8363 8363
 			}
8364 8364
 		}
@@ -8370,7 +8370,7 @@  discard block
 block discarded – undo
8370 8370
 		$resql = $this->db->query($sql);
8371 8371
 		if ($resql) {
8372 8372
 			// Construct $out and $outarray
8373
-			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
8373
+			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
8374 8374
 
8375 8375
 			// Warning: Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
8376 8376
 			$textifempty = '&nbsp;';
@@ -8384,7 +8384,7 @@  discard block
 block discarded – undo
8384 8384
 				}
8385 8385
 			}
8386 8386
 			if ($showempty) {
8387
-				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
8387
+				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";
8388 8388
 			}
8389 8389
 
8390 8390
 			$num = $this->db->num_rows($resql);
@@ -8407,9 +8407,9 @@  discard block
 block discarded – undo
8407 8407
 					}
8408 8408
 					if (empty($outputmode)) {
8409 8409
 						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
8410
-							$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8410
+							$out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8411 8411
 						} else {
8412
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8412
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8413 8413
 						}
8414 8414
 					} else {
8415 8415
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -8422,10 +8422,10 @@  discard block
 block discarded – undo
8422 8422
 				}
8423 8423
 			}
8424 8424
 
8425
-			$out .= '</select>' . "\n";
8425
+			$out .= '</select>'."\n";
8426 8426
 
8427 8427
 			if (!$forcecombo) {
8428
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8428
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8429 8429
 				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));
8430 8430
 			}
8431 8431
 		} else {
@@ -8489,8 +8489,8 @@  discard block
 block discarded – undo
8489 8489
 			}
8490 8490
 		}
8491 8491
 		$idname = str_replace(array('[', ']'), array('', ''), $htmlname);
8492
-		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"';
8493
-		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
8492
+		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"';
8493
+		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
8494 8494
 		$out .= '>'."\n";
8495 8495
 
8496 8496
 		if ($show_empty) {
@@ -8501,7 +8501,7 @@  discard block
 block discarded – undo
8501 8501
 			if (!is_numeric($show_empty)) {
8502 8502
 				$textforempty = $show_empty;
8503 8503
 			}
8504
-			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
8504
+			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
8505 8505
 		}
8506 8506
 		if (is_array($array)) {
8507 8507
 			// Translate
@@ -8526,7 +8526,7 @@  discard block
 block discarded – undo
8526 8526
 					$value = $tmpvalue['label'];
8527 8527
 					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];
8528 8528
 					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';
8529
-					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';
8529
+					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';
8530 8530
 				} else {
8531 8531
 					$value = $tmpvalue;
8532 8532
 					//$valuehtml = $tmpvalue;
@@ -8542,9 +8542,9 @@  discard block
 block discarded – undo
8542 8542
 				}
8543 8543
 				if ($key_in_label) {
8544 8544
 					if (empty($nohtmlescape)) {
8545
-						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
8545
+						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
8546 8546
 					} else {
8547
-						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
8547
+						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
8548 8548
 					}
8549 8549
 				} else {
8550 8550
 					if (empty($nohtmlescape)) {
@@ -8556,8 +8556,8 @@  discard block
 block discarded – undo
8556 8556
 						$selectOptionValue = '&nbsp;';
8557 8557
 					}
8558 8558
 				}
8559
-				$out .= '<option value="' . $key . '"';
8560
-				$out .= $style . $disabled;
8559
+				$out .= '<option value="'.$key.'"';
8560
+				$out .= $style.$disabled;
8561 8561
 				if (is_array($id)) {
8562 8562
 					if (in_array($key, $id) && !$disabled) {
8563 8563
 						$out .= ' selected'; // To preselect a value
@@ -8569,7 +8569,7 @@  discard block
 block discarded – undo
8569 8569
 					}
8570 8570
 				}
8571 8571
 				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content.
8572
-					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';
8572
+					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
8573 8573
 				}
8574 8574
 
8575 8575
 				if (is_array($tmpvalue)) {
@@ -8588,7 +8588,7 @@  discard block
 block discarded – undo
8588 8588
 		// Add code for jquery to use multiselect
8589 8589
 		if ($addjscombo && $jsbeautify) {
8590 8590
 			// Enhance with select2
8591
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8591
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8592 8592
 			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);
8593 8593
 		}
8594 8594
 
@@ -8616,28 +8616,28 @@  discard block
 block discarded – undo
8616 8616
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
8617 8617
 	{
8618 8618
 		global $conf, $langs;
8619
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8619
+		global $delayedhtmlcontent; // Will be used later outside of this function
8620 8620
 
8621 8621
 		// TODO Use an internal dolibarr component instead of select2
8622 8622
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8623 8623
 			return '';
8624 8624
 		}
8625 8625
 
8626
-		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
8626
+		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
8627 8627
 
8628 8628
 		$outdelayed = '';
8629 8629
 		if (!empty($conf->use_javascript_ajax)) {
8630 8630
 			$tmpplugin = 'select2';
8631
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8632
-		    	<script nonce="' . getNonce() . '">
8631
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8632
+		    	<script nonce="' . getNonce().'">
8633 8633
 		    	$(document).ready(function () {
8634 8634
 
8635
-	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
8635
+	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
8636 8636
 
8637
-	                $(".' . $htmlname . '").select2({
8637
+	                $(".' . $htmlname.'").select2({
8638 8638
 				    	ajax: {
8639 8639
 					    	dir: "ltr",
8640
-					    	url: "' . $url . '",
8640
+					    	url: "' . $url.'",
8641 8641
 					    	dataType: \'json\',
8642 8642
 					    	delay: 250,
8643 8643
 					    	data: function (params) {
@@ -8664,9 +8664,9 @@  discard block
 block discarded – undo
8664 8664
 				    	},
8665 8665
 		 				language: select2arrayoflanguage,
8666 8666
 						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
8667
-					    placeholder: "' . dol_escape_js($placeholder) . '",
8667
+					    placeholder: "' . dol_escape_js($placeholder).'",
8668 8668
 				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
8669
-				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',
8669
+				    	minimumInputLength: ' . ((int) $minimumInputLength).',
8670 8670
 				        formatResult: function (result, container, query, escapeMarkup) {
8671 8671
 	                        return escapeMarkup(result.text);
8672 8672
 	                    },
@@ -8674,10 +8674,10 @@  discard block
 block discarded – undo
8674 8674
 
8675 8675
 	                ' . ($callurlonselect ? '
8676 8676
 	                /* Code to execute a GET when we select a value */
8677
-	                $(".' . $htmlname . '").change(function() {
8678
-				    	var selected = $(".' . $htmlname . '").val();
8677
+	                $(".' . $htmlname.'").change(function() {
8678
+				    	var selected = $(".' . $htmlname.'").val();
8679 8679
 	                	console.log("We select in selectArrayAjax the entry "+selected)
8680
-				        $(".' . $htmlname . '").val("");  /* reset visible combo value */
8680
+				        $(".' . $htmlname.'").val("");  /* reset visible combo value */
8681 8681
 	    			    $.each( saveRemoteData, function( key, value ) {
8682 8682
 	    				        if (key == selected)
8683 8683
 	    			            {
@@ -8685,7 +8685,7 @@  discard block
 block discarded – undo
8685 8685
 	    			                 location.assign(value.url);
8686 8686
 	    			            }
8687 8687
 	                    });
8688
-	    			});' : '') . '
8688
+	    			});' : '').'
8689 8689
 
8690 8690
 	    	   });
8691 8691
 		       </script>';
@@ -8721,14 +8721,14 @@  discard block
 block discarded – undo
8721 8721
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
8722 8722
 	{
8723 8723
 		global $conf, $langs;
8724
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8724
+		global $delayedhtmlcontent; // Will be used later outside of this function
8725 8725
 
8726 8726
 		// TODO Use an internal dolibarr component instead of select2
8727 8727
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8728 8728
 			return '';
8729 8729
 		}
8730 8730
 
8731
-		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
8731
+		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
8732 8732
 
8733 8733
 		$formattedarrayresult = array();
8734 8734
 
@@ -8743,20 +8743,20 @@  discard block
 block discarded – undo
8743 8743
 		$outdelayed = '';
8744 8744
 		if (!empty($conf->use_javascript_ajax)) {
8745 8745
 			$tmpplugin = 'select2';
8746
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8747
-				<script nonce="' . getNonce() . '">
8746
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8747
+				<script nonce="' . getNonce().'">
8748 8748
 				$(document).ready(function () {
8749
-					var data = ' . json_encode($formattedarrayresult) . ';
8749
+					var data = ' . json_encode($formattedarrayresult).';
8750 8750
 
8751
-					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
8751
+					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
8752 8752
 
8753
-					$(".' . $htmlname . '").select2({
8753
+					$(".' . $htmlname.'").select2({
8754 8754
 						data: data,
8755 8755
 						language: select2arrayoflanguage,
8756 8756
 						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
8757
-						placeholder: "' . dol_escape_js($placeholder) . '",
8757
+						placeholder: "' . dol_escape_js($placeholder).'",
8758 8758
 						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
8759
-						minimumInputLength: ' . $minimumInputLength . ',
8759
+						minimumInputLength: ' . $minimumInputLength.',
8760 8760
 						formatResult: function (result, container, query, escapeMarkup) {
8761 8761
 							return escapeMarkup(result.text);
8762 8762
 						},
@@ -8795,11 +8795,11 @@  discard block
 block discarded – undo
8795 8795
 
8796 8796
 					' . ($callurlonselect ? '
8797 8797
 					/* Code to execute a GET when we select a value */
8798
-					$(".' . $htmlname . '").change(function() {
8799
-						var selected = $(".' . $htmlname . '").val();
8798
+					$(".' . $htmlname.'").change(function() {
8799
+						var selected = $(".' . $htmlname.'").val();
8800 8800
 						console.log("We select "+selected)
8801 8801
 
8802
-						$(".' . $htmlname . '").val("");  /* reset visible combo value */
8802
+						$(".' . $htmlname.'").val("");  /* reset visible combo value */
8803 8803
 						$.each( saveRemoteData, function( key, value ) {
8804 8804
 							if (key == selected)
8805 8805
 							{
@@ -8807,7 +8807,7 @@  discard block
 block discarded – undo
8807 8807
 								location.assign(value.url);
8808 8808
 							}
8809 8809
 						});
8810
-					});' : '') . '
8810
+					});' : '').'
8811 8811
 
8812 8812
 				});
8813 8813
 				</script>';
@@ -8856,7 +8856,7 @@  discard block
 block discarded – undo
8856 8856
 		$useenhancedmultiselect = 0;
8857 8857
 		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
8858 8858
 			if ($addjscombo) {
8859
-				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0.
8859
+				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.
8860 8860
 			}
8861 8861
 		}
8862 8862
 
@@ -8865,7 +8865,7 @@  discard block
 block discarded – undo
8865 8865
 		// submitted to nothing.
8866 8866
 		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';
8867 8867
 		// Output select component
8868
-		$out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', (string) $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n";
8868
+		$out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', (string) $width) ? $width : $width.'px').'"' : '').'>'."\n";
8869 8869
 		if (is_array($array) && !empty($array)) {
8870 8870
 			if ($value_as_key) {
8871 8871
 				$array = array_combine($array, $array);
@@ -8886,33 +8886,33 @@  discard block
 block discarded – undo
8886 8886
 						$tmplabelhtml = empty($value['labelhtml']) ? '' : $value['labelhtml'];
8887 8887
 					}
8888 8888
 					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
8889
-					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
8889
+					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
8890 8890
 
8891
-					$out .= '<option value="' . $tmpkey . '"';
8891
+					$out .= '<option value="'.$tmpkey.'"';
8892 8892
 					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
8893 8893
 						$out .= ' selected';
8894 8894
 					}
8895 8895
 					if (!empty($tmplabelhtml)) {
8896
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
8896
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
8897 8897
 					} else {
8898
-						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
8899
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
8898
+						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval;
8899
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
8900 8900
 					}
8901 8901
 					$out .= '>';
8902 8902
 					$out .= dol_htmlentitiesbr($newval);
8903
-					$out .= '</option>' . "\n";
8903
+					$out .= '</option>'."\n";
8904 8904
 				}
8905 8905
 			}
8906 8906
 		}
8907
-		$out .= '</select>' . "\n";
8907
+		$out .= '</select>'."\n";
8908 8908
 
8909 8909
 		// Add code for jquery to use multiselect
8910 8910
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
8911
-			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
8912
-			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
8911
+			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
8912
+			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";
8913 8913
 			if ($addjscombo == 1) {
8914 8914
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
8915
-				$out .= 'function formatResult(record, container) {' . "\n";
8915
+				$out .= 'function formatResult(record, container) {'."\n";
8916 8916
 				// If property data-html set, we decode html entities and use this.
8917 8917
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
8918 8918
 				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {';
@@ -8920,26 +8920,26 @@  discard block
 block discarded – undo
8920 8920
 				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));';
8921 8921
 				$out .= '	}'."\n";
8922 8922
 				$out .= '	return record.text;';
8923
-				$out .= '}' . "\n";
8924
-				$out .= 'function formatSelection(record) {' . "\n";
8923
+				$out .= '}'."\n";
8924
+				$out .= 'function formatSelection(record) {'."\n";
8925 8925
 				if ($elemtype == 'category') {
8926
-					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
8926
+					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
8927 8927
 				} else {
8928 8928
 					$out .= 'return record.text;';
8929 8929
 				}
8930
-				$out .= '}' . "\n";
8930
+				$out .= '}'."\n";
8931 8931
 				$out .= '$(document).ready(function () {
8932
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
8932
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({';
8933 8933
 				if ($placeholder) {
8934 8934
 					$out .= '
8935 8935
 								placeholder: {
8936 8936
 								    id: \'-1\',
8937
-								    text: \'' . dol_escape_js($placeholder) . '\'
8937
+								    text: \'' . dol_escape_js($placeholder).'\'
8938 8938
 								  },';
8939 8939
 				}
8940 8940
 				$out .= '		dir: \'ltr\',
8941 8941
 								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
8942
-								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
8942
+								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
8943 8943
 								// Specify format function for dropdown item
8944 8944
 								formatResult: formatResult,
8945 8945
 							 	templateResult: formatResult,		/* For 4.0 */
@@ -8951,21 +8951,21 @@  discard block
 block discarded – undo
8951 8951
 
8952 8952
 							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
8953 8953
 								 the size only if component is not hidden by default on load */
8954
-							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
8954
+							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');
8955 8955
 						});' . "\n";
8956 8956
 			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
8957 8957
 				// Add other js lib
8958 8958
 				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
8959 8959
 				// ...
8960
-				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
8960
+				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';
8961 8961
 				$out .= '$(document).ready(function () {
8962
-							$(\'#' . $htmlname . '\').multiSelect({
8962
+							$(\'#' . $htmlname.'\').multiSelect({
8963 8963
 								containerHTML: \'<div class="multi-select-container">\',
8964 8964
 								menuHTML: \'<div class="multi-select-menu">\',
8965
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
8965
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
8966 8966
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
8967 8967
 								activeClass: \'multi-select-container--open\',
8968
-								noneText: \'' . $placeholder . '\'
8968
+								noneText: \'' . $placeholder.'\'
8969 8969
 							});
8970 8970
 						})';
8971 8971
 			}
@@ -8997,7 +8997,7 @@  discard block
 block discarded – undo
8997 8997
 			return '';
8998 8998
 		}
8999 8999
 
9000
-		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show
9000
+		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
9001 9001
 
9002 9002
 		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user
9003 9003
 			$tmparray = explode(',', $user->conf->$tmpvar);
@@ -9040,19 +9040,19 @@  discard block
 block discarded – undo
9040 9040
 				}
9041 9041
 
9042 9042
 				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
9043
-				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';
9044
-				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
9043
+				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
9044
+				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
9045 9045
 			}
9046 9046
 		}
9047 9047
 
9048
-		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
9048
+		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
9049 9049
 
9050 9050
         <dl class="dropdown">
9051 9051
             <dt>
9052
-            <a href="#' . $htmlname . '">
9053
-              ' . img_picto('', 'list') . '
9052
+            <a href="#' . $htmlname.'">
9053
+              ' . img_picto('', 'list').'
9054 9054
             </a>
9055
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
9055
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
9056 9056
             </dt>
9057 9057
             <dd class="dropdowndd">
9058 9058
                 <div class="multiselectcheckbox'.$htmlname.'">
@@ -9064,19 +9064,19 @@  discard block
 block discarded – undo
9064 9064
             </dd>
9065 9065
         </dl>
9066 9066
 
9067
-        <script nonce="' . getNonce() . '" type="text/javascript">
9067
+        <script nonce="' . getNonce().'" type="text/javascript">
9068 9068
           jQuery(document).ready(function () {
9069
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
9069
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
9070 9070
                   console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
9071 9071
 
9072 9072
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST
9073 9073
 
9074 9074
                   var title = $(this).val() + ",";
9075 9075
                   if ($(this).is(\':checked\')) {
9076
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
9076
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
9077 9077
                   }
9078 9078
                   else {
9079
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
9079
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
9080 9080
                   }
9081 9081
                   // Now, we submit page
9082 9082
                   //$(this).parents(\'form:first\').submit();
@@ -9107,7 +9107,7 @@  discard block
 block discarded – undo
9107 9107
 	 */
9108 9108
 	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
9109 9109
 	{
9110
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
9110
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
9111 9111
 
9112 9112
 		$cat = new Categorie($this->db);
9113 9113
 		$categories = $cat->containing($id, $type);
@@ -9117,10 +9117,10 @@  discard block
 block discarded – undo
9117 9117
 			foreach ($categories as $c) {
9118 9118
 				$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
9119 9119
 				foreach ($ways as $way) {
9120
-					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
9120
+					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
9121 9121
 				}
9122 9122
 			}
9123
-			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
9123
+			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
9124 9124
 		}
9125 9125
 
9126 9126
 		if ($rendermode == 0) {
@@ -9168,15 +9168,15 @@  discard block
 block discarded – undo
9168 9168
 
9169 9169
 
9170 9170
 			print '<div class="div-table-responsive-no-min">';
9171
-			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
9171
+			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
9172 9172
 
9173 9173
 			print '<tr class="liste_titre">';
9174
-			print '<td>' . $langs->trans("Type") . '</td>';
9175
-			print '<td>' . $langs->trans("Ref") . '</td>';
9174
+			print '<td>'.$langs->trans("Type").'</td>';
9175
+			print '<td>'.$langs->trans("Ref").'</td>';
9176 9176
 			print '<td class="center"></td>';
9177
-			print '<td class="center">' . $langs->trans("Date") . '</td>';
9178
-			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9179
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
9177
+			print '<td class="center">'.$langs->trans("Date").'</td>';
9178
+			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9179
+			print '<td class="right">'.$langs->trans("Status").'</td>';
9180 9180
 			print '<td></td>';
9181 9181
 			print '</tr>';
9182 9182
 
@@ -9195,13 +9195,13 @@  discard block
 block discarded – undo
9195 9195
 				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
9196 9196
 					$element = $regs[1];
9197 9197
 					$subelement = $regs[2];
9198
-					$tplpath = $element . '/' . $subelement;
9198
+					$tplpath = $element.'/'.$subelement;
9199 9199
 				}
9200 9200
 				$tplname = 'linkedobjectblock';
9201 9201
 
9202 9202
 				// To work with non standard path
9203 9203
 				if ($objecttype == 'facture') {
9204
-					$tplpath = 'compta/' . $element;
9204
+					$tplpath = 'compta/'.$element;
9205 9205
 					if (!isModEnabled('invoice')) {
9206 9206
 						continue; // Do not show if module disabled
9207 9207
 					}
@@ -9212,7 +9212,7 @@  discard block
 block discarded – undo
9212 9212
 						continue; // Do not show if module disabled
9213 9213
 					}
9214 9214
 				} elseif ($objecttype == 'propal') {
9215
-					$tplpath = 'comm/' . $element;
9215
+					$tplpath = 'comm/'.$element;
9216 9216
 					if (!isModEnabled('propal')) {
9217 9217
 						continue; // Do not show if module disabled
9218 9218
 					}
@@ -9263,7 +9263,7 @@  discard block
 block discarded – undo
9263 9263
 				$linkedObjectBlock = $objects;
9264 9264
 
9265 9265
 				// Output template part (modules that overwrite templates must declare this into descriptor)
9266
-				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
9266
+				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
9267 9267
 				foreach ($dirtpls as $reldir) {
9268 9268
 					$reldir = rtrim($reldir, '/');
9269 9269
 					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
@@ -9271,7 +9271,7 @@  discard block
 block discarded – undo
9271 9271
 						$noMoreLinkedObjectBlockAfter = 1;
9272 9272
 					}
9273 9273
 
9274
-					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
9274
+					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
9275 9275
 					if ($res) {
9276 9276
 						$nboftypesoutput++;
9277 9277
 						break;
@@ -9280,7 +9280,7 @@  discard block
 block discarded – undo
9280 9280
 			}
9281 9281
 
9282 9282
 			if (!$nboftypesoutput) {
9283
-				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
9283
+				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
9284 9284
 			}
9285 9285
 
9286 9286
 			print '</table>';
@@ -9320,14 +9320,14 @@  discard block
 block discarded – undo
9320 9320
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
9321 9321
 			$listofidcompanytoscan = $object->thirdparty->id;
9322 9322
 			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) {
9323
-				$listofidcompanytoscan .= ',' . $object->thirdparty->parent;
9323
+				$listofidcompanytoscan .= ','.$object->thirdparty->parent;
9324 9324
 			}
9325 9325
 			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) {
9326
-				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
9326
+				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
9327 9327
 				$tmpproject = new Project($this->db);
9328 9328
 				$tmpproject->fetch($object->fk_project);
9329 9329
 				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
9330
-					$listofidcompanytoscan .= ',' . $tmpproject->socid;
9330
+					$listofidcompanytoscan .= ','.$tmpproject->socid;
9331 9331
 				}
9332 9332
 				unset($tmpproject);
9333 9333
 			}
@@ -9337,63 +9337,63 @@  discard block
 block discarded – undo
9337 9337
 					'enabled' => isModEnabled('propal'),
9338 9338
 					'perms' => 1,
9339 9339
 					'label' => 'LinkToProposal',
9340
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('propal') . ')'),
9340
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
9341 9341
 				'shipping' => array(
9342 9342
 					'enabled' => isModEnabled('shipping'),
9343 9343
 					'perms' => 1,
9344 9344
 					'label' => 'LinkToExpedition',
9345
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('shipping') . ')'),
9345
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('shipping').')'),
9346 9346
 				'order' => array(
9347 9347
 					'enabled' => isModEnabled('order'),
9348 9348
 					'perms' => 1,
9349 9349
 					'label' => 'LinkToOrder',
9350
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande') . ')'),
9350
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
9351 9351
 				'invoice' => array(
9352 9352
 					'enabled' => isModEnabled('invoice'),
9353 9353
 					'perms' => 1,
9354 9354
 					'label' => 'LinkToInvoice',
9355
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'),
9355
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
9356 9356
 				'invoice_template' => array(
9357 9357
 					'enabled' => isModEnabled('invoice'),
9358 9358
 					'perms' => 1,
9359 9359
 					'label' => 'LinkToTemplateInvoice',
9360
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'),
9360
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
9361 9361
 				'contrat' => array(
9362 9362
 					'enabled' => isModEnabled('contract'),
9363 9363
 					'perms' => 1,
9364 9364
 					'label' => 'LinkToContract',
9365 9365
 					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
9366
-							FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "contrat as t, " . $this->db->prefix() . "contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('contract') . ') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
9366
+							FROM " . $this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
9367 9367
 				),
9368 9368
 				'fichinter' => array(
9369 9369
 					'enabled' => isModEnabled('intervention'),
9370 9370
 					'perms' => 1,
9371 9371
 					'label' => 'LinkToIntervention',
9372
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('intervention') . ')'),
9372
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
9373 9373
 				'supplier_proposal' => array(
9374 9374
 					'enabled' => isModEnabled('supplier_proposal'),
9375 9375
 					'perms' => 1,
9376 9376
 					'label' => 'LinkToSupplierProposal',
9377
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('supplier_proposal') . ')'),
9377
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
9378 9378
 				'order_supplier' => array(
9379 9379
 					'enabled' => isModEnabled("supplier_order"),
9380 9380
 					'perms' => 1,
9381 9381
 					'label' => 'LinkToSupplierOrder',
9382
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande_fournisseur') . ')'),
9382
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
9383 9383
 				'invoice_supplier' => array(
9384 9384
 					'enabled' => isModEnabled("supplier_invoice"),
9385 9385
 					'perms' => 1, 'label' => 'LinkToSupplierInvoice',
9386
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('facture_fourn') . ')'),
9386
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
9387 9387
 				'ticket' => array(
9388 9388
 					'enabled' => isModEnabled('ticket'),
9389 9389
 					'perms' => 1,
9390 9390
 					'label' => 'LinkToTicket',
9391
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('ticket') . ')'),
9391
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
9392 9392
 				'mo' => array(
9393 9393
 					'enabled' => isModEnabled('mrp'),
9394 9394
 					'perms' => 1,
9395 9395
 					'label' => 'LinkToMo',
9396
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM " . $this->db->prefix() . "societe as s INNER JOIN " . $this->db->prefix() . "mrp_mo as t ON t.fk_soc = s.rowid  WHERE  t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('mo') . ')')
9396
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid  WHERE  t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
9397 9397
 			);
9398 9398
 		}
9399 9399
 
@@ -9429,22 +9429,22 @@  discard block
 block discarded – undo
9429 9429
 			}
9430 9430
 
9431 9431
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
9432
-				print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
9432
+				print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
9433 9433
 
9434 9434
 				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) {
9435 9435
 					print '<br>'."\n";
9436 9436
 					print '<!-- form to add a link from anywhere -->'."\n";
9437
-					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
9438
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
9437
+					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
9438
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
9439 9439
 					print '<input type="hidden" name="action" value="addlinkbyref">';
9440
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
9441
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
9440
+					print '<input type="hidden" name="token" value="'.newToken().'">';
9441
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
9442 9442
 					print '<table class="noborder">';
9443 9443
 					print '<tr>';
9444 9444
 					//print '<td>' . $langs->trans("Ref") . '</td>';
9445
-					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
9446
-					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
9447
-					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
9445
+					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;';
9446
+					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;';
9447
+					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
9448 9448
 					print '</tr>';
9449 9449
 					print '</table>';
9450 9450
 					print '</form>';
@@ -9459,48 +9459,48 @@  discard block
 block discarded – undo
9459 9459
 
9460 9460
 					print '<br>';
9461 9461
 					print '<!-- form to add a link from object to same thirdparty -->'."\n";
9462
-					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
9462
+					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
9463 9463
 					print '<input type="hidden" name="action" value="addlink">';
9464
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
9465
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
9466
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
9464
+					print '<input type="hidden" name="token" value="'.newToken().'">';
9465
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
9466
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
9467 9467
 					print '<table class="noborder">';
9468 9468
 					print '<tr class="liste_titre">';
9469 9469
 					print '<td class="nowrap"></td>';
9470
-					print '<td class="center">' . $langs->trans("Ref") . '</td>';
9471
-					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>';
9472
-					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9473
-					print '<td class="left">' . $langs->trans("Company") . '</td>';
9470
+					print '<td class="center">'.$langs->trans("Ref").'</td>';
9471
+					print '<td class="left">'.$langs->trans("RefCustomer").'</td>';
9472
+					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9473
+					print '<td class="left">'.$langs->trans("Company").'</td>';
9474 9474
 					print '</tr>';
9475 9475
 					while ($i < $num) {
9476 9476
 						$objp = $this->db->fetch_object($resqllist);
9477 9477
 
9478 9478
 						print '<tr class="oddeven">';
9479 9479
 						print '<td class="left">';
9480
-						print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';
9480
+						print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
9481 9481
 						print '</td>';
9482
-						print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';
9483
-						print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';
9482
+						print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
9483
+						print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';
9484 9484
 						print '<td class="right">';
9485 9485
 						if ($possiblelink['label'] == 'LinkToContract') {
9486 9486
 							$form = new Form($this->db);
9487
-							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' ';
9487
+							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
9488 9488
 						}
9489
-						print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';
9489
+						print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
9490 9490
 						print '</td>';
9491
-						print '<td>' . $objp->name . '</td>';
9491
+						print '<td>'.$objp->name.'</td>';
9492 9492
 						print '</tr>';
9493 9493
 						$i++;
9494 9494
 					}
9495 9495
 					print '</table>';
9496 9496
 					print '<div class="center">';
9497 9497
 					if ($num) {
9498
-						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">';
9498
+						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">';
9499 9499
 					}
9500 9500
 					if (empty($conf->use_javascript_ajax)) {
9501
-						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9501
+						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9502 9502
 					} else {
9503
-						print '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9503
+						print '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9504 9504
 					}
9505 9505
 					print '</form>';
9506 9506
 					$this->db->free($resqllist);
@@ -9511,10 +9511,10 @@  discard block
 block discarded – undo
9511 9511
 
9512 9512
 				//$linktoelem.=($linktoelem?' &nbsp; ':'');
9513 9513
 				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) {
9514
-					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
9514
+					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
9515 9515
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
9516 9516
 				} else {
9517
-					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
9517
+					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
9518 9518
 				}
9519 9519
 			}
9520 9520
 		}
@@ -9524,22 +9524,22 @@  discard block
 block discarded – undo
9524 9524
     		<dl class="dropdown" id="linktoobjectname">
9525 9525
     		';
9526 9526
 			if (!empty($conf->use_javascript_ajax)) {
9527
-				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>';
9527
+				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
9528 9528
 			}
9529 9529
 			$linktoelem .= '<dd>
9530 9530
     		<div class="multiselectlinkto">
9531
-    		<ul class="ulselectedfields">' . $linktoelemlist . '
9531
+    		<ul class="ulselectedfields">' . $linktoelemlist.'
9532 9532
     		</ul>
9533 9533
     		</div>
9534 9534
     		</dd>
9535 9535
     		</dl>';
9536 9536
 		} else {
9537
-			$linktoelem = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
9537
+			$linktoelem = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
9538 9538
 		}
9539 9539
 
9540 9540
 		if (!empty($conf->use_javascript_ajax)) {
9541 9541
 			print '<!-- Add js to show linkto box -->
9542
-				<script nonce="' . getNonce() . '">
9542
+				<script nonce="' . getNonce().'">
9543 9543
 				jQuery(document).ready(function() {
9544 9544
 					jQuery(".linkto").click(function() {
9545 9545
 						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list");
@@ -9580,19 +9580,19 @@  discard block
 block discarded – undo
9580 9580
 
9581 9581
 		$disabled = ($disabled ? ' disabled' : '');
9582 9582
 
9583
-		$resultyesno = '<select class="flat width75' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
9583
+		$resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
9584 9584
 		if ($useempty) {
9585
-			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
9585
+			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
9586 9586
 		}
9587 9587
 		if (("$value" == 'yes') || ($value == 1)) {
9588
-			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";
9589
-			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";
9588
+			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
9589
+			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
9590 9590
 		} else {
9591 9591
 			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
9592
-			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";
9593
-			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";
9592
+			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
9593
+			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
9594 9594
 		}
9595
-		$resultyesno .= '</select>' . "\n";
9595
+		$resultyesno .= '</select>'."\n";
9596 9596
 
9597 9597
 		if ($addjscombo) {
9598 9598
 			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
@@ -9616,12 +9616,12 @@  discard block
 block discarded – undo
9616 9616
 	{
9617 9617
 		// phpcs:enable
9618 9618
 		$sql = "SELECT rowid, label";
9619
-		$sql .= " FROM " . $this->db->prefix() . "export_model";
9620
-		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";
9619
+		$sql .= " FROM ".$this->db->prefix()."export_model";
9620
+		$sql .= " WHERE type = '".$this->db->escape($type)."'";
9621 9621
 		$sql .= " ORDER BY rowid";
9622 9622
 		$result = $this->db->query($sql);
9623 9623
 		if ($result) {
9624
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
9624
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
9625 9625
 			if ($useempty) {
9626 9626
 				print '<option value="-1">&nbsp;</option>';
9627 9627
 			}
@@ -9631,9 +9631,9 @@  discard block
 block discarded – undo
9631 9631
 			while ($i < $num) {
9632 9632
 				$obj = $this->db->fetch_object($result);
9633 9633
 				if ($selected == $obj->rowid) {
9634
-					print '<option value="' . $obj->rowid . '" selected>';
9634
+					print '<option value="'.$obj->rowid.'" selected>';
9635 9635
 				} else {
9636
-					print '<option value="' . $obj->rowid . '">';
9636
+					print '<option value="'.$obj->rowid.'">';
9637 9637
 				}
9638 9638
 				print $obj->label;
9639 9639
 				print '</option>';
@@ -9724,8 +9724,8 @@  discard block
 block discarded – undo
9724 9724
 				$stringforfirstkey .= ' CTL +';
9725 9725
 			}
9726 9726
 
9727
-			$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
9728
-			$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
9727
+			$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="'.$stringforfirstkey.' p" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
9728
+			$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="'.$stringforfirstkey.' n" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
9729 9729
 		}
9730 9730
 
9731 9731
 		//print "xx".$previous_ref."x".$next_ref;
@@ -9733,18 +9733,18 @@  discard block
 block discarded – undo
9733 9733
 
9734 9734
 		// Right part of banner
9735 9735
 		if ($morehtmlright) {
9736
-			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
9736
+			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
9737 9737
 		}
9738 9738
 
9739 9739
 		if ($previous_ref || $next_ref || $morehtml) {
9740 9740
 			$ret .= '<div class="pagination paginationref"><ul class="right">';
9741 9741
 		}
9742 9742
 		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
9743
-			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
9743
+			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
9744 9744
 		}
9745 9745
 		if ($shownav && ($previous_ref || $next_ref)) {
9746
-			$ret .= '<li class="pagination">' . $previous_ref . '</li>';
9747
-			$ret .= '<li class="pagination">' . $next_ref . '</li>';
9746
+			$ret .= '<li class="pagination">'.$previous_ref.'</li>';
9747
+			$ret .= '<li class="pagination">'.$next_ref.'</li>';
9748 9748
 		}
9749 9749
 		if ($previous_ref || $next_ref || $morehtml) {
9750 9750
 			$ret .= '</ul></div>';
@@ -9759,7 +9759,7 @@  discard block
 block discarded – undo
9759 9759
 			$morehtmlstatus = $hookmanager->resPrint;
9760 9760
 		}
9761 9761
 		if ($morehtmlstatus) {
9762
-			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
9762
+			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
9763 9763
 		}
9764 9764
 
9765 9765
 		$parameters = array();
@@ -9773,14 +9773,14 @@  discard block
 block discarded – undo
9773 9773
 		// Left part of banner
9774 9774
 		if ($morehtmlleft) {
9775 9775
 			if ($conf->browser->layout == 'phone') {
9776
-				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';
9776
+				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';
9777 9777
 			} else {
9778
-				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';
9778
+				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
9779 9779
 			}
9780 9780
 		}
9781 9781
 
9782 9782
 		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
9783
-		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
9783
+		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
9784 9784
 
9785 9785
 		// For thirdparty, contact, user, member, the ref is the id, so we show something else
9786 9786
 		if ($object->element == 'societe') {
@@ -9794,7 +9794,7 @@  discard block
 block discarded – undo
9794 9794
 
9795 9795
 			if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
9796 9796
 				if (!is_object($extralanguages)) {
9797
-					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
9797
+					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
9798 9798
 					$extralanguages = new ExtraLanguages($this->db);
9799 9799
 				}
9800 9800
 				$extralanguages->fetch_name_extralanguages('societe');
@@ -9809,29 +9809,29 @@  discard block
 block discarded – undo
9809 9809
 						if ($object->array_languages['name'][$extralangcode]) {
9810 9810
 							$htmltext .= $object->array_languages['name'][$extralangcode];
9811 9811
 						} else {
9812
-							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>';
9812
+							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>';
9813 9813
 						}
9814 9814
 					}
9815
-					$ret .= '<!-- Show translations of name -->' . "\n";
9815
+					$ret .= '<!-- Show translations of name -->'."\n";
9816 9816
 					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
9817 9817
 				}
9818 9818
 			}
9819 9819
 		} elseif ($object->element == 'member') {
9820 9820
 			'@phan-var-force Adherent $object';
9821
-			$ret .= $object->ref . '<br>';
9821
+			$ret .= $object->ref.'<br>';
9822 9822
 			$fullname = $object->getFullName($langs);
9823 9823
 			if ($object->morphy == 'mor' && $object->societe) {
9824
-				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
9824
+				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
9825 9825
 			} else {
9826
-				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
9826
+				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
9827 9827
 			}
9828 9828
 		} elseif (in_array($object->element, array('contact', 'user'))) {
9829
-			$ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;
9829
+			$ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;
9830 9830
 		} elseif ($object->element == 'usergroup') {
9831 9831
 			$ret .= dol_htmlentities($object->name);
9832 9832
 		} elseif (in_array($object->element, array('action', 'agenda'))) {
9833 9833
 			'@phan-var-force ActionComm $object';
9834
-			$ret .= $object->ref . '<br>' . $object->label;
9834
+			$ret .= $object->ref.'<br>'.$object->label;
9835 9835
 		} elseif (in_array($object->element, array('adherent_type'))) {
9836 9836
 			$ret .= $object->label;
9837 9837
 		} elseif ($object->element == 'ecm_directories') {
@@ -9884,9 +9884,9 @@  discard block
 block discarded – undo
9884 9884
 		}
9885 9885
 
9886 9886
 		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty
9887
-		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
9888
-		$out = '<!-- url barcode = ' . $url . ' -->';
9889
-		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';
9887
+		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
9888
+		$out = '<!-- url barcode = '.$url.' -->';
9889
+		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';
9890 9890
 
9891 9891
 		return $out;
9892 9892
 	}
@@ -9913,7 +9913,7 @@  discard block
 block discarded – undo
9913 9913
 		global $conf, $langs;
9914 9914
 
9915 9915
 		$entity = (empty($object->entity) ? $conf->entity : $object->entity);
9916
-		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
9916
+		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
9917 9917
 
9918 9918
 		$dir = '';
9919 9919
 		$file = '';
@@ -9926,28 +9926,28 @@  discard block
 block discarded – undo
9926 9926
 			if (!empty($object->logo)) {
9927 9927
 				if (dolIsAllowedForPreview($object->logo)) {
9928 9928
 					if ((string) $imagesize == 'mini') {
9929
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
9929
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
9930 9930
 					} elseif ((string) $imagesize == 'small') {
9931
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
9931
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');
9932 9932
 					} else {
9933
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
9933
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
9934 9934
 					}
9935
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
9935
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
9936 9936
 				}
9937 9937
 			}
9938 9938
 			$email = $object->email;
9939 9939
 		} elseif ($modulepart == 'contact') {
9940
-			$dir = $conf->societe->multidir_output[$entity] . '/contact';
9940
+			$dir = $conf->societe->multidir_output[$entity].'/contact';
9941 9941
 			if (!empty($object->photo)) {
9942 9942
 				if (dolIsAllowedForPreview($object->photo)) {
9943 9943
 					if ((string) $imagesize == 'mini') {
9944
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
9944
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');
9945 9945
 					} elseif ((string) $imagesize == 'small') {
9946
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
9946
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');
9947 9947
 					} else {
9948
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
9948
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
9949 9949
 					}
9950
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
9950
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
9951 9951
 				}
9952 9952
 			}
9953 9953
 			$email = $object->email;
@@ -9957,17 +9957,17 @@  discard block
 block discarded – undo
9957 9957
 			if (!empty($object->photo)) {
9958 9958
 				if (dolIsAllowedForPreview($object->photo)) {
9959 9959
 					if ((string) $imagesize == 'mini') {
9960
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
9960
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');
9961 9961
 					} elseif ((string) $imagesize == 'small') {
9962
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
9962
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
9963 9963
 					} else {
9964
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
9964
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
9965 9965
 					}
9966
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
9966
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
9967 9967
 				}
9968 9968
 			}
9969 9969
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
9970
-				$altfile = $object->id . ".jpg"; // For backward compatibility
9970
+				$altfile = $object->id.".jpg"; // For backward compatibility
9971 9971
 			}
9972 9972
 			$email = $object->email;
9973 9973
 			$capture = 'user';
@@ -9976,17 +9976,17 @@  discard block
 block discarded – undo
9976 9976
 			if (!empty($object->photo)) {
9977 9977
 				if (dolIsAllowedForPreview($object->photo)) {
9978 9978
 					if ((string) $imagesize == 'mini') {
9979
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
9979
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
9980 9980
 					} elseif ((string) $imagesize == 'small') {
9981
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
9981
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
9982 9982
 					} else {
9983
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
9983
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
9984 9984
 					}
9985
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
9985
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
9986 9986
 				}
9987 9987
 			}
9988 9988
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
9989
-				$altfile = $object->id . ".jpg"; // For backward compatibility
9989
+				$altfile = $object->id.".jpg"; // For backward compatibility
9990 9990
 			}
9991 9991
 			$email = $object->email;
9992 9992
 			$capture = 'user';
@@ -10012,35 +10012,35 @@  discard block
 block discarded – undo
10012 10012
 		$ret = '';
10013 10013
 
10014 10014
 		if ($dir) {
10015
-			if ($file && file_exists($dir . "/" . $file)) {
10015
+			if ($file && file_exists($dir."/".$file)) {
10016 10016
 				if ($addlinktofullsize) {
10017
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10017
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10018 10018
 					if ($urladvanced) {
10019
-						$ret .= '<a href="' . $urladvanced . '">';
10019
+						$ret .= '<a href="'.$urladvanced.'">';
10020 10020
 					} else {
10021
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10021
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10022 10022
 					}
10023 10023
 				}
10024
-				$ret .= '<img alt="" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">';
10024
+				$ret .= '<img alt="" class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').' photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
10025 10025
 				if ($addlinktofullsize) {
10026 10026
 					$ret .= '</a>';
10027 10027
 				}
10028
-			} elseif ($altfile && file_exists($dir . "/" . $altfile)) {
10028
+			} elseif ($altfile && file_exists($dir."/".$altfile)) {
10029 10029
 				if ($addlinktofullsize) {
10030
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10030
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10031 10031
 					if ($urladvanced) {
10032
-						$ret .= '<a href="' . $urladvanced . '">';
10032
+						$ret .= '<a href="'.$urladvanced.'">';
10033 10033
 					} else {
10034
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10034
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10035 10035
 					}
10036 10036
 				}
10037
-				$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo alt" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" class="' . $cssclass . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($altfile) . '&cache=' . $cache . '">';
10037
+				$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" class="'.$cssclass.'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">';
10038 10038
 				if ($addlinktofullsize) {
10039 10039
 					$ret .= '</a>';
10040 10040
 				}
10041 10041
 			} else {
10042 10042
 				$nophoto = '/public/theme/common/nophoto.png';
10043
-				$defaultimg = 'identicon';        // For gravatar
10043
+				$defaultimg = 'identicon'; // For gravatar
10044 10044
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found
10045 10045
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) {
10046 10046
 						$nophoto = 'company';
@@ -10058,13 +10058,13 @@  discard block
 block discarded – undo
10058 10058
 				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
10059 10059
 					// see https://gravatar.com/site/implement/images/php/
10060 10060
 					$ret .= '<!-- Put link to gravatar -->';
10061
-					$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 'sha256', 1) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash
10061
+					$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)), 'sha256', 1).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash
10062 10062
 				} else {
10063 10063
 					if ($nophoto == 'company') {
10064
-						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
10064
+						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>';
10065 10065
 						//$ret .= '<div class="difforspanimgright"></div>';
10066 10066
 					} else {
10067
-						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
10067
+						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
10068 10068
 					}
10069 10069
 				}
10070 10070
 			}
@@ -10075,15 +10075,15 @@  discard block
 block discarded – undo
10075 10075
 				}
10076 10076
 				$ret .= '<table class="nobordernopadding centpercent">';
10077 10077
 				if ($object->photo) {
10078
-					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>';
10078
+					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
10079 10079
 				}
10080 10080
 				$ret .= '<tr><td class="tdoverflow">';
10081 10081
 				$maxfilesizearray = getMaxFileSizeArray();
10082 10082
 				$maxmin = $maxfilesizearray['maxmin'];
10083 10083
 				if ($maxmin > 0) {
10084
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
10084
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
10085 10085
 				}
10086
-				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';
10086
+				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
10087 10087
 				$ret .= '</td></tr>';
10088 10088
 				$ret .= '</table>';
10089 10089
 			}
@@ -10137,38 +10137,38 @@  discard block
 block discarded – undo
10137 10137
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10138 10138
 			$sql .= ", e.label";
10139 10139
 		}
10140
-		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";
10140
+		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
10141 10141
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10142
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";
10142
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
10143 10143
 			if ($force_entity) {
10144
-				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";
10144
+				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
10145 10145
 			} else {
10146 10146
 				$sql .= " WHERE ug.entity IS NOT NULL";
10147 10147
 			}
10148 10148
 		} else {
10149
-			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";
10149
+			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";
10150 10150
 		}
10151 10151
 		if (is_array($exclude) && $excludeGroups) {
10152
-			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")";
10152
+			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")";
10153 10153
 		}
10154 10154
 		if (is_array($include) && $includeGroups) {
10155
-			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")";
10155
+			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")";
10156 10156
 		}
10157 10157
 		$sql .= " ORDER BY ug.nom ASC";
10158 10158
 
10159
-		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
10159
+		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
10160 10160
 		$resql = $this->db->query($sql);
10161 10161
 		if ($resql) {
10162 10162
 			// Enhance with select2
10163
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10163
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10164 10164
 
10165
-			$out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
10165
+			$out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
10166 10166
 
10167 10167
 			$num = $this->db->num_rows($resql);
10168 10168
 			$i = 0;
10169 10169
 			if ($num) {
10170 10170
 				if ($show_empty && !$multiple) {
10171
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10171
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
10172 10172
 				}
10173 10173
 
10174 10174
 				while ($i < $num) {
@@ -10181,11 +10181,11 @@  discard block
 block discarded – undo
10181 10181
 					$label = $obj->name;
10182 10182
 					$labelhtml = $obj->name;
10183 10183
 					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
10184
-						$label .= " (" . $obj->label . ")";
10185
-						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>';
10184
+						$label .= " (".$obj->label.")";
10185
+						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>';
10186 10186
 					}
10187 10187
 
10188
-					$out .= '<option value="' . $obj->rowid . '"';
10188
+					$out .= '<option value="'.$obj->rowid.'"';
10189 10189
 					if ($disableline) {
10190 10190
 						$out .= ' disabled';
10191 10191
 					}
@@ -10201,9 +10201,9 @@  discard block
 block discarded – undo
10201 10201
 				}
10202 10202
 			} else {
10203 10203
 				if ($show_empty) {
10204
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
10204
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
10205 10205
 				}
10206
-				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
10206
+				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
10207 10207
 			}
10208 10208
 			$out .= '</select>';
10209 10209
 
@@ -10247,25 +10247,25 @@  discard block
 block discarded – undo
10247 10247
 		$out = '';
10248 10248
 
10249 10249
 		if (!empty($conf->use_javascript_ajax)) {
10250
-			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';
10250
+			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';
10251 10251
 		}
10252
-		$out .= '<script nonce="' . getNonce() . '">
10252
+		$out .= '<script nonce="'.getNonce().'">
10253 10253
             $(document).ready(function() {
10254
-                $("#' . $cssclass . 's").click(function() {
10254
+                $("#' . $cssclass.'s").click(function() {
10255 10255
                     if($(this).is(\':checked\')){
10256
-                        console.log("We check all ' . $cssclass . ' and trigger the change method");
10257
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
10256
+                        console.log("We check all ' . $cssclass.' and trigger the change method");
10257
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
10258 10258
                     }
10259 10259
                     else
10260 10260
                     {
10261 10261
                         console.log("We uncheck all");
10262
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
10262
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
10263 10263
                     }' . "\n";
10264 10264
 		if ($calljsfunction) {
10265
-			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10265
+			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10266 10266
 		}
10267 10267
 		$out .= '         });
10268
-        	        $(".' . $cssclass . '").change(function() {
10268
+        	        $(".' . $cssclass.'").change(function() {
10269 10269
 					$(this).closest("tr").toggleClass("highlight", this.checked);
10270 10270
 				});
10271 10271
 		 	});
@@ -10310,67 +10310,67 @@  discard block
 block discarded – undo
10310 10310
 		global $langs, $user;
10311 10311
 
10312 10312
 		$out = '';
10313
-		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";
10314
-		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")";
10313
+		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
10314
+		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
10315 10315
 		if (!empty($excludeid)) {
10316
-			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")";
10316
+			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
10317 10317
 		}
10318 10318
 		$sql .= " ORDER BY label";
10319 10319
 
10320 10320
 		$resql = $this->db->query($sql);
10321 10321
 		if ($resql) {
10322
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';
10322
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
10323 10323
 			if ($useempty) {
10324 10324
 				$out .= '<option value="0">&nbsp;</option>';
10325 10325
 			}
10326 10326
 
10327 10327
 			while ($obj = $this->db->fetch_object($resql)) {
10328
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
10328
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
10329 10329
 			}
10330 10330
 			$out .= '</select>';
10331
-			$out .= ajax_combobox('select_' . $htmlname);
10331
+			$out .= ajax_combobox('select_'.$htmlname);
10332 10332
 
10333 10333
 			if (!empty($htmlname) && $user->admin && $info_admin) {
10334
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10334
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10335 10335
 			}
10336 10336
 
10337 10337
 			if (!empty($target)) {
10338
-				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10338
+				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10339 10339
 				$resql = $this->db->query($sql);
10340 10340
 				if ($resql) {
10341 10341
 					if ($this->db->num_rows($resql) > 0) {
10342 10342
 						$obj = $this->db->fetch_object($resql);
10343
-						$out .= '<script nonce="' . getNonce() . '">
10343
+						$out .= '<script nonce="'.getNonce().'">
10344 10344
 							$(function() {
10345
-								$("select[name=' . $target . ']").on("change", function() {
10345
+								$("select[name=' . $target.']").on("change", function() {
10346 10346
 									var current_val = $(this).val();
10347
-									if (current_val == ' . $obj->id . ') {';
10347
+									if (current_val == ' . $obj->id.') {';
10348 10348
 						if (!empty($default_selected) || !empty($selected)) {
10349
-							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
10349
+							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
10350 10350
 						}
10351 10351
 
10352 10352
 						$out .= '
10353
-										$("select[name=' . $htmlname . ']").change();
10353
+										$("select[name=' . $htmlname.']").change();
10354 10354
 									}
10355 10355
 								});
10356 10356
 
10357
-								$("select[name=' . $htmlname . ']").change(function() {
10357
+								$("select[name=' . $htmlname.']").change(function() {
10358 10358
 
10359
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
10359
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
10360 10360
 										// get price of kilometer to fill the unit price
10361 10361
 										$.ajax({
10362 10362
 											method: "POST",
10363 10363
 											dataType: "json",
10364
-											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' },
10365
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '",
10364
+											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' },
10365
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'",
10366 10366
 										}).done(function( data, textStatus, jqXHR ) {
10367 10367
 											console.log(data);
10368 10368
 											if (typeof data.up != "undefined") {
10369 10369
 												$("input[name=value_unit]").val(data.up);
10370
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
10370
+												$("select[name=' . $htmlname.']").attr("title", data.title);
10371 10371
 											} else {
10372 10372
 												$("input[name=value_unit]").val("");
10373
-												$("select[name=' . $htmlname . ']").attr("title", "");
10373
+												$("select[name=' . $htmlname.']").attr("title", "");
10374 10374
 											}
10375 10375
 										});
10376 10376
 									}
@@ -10400,18 +10400,18 @@  discard block
 block discarded – undo
10400 10400
 		global $conf, $langs;
10401 10401
 
10402 10402
 		$out = '';
10403
-		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";
10404
-		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";
10403
+		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
10404
+		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
10405 10405
 
10406 10406
 		$resql = $this->db->query($sql);
10407 10407
 		if ($resql) {
10408
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10408
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10409 10409
 			if ($useempty) {
10410 10410
 				$out .= '<option value="0"></option>';
10411 10411
 			}
10412 10412
 
10413 10413
 			while ($obj = $this->db->fetch_object($resql)) {
10414
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
10414
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
10415 10415
 			}
10416 10416
 			$out .= '</select>';
10417 10417
 		} else {
@@ -10442,12 +10442,12 @@  discard block
 block discarded – undo
10442 10442
 
10443 10443
 		$resql = $this->db->query($sql);
10444 10444
 		if ($resql) {
10445
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10445
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10446 10446
 			if ($useempty) {
10447 10447
 				$out .= '<option value="0"></option>';
10448 10448
 			}
10449 10449
 			if ($allchoice) {
10450
-				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
10450
+				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
10451 10451
 			}
10452 10452
 
10453 10453
 			$field = 'code';
@@ -10457,7 +10457,7 @@  discard block
 block discarded – undo
10457 10457
 
10458 10458
 			while ($obj = $this->db->fetch_object($resql)) {
10459 10459
 				$key = $langs->trans($obj->code);
10460
-				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
10460
+				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
10461 10461
 			}
10462 10462
 			$out .= '</select>';
10463 10463
 
@@ -10491,7 +10491,7 @@  discard block
 block discarded – undo
10491 10491
 	{
10492 10492
 		global $user, $conf, $langs;
10493 10493
 
10494
-		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
10494
+		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
10495 10495
 
10496 10496
 		if (is_null($usertofilter)) {
10497 10497
 			$usertofilter = $user;
@@ -10515,10 +10515,10 @@  discard block
 block discarded – undo
10515 10515
 		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
10516 10516
             p.title, p.fk_soc, p.fk_statut, p.public,";
10517 10517
 		$sql .= ' s.nom as name';
10518
-		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
10519
-		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';
10520
-		$sql .= ' ' . $this->db->prefix() . 'facture as f';
10521
-		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
10518
+		$sql .= ' FROM '.$this->db->prefix().'projet as p';
10519
+		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
10520
+		$sql .= ' '.$this->db->prefix().'facture as f';
10521
+		$sql .= " WHERE p.entity IN (".getEntity('project').")";
10522 10522
 		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
10523 10523
 		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
10524 10524
 		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
@@ -10529,14 +10529,14 @@  discard block
 block discarded – undo
10529 10529
 		if ($resql) {
10530 10530
 			// Use select2 selector
10531 10531
 			if (!empty($conf->use_javascript_ajax)) {
10532
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10532
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10533 10533
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
10534 10534
 				$out .= $comboenhancement;
10535 10535
 				$morecss = 'minwidth200imp maxwidth500';
10536 10536
 			}
10537 10537
 
10538 10538
 			if (empty($option_only)) {
10539
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10539
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10540 10540
 			}
10541 10541
 			if (!empty($show_empty)) {
10542 10542
 				$out .= '<option value="0" class="optiongrey">';
@@ -10566,33 +10566,33 @@  discard block
 block discarded – undo
10566 10566
 						if ($showproject == 'all') {
10567 10567
 							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
10568 10568
 							if ($obj->name) {
10569
-								$labeltoshow .= ' - ' . $obj->name; // Soc name
10569
+								$labeltoshow .= ' - '.$obj->name; // Soc name
10570 10570
 							}
10571 10571
 
10572 10572
 							$disabled = 0;
10573 10573
 							if ($obj->fk_statut == Project::STATUS_DRAFT) {
10574 10574
 								$disabled = 1;
10575
-								$labeltoshow .= ' - ' . $langs->trans("Draft");
10575
+								$labeltoshow .= ' - '.$langs->trans("Draft");
10576 10576
 							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
10577 10577
 								if ($discard_closed == 2) {
10578 10578
 									$disabled = 1;
10579 10579
 								}
10580
-								$labeltoshow .= ' - ' . $langs->trans("Closed");
10580
+								$labeltoshow .= ' - '.$langs->trans("Closed");
10581 10581
 							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
10582 10582
 								$disabled = 1;
10583
-								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
10583
+								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
10584 10584
 							}
10585 10585
 						}
10586 10586
 
10587 10587
 						if (!empty($selected) && $selected == $obj->rowid) {
10588
-							$out .= '<option value="' . $obj->rowid . '" selected';
10588
+							$out .= '<option value="'.$obj->rowid.'" selected';
10589 10589
 							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10590
-							$out .= '>' . $labeltoshow . '</option>';
10590
+							$out .= '>'.$labeltoshow.'</option>';
10591 10591
 						} else {
10592 10592
 							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
10593 10593
 								$resultat = '';
10594 10594
 							} else {
10595
-								$resultat = '<option value="' . $obj->rowid . '"';
10595
+								$resultat = '<option value="'.$obj->rowid.'"';
10596 10596
 								if ($disabled) {
10597 10597
 									$resultat .= ' disabled';
10598 10598
 								}
@@ -10644,22 +10644,22 @@  discard block
 block discarded – undo
10644 10644
 
10645 10645
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
10646 10646
 		//$sql.= ', el.fk_source';
10647
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
10648
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
10647
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
10648
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
10649 10649
 		$sql .= " ORDER BY f.titre ASC";
10650 10650
 
10651 10651
 		$resql = $this->db->query($sql);
10652 10652
 		if ($resql) {
10653 10653
 			// Use select2 selector
10654 10654
 			if (!empty($conf->use_javascript_ajax)) {
10655
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10655
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10656 10656
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
10657 10657
 				$out .= $comboenhancement;
10658 10658
 				$morecss = 'minwidth200imp maxwidth500';
10659 10659
 			}
10660 10660
 
10661 10661
 			if (empty($option_only)) {
10662
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10662
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10663 10663
 			}
10664 10664
 			if (!empty($show_empty)) {
10665 10665
 				$out .= '<option value="0" class="optiongrey">';
@@ -10678,19 +10678,19 @@  discard block
 block discarded – undo
10678 10678
 					$disabled = 0;
10679 10679
 					if (!empty($obj->suspended)) {
10680 10680
 						$disabled = 1;
10681
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
10681
+						$labeltoshow .= ' - '.$langs->trans("Closed");
10682 10682
 					}
10683 10683
 
10684 10684
 
10685 10685
 					if (!empty($selected) && $selected == $obj->rowid) {
10686
-						$out .= '<option value="' . $obj->rowid . '" selected';
10686
+						$out .= '<option value="'.$obj->rowid.'" selected';
10687 10687
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10688
-						$out .= '>' . $labeltoshow . '</option>';
10688
+						$out .= '>'.$labeltoshow.'</option>';
10689 10689
 					} else {
10690 10690
 						if ($disabled && ($selected != $obj->rowid)) {
10691 10691
 							$resultat = '';
10692 10692
 						} else {
10693
-							$resultat = '<option value="' . $obj->rowid . '"';
10693
+							$resultat = '<option value="'.$obj->rowid.'"';
10694 10694
 							if ($disabled) {
10695 10695
 								$resultat .= ' disabled';
10696 10696
 							}
@@ -10730,14 +10730,14 @@  discard block
 block discarded – undo
10730 10730
 		global $langs;
10731 10731
 
10732 10732
 		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with ()
10733
-			$search_component_params_hidden = '(' . $search_component_params_hidden . ')';
10733
+			$search_component_params_hidden = '('.$search_component_params_hidden.')';
10734 10734
 		}
10735 10735
 
10736 10736
 		$ret = '';
10737 10737
 
10738 10738
 		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';
10739 10739
 		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
10740
-		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth hideonsmartphone" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
10740
+		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth hideonsmartphone" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
10741 10741
 		$ret .= '</a>';
10742 10742
 
10743 10743
 		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
@@ -10781,29 +10781,29 @@  discard block
 block discarded – undo
10781 10781
 			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
10782 10782
 		}
10783 10783
 		$ret .= "<!-- We store the full Universal Search String into this field. For example: (t.ref:like:'SO-%') AND ((t.ref:like:'CO-%') OR (t.ref:like:'AA%')) -->";
10784
-		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';
10784
+		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
10785 10785
 		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";
10786 10786
 
10787 10787
 		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields
10788 10788
 		foreach ($arrayofcriterias as $criteria) {
10789 10789
 			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) {
10790
-				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
10790
+				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
10791 10791
 					continue;
10792 10792
 				}
10793 10793
 				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) {
10794 10794
 					continue;
10795 10795
 				}
10796 10796
 				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
10797
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';
10798
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';
10799
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';
10800
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';
10801
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';
10802
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';
10803
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';
10804
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';
10797
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
10798
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
10799
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
10800
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
10801
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
10802
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
10803
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
10804
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
10805 10805
 				} else {
10806
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';
10806
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
10807 10807
 				}
10808 10808
 			}
10809 10809
 		}
@@ -10811,7 +10811,7 @@  discard block
 block discarded – undo
10811 10811
 		$ret .= '</div>';
10812 10812
 
10813 10813
 		$ret .= "<!-- Field to enter a generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n";
10814
-		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
10814
+		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
10815 10815
 
10816 10816
 		$ret .= '</div>';
10817 10817
 		$ret .= '</div>';
@@ -10885,7 +10885,7 @@  discard block
 block discarded – undo
10885 10885
 
10886 10886
 		$TModels = array();
10887 10887
 
10888
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
10888
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
10889 10889
 		$formmail = new FormMail($this->db);
10890 10890
 		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
10891 10891
 
@@ -10898,17 +10898,17 @@  discard block
 block discarded – undo
10898 10898
 			}
10899 10899
 		}
10900 10900
 
10901
-		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';
10901
+		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
10902 10902
 
10903 10903
 		foreach ($TModels as $id_model => $label_model) {
10904
-			$retstring .= '<option value="' . $id_model . '"';
10905
-			$retstring .= ">" . $label_model . "</option>";
10904
+			$retstring .= '<option value="'.$id_model.'"';
10905
+			$retstring .= ">".$label_model."</option>";
10906 10906
 		}
10907 10907
 
10908 10908
 		$retstring .= "</select>";
10909 10909
 
10910 10910
 		if ($addjscombo) {
10911
-			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail');
10911
+			$retstring .= ajax_combobox('select_'.$prefix.'model_mail');
10912 10912
 		}
10913 10913
 
10914 10914
 		return $retstring;
@@ -10959,16 +10959,16 @@  discard block
 block discarded – undo
10959 10959
 
10960 10960
 		foreach ($buttons as $button) {
10961 10961
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
10962
-			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';
10962
+			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
10963 10963
 		}
10964 10964
 		$retstring .= $withoutdiv ? '' : '</div>';
10965 10965
 
10966 10966
 		if ($dol_openinpopup) {
10967
-			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";
10968
-			$retstring .= '<script nonce="' . getNonce() . '">';
10967
+			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";
10968
+			$retstring .= '<script nonce="'.getNonce().'">';
10969 10969
 			$retstring .= 'jQuery(".button-cancel").click(function(e) {
10970
-				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');
10971
-				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');
10970
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\');
10971
+				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\');
10972 10972
 				 });';
10973 10973
 			$retstring .= '</script>';
10974 10974
 		}
@@ -10997,7 +10997,7 @@  discard block
 block discarded – undo
10997 10997
 		dol_syslog(__METHOD__, LOG_DEBUG);
10998 10998
 
10999 10999
 		$sql = "SELECT rowid, code, label as label";
11000
-		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';
11000
+		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';
11001 11001
 		$sql .= " WHERE active = 1";
11002 11002
 
11003 11003
 		$resql = $this->db->query($sql);
@@ -11008,7 +11008,7 @@  discard block
 block discarded – undo
11008 11008
 				$obj = $this->db->fetch_object($resql);
11009 11009
 
11010 11010
 				// If translation exists, we use it, otherwise we take the default wording
11011
-				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11011
+				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11012 11012
 				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;
11013 11013
 				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;
11014 11014
 				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label;
@@ -11040,18 +11040,18 @@  discard block
 block discarded – undo
11040 11040
 		global $langs, $user;
11041 11041
 
11042 11042
 		$out = '';
11043
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
11043
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
11044 11044
 
11045 11045
 		$this->load_cache_invoice_subtype();
11046 11046
 
11047
-		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
11047
+		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
11048 11048
 		if ($addempty) {
11049 11049
 			$out .= '<option value="0">&nbsp;</option>';
11050 11050
 		}
11051 11051
 
11052 11052
 		foreach ($this->cache_invoice_subtype as $rowid => $subtype) {
11053 11053
 			$label = $subtype['label'];
11054
-			$out .= '<option value="' . $subtype['rowid'] . '"';
11054
+			$out .= '<option value="'.$subtype['rowid'].'"';
11055 11055
 			if ($selected == $subtype['rowid']) {
11056 11056
 				$out .= ' selected="selected"';
11057 11057
 			}
Please login to merge, or discard this patch.