Completed
Branch develop (f2006c)
by
unknown
24:48
created
htdocs/societe/class/api_contacts.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -412,7 +412,7 @@
 block discarded – undo
412 412
 		$this->contact->oldcopy = clone $this->contact; // @phan-suppress-current-line PhanTypeMismatchProperty
413 413
 
414 414
 		if ($this->contact->delete(DolibarrApiAccess::$user) <= 0) {
415
-			throw new RestException(500, 'Error when delete contact ' . $this->contact->error);
415
+			throw new RestException(500, 'Error when delete contact '.$this->contact->error);
416 416
 		}
417 417
 
418 418
 		return array(
Please login to merge, or discard this patch.
test/phpunit/SecurityTest.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -25,36 +25,36 @@  discard block
 block discarded – undo
25 25
  *		\remarks	To run this script as CLI:  phpunit filename.php
26 26
  */
27 27
 
28
-global $conf,$user,$langs,$db;
28
+global $conf, $user, $langs, $db;
29 29
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
30 30
 //require_once 'PHPUnit/Autoload.php';
31 31
 
32
-if (! defined('NOREQUIRESOC')) {
32
+if (!defined('NOREQUIRESOC')) {
33 33
 	define('NOREQUIRESOC', '1');
34 34
 }
35
-if (! defined('NOCSRFCHECK')) {
35
+if (!defined('NOCSRFCHECK')) {
36 36
 	define('NOCSRFCHECK', '1');
37 37
 }
38
-if (! defined('NOTOKENRENEWAL')) {
38
+if (!defined('NOTOKENRENEWAL')) {
39 39
 	define('NOTOKENRENEWAL', '1');
40 40
 }
41
-if (! defined('NOREQUIREMENU')) {
41
+if (!defined('NOREQUIREMENU')) {
42 42
 	define('NOREQUIREMENU', '1'); // If there is no menu to show
43 43
 }
44
-if (! defined('NOREQUIREHTML')) {
44
+if (!defined('NOREQUIREHTML')) {
45 45
 	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
46 46
 }
47
-if (! defined('NOREQUIREAJAX')) {
47
+if (!defined('NOREQUIREAJAX')) {
48 48
 	define('NOREQUIREAJAX', '1');
49 49
 }
50
-if (! defined("NOLOGIN")) {
51
-	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session)
50
+if (!defined("NOLOGIN")) {
51
+	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
52 52
 }
53
-if (! defined("NOSESSION")) {
53
+if (!defined("NOSESSION")) {
54 54
 	define("NOSESSION", '1');
55 55
 }
56 56
 
57
-require_once dirname(__FILE__).'/../../htdocs/main.inc.php';	// We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
57
+require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
58 58
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
59 59
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
60 60
 require_once dirname(__FILE__).'/CommonClassTest.class.php';
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 		$result = testSqlAndScriptInject($test, 0);
229 229
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee');
230 230
 
231
-		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">";		// Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
232
-		$test = "<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">";	// Same
231
+		$test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer.
232
+		$test = "<IMG SRC=\"jav&#x0D;ascript:alert('XSS');\">"; // Same
233 233
 
234 234
 		$test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>';
235 235
 		$result = testSqlAndScriptInject($test, 0);
@@ -263,21 +263,21 @@  discard block
 block discarded – undo
263 263
 		$result = testSqlAndScriptInject($test, 0);
264 264
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll');
265 265
 
266
-		$test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>';	// Add the char %F6 into the variable
266
+		$test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable
267 267
 		$result = testSqlAndScriptInject($test, 0);
268 268
 		//print "test=".$test." result=".$result."\n";
269 269
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm');
270 270
 
271 271
 
272 272
 		$test = "Text with ' encoded with the numeric html entity converted into text entity &#39; (like when submitted by CKEditor)";
273
-		$result = testSqlAndScriptInject($test, 0);	// result must be 0
273
+		$result = testSqlAndScriptInject($test, 0); // result must be 0
274 274
 		$this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not');
275 275
 
276 276
 		$test = '<a href="j&Tab;a&Tab;v&Tab;asc&NewLine;ri&Tab;pt:&lpar;a&Tab;l&Tab;e&Tab;r&Tab;t&Tab;(document.cookie)&rpar;">XSS</a>';
277 277
 		$result = testSqlAndScriptInject($test, 0);
278 278
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not');
279 279
 
280
-		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc";	// Add the char %F6 into the variable
280
+		$test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable
281 281
 		$result = testSqlAndScriptInject($test, 2);
282 282
 		//print "test=".$test." result=".$result."\n";
283 283
 		$this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char');
@@ -389,21 +389,21 @@  discard block
 block discarded – undo
389 389
 	{
390 390
 		global $conf;
391 391
 
392
-		$genpass1 = getRandomPassword(true);				// Should be a string return by dol_hash (if no option set, will be md5)
392
+		$genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5)
393 393
 		print __METHOD__." genpass1=".$genpass1."\n";
394 394
 		$this->assertEquals(strlen($genpass1), 32);
395 395
 
396
-		$genpass1 = getRandomPassword(true, array('I'));	// Should be a string return by dol_hash (if no option set, will be md5)
396
+		$genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5)
397 397
 		print __METHOD__." genpass1=".$genpass1."\n";
398 398
 		$this->assertEquals(strlen($genpass1), 32);
399 399
 
400 400
 		$conf->global->USER_PASSWORD_GENERATED = 'None';
401
-		$genpass2 = getRandomPassword(false);				// Should return an empty string
401
+		$genpass2 = getRandomPassword(false); // Should return an empty string
402 402
 		print __METHOD__." genpass2=".$genpass2."\n";
403 403
 		$this->assertEquals($genpass2, '');
404 404
 
405 405
 		$conf->global->USER_PASSWORD_GENERATED = 'Standard';
406
-		$genpass3 = getRandomPassword(false);				// Should return a password of 12 chars
406
+		$genpass3 = getRandomPassword(false); // Should return a password of 12 chars
407 407
 		print __METHOD__." genpass3=".$genpass3."\n";
408 408
 		$this->assertEquals(strlen($genpass3), 12);
409 409
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 */
418 418
 	public function testRestrictedArea()
419 419
 	{
420
-		global $conf,$user,$langs,$db;
420
+		global $conf, $user, $langs, $db;
421 421
 		$conf = $this->savconf;
422 422
 		$user = $this->savuser;
423 423
 		$langs = $this->savlangs;
@@ -448,40 +448,40 @@  discard block
 block discarded – undo
448 448
 		$tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']);
449 449
 		$this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should.");
450 450
 
451
-		$url = 'https://www.dolibarr.fr';	// This is a redirect 301 page
452
-		$tmp = getURLContent($url, 'GET', '', 0);	// We do NOT follow
451
+		$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
452
+		$tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow
453 453
 		print __METHOD__." url=".$url."\n";
454 454
 		$this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response');
455 455
 
456
-		$url = 'https://www.dolibarr.fr';	// This is a redirect 301 page
457
-		$tmp = getURLContent($url);		// We DO follow a page with return 300 so result should be 200
456
+		$url = 'https://www.dolibarr.fr'; // This is a redirect 301 page
457
+		$tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200
458 458
 		print __METHOD__." url=".$url."\n";
459 459
 		$this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code']));
460 460
 
461 461
 		$url = 'http://localhost';
462
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
462
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
463 463
 		print __METHOD__." url=".$url."\n";
464
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL');	// Test we receive an error because localtest.me is not an external URL
464
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL
465 465
 
466 466
 		$url = 'http://127.0.0.1';
467
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
467
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
468 468
 		print __METHOD__." url=".$url."\n";
469
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 127.0.0.1 is not an external URL
469
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL
470 470
 
471 471
 		$url = 'http://127.0.2.1';
472
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
472
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
473 473
 		print __METHOD__." url=".$url."\n";
474
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 127.0.2.1 is not an external URL
474
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL
475 475
 
476 476
 		$url = 'https://169.254.0.1';
477
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
477
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
478 478
 		print __METHOD__." url=".$url."\n";
479
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because 169.254.0.1 is not an external URL
479
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL
480 480
 
481 481
 		$url = 'http://[::1]';
482
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
482
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL
483 483
 		print __METHOD__." url=".$url."\n";
484
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL');	// Test we receive an error because [::1] is not an external URL
484
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL
485 485
 
486 486
 		/*$url = 'localtest.me';
487 487
 		 $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
 		 */
491 491
 
492 492
 		$url = 'http://192.0.0.192';
493
-		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0);		// Only external URL but on an IP in blacklist
493
+		$tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist
494 494
 		print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n";
495
-		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not');	// Test we receive an error because ip is in blacklist
495
+		$this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist
496 496
 
497 497
 		return 0;
498 498
 	}
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	public function testDolSanitizeUrl()
506 506
 	{
507
-		global $conf,$user,$langs,$db;
507
+		global $conf, $user, $langs, $db;
508 508
 		$conf = $this->savconf;
509 509
 		$user = $this->savuser;
510 510
 		$langs = $this->savlangs;
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	public function testDolSanitizeEmail()
532 532
 	{
533
-		global $conf,$user,$langs,$db;
533
+		global $conf, $user, $langs, $db;
534 534
 		$conf = $this->savconf;
535 535
 		$user = $this->savuser;
536 536
 		$langs = $this->savlangs;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	 */
561 561
 	public function testDolSanitizeFileName()
562 562
 	{
563
-		global $conf,$user,$langs,$db;
563
+		global $conf, $user, $langs, $db;
564 564
 		$conf = $this->savconf;
565 565
 		$user = $this->savuser;
566 566
 		$langs = $this->savlangs;
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 	 */
584 584
 	public function testDolEval()
585 585
 	{
586
-		global $conf,$user,$langs,$db;
586
+		global $conf, $user, $langs, $db;
587 587
 		$conf = $this->savconf;
588 588
 		$user = $this->savuser;
589 589
 		$langs = $this->savlangs;
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
594 594
 		include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
595 595
 
596
-		$result = dol_eval('1==\x01', 1, 0);	// Check that we can't make dol_eval on string containing \ char.
596
+		$result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char.
597 597
 		print "result0 = ".$result."\n";
598 598
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result);
599 599
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 		$this->assertEquals('Bad string syntax to evaluate: new __forbiddenstring__(\'abc\')', $result);
637 637
 
638 638
 
639
-		$result = dol_eval('$a=function() { }; $a', 1, 1, '0');		// result of dol_eval may be an object Closure
639
+		$result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure
640 640
 		print "result5 = ".json_encode($result)."\n";
641 641
 		$this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result));
642 642
 
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 		print "result13 = ".$result."\n";
673 673
 		$this->assertEquals('358080.38', $result);
674 674
 
675
-		global $leftmenu;	// Used into strings to eval
675
+		global $leftmenu; // Used into strings to eval
676 676
 
677 677
 		$leftmenu = 'AAA';
678 678
 		$result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1');
@@ -696,13 +696,13 @@  discard block
 block discarded – undo
696 696
 		$this->assertFalse($result);
697 697
 
698 698
 		$leftmenu = 'XXX';
699
-		$conf->global->MAIN_FEATURES_LEVEL = 1;		// Force for the case option is -1
699
+		$conf->global->MAIN_FEATURES_LEVEL = 1; // Force for the case option is -1
700 700
 		$string = '(isModEnabled("agenda") || isModEnabled("resource")) && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 0 && preg_match(\'/^(admintools|all|XXX)/\', $leftmenu)';
701 701
 		$result = dol_eval($string, 1, 1, '1');
702 702
 		print "result17 = ".$result."\n";
703 703
 		$this->assertTrue($result);
704 704
 
705
-		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0);	// Should return false and not a 'Bad string syntax to evaluate ...'
705
+		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...'
706 706
 		print "result18 = ".$result."\n";
707 707
 		$this->assertFalse($result);
708 708
 
@@ -741,12 +741,12 @@  discard block
 block discarded – undo
741 741
 		global $conf;
742 742
 
743 743
 		// Set options for cleaning data
744
-		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;	// disabled, does not work on HTML5 and some libxml versions
744
+		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions
745 745
 		// Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible
746 746
 		if (extension_loaded('tidy') && class_exists("tidy")) {
747 747
 			$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
748 748
 		}
749
-		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;	// disabled, does not work on HTML5 and some libxml versions
749
+		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions
750 750
 
751 751
 
752 752
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1);
759 759
 		$result = dolPrintHTML($stringtotest);
760 760
 		print __METHOD__." result=".$result."\n";
761
-		$this->assertEquals($stringfixed, $result, 'Error');    // Expected '' because should failed because login 'auto' does not exists
761
+		$this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists
762 762
 
763 763
 
764 764
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		// With cleaning options of HTML TIDY
828 828
 		if (extension_loaded('tidy') && class_exists("tidy")) {
829 829
 			$stringtotest = "Message<br>with ' and &egrave; and &#39; !";
830
-			$stringexpected = "Message<br>\nwith ' and &egrave; and ' !";		// The &#39; is modified into ' because html tidy fix it.
830
+			$stringexpected = "Message<br>\nwith ' and &egrave; and ' !"; // The &#39; is modified into ' because html tidy fix it.
831 831
 			/*
832 832
 			var_dump($stringtotest);
833 833
 			var_dump(dol_htmlentitiesbr($stringtotest));
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 		$this->assertEquals('a', $result);
860 860
 
861 861
 		// Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range
862
-		$arraytmp = array(0 => '&#9989;', 1 => '9989;');	// Encoded as decimal
862
+		$arraytmp = array(0 => '&#9989;', 1 => '9989;'); // Encoded as decimal
863 863
 		$result = realCharForNumericEntities($arraytmp);
864 864
 		$this->assertEquals('✅', $result);
865 865
 
866
-		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;');	// Encoded as hexadecimal
866
+		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;'); // Encoded as hexadecimal
867 867
 		$result = realCharForNumericEntities($arraytmp);
868 868
 		$this->assertEquals('✅', $result);
869 869
 
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 		// For a string with js and link with restricthtmlallowlinkscript
934 934
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
935 935
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
936
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
936
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
937 937
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
938 938
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
939 939
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
@@ -946,7 +946,7 @@  discard block
 block discarded – undo
946 946
 		// For a string with js and link with restricthtmlallowlinkscript
947 947
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
948 948
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
949
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
949
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
950 950
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
951 951
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
952 952
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 		// For a string with js and link with restricthtmlallowlinkscript
960 960
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
961 961
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
962
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
962
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
963 963
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
964 964
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
965 965
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
Please login to merge, or discard this patch.
test/phpunit/SecurityLoginTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,36 +25,36 @@  discard block
 block discarded – undo
25 25
  *		\remarks	To run this script as CLI:  phpunit filename.php
26 26
  */
27 27
 
28
-global $conf,$user,$langs,$db;
28
+global $conf, $user, $langs, $db;
29 29
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
30 30
 //require_once 'PHPUnit/Autoload.php';
31 31
 
32
-if (! defined('NOREQUIRESOC')) {
32
+if (!defined('NOREQUIRESOC')) {
33 33
 	define('NOREQUIRESOC', '1');
34 34
 }
35
-if (! defined('NOCSRFCHECK')) {
35
+if (!defined('NOCSRFCHECK')) {
36 36
 	define('NOCSRFCHECK', '1');
37 37
 }
38
-if (! defined('NOTOKENRENEWAL')) {
38
+if (!defined('NOTOKENRENEWAL')) {
39 39
 	define('NOTOKENRENEWAL', '1');
40 40
 }
41
-if (! defined('NOREQUIREMENU')) {
41
+if (!defined('NOREQUIREMENU')) {
42 42
 	define('NOREQUIREMENU', '1'); // If there is no menu to show
43 43
 }
44
-if (! defined('NOREQUIREHTML')) {
44
+if (!defined('NOREQUIREHTML')) {
45 45
 	define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
46 46
 }
47
-if (! defined('NOREQUIREAJAX')) {
47
+if (!defined('NOREQUIREAJAX')) {
48 48
 	define('NOREQUIREAJAX', '1');
49 49
 }
50
-if (! defined("NOLOGIN")) {
51
-	define("NOLOGIN", '1');       // If this page is public (can be called outside logged session)
50
+if (!defined("NOLOGIN")) {
51
+	define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
52 52
 }
53
-if (! defined("NOSESSION")) {
53
+if (!defined("NOSESSION")) {
54 54
 	define("NOSESSION", '1');
55 55
 }
56 56
 
57
-require_once dirname(__FILE__).'/../../htdocs/main.inc.php';	// We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
57
+require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test.
58 58
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
59 59
 require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
60 60
 require_once dirname(__FILE__).'/CommonClassTest.class.php';
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 		print __METHOD__." login=".$login."\n";
92 92
 		$this->assertEquals($login, '');
93 93
 
94
-		$login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr'));            // Should works because admin/admin exists
94
+		$login = checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists
95 95
 		print __METHOD__." login=".$login."\n";
96 96
 		$this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed');
97 97
 
98
-		$login = checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr'));    // Should work because of second authentication method
98
+		$login = checkLoginPassEntity('admin', 'admin', 1, array('http', 'dolibarr')); // Should work because of second authentication method
99 99
 		print __METHOD__." login=".$login."\n";
100 100
 		$this->assertEquals($login, 'admin');
101 101
 
102 102
 		$login = checkLoginPassEntity('admin', 'admin', 1, array('forceuser'));
103 103
 		print __METHOD__." login=".$login."\n";
104
-		$this->assertEquals('', $login, 'Error');    // Expected '' because should failed because login 'auto' does not exists
104
+		$this->assertEquals('', $login, 'Error'); // Expected '' because should failed because login 'auto' does not exists
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
htdocs/core/lib/website2.lib.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	if (dol_is_file($filetpl)) {
152 152
 		if ($backupold) {
153 153
 			$result = archiveOrBackupFile($filetpl);
154
-			if (! $result) {
154
+			if (!$result) {
155 155
 				return false;
156 156
 			}
157 157
 		} else {
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 						$indexcontent .= "	require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
376 376
 						$indexcontent .= '	redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n";
377 377
 						$indexcontent .= "}\n";
378
-						$indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n";	// use .. instead of .
378
+						$indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of .
379 379
 						$indexcontent .= '// END PHP ?>'."\n";
380 380
 						$result = file_put_contents($fileindexsub, $indexcontent);
381 381
 						if ($result === false) {
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		//$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once"));
735 735
 		if (!getDolGlobalString('WEBSITE_PHP_ALLOW_EXEC')) {    // If option is not on, we disallow functions to execute commands
736 736
 			$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen"));
737
-			$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond"));	// native dolibarr functions
737
+			$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions
738 738
 			$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities
739 739
 		}
740 740
 		if (!getDolGlobalString('WEBSITE_PHP_ALLOW_WRITE')) {    // If option is not on, we disallow functions to write files
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 		}
744 744
 		//$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include"));
745 745
 
746
-		$forbiddenphpmethods = array('invoke', 'invokeArgs');	// Method of ReflectionFunction to execute a function
746
+		$forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function
747 747
 
748 748
 		foreach ($forbiddenphpstrings as $forbiddenphpstring) {
749 749
 			if (preg_match('/'.preg_quote($forbiddenphpstring, '/').'/ims', $phpfullcodestring)) {
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 1 patch
Spacing   +1257 added lines, -1257 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) {
124 124
 			if (!empty($perm)) {
125 125
 				$tmp = explode(':', $typeofdata);
126
-				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
126
+				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
127 127
 				if ($fieldrequired) {
128 128
 					$ret .= '<span class="fieldrequired">';
129 129
 				}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				if ($fieldrequired) {
136 136
 					$ret .= '</span>';
137 137
 				}
138
-				$ret .= '</div>' . "\n";
138
+				$ret .= '</div>'."\n";
139 139
 			} else {
140 140
 				if ($fieldrequired) {
141 141
 					$ret .= '<span class="fieldrequired">';
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 			if (empty($notabletag) && $perm) {
174 174
 				$ret .= '<td class="right">';
175 175
 			}
176
-			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
177
-				$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>';
176
+			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
177
+				$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>';
178 178
 			}
179 179
 			if (!empty($notabletag) && $notabletag == 1) {
180 180
 				if ($text) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			} elseif ($reg[1] == 'int') {
242 242
 				$typeofdata = 'numeric';
243 243
 			} else {
244
-				return 'ErrorBadParameter ' . $typeofdata;
244
+				return 'ErrorBadParameter '.$typeofdata;
245 245
 			}
246 246
 		}
247 247
 
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 			if ($editaction == '') {
253 253
 				$editaction = GETPOST('action', 'aZ09');
254 254
 			}
255
-			$editmode = ($editaction == 'edit' . $htmlname);
255
+			$editmode = ($editaction == 'edit'.$htmlname);
256 256
 			if ($editmode) {	// edit mode
257 257
 				$ret .= "<!-- formeditfieldval -->\n";
258
-				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';
259
-				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
260
-				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
261
-				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
258
+				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
259
+				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
260
+				$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
261
+				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
262 262
 				if (empty($notabletag)) {
263 263
 					$ret .= '<table class="nobordernopadding centpercent">';
264 264
 				}
@@ -267,28 +267,28 @@  discard block
 block discarded – undo
267 267
 				}
268 268
 				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) {
269 269
 					$tmp = explode(':', $typeofdata);
270
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
270
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
271 271
 				} elseif (preg_match('/^(integer)/', $typeofdata)) {
272 272
 					$tmp = explode(':', $typeofdata);
273 273
 					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);
274
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
274
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
275 275
 				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
276 276
 					$tmp = explode(':', $typeofdata);
277 277
 					$valuetoshow = price2num($editvalue ? $editvalue : $value);
278
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
278
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
279 279
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
280 280
 					$tmp = explode(':', $typeofdata);
281
-					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
281
+					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';
282 282
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor'
283 283
 					$tmp = explode(':', $typeofdata);
284 284
 					$cols = (empty($tmp[2]) ? '' : $tmp[2]);
285 285
 					$morealt = '';
286 286
 					if (preg_match('/%/', $cols)) {
287
-						$morealt = ' style="width: ' . $cols . '"';
287
+						$morealt = ' style="width: '.$cols.'"';
288 288
 						$cols = '';
289 289
 					}
290 290
 					$valuetoshow = ($editvalue ? $editvalue : $value);
291
-					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';
291
+					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
292 292
 					// textarea convert automatically entities chars into simple chars.
293 293
 					// 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 wysiwyg is off.
294 294
 					$valuetoshow = str_replace('&', '&amp;', $valuetoshow);
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
299 299
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
300 300
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
301
-					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
301
+					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
302 302
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
303 303
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
304 304
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
305 305
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
306
-					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
306
+					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
307 307
 				} elseif (preg_match('/^select;/', $typeofdata)) {
308 308
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
309 309
 					$arraylist = array();
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 					// TODO Not yet implemented. See code for extrafields
318 318
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
319 319
 					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
320
-					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
320
+					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
321 321
 					$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? 100 : (int) $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? false : (bool) $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? 20 : (int) $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));
322 322
 					$ret .= $doleditor->Create(1);
323 323
 				} elseif ($typeofdata == 'asis') {
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
 					$ret .= '<td>';
333 333
 				}
334 334
 				//else $ret.='<div class="clearboth"></div>';
335
-				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
335
+				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
336 336
 				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) {
337
-					$ret .= '<br>' . "\n";
337
+					$ret .= '<br>'."\n";
338 338
 				}
339
-				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
339
+				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
340 340
 				if (empty($notabletag)) {
341 341
 					$ret .= '</td>';
342 342
 				}
343 343
 
344 344
 				if (empty($notabletag)) {
345
-					$ret .= '</tr></table>' . "\n";
345
+					$ret .= '</tr></table>'."\n";
346 346
 				}
347
-				$ret .= '</form>' . "\n";
347
+				$ret .= '</form>'."\n";
348 348
 			} else {		// view mode
349 349
 				if (preg_match('/^email/', $typeofdata)) {
350 350
 					$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
 					$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : '');
357 357
 				} elseif (preg_match('/^checkbox/', $typeofdata)) {
358 358
 					$tmp = explode(':', $typeofdata);
359
-					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
359
+					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';
360 360
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
361 361
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));
362 362
 				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring'
363 363
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));
364 364
 				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
365
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';
365
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';
366 366
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
367
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';
367
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';
368 368
 				} elseif (preg_match('/^select;/', $typeofdata)) {
369 369
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
370 370
 					$arraylist = array();
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
 					$ret .= $arraylist[$value];
376 376
 					if ($htmlname == 'fk_product_type') {
377 377
 						if ($value == 0) {
378
-							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
378
+							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
379 379
 						} else {
380
-							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
380
+							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
381 381
 						}
382 382
 					}
383 383
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
386 386
 						$firstline = preg_replace('/<br>.*/', '', $tmpcontent);
387 387
 						$firstline = preg_replace('/[\n\r].*/', '', $firstline);
388
-						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
388
+						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
389 389
 					}
390 390
 					// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also
391 391
 					// clean data from some dangerous html
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					if (empty($moreoptions['valuealreadyhtmlescaped'])) {
395 395
 						$ret .= dol_escape_htmltag($value);
396 396
 					} else {
397
-						$ret .= $value;        // $value must be already html escaped.
397
+						$ret .= $value; // $value must be already html escaped.
398 398
 					}
399 399
 				}
400 400
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 		if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
434 434
 			if (!is_object($extralanguages)) {
435
-				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
435
+				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
436 436
 				$extralanguages = new ExtraLanguages($this->db);
437 437
 			}
438 438
 			$extralanguages->fetch_name_extralanguages('societe');
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
 				return ''; // No extralang field to show
442 442
 			}
443 443
 
444
-			$result .= '<!-- Widget for translation -->' . "\n";
445
-			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';
444
+			$result .= '<!-- Widget for translation -->'."\n";
445
+			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
446 446
 			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', 0, 0, 0, '', 'fa-15 editfieldlang');
447 447
 			$result .= $s;
448 448
 			$result .= '</div>';
449 449
 
450
-			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';
450
+			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
451 451
 
452 452
 			$resultforextrlang = '';
453 453
 			foreach ($arrayoflangcode as $langcode) {
454
-				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : '';
454
+				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
455 455
 				if (empty($valuetoshow)) {
456 456
 					$object->fetchValuesForExtraLanguages();
457 457
 					//var_dump($object->array_languages);
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
 
464 464
 				// TODO Use the showInputField() method of ExtraLanguages object
465 465
 				if ($typeofdata == 'textarea') {
466
-					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';
466
+					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
467 467
 					$resultforextrlang .= $valuetoshow;
468 468
 					$resultforextrlang .= '</textarea>';
469 469
 				} else {
470
-					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';
470
+					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
471 471
 				}
472 472
 			}
473 473
 			$result .= $resultforextrlang;
474 474
 
475 475
 			$result .= '</div>';
476
-			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>';
476
+			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
477 477
 		}
478 478
 
479 479
 		return $result;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 				if (!empty($tmp[2])) {
537 537
 					$savemethod = $tmp[2];
538 538
 				}
539
-				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
539
+				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
540 540
 			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
541 541
 				$tmp = explode(':', $inputType);
542 542
 				$inputType = $tmp[0];
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 					$savemethod = $tmp[2];
548 548
 				}
549 549
 
550
-				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
550
+				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
551 551
 			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
552 552
 				$tmp = explode(':', $inputType);
553 553
 				$inputType = $tmp[0];
@@ -578,40 +578,40 @@  discard block
 block discarded – undo
578 578
 				}
579 579
 
580 580
 				if (isModEnabled('fckeditor')) {
581
-					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
581
+					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";
582 582
 				} else {
583 583
 					$inputType = 'textarea';
584 584
 				}
585 585
 			}
586 586
 
587
-			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";
588
-			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
589
-			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
590
-			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
587
+			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";
588
+			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";
589
+			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";
590
+			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
591 591
 			if (!empty($savemethod)) {
592
-				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
592
+				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
593 593
 			}
594 594
 			if (!empty($ext_element)) {
595
-				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
595
+				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
596 596
 			}
597 597
 			if (!empty($custommsg)) {
598 598
 				if (is_array($custommsg)) {
599 599
 					if (!empty($custommsg['success'])) {
600
-						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
600
+						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
601 601
 					}
602 602
 					if (!empty($custommsg['error'])) {
603
-						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
603
+						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
604 604
 					}
605 605
 				} else {
606
-					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
606
+					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
607 607
 				}
608 608
 			}
609 609
 			if ($inputType == 'textarea') {
610
-				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
611
-				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";
610
+				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
611
+				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
612 612
 			}
613
-			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";
614
-			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";
613
+			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
614
+			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";
615 615
 		} else {
616 616
 			$out = $value;
617 617
 		}
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
641 641
 	{
642 642
 		if ($incbefore) {
643
-			$text = $incbefore . $text;
643
+			$text = $incbefore.$text;
644 644
 		}
645 645
 		if (!$htmltext) {
646 646
 			return $text;
647 647
 		}
648
-		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0
648
+		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
649 649
 
650 650
 		$tag = 'td';
651 651
 		if ($notabs == 2) {
@@ -659,11 +659,11 @@  discard block
 block discarded – undo
659 659
 
660 660
 		$extrastyle = '';
661 661
 		if ($direction < 0) {
662
-			$extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : '');
662
+			$extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : '');
663 663
 			$extrastyle = 'padding: 0px; padding-left: 2px;';
664 664
 		}
665 665
 		if ($direction > 0) {
666
-			$extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : '');
666
+			$extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : '');
667 667
 			$extrastyle = 'padding: 0px; padding-right: 2px;';
668 668
 		}
669 669
 
@@ -676,53 +676,53 @@  discard block
 block discarded – undo
676 676
 			$htmltext = str_replace('"', '&quot;', $htmltext);
677 677
 		} else {
678 678
 			$classfortooltip = 'classfortooltiponclick';
679
-			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';
679
+			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
680 680
 		}
681 681
 		if ($tooltipon == 2 || $tooltipon == 3) {
682
-			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
682
+			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
683 683
 			if ($tooltiptrigger == '') {
684
-				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip
684
+				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip
685 685
 			} else {
686
-				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
686
+				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
687 687
 			}
688 688
 		} else {
689
-			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
689
+			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
690 690
 		}
691 691
 		if ($tooltipon == 1 || $tooltipon == 3) {
692
-			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
692
+			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
693 693
 			if ($tooltiptrigger == '') {
694
-				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip
694
+				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip
695 695
 			} else {
696
-				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
696
+				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
697 697
 			}
698 698
 		} else {
699
-			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
699
+			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
700 700
 		}
701 701
 		if (empty($notabs)) {
702 702
 			$s .= '<table class="nobordernopadding"><tr style="height: auto;">';
703 703
 		} elseif ($notabs == 2) {
704
-			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';
704
+			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';
705 705
 		}
706 706
 		// Define value if value is before
707 707
 		if ($direction < 0) {
708
-			$s .= '<' . $tag . $paramfortooltipimg;
708
+			$s .= '<'.$tag.$paramfortooltipimg;
709 709
 			if ($tag == 'td') {
710 710
 				$s .= ' class="valigntop" width="14"';
711 711
 			}
712
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
712
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
713 713
 		}
714 714
 		// Use another method to help avoid having a space in value in order to use this value with jquery
715 715
 		// Define label
716 716
 		if ((string) $text != '') {
717
-			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
717
+			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
718 718
 		}
719 719
 		// Define value if value is after
720 720
 		if ($direction > 0) {
721
-			$s .= '<' . $tag . $paramfortooltipimg;
721
+			$s .= '<'.$tag.$paramfortooltipimg;
722 722
 			if ($tag == 'td') {
723 723
 				$s .= ' class="valignmiddle" width="14"';
724 724
 			}
725
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
725
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
726 726
 		}
727 727
 		if (empty($notabs)) {
728 728
 			$s .= '</tr></table>';
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 
830 830
 		$disabled = 0;
831 831
 		$ret = '<div class="centpercent center">';
832
-		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';
832
+		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';
833 833
 
834 834
 		// 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.
835 835
 		$parameters = array();
@@ -840,10 +840,10 @@  discard block
 block discarded – undo
840 840
 			return;
841 841
 		}
842 842
 		if (empty($reshook)) {
843
-			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>';
843
+			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';
844 844
 			if (is_array($arrayofaction)) {
845 845
 				foreach ($arrayofaction as $code => $label) {
846
-					$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';
846
+					$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
847 847
 				}
848 848
 			}
849 849
 		}
@@ -852,17 +852,17 @@  discard block
 block discarded – undo
852 852
 		$ret .= '</select>';
853 853
 
854 854
 		if (empty($conf->dol_optimize_smallscreen)) {
855
-			$ret .= ajax_combobox('.' . $name . 'select');
855
+			$ret .= ajax_combobox('.'.$name.'select');
856 856
 		}
857 857
 
858 858
 		// 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
859 859
 		$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.
860
-		$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
+		$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")).'">';
861 861
 		$ret .= '</div>';
862 862
 
863 863
 		if (!empty($conf->use_javascript_ajax)) {
864 864
 			$ret .= '<!-- JS CODE TO ENABLE mass action select -->
865
-    		<script nonce="' . getNonce() . '">
865
+    		<script nonce="' . getNonce().'">
866 866
                         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 */
867 867
         		{
868 868
         			atleastoneselected=0;
@@ -873,11 +873,11 @@  discard block
 block discarded – undo
873 873
 
874 874
 					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected);
875 875
 
876
-    	  			if (atleastoneselected || ' . $alwaysvisible . ')
876
+    	  			if (atleastoneselected || ' . $alwaysvisible.')
877 877
     	  			{
878 878
                                     jQuery("."+name).show();
879
-        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . '
880
-        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . '
879
+        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').'
880
+        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').'
881 881
     	  			}
882 882
     	  			else
883 883
     	  			{
@@ -887,26 +887,26 @@  discard block
 block discarded – undo
887 887
         		}
888 888
 
889 889
         	jQuery(document).ready(function () {
890
-                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");
891
-                    jQuery(".' . $cssclass . '").click(function() {
892
-                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");
890
+                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");
891
+                    jQuery(".' . $cssclass.'").click(function() {
892
+                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");
893 893
                     });
894
-                    jQuery(".' . $name . 'select").change(function() {
894
+                    jQuery(".' . $name.'select").change(function() {
895 895
         				var massaction = $( this ).val();
896 896
         				var urlform = $( this ).closest("form").attr("action").replace("#show_files","");
897 897
         				if (massaction == "builddoc") {
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
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false);
905
-										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */
906
-                                        jQuery(".' . $name . '"+massaction).show();
904
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false);
905
+										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */
906
+                                        jQuery(".' . $name.'"+massaction).show();
907 907
     	  				} else {
908
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true);
909
-										jQuery(".' . $name . 'other").hide();	/* To disable any div open */
908
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true);
909
+										jQuery(".' . $name.'other").hide();	/* To disable any div open */
910 910
     	  				}
911 911
     	        });
912 912
         	});
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 		$atleastonefavorite = 0;
950 950
 
951 951
 		$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";
952
-		$sql .= " FROM " . $this->db->prefix() . "c_country";
952
+		$sql .= " FROM ".$this->db->prefix()."c_country";
953 953
 		$sql .= " WHERE active > 0";
954 954
 		//$sql.= " ORDER BY code ASC";
955 955
 
956
-		dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);
956
+		dol_syslog(get_class($this)."::select_country", LOG_DEBUG);
957 957
 		$resql = $this->db->query($sql);
958 958
 		if ($resql) {
959
-			$out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';
959
+			$out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';
960 960
 			$num = $this->db->num_rows($resql);
961 961
 			$i = 0;
962 962
 			if ($num) {
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 					$countryArray[$i]['rowid'] = $obj->rowid;
967 967
 					$countryArray[$i]['code_iso'] = $obj->code_iso;
968 968
 					$countryArray[$i]['code_iso3'] = $obj->code_iso3;
969
-					$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 : ''));
969
+					$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 : ''));
970 970
 					$countryArray[$i]['favorite'] = $obj->favorite;
971 971
 					$countryArray[$i]['eec'] = $obj->eec;
972 972
 					$favorite[$i] = $obj->favorite;
@@ -984,20 +984,20 @@  discard block
 block discarded – undo
984 984
 
985 985
 				if ($showempty) {
986 986
 					if (is_numeric($showempty)) {
987
-						$out .= '<option value="">&nbsp;</option>' . "\n";
987
+						$out .= '<option value="">&nbsp;</option>'."\n";
988 988
 					} else {
989
-						$out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";
989
+						$out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";
990 990
 					}
991 991
 				}
992 992
 
993 993
 				if ($addspecialentries) {    // Add dedicated entries for groups of countries
994 994
 					//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
995
-					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
996
-					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>';
995
+					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
996
+					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>';
997 997
 					if ($mysoc->isInEEC()) {
998
-						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
998
+						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
999 999
 					}
1000
-					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>';
1000
+					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>';
1001 1001
 					$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';
1002 1002
 				}
1003 1003
 
@@ -1025,20 +1025,20 @@  discard block
 block discarded – undo
1025 1025
 						$labeltoshow .= '&nbsp;';
1026 1026
 					}
1027 1027
 					if ($row['code_iso']) {
1028
-						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>';
1028
+						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>';
1029 1029
 						if (empty($hideflags)) {
1030 1030
 							$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);
1031
-							$labeltoshow = $tmpflag . ' ' . $labeltoshow;
1031
+							$labeltoshow = $tmpflag.' '.$labeltoshow;
1032 1032
 						}
1033 1033
 					}
1034 1034
 
1035 1035
 					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
1036
-						$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']) . '">';
1036
+						$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']).'">';
1037 1037
 					} else {
1038
-						$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']) . '">';
1038
+						$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']).'">';
1039 1039
 					}
1040 1040
 					$out .= $labeltoshow;
1041
-					$out .= '</option>' . "\n";
1041
+					$out .= '</option>'."\n";
1042 1042
 				}
1043 1043
 			}
1044 1044
 			$out .= '</select>';
@@ -1047,8 +1047,8 @@  discard block
 block discarded – undo
1047 1047
 		}
1048 1048
 
1049 1049
 		// Make select dynamic
1050
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1051
-		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve');
1050
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1051
+		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve');
1052 1052
 
1053 1053
 		return $out;
1054 1054
 	}
@@ -1080,25 +1080,25 @@  discard block
 block discarded – undo
1080 1080
 		$incotermArray = array();
1081 1081
 
1082 1082
 		$sql = "SELECT rowid, code";
1083
-		$sql .= " FROM " . $this->db->prefix() . "c_incoterms";
1083
+		$sql .= " FROM ".$this->db->prefix()."c_incoterms";
1084 1084
 		$sql .= " WHERE active > 0";
1085 1085
 		$sql .= " ORDER BY code ASC";
1086 1086
 
1087
-		dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);
1087
+		dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
1088 1088
 		$resql = $this->db->query($sql);
1089 1089
 		if ($resql) {
1090 1090
 			if ($conf->use_javascript_ajax && !$forcecombo) {
1091
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1091
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1092 1092
 				$out .= ajax_combobox($htmlname, $events);
1093 1093
 			}
1094 1094
 
1095 1095
 			if (!empty($page)) {
1096
-				$out .= '<form method="post" action="' . $page . '">';
1096
+				$out .= '<form method="post" action="'.$page.'">';
1097 1097
 				$out .= '<input type="hidden" name="action" value="set_incoterms">';
1098
-				$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
1098
+				$out .= '<input type="hidden" name="token" value="'.newToken().'">';
1099 1099
 			}
1100 1100
 
1101
-			$out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';
1101
+			$out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';
1102 1102
 			$out .= '<option value="0">&nbsp;</option>';
1103 1103
 			$num = $this->db->num_rows($resql);
1104 1104
 			$i = 0;
@@ -1112,9 +1112,9 @@  discard block
 block discarded – undo
1112 1112
 
1113 1113
 				foreach ($incotermArray as $row) {
1114 1114
 					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) {
1115
-						$out .= '<option value="' . $row['rowid'] . '" selected>';
1115
+						$out .= '<option value="'.$row['rowid'].'" selected>';
1116 1116
 					} else {
1117
-						$out .= '<option value="' . $row['rowid'] . '">';
1117
+						$out .= '<option value="'.$row['rowid'].'">';
1118 1118
 					}
1119 1119
 
1120 1120
 					if ($row['code']) {
@@ -1128,13 +1128,13 @@  discard block
 block discarded – undo
1128 1128
 			$out .= ajax_combobox($htmlname);
1129 1129
 
1130 1130
 			if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
1131
-				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
1131
+				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n";
1132 1132
 				$moreattrib .= ' autocomplete="off"';
1133 1133
 			}
1134
-			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";
1134
+			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";
1135 1135
 
1136 1136
 			if (!empty($page)) {
1137
-				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>';
1137
+				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
1138 1138
 			}
1139 1139
 		} else {
1140 1140
 			dol_print_error($this->db);
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 			if (empty($hidetext)) {
1170 1170
 				print $langs->trans("Type").'...';
1171 1171
 			}
1172
-			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';
1172
+			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
1173 1173
 			if ($showempty) {
1174 1174
 				print '<option value="-1" class="opacitymedium"'.($useajaxcombo ? '' : ' disabled="disabled"');
1175 1175
 				if ($selected == -1) {
@@ -1188,31 +1188,31 @@  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 1200
 
1201 1201
 			if ($useajaxcombo) {
1202
-				print ajax_combobox('select_' . $htmlname);
1202
+				print ajax_combobox('select_'.$htmlname);
1203 1203
 			}
1204 1204
 			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
1205 1205
 		}
1206 1206
 		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {
1207 1207
 			print $langs->trans("Service");
1208
-			print '<input type="hidden" name="' . $htmlname . '" value="1">';
1208
+			print '<input type="hidden" name="'.$htmlname.'" value="1">';
1209 1209
 		}
1210 1210
 		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) {
1211 1211
 			print $langs->trans("Product");
1212
-			print '<input type="hidden" name="' . $htmlname . '" value="0">';
1212
+			print '<input type="hidden" name="'.$htmlname.'" value="0">';
1213 1213
 		}
1214 1214
 		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled.
1215
-			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
1215
+			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
1216 1216
 		}
1217 1217
 	}
1218 1218
 
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 		$langs->load("trips");
1239 1239
 
1240 1240
 		$sql = "SELECT c.code, c.label";
1241
-		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";
1241
+		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";
1242 1242
 		$sql .= " WHERE active > 0";
1243 1243
 
1244 1244
 		$resql = $this->db->query($sql);
@@ -1279,11 +1279,11 @@  discard block
 block discarded – undo
1279 1279
 		// phpcs:enable
1280 1280
 		global $user, $langs;
1281 1281
 
1282
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
1282
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
1283 1283
 
1284 1284
 		$this->load_cache_types_fees();
1285 1285
 
1286
-		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1286
+		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';
1287 1287
 		if ($showempty) {
1288 1288
 			print '<option value="-1"';
1289 1289
 			if ($selected == -1) {
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
 		}
1294 1294
 
1295 1295
 		foreach ($this->cache_types_fees as $key => $value) {
1296
-			print '<option value="' . $key . '"';
1296
+			print '<option value="'.$key.'"';
1297 1297
 			if ($key == $selected) {
1298 1298
 				print ' selected';
1299 1299
 			}
@@ -1345,12 +1345,12 @@  discard block
 block discarded – undo
1345 1345
 				$ajaxoptions = array();
1346 1346
 			}
1347 1347
 
1348
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1348
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1349 1349
 
1350 1350
 			// No immediate load of all database
1351 1351
 			$placeholder = '';
1352 1352
 			if ($selected && empty($selected_input_value)) {
1353
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1353
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1354 1354
 				$societetmp = new Societe($this->db);
1355 1355
 				$societetmp->fetch($selected);
1356 1356
 				$selected_input_value = $societetmp->name;
@@ -1358,11 +1358,11 @@  discard block
 block discarded – undo
1358 1358
 			}
1359 1359
 
1360 1360
 			// mode 1
1361
-			$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)) : '');
1361
+			$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)) : '');
1362 1362
 
1363 1363
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1364 1364
 			if (empty($hidelabel)) {
1365
-				$out .= $langs->trans("RefOrLabel") . ' : ';
1365
+				$out .= $langs->trans("RefOrLabel").' : ';
1366 1366
 			} elseif ($hidelabel == 1 && !is_numeric($showempty)) {
1367 1367
 				$placeholder = $langs->trans($showempty);
1368 1368
 			} elseif ($hidelabel > 1) {
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 					$out .= img_picto($langs->trans("Search"), 'search');
1372 1372
 				}
1373 1373
 			}
1374
-			$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' : '') . ' />';
1374
+			$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' : '').' />';
1375 1375
 			if ($hidelabel == 3) {
1376 1376
 				$out .= img_picto($langs->trans("Search"), 'search');
1377 1377
 			}
@@ -1433,12 +1433,12 @@  discard block
 block discarded – undo
1433 1433
 				$events = array();
1434 1434
 			}
1435 1435
 
1436
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1436
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1437 1437
 
1438 1438
 			// No immediate load of all database
1439 1439
 			$placeholder = '';
1440 1440
 			if ($selected && empty($selected_input_value)) {
1441
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1441
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1442 1442
 				$contacttmp = new Contact($this->db);
1443 1443
 				$contacttmp->fetch($selected);
1444 1444
 				$selected_input_value = $contacttmp->getFullName($langs);
@@ -1449,11 +1449,11 @@  discard block
 block discarded – undo
1449 1449
 			}
1450 1450
 
1451 1451
 			// mode 1
1452
-			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : '');
1452
+			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : '');
1453 1453
 
1454 1454
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1455 1455
 
1456
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
1456
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
1457 1457
 
1458 1458
 			$out .= ajax_event($htmlname, $events);
1459 1459
 
@@ -1550,30 +1550,30 @@  discard block
 block discarded – undo
1550 1550
 			$sql .= ", s.address, s.zip, s.town";
1551 1551
 			$sql .= ", dictp.code as country_code";
1552 1552
 		}
1553
-		$sql .= " FROM " . $this->db->prefix() . "societe as s";
1553
+		$sql .= " FROM ".$this->db->prefix()."societe as s";
1554 1554
 		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1555
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
1555
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
1556 1556
 		}
1557 1557
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1558
-			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
1558
+			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
1559 1559
 		}
1560
-		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1560
+		$sql .= " WHERE s.entity IN (".getEntity('societe').")";
1561 1561
 		if (!empty($user->socid)) {
1562
-			$sql .= " AND s.rowid = " . ((int) $user->socid);
1562
+			$sql .= " AND s.rowid = ".((int) $user->socid);
1563 1563
 		}
1564 1564
 		if ($filter) {
1565 1565
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1566 1566
 			// if not, by testSqlAndScriptInject() only.
1567
-			$sql .= " AND (" . $filter . ")";
1567
+			$sql .= " AND (".$filter.")";
1568 1568
 		}
1569 1569
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1570
-			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
1570
+			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1571 1571
 		}
1572 1572
 		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) {
1573 1573
 			$sql .= " AND s.status <> 0";
1574 1574
 		}
1575 1575
 		if (!empty($excludeids)) {
1576
-			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")";
1576
+			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")";
1577 1577
 		}
1578 1578
 		// Add where from hooks
1579 1579
 		$parameters = array();
@@ -1593,17 +1593,17 @@  discard block
 block discarded – undo
1593 1593
 				if ($i > 0) {
1594 1594
 					$sql .= " AND ";
1595 1595
 				}
1596
-				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1596
+				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
1597 1597
 				$i++;
1598 1598
 			}
1599 1599
 			if (count($search_crit) > 1) {
1600 1600
 				$sql .= ")";
1601 1601
 			}
1602 1602
 			if (isModEnabled('barcode')) {
1603
-				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1603
+				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1604 1604
 			}
1605
-			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1606
-			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1605
+			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1606
+			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1607 1607
 			$sql .= ")";
1608 1608
 		}
1609 1609
 		$sql .= $this->db->order("nom", "ASC");
@@ -1614,7 +1614,7 @@  discard block
 block discarded – undo
1614 1614
 		$resql = $this->db->query($sql);
1615 1615
 		if ($resql) {
1616 1616
 			// Construct $out and $outarray
1617
-			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
1617
+			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
1618 1618
 
1619 1619
 			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');
1620 1620
 			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
 				}
1628 1628
 			}
1629 1629
 			if ($showempty) {
1630
-				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : '&nbsp;') . '</span>') . '">' . $textifempty . '</option>' . "\n";
1630
+				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
1631 1631
 			}
1632 1632
 
1633 1633
 			$companytemp = new Societe($this->db);
@@ -1640,18 +1640,18 @@  discard block
 block discarded – undo
1640 1640
 					$label = '';
1641 1641
 					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
1642 1642
 						if (($obj->client) && (!empty($obj->code_client))) {
1643
-							$label = $obj->code_client . ' - ';
1643
+							$label = $obj->code_client.' - ';
1644 1644
 						}
1645 1645
 						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
1646
-							$label .= $obj->code_fournisseur . ' - ';
1646
+							$label .= $obj->code_fournisseur.' - ';
1647 1647
 						}
1648
-						$label .= ' ' . $obj->name;
1648
+						$label .= ' '.$obj->name;
1649 1649
 					} else {
1650 1650
 						$label = $obj->name;
1651 1651
 					}
1652 1652
 
1653 1653
 					if (!empty($obj->name_alias)) {
1654
-						$label .= ' (' . $obj->name_alias . ')';
1654
+						$label .= ' ('.$obj->name_alias.')';
1655 1655
 					}
1656 1656
 
1657 1657
 					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) {
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 						$companytemp->fournisseur = $obj->fournisseur;
1667 1667
 						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');
1668 1668
 						if ($tmptype) {
1669
-							$labelhtml .= ' ' . $tmptype;
1669
+							$labelhtml .= ' '.$tmptype;
1670 1670
 						}
1671 1671
 
1672 1672
 						if ($obj->client || $obj->fournisseur) {
@@ -1676,10 +1676,10 @@  discard block
 block discarded – undo
1676 1676
 							$label .= $langs->trans("Customer");
1677 1677
 						}
1678 1678
 						if ($obj->client == 2 || $obj->client == 3) {
1679
-							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1679
+							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect");
1680 1680
 						}
1681 1681
 						if ($obj->fournisseur) {
1682
-							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1682
+							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier");
1683 1683
 						}
1684 1684
 						if ($obj->client || $obj->fournisseur) {
1685 1685
 							$label .= ')';
@@ -1687,9 +1687,9 @@  discard block
 block discarded – undo
1687 1687
 					}
1688 1688
 
1689 1689
 					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1690
-						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');
1690
+						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
1691 1691
 						if (!empty($obj->country_code)) {
1692
-							$s .= ', ' . $langs->trans('Country' . $obj->country_code);
1692
+							$s .= ', '.$langs->trans('Country'.$obj->country_code);
1693 1693
 						}
1694 1694
 						$label .= $s;
1695 1695
 						$labelhtml .= $s;
@@ -1697,9 +1697,9 @@  discard block
 block discarded – undo
1697 1697
 
1698 1698
 					if (empty($outputmode)) {
1699 1699
 						if (in_array($obj->rowid, $selected)) {
1700
-							$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>';
1700
+							$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>';
1701 1701
 						} else {
1702
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1702
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1703 1703
 						}
1704 1704
 					} else {
1705 1705
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@@ -1711,9 +1711,9 @@  discard block
 block discarded – undo
1711 1711
 					}
1712 1712
 				}
1713 1713
 			}
1714
-			$out .= '</select>' . "\n";
1714
+			$out .= '</select>'."\n";
1715 1715
 			if (!$forcecombo) {
1716
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1716
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1717 1717
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT"));
1718 1718
 			}
1719 1719
 		} else {
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
 		}
1803 1803
 
1804 1804
 		if (!is_object($hookmanager)) {
1805
-			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1805
+			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1806 1806
 			$hookmanager = new HookManager($this->db);
1807 1807
 		}
1808 1808
 
@@ -1811,14 +1811,14 @@  discard block
 block discarded – undo
1811 1811
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1812 1812
 			$sql .= ", s.nom as company, s.town AS company_town";
1813 1813
 		}
1814
-		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
1814
+		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
1815 1815
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1816
-			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
1816
+			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
1817 1817
 		}
1818
-		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
1818
+		$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
1819 1819
 		$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact
1820 1820
 		if ($socid > 0 || $socid == -1) {
1821
-			$sql .= " AND sp.fk_soc = " . ((int) $socid);
1821
+			$sql .= " AND sp.fk_soc = ".((int) $socid);
1822 1822
 		}
1823 1823
 		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) {
1824 1824
 			$sql .= " AND sp.statut <> 0";
@@ -1826,7 +1826,7 @@  discard block
 block discarded – undo
1826 1826
 		if ($filter) {
1827 1827
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1828 1828
 			// if not, by testSqlAndScriptInject() only.
1829
-			$sql .= " AND (" . $filter . ")";
1829
+			$sql .= " AND (".$filter.")";
1830 1830
 		}
1831 1831
 		// Add where from hooks
1832 1832
 		$parameters = array();
@@ -1834,30 +1834,30 @@  discard block
 block discarded – undo
1834 1834
 		$sql .= $hookmanager->resPrint;
1835 1835
 		$sql .= " ORDER BY sp.lastname ASC";
1836 1836
 
1837
-		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);
1837
+		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
1838 1838
 		$resql = $this->db->query($sql);
1839 1839
 		if ($resql) {
1840 1840
 			$num = $this->db->num_rows($resql);
1841 1841
 
1842 1842
 			if ($htmlname != 'none' && !$options_only) {
1843
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1843
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1844 1844
 			}
1845 1845
 
1846 1846
 			if ($showempty && !is_numeric($showempty)) {
1847 1847
 				$textforempty = $showempty;
1848
-				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';
1848
+				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
1849 1849
 			} else {
1850 1850
 				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1851
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1851
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1852 1852
 				}
1853 1853
 				if ($showempty == 2) {
1854
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>';
1854
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
1855 1855
 				}
1856 1856
 			}
1857 1857
 
1858 1858
 			$i = 0;
1859 1859
 			if ($num) {
1860
-				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1860
+				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1861 1861
 				$contactstatic = new Contact($this->db);
1862 1862
 
1863 1863
 				while ($i < $num) {
@@ -1893,7 +1893,7 @@  discard block
 block discarded – undo
1893 1893
 						}
1894 1894
 						$extendedInfos = implode(' - ', $extendedInfos);
1895 1895
 						if (!empty($extendedInfos)) {
1896
-							$extendedInfos = ' - ' . $extendedInfos;
1896
+							$extendedInfos = ' - '.$extendedInfos;
1897 1897
 						}
1898 1898
 					}
1899 1899
 
@@ -1911,35 +1911,35 @@  discard block
 block discarded – undo
1911 1911
 								$disabled = 1;
1912 1912
 							}
1913 1913
 							if (!empty($selected) && in_array($obj->rowid, $selected)) {
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 .= ' selected>';
1919 1919
 
1920
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1920
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1921 1921
 								if ($showfunction && $obj->poste) {
1922
-									$tmplabel .= ' (' . $obj->poste . ')';
1922
+									$tmplabel .= ' ('.$obj->poste.')';
1923 1923
 								}
1924 1924
 								if (($showsoc > 0) && $obj->company) {
1925
-									$tmplabel .= ' - (' . $obj->company . ')';
1925
+									$tmplabel .= ' - ('.$obj->company.')';
1926 1926
 								}
1927 1927
 
1928 1928
 								$out .= $tmplabel;
1929 1929
 								$out .= '</option>';
1930 1930
 							} else {
1931
-								$out .= '<option value="' . $obj->rowid . '"';
1931
+								$out .= '<option value="'.$obj->rowid.'"';
1932 1932
 								if ($disabled) {
1933 1933
 									$out .= ' disabled';
1934 1934
 								}
1935 1935
 								$out .= '>';
1936 1936
 
1937
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1937
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1938 1938
 								if ($showfunction && $obj->poste) {
1939
-									$tmplabel .= ' (' . $obj->poste . ')';
1939
+									$tmplabel .= ' ('.$obj->poste.')';
1940 1940
 								}
1941 1941
 								if (($showsoc > 0) && $obj->company) {
1942
-									$tmplabel .= ' - (' . $obj->company . ')';
1942
+									$tmplabel .= ' - ('.$obj->company.')';
1943 1943
 								}
1944 1944
 
1945 1945
 								$out .= $tmplabel;
@@ -1947,12 +1947,12 @@  discard block
 block discarded – undo
1947 1947
 							}
1948 1948
 						} else {
1949 1949
 							if (in_array($obj->rowid, $selected)) {
1950
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1950
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1951 1951
 								if ($showfunction && $obj->poste) {
1952
-									$tmplabel .= ' (' . $obj->poste . ')';
1952
+									$tmplabel .= ' ('.$obj->poste.')';
1953 1953
 								}
1954 1954
 								if (($showsoc > 0) && $obj->company) {
1955
-									$tmplabel .= ' - (' . $obj->company . ')';
1955
+									$tmplabel .= ' - ('.$obj->company.')';
1956 1956
 								}
1957 1957
 
1958 1958
 								$out .= $tmplabel;
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
 				}
1968 1968
 			} else {
1969 1969
 				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1970
-				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';
1970
+				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';
1971 1971
 				$out .= $labeltoshow;
1972 1972
 				$out .= '</option>';
1973 1973
 			}
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
 			}
1989 1989
 
1990 1990
 			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
1991
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1991
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1992 1992
 				$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT"));
1993 1993
 			}
1994 1994
 
@@ -2027,18 +2027,18 @@  discard block
 block discarded – undo
2027 2027
 		// On recherche les remises
2028 2028
 		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
2029 2029
 		$sql .= " re.description, re.fk_facture_source";
2030
-		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
2031
-		$sql .= " WHERE re.fk_soc = " . (int) $socid;
2032
-		$sql .= " AND re.entity = " . $conf->entity;
2030
+		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";
2031
+		$sql .= " WHERE re.fk_soc = ".(int) $socid;
2032
+		$sql .= " AND re.entity = ".$conf->entity;
2033 2033
 		if ($filter) {
2034
-			$sql .= " AND " . $filter;
2034
+			$sql .= " AND ".$filter;
2035 2035
 		}
2036 2036
 		$sql .= " ORDER BY re.description ASC";
2037 2037
 
2038
-		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
2038
+		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
2039 2039
 		$resql = $this->db->query($sql);
2040 2040
 		if ($resql) {
2041
-			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';
2041
+			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
2042 2042
 			$num = $this->db->num_rows($resql);
2043 2043
 
2044 2044
 			$qualifiedlines = $num;
@@ -2076,16 +2076,16 @@  discard block
 block discarded – undo
2076 2076
 					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) {
2077 2077
 						$tmpfac = new Facture($this->db);
2078 2078
 						if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
2079
-							$desc = $desc . ' - ' . $tmpfac->ref;
2079
+							$desc = $desc.' - '.$tmpfac->ref;
2080 2080
 						}
2081 2081
 					}
2082 2082
 
2083
-					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
2083
+					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
2084 2084
 					$i++;
2085 2085
 				}
2086 2086
 			}
2087 2087
 			print '</select>';
2088
-			print ajax_combobox('select_' . $htmlname);
2088
+			print ajax_combobox('select_'.$htmlname);
2089 2089
 
2090 2090
 			return $qualifiedlines;
2091 2091
 		} else {
@@ -2194,14 +2194,14 @@  discard block
 block discarded – undo
2194 2194
 		if ($showlabelofentity) {
2195 2195
 			$sql .= ", e.label";
2196 2196
 		}
2197
-		$sql .= " FROM " . $this->db->prefix() . "user as u";
2197
+		$sql .= " FROM ".$this->db->prefix()."user as u";
2198 2198
 		if ($showlabelofentity) {
2199
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
2199
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
2200 2200
 		}
2201 2201
 		// Condition here should be the same than into societe->getSalesRepresentatives().
2202 2202
 		if ($userissuperadminentityone && $force_entity != 'default') {
2203 2203
 			if (!empty($force_entity)) {
2204
-				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
2204
+				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
2205 2205
 			} else {
2206 2206
 				$sql .= " WHERE u.entity IS NOT NULL";
2207 2207
 			}
@@ -2209,18 +2209,18 @@  discard block
 block discarded – undo
2209 2209
 			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) {
2210 2210
 				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))";
2211 2211
 			} else {
2212
-				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
2212
+				$sql .= " WHERE u.entity IN (".getEntity('user').")";
2213 2213
 			}
2214 2214
 		}
2215 2215
 
2216 2216
 		if (!empty($user->socid)) {
2217
-			$sql .= " AND u.fk_soc = " . ((int) $user->socid);
2217
+			$sql .= " AND u.fk_soc = ".((int) $user->socid);
2218 2218
 		}
2219 2219
 		if (is_array($exclude) && $excludeUsers) {
2220
-			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
2220
+			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")";
2221 2221
 		}
2222 2222
 		if ($includeUsers) {
2223
-			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")";
2223
+			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")";
2224 2224
 		}
2225 2225
 		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
2226 2226
 			$sql .= " AND u.statut <> 0";
@@ -2257,7 +2257,7 @@  discard block
 block discarded – undo
2257 2257
 			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
2258 2258
 		}
2259 2259
 
2260
-		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);
2260
+		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
2261 2261
 
2262 2262
 		$resql = $this->db->query($sql);
2263 2263
 		if ($resql) {
@@ -2265,7 +2265,7 @@  discard block
 block discarded – undo
2265 2265
 			$i = 0;
2266 2266
 			if ($num) {
2267 2267
 				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
2268
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
2268
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
2269 2269
 				if ($show_empty && !$multiple) {
2270 2270
 					$textforempty = ' ';
2271 2271
 					if (!empty($conf->use_javascript_ajax)) {
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 					if (!is_numeric($show_empty)) {
2275 2275
 						$textforempty = $show_empty;
2276 2276
 					}
2277
-					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
2277
+					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
2278 2278
 
2279 2279
 					$outarray[($show_empty < 0 ? $show_empty : -1)] = $textforempty;
2280 2280
 					$outarray2[($show_empty < 0 ? $show_empty : -1)] = array(
@@ -2286,13 +2286,13 @@  discard block
 block discarded – undo
2286 2286
 					);
2287 2287
 				}
2288 2288
 				if ($show_every) {
2289
-					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
2289
+					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
2290 2290
 
2291
-					$outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --';
2291
+					$outarray[-2] = '-- '.$langs->trans("Everybody").' --';
2292 2292
 					$outarray2[-2] = array(
2293 2293
 						'id' => -2,
2294
-						'label' => '-- ' . $langs->trans("Everybody") . ' --',
2295
-						'labelhtml' => '-- ' . $langs->trans("Everybody") . ' --',
2294
+						'label' => '-- '.$langs->trans("Everybody").' --',
2295
+						'labelhtml' => '-- '.$langs->trans("Everybody").' --',
2296 2296
 						'color' => '',
2297 2297
 						'picto' => ''
2298 2298
 					);
@@ -2343,21 +2343,21 @@  discard block
 block discarded – undo
2343 2343
 					}
2344 2344
 					if ($showstatus >= 0) {
2345 2345
 						if ($obj->status == 1 && $showstatus == 1) {
2346
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
2347
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled');
2346
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
2347
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
2348 2348
 						}
2349 2349
 						if ($obj->status == 0 && $showstatus == 1) {
2350
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
2351
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled');
2350
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
2351
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
2352 2352
 						}
2353 2353
 					}
2354 2354
 					if ($showlabelofentity) {
2355 2355
 						if (empty($obj->entity)) {
2356
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
2357
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
2356
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
2357
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
2358 2358
 						} else {
2359 2359
 							if ($obj->entity != $conf->entity) {
2360
-								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2360
+								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2361 2361
 								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2362 2362
 							}
2363 2363
 						}
@@ -2366,13 +2366,13 @@  discard block
 block discarded – undo
2366 2366
 					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');
2367 2367
 					if (!empty($disableline) && $disableline != '1') {
2368 2368
 						// Add text from $enableonlytext parameter
2369
-						$moreinfo .= ' - ' . $disableline;
2370
-						$moreinfohtml .= ' - ' . $disableline;
2369
+						$moreinfo .= ' - '.$disableline;
2370
+						$moreinfohtml .= ' - '.$disableline;
2371 2371
 					}
2372 2372
 					$labeltoshow .= $moreinfo;
2373 2373
 					$labeltoshowhtml .= $moreinfohtml;
2374 2374
 
2375
-					$out .= '<option value="' . $obj->rowid . '"';
2375
+					$out .= '<option value="'.$obj->rowid.'"';
2376 2376
 					if (!empty($disableline)) {
2377 2377
 						$out .= ' disabled';
2378 2378
 					}
@@ -2381,7 +2381,7 @@  discard block
 block discarded – undo
2381 2381
 					}
2382 2382
 					$out .= ' data-html="';
2383 2383
 
2384
-					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';
2384
+					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
2385 2385
 					if ($showstatus >= 0 && $obj->status == 0) {
2386 2386
 						$outhtml .= '<strike class="opacitymediumxxx">';
2387 2387
 					}
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
 					$out .= $labeltoshow;
2397 2397
 					$out .= '</option>';
2398 2398
 
2399
-					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
2399
+					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
2400 2400
 					$outarray2[$userstatic->id] = array(
2401 2401
 						'id' => $userstatic->id,
2402 2402
 						'label' => $labeltoshow,
@@ -2408,14 +2408,14 @@  discard block
 block discarded – undo
2408 2408
 					$i++;
2409 2409
 				}
2410 2410
 			} else {
2411
-				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
2412
-				$out .= '<option value="">' . $langs->trans("None") . '</option>';
2411
+				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
2412
+				$out .= '<option value="">'.$langs->trans("None").'</option>';
2413 2413
 			}
2414 2414
 			$out .= '</select>';
2415 2415
 
2416 2416
 			if ($num && !$forcecombo) {
2417 2417
 				// Enhance with select2
2418
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2418
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2419 2419
 				$out .= ajax_combobox($htmlname);
2420 2420
 			}
2421 2421
 		} else {
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
 			$out .= $userstatic->getNomUrl(-1);
2493 2493
 			if ($i == 0) {
2494 2494
 				$ownerid = $value['id'];
2495
-				$out .= ' (' . $langs->trans("Owner") . ')';
2495
+				$out .= ' ('.$langs->trans("Owner").')';
2496 2496
 			}
2497 2497
 			// Add picto to delete owner/assignee
2498 2498
 			if ($nbassignetouser > 1 && $action != 'view') {
@@ -2503,7 +2503,7 @@  discard block
 block discarded – undo
2503 2503
 						$canremoveassignee = 0;
2504 2504
 					}
2505 2505
 					if (!$user->hasRight('agenda', 'allactions', 'create')) {
2506
-						$canremoveassignee = 0;		// Can't remove the owner
2506
+						$canremoveassignee = 0; // Can't remove the owner
2507 2507
 					}
2508 2508
 				} else {
2509 2509
 					// We are not on the owner of the event but on a secondary assignee
@@ -2511,14 +2511,14 @@  discard block
 block discarded – undo
2511 2511
 				if ($canremoveassignee) {
2512 2512
 					// If user has all permission, he should be ableto remove a assignee.
2513 2513
 					// If user has not all permission, he can onlyremove assignee of other (he can't remove itself)
2514
-					$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 . '">';
2514
+					$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.'">';
2515 2515
 				}
2516 2516
 			}
2517 2517
 			// Show my availability
2518 2518
 			if ($showproperties) {
2519 2519
 				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
2520 2520
 					$out .= '<div class="myavailability inline-block">';
2521
-					$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>';
2521
+					$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>';
2522 2522
 					$out .= '</div>';
2523 2523
 				}
2524 2524
 			}
@@ -2535,15 +2535,15 @@  discard block
 block discarded – undo
2535 2535
 		// Method with no ajax
2536 2536
 		if ($action != 'view') {
2537 2537
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
2538
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2538
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2539 2539
 			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
2540 2540
 			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
2541
-			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }';
2542
-			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }';
2541
+			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';
2542
+			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }';
2543 2543
 			$out .= '});';
2544 2544
 			$out .= '})</script>';
2545 2545
 			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2546
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2546
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2547 2547
 			$out .= '<br>';
2548 2548
 		}
2549 2549
 
@@ -2602,13 +2602,13 @@  discard block
 block discarded – undo
2602 2602
 			$resourcestatic->fetch($value['id']);
2603 2603
 			$out .= $resourcestatic->getNomUrl(-1);
2604 2604
 			if ($nbassignetoresource >= 1 && $action != 'view') {
2605
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassignedresource reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">';
2605
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassignedresource reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">';
2606 2606
 			}
2607 2607
 			// Show my availability
2608 2608
 			if ($showproperties) {
2609 2609
 				if (is_array($listofresourceid) && count($listofresourceid)) {
2610 2610
 					$out .= '<div class="myavailability inline-block">';
2611
-					$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>';
2611
+					$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>';
2612 2612
 					$out .= '</div>';
2613 2613
 				}
2614 2614
 			}
@@ -2625,11 +2625,11 @@  discard block
 block discarded – undo
2625 2625
 		// Method with no ajax
2626 2626
 		if ($action != 'view') {
2627 2627
 			$out .= '<input type="hidden" class="removedassignedresourcehidden" name="removedassignedresource" value="">';
2628
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2628
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2629 2629
 			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });';
2630 2630
 			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());';
2631
-			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }';
2632
-			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }';
2631
+			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }';
2632
+			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }';
2633 2633
 			$out .= '});';
2634 2634
 			$out .= '})</script>';
2635 2635
 
@@ -2637,7 +2637,7 @@  discard block
 block discarded – undo
2637 2637
 			$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
2638 2638
 			$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);
2639 2639
 			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2640
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2640
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2641 2641
 			$out .= '<br>';
2642 2642
 		}
2643 2643
 
@@ -2700,7 +2700,7 @@  discard block
 block discarded – undo
2700 2700
 			$placeholder = (is_numeric($showempty) ? '' : 'placeholder="'.dolPrintHTML($showempty).'"');
2701 2701
 
2702 2702
 			if ($selected && empty($selected_input_value)) {
2703
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2703
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2704 2704
 				$producttmpselect = new Product($this->db);
2705 2705
 				$producttmpselect->fetch($selected);
2706 2706
 				$selected_input_value = $producttmpselect->ref;
@@ -2715,21 +2715,21 @@  discard block
 block discarded – undo
2715 2715
 				}
2716 2716
 			}
2717 2717
 			// mode=1 means customers products
2718
-			$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;
2718
+			$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;
2719 2719
 			if ((int) $warehouseId > 0) {
2720
-				$urloption .= '&warehouseid=' . (int) $warehouseId;
2720
+				$urloption .= '&warehouseid='.(int) $warehouseId;
2721 2721
 			}
2722 2722
 
2723
-			$out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions);
2723
+			$out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions);
2724 2724
 
2725 2725
 			if (isModEnabled('variants') && is_array($selected_combinations)) {
2726 2726
 				// Code to automatically insert with javascript the select of attributes under the select of product
2727 2727
 				// when a parent of variant has been selected.
2728 2728
 				$out .= '
2729 2729
 				<!-- script to auto show attributes select tags if a variant was selected -->
2730
-				<script nonce="' . getNonce() . '">
2730
+				<script nonce="' . getNonce().'">
2731 2731
 					// auto show attributes fields
2732
-					selected = ' . json_encode($selected_combinations) . ';
2732
+					selected = ' . json_encode($selected_combinations).';
2733 2733
 					combvalues = {};
2734 2734
 
2735 2735
 					jQuery(document).ready(function () {
@@ -2740,7 +2740,7 @@  discard block
 block discarded – undo
2740 2740
 							}
2741 2741
 						});
2742 2742
 
2743
-						jQuery("input#' . $htmlname . '").change(function () {
2743
+						jQuery("input#' . $htmlname.'").change(function () {
2744 2744
 
2745 2745
 							if (!jQuery(this).val()) {
2746 2746
 								jQuery(\'div#attributes_box\').empty();
@@ -2749,7 +2749,7 @@  discard block
 block discarded – undo
2749 2749
 
2750 2750
 							console.log("A change has started. We get variants fields to inject html select");
2751 2751
 
2752
-							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", {
2752
+							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
2753 2753
 								id: jQuery(this).val()
2754 2754
 							}, function (data) {
2755 2755
 								jQuery(\'div#attributes_box\').empty();
@@ -2792,22 +2792,22 @@  discard block
 block discarded – undo
2792 2792
 							})
2793 2793
 						});
2794 2794
 
2795
-						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . '
2795
+						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').'
2796 2796
 					});
2797 2797
 				</script>
2798 2798
                 ';
2799 2799
 			}
2800 2800
 
2801 2801
 			if (empty($hidelabel)) {
2802
-				$placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"';
2802
+				$placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"';
2803 2803
 			} elseif ($hidelabel > 1) {
2804
-				$placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"';
2804
+				$placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"';
2805 2805
 				if ($hidelabel == 2) {
2806 2806
 					$out .= img_picto($langs->trans("Search"), 'search');
2807 2807
 				}
2808 2808
 			}
2809 2809
 
2810
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
2810
+			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
2811 2811
 			if ($hidelabel == 3) {
2812 2812
 				$out .= img_picto($langs->trans("Search"), 'search');
2813 2813
 			}
@@ -2844,33 +2844,33 @@  discard block
 block discarded – undo
2844 2844
 		// phpcs:enable
2845 2845
 		global $db;
2846 2846
 
2847
-		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2847
+		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2848 2848
 
2849 2849
 		$error = 0;
2850 2850
 		$out = '';
2851 2851
 
2852 2852
 		if (!$forcecombo) {
2853
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2853
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2854 2854
 			$events = array();
2855 2855
 			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2856 2856
 		}
2857 2857
 
2858
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2858
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2859 2859
 
2860 2860
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2861
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2862
-		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2861
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2862
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2863 2863
 		if (!empty($status)) {
2864
-			$sql .= ' AND status = ' . (int) $status;
2864
+			$sql .= ' AND status = '.(int) $status;
2865 2865
 		}
2866 2866
 		if (!empty($type)) {
2867
-			$sql .= ' AND bomtype = ' . (int) $type;
2867
+			$sql .= ' AND bomtype = '.(int) $type;
2868 2868
 		}
2869 2869
 		if (!empty($TProducts)) {
2870
-			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2870
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2871 2871
 		}
2872 2872
 		if (!empty($limit)) {
2873
-			$sql .= ' LIMIT ' . (int) $limit;
2873
+			$sql .= ' LIMIT '.(int) $limit;
2874 2874
 		}
2875 2875
 		$resql = $db->query($sql);
2876 2876
 		if ($resql) {
@@ -2884,11 +2884,11 @@  discard block
 block discarded – undo
2884 2884
 			while ($obj = $db->fetch_object($resql)) {
2885 2885
 				$product = new Product($db);
2886 2886
 				$res = $product->fetch($obj->fk_product);
2887
-				$out .= '<option value="' . $obj->rowid . '"';
2887
+				$out .= '<option value="'.$obj->rowid.'"';
2888 2888
 				if ($obj->rowid == $selected) {
2889 2889
 					$out .= 'selected';
2890 2890
 				}
2891
-				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2891
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2892 2892
 			}
2893 2893
 		} else {
2894 2894
 			$error++;
@@ -2946,7 +2946,7 @@  discard block
 block discarded – undo
2946 2946
 
2947 2947
 		$warehouseStatusArray = array();
2948 2948
 		if (!empty($warehouseStatus)) {
2949
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2949
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2950 2950
 			if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2951 2951
 				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2952 2952
 			}
@@ -2960,9 +2960,9 @@  discard block
 block discarded – undo
2960 2960
 
2961 2961
 		$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";
2962 2962
 		if (count($warehouseStatusArray)) {
2963
-			$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
2963
+			$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
2964 2964
 		} else {
2965
-			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
2965
+			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
2966 2966
 		}
2967 2967
 
2968 2968
 		$sql = "SELECT ";
@@ -2978,9 +2978,9 @@  discard block
 block discarded – undo
2978 2978
 
2979 2979
 		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
2980 2980
 			//Product category
2981
-			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
2982
-						FROM " . $this->db->prefix() . "categorie_product
2983
-						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
2981
+			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
2982
+						FROM " . $this->db->prefix()."categorie_product
2983
+						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid
2984 2984
 						LIMIT 1
2985 2985
 				) AS categorie_product_id ";
2986 2986
 		}
@@ -3006,15 +3006,15 @@  discard block
 block discarded – undo
3006 3006
 		}
3007 3007
 		// Price by quantity
3008 3008
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
3009
-			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
3009
+			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
3010 3010
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
3011
-				$sql .= " AND price_level = " . ((int) $price_level);
3011
+				$sql .= " AND price_level = ".((int) $price_level);
3012 3012
 			}
3013 3013
 			$sql .= " ORDER BY date_price";
3014 3014
 			$sql .= " DESC LIMIT 1) as price_rowid";
3015
-			$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
3015
+			$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
3016 3016
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
3017
-				$sql .= " AND price_level = " . ((int) $price_level);
3017
+				$sql .= " AND price_level = ".((int) $price_level);
3018 3018
 			}
3019 3019
 			$sql .= " ORDER BY date_price";
3020 3020
 			$sql .= " DESC LIMIT 1) as price_by_qty";
@@ -3024,7 +3024,7 @@  discard block
 block discarded – undo
3024 3024
 		$sql .= " FROM ".$this->db->prefix()."product as p";
3025 3025
 
3026 3026
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) {
3027
-			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")";
3027
+			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")";
3028 3028
 		}
3029 3029
 
3030 3030
 		// Add from (left join) from hooks
@@ -3033,53 +3033,53 @@  discard block
 block discarded – undo
3033 3033
 		$sql .= $hookmanager->resPrint;
3034 3034
 
3035 3035
 		if (count($warehouseStatusArray)) {
3036
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
3037
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
3038
-			$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.
3036
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
3037
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
3038
+			$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.
3039 3039
 		}
3040 3040
 
3041 3041
 		// include search in supplier ref
3042 3042
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3043
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3043
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3044 3044
 		}
3045 3045
 
3046 3046
 		//Price by customer
3047 3047
 		if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
3048
-			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
3048
+			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
3049 3049
 		}
3050 3050
 		// Units
3051 3051
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3052
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3052
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3053 3053
 		}
3054 3054
 		// Multilang : we add translation
3055 3055
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
3056
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
3056
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
3057 3057
 			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) {
3058
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
3058
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
3059 3059
 				$soc = new Societe($this->db);
3060 3060
 				$result = $soc->fetch($socid);
3061 3061
 				if ($result > 0 && !empty($soc->default_lang)) {
3062
-					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
3062
+					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
3063 3063
 				} else {
3064
-					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3064
+					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3065 3065
 				}
3066 3066
 			} else {
3067
-				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3067
+				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3068 3068
 			}
3069 3069
 		}
3070 3070
 
3071 3071
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3072
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3072
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3073 3073
 		}
3074 3074
 
3075
-		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
3075
+		$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
3076 3076
 
3077 3077
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3078 3078
 			$sql .= " AND pac.rowid IS NULL";
3079 3079
 		}
3080 3080
 
3081 3081
 		if ($finished == 0) {
3082
-			$sql .= " AND p.finished = " . ((int) $finished);
3082
+			$sql .= " AND p.finished = ".((int) $finished);
3083 3083
 		} elseif ($finished == 1) {
3084 3084
 			$sql .= " AND p.finished = ".((int) $finished);
3085 3085
 		}
@@ -3087,11 +3087,11 @@  discard block
 block discarded – undo
3087 3087
 			$sql .= " AND p.tosell = ".((int) $status);
3088 3088
 		}
3089 3089
 		if ($status_purchase >= 0) {
3090
-			$sql .= " AND p.tobuy = " . ((int) $status_purchase);
3090
+			$sql .= " AND p.tobuy = ".((int) $status_purchase);
3091 3091
 		}
3092 3092
 		// Filter by product type
3093 3093
 		if (strval($filtertype) != '') {
3094
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3094
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3095 3095
 		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
3096 3096
 			$sql .= " AND p.fk_product_type = 1";
3097 3097
 		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
@@ -3099,7 +3099,7 @@  discard block
 block discarded – undo
3099 3099
 		}
3100 3100
 
3101 3101
 		if ((int) $warehouseId > 0) {
3102
-			$sql .= " AND EXISTS (SELECT psw.fk_product FROM " . $this->db->prefix() . "product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)";
3102
+			$sql .= " AND EXISTS (SELECT psw.fk_product FROM ".$this->db->prefix()."product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)";
3103 3103
 		}
3104 3104
 
3105 3105
 		// Add where from hooks
@@ -3120,21 +3120,21 @@  discard block
 block discarded – undo
3120 3120
 				if ($i > 0) {
3121 3121
 					$sql .= " AND ";
3122 3122
 				}
3123
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3123
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3124 3124
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
3125
-					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3125
+					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3126 3126
 				}
3127 3127
 				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
3128
-					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3128
+					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
3129 3129
 				}
3130 3130
 				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) {
3131
-					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3131
+					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3132 3132
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
3133
-						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3133
+						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3134 3134
 					}
3135 3135
 				}
3136 3136
 				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3137
-					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3137
+					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3138 3138
 				}
3139 3139
 				$sql .= ")";
3140 3140
 				$i++;
@@ -3143,12 +3143,12 @@  discard block
 block discarded – undo
3143 3143
 				$sql .= ")";
3144 3144
 			}
3145 3145
 			if (isModEnabled('barcode')) {
3146
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3146
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3147 3147
 			}
3148 3148
 			$sql .= ')';
3149 3149
 		}
3150 3150
 		if (count($warehouseStatusArray)) {
3151
-			$sql .= " GROUP BY " . $selectFields;
3151
+			$sql .= " GROUP BY ".$selectFields;
3152 3152
 		}
3153 3153
 
3154 3154
 		//Sort by category
@@ -3163,23 +3163,23 @@  discard block
 block discarded – undo
3163 3163
 		$sql .= $this->db->plimit($limit, 0);
3164 3164
 
3165 3165
 		// Build output string
3166
-		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
3166
+		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
3167 3167
 		$result = $this->db->query($sql);
3168 3168
 		if ($result) {
3169
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3170
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3171
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3169
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3170
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3171
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3172 3172
 
3173 3173
 			$num = $this->db->num_rows($result);
3174 3174
 
3175 3175
 			$events = array();
3176 3176
 
3177 3177
 			if (!$forcecombo) {
3178
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
3178
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
3179 3179
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
3180 3180
 			}
3181 3181
 
3182
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
3182
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
3183 3183
 
3184 3184
 			$textifempty = '';
3185 3185
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -3196,7 +3196,7 @@  discard block
 block discarded – undo
3196 3196
 				}
3197 3197
 			}
3198 3198
 			if ($showempty) {
3199
-				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : '&nbsp;') . '</option>';
3199
+				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
3200 3200
 			}
3201 3201
 
3202 3202
 			$i = 0;
@@ -3207,11 +3207,11 @@  discard block
 block discarded – undo
3207 3207
 
3208 3208
 				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
3209 3209
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
3210
-					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
3211
-					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
3210
+					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
3211
+					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
3212 3212
 					$sql .= " ORDER BY quantity ASC";
3213 3213
 
3214
-					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
3214
+					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
3215 3215
 					$result2 = $this->db->query($sql);
3216 3216
 					if ($result2) {
3217 3217
 						$nb_prices = $this->db->num_rows($result2);
@@ -3249,7 +3249,7 @@  discard block
 block discarded – undo
3249 3249
 						$price_product = new Product($this->db);
3250 3250
 						$price_product->fetch($objp->rowid, '', '', 1);
3251 3251
 
3252
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3252
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3253 3253
 						$priceparser = new PriceParser($this->db);
3254 3254
 						$price_result = $priceparser->parseProduct($price_product);
3255 3255
 						if ($price_result >= 0) {
@@ -3335,7 +3335,7 @@  discard block
 block discarded – undo
3335 3335
 			$label = $objp->label_translated;
3336 3336
 		}
3337 3337
 		if (!empty($filterkey) && $filterkey != '') {
3338
-			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3338
+			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3339 3339
 		}
3340 3340
 
3341 3341
 		$outkey = $objp->rowid;
@@ -3356,32 +3356,32 @@  discard block
 block discarded – undo
3356 3356
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
3357 3357
 
3358 3358
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3359
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
3359
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
3360 3360
 		}
3361 3361
 
3362 3362
 		// Units
3363 3363
 		$outvalUnits = '';
3364 3364
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3365 3365
 			if (!empty($objp->unit_short)) {
3366
-				$outvalUnits .= ' - ' . $objp->unit_short;
3366
+				$outvalUnits .= ' - '.$objp->unit_short;
3367 3367
 			}
3368 3368
 		}
3369 3369
 		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) {
3370 3370
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
3371 3371
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3372
-				$outvalUnits .= ' - ' . $unitToShow;
3372
+				$outvalUnits .= ' - '.$unitToShow;
3373 3373
 			}
3374 3374
 			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3375
-				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3376
-				$outvalUnits .= ' - ' . $unitToShow;
3375
+				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3376
+				$outvalUnits .= ' - '.$unitToShow;
3377 3377
 			}
3378 3378
 			if (!empty($objp->surface) && $objp->surface_units !== null) {
3379 3379
 				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3380
-				$outvalUnits .= ' - ' . $unitToShow;
3380
+				$outvalUnits .= ' - '.$unitToShow;
3381 3381
 			}
3382 3382
 			if (!empty($objp->volume) && $objp->volume_units !== null) {
3383 3383
 				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3384
-				$outvalUnits .= ' - ' . $unitToShow;
3384
+				$outvalUnits .= ' - '.$unitToShow;
3385 3385
 			}
3386 3386
 		}
3387 3387
 		if ($outdurationvalue && $outdurationunit) {
@@ -3393,7 +3393,7 @@  discard block
 block discarded – undo
3393 3393
 				'y' => $langs->trans('Year')
3394 3394
 			);
3395 3395
 			if (isset($da[$outdurationunit])) {
3396
-				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3396
+				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3397 3397
 			}
3398 3398
 		}
3399 3399
 
@@ -3413,31 +3413,31 @@  discard block
 block discarded – undo
3413 3413
 		$labeltoshow = '';
3414 3414
 		$labeltoshow .= $objp->ref;
3415 3415
 		if (!empty($objp->custref)) {
3416
-			$labeltoshow .= ' (' . $objp->custref . ')';
3416
+			$labeltoshow .= ' ('.$objp->custref.')';
3417 3417
 		}
3418 3418
 		if ($outbarcode) {
3419
-			$labeltoshow .= ' (' . $outbarcode . ')';
3419
+			$labeltoshow .= ' ('.$outbarcode.')';
3420 3420
 		}
3421
-		$labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle);
3421
+		$labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle);
3422 3422
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3423
-			$labeltoshow .= ' (' . getCountry($outorigin, '1') . ')';
3423
+			$labeltoshow .= ' ('.getCountry($outorigin, '1').')';
3424 3424
 		}
3425 3425
 
3426 3426
 		// Set $labltoshowhtml
3427 3427
 		$labeltoshowhtml = '';
3428 3428
 		$labeltoshowhtml .= $objp->ref;
3429 3429
 		if (!empty($objp->custref)) {
3430
-			$labeltoshowhtml .= ' (' . $objp->custref . ')';
3430
+			$labeltoshowhtml .= ' ('.$objp->custref.')';
3431 3431
 		}
3432 3432
 		if (!empty($filterkey) && $filterkey != '') {
3433
-			$labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3433
+			$labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3434 3434
 		}
3435 3435
 		if ($outbarcode) {
3436
-			$labeltoshowhtml .= ' (' . $outbarcode . ')';
3436
+			$labeltoshowhtml .= ' ('.$outbarcode.')';
3437 3437
 		}
3438
-		$labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle);
3438
+		$labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle);
3439 3439
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3440
-			$labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')';
3440
+			$labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')';
3441 3441
 		}
3442 3442
 
3443 3443
 		// Stock
@@ -3445,14 +3445,14 @@  discard block
 block discarded – undo
3445 3445
 		$labeltoshowhtmlstock = '';
3446 3446
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3447 3447
 			if ($user->hasRight('stock', 'lire')) {
3448
-				$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3448
+				$labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3449 3449
 
3450 3450
 				if ($objp->stock > 0) {
3451 3451
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">';
3452 3452
 				} elseif ($objp->stock <= 0) {
3453 3453
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">';
3454 3454
 				}
3455
-				$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3455
+				$labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3456 3456
 				$labeltoshowhtmlstock .= '</span>';
3457 3457
 
3458 3458
 				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
@@ -3463,9 +3463,9 @@  discard block
 block discarded – undo
3463 3463
 					$tmpproduct->load_virtual_stock();
3464 3464
 					$virtualstock = $tmpproduct->stock_theorique;
3465 3465
 
3466
-					$labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3466
+					$labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3467 3467
 
3468
-					$labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3468
+					$labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':';
3469 3469
 					if ($virtualstock > 0) {
3470 3470
 						$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">';
3471 3471
 					} elseif ($virtualstock <= 0) {
@@ -3486,35 +3486,35 @@  discard block
 block discarded – undo
3486 3486
 		// If we need a particular price level (from 1 to n)
3487 3487
 		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) {
3488 3488
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
3489
-			$sql .= " FROM " . $this->db->prefix() . "product_price";
3490
-			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
3491
-			$sql .= " AND entity IN (" . getEntity('productprice') . ")";
3492
-			$sql .= " AND price_level = " . ((int) $price_level);
3489
+			$sql .= " FROM ".$this->db->prefix()."product_price";
3490
+			$sql .= " WHERE fk_product = ".((int) $objp->rowid);
3491
+			$sql .= " AND entity IN (".getEntity('productprice').")";
3492
+			$sql .= " AND price_level = ".((int) $price_level);
3493 3493
 			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
3494 3494
 			$sql .= " LIMIT 1";
3495 3495
 
3496
-			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);
3496
+			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
3497 3497
 			$result2 = $this->db->query($sql);
3498 3498
 			if ($result2) {
3499 3499
 				$objp2 = $this->db->fetch_object($result2);
3500 3500
 				if ($objp2) {
3501 3501
 					$found = 1;
3502 3502
 					if ($objp2->price_base_type == 'HT') {
3503
-						$labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3504
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3503
+						$labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3504
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3505 3505
 					} else {
3506
-						$labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3507
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3506
+						$labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3507
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3508 3508
 					}
3509 3509
 					$outprice_ht = price($objp2->price);
3510 3510
 					$outprice_ttc = price($objp2->price_ttc);
3511 3511
 					$outpricebasetype = $objp2->price_base_type;
3512 3512
 					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility
3513
-						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
3514
-						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
3513
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3514
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3515 3515
 					} else {
3516
-						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice
3517
-						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice
3516
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3517
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3518 3518
 					}
3519 3519
 				}
3520 3520
 			} else {
@@ -3528,13 +3528,13 @@  discard block
 block discarded – undo
3528 3528
 			$outqty = $objp->quantity;
3529 3529
 			$outdiscount = $objp->remise_percent;
3530 3530
 			if ($objp->quantity == 1) {
3531
-				$labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";
3532
-				$labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";
3531
+				$labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
3532
+				$labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
3533 3533
 				$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3534 3534
 				$labeltoshowhtmlprice .= $langs->transnoentities("Unit");
3535 3535
 			} else {
3536
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3537
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3536
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3537
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3538 3538
 				$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3539 3539
 				$labeltoshowhtmlprice .= $langs->transnoentities("Units");
3540 3540
 			}
@@ -3542,16 +3542,16 @@  discard block
 block discarded – undo
3542 3542
 			$outprice_ht = price($objp->unitprice);
3543 3543
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3544 3544
 			$outpricebasetype = $objp->price_base_type;
3545
-			$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
3546
-			$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
3545
+			$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
3546
+			$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
3547 3547
 		}
3548 3548
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3549
-			$labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3550
-			$labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3549
+			$labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3550
+			$labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3551 3551
 		}
3552 3552
 		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
3553
-			$labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3554
-			$labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3553
+			$labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3554
+			$labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3555 3555
 		}
3556 3556
 
3557 3557
 		// Price by customer
@@ -3560,11 +3560,11 @@  discard block
 block discarded – undo
3560 3560
 				$found = 1;
3561 3561
 
3562 3562
 				if ($objp->custprice_base_type == 'HT') {
3563
-					$labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3564
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3563
+					$labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3564
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3565 3565
 				} else {
3566
-					$labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3567
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3566
+					$labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3567
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3568 3568
 				}
3569 3569
 
3570 3570
 				$outprice_ht = price($objp->custprice);
@@ -3578,11 +3578,11 @@  discard block
 block discarded – undo
3578 3578
 		// If level no defined or multiprice not found, we used the default price
3579 3579
 		if (empty($hidepriceinlabel) && !$found) {
3580 3580
 			if ($objp->price_base_type == 'HT') {
3581
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3582
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3581
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3582
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3583 3583
 			} else {
3584
-				$labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3585
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3584
+				$labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3585
+				$labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3586 3586
 			}
3587 3587
 			$outprice_ht = price($objp->price);
3588 3588
 			$outprice_ttc = price($objp->price_ttc);
@@ -3592,14 +3592,14 @@  discard block
 block discarded – undo
3592 3592
 		}
3593 3593
 
3594 3594
 		// Build options
3595
-		$opt = '<option value="' . $objp->rowid . '"';
3595
+		$opt = '<option value="'.$objp->rowid.'"';
3596 3596
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
3597 3597
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
3598
-			$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 . '"';
3598
+			$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.'"';
3599 3599
 		}
3600 3600
 		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
3601
-			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
3602
-			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
3601
+			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
3602
+			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
3603 3603
 		}
3604 3604
 
3605 3605
 		if ($stocktag == 1) {
@@ -3694,7 +3694,7 @@  discard block
 block discarded – undo
3694 3694
 		$selected_input_value = '';
3695 3695
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
3696 3696
 			if ($selected > 0) {
3697
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3697
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3698 3698
 				$producttmpselect = new Product($this->db);
3699 3699
 				$producttmpselect->fetch($selected);
3700 3700
 				$selected_input_value = $producttmpselect->ref;
@@ -3702,10 +3702,10 @@  discard block
 block discarded – undo
3702 3702
 			}
3703 3703
 
3704 3704
 			// mode=2 means suppliers products
3705
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
3706
-			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3705
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
3706
+			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3707 3707
 
3708
-			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>';
3708
+			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
3709 3709
 		} else {
3710 3710
 			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
3711 3711
 		}
@@ -3763,25 +3763,25 @@  discard block
 block discarded – undo
3763 3763
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3764 3764
 			$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";
3765 3765
 		}
3766
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3767
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
3766
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3767
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
3768 3768
 		if ($socid > 0) {
3769
-			$sql .= " AND pfp.fk_soc = " . ((int) $socid);
3769
+			$sql .= " AND pfp.fk_soc = ".((int) $socid);
3770 3770
 		}
3771
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3771
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3772 3772
 		// Units
3773 3773
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3774
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3774
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3775 3775
 		}
3776
-		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
3776
+		$sql .= " WHERE p.entity IN (".getEntity('product').")";
3777 3777
 		if ($statut != -1) {
3778
-			$sql .= " AND p.tobuy = " . ((int) $statut);
3778
+			$sql .= " AND p.tobuy = ".((int) $statut);
3779 3779
 		}
3780 3780
 		if (strval($filtertype) != '') {
3781
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3781
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3782 3782
 		}
3783 3783
 		if (!empty($filtre)) {
3784
-			$sql .= " " . $filtre;
3784
+			$sql .= " ".$filtre;
3785 3785
 		}
3786 3786
 		// Add where from hooks
3787 3787
 		$parameters = array();
@@ -3801,9 +3801,9 @@  discard block
 block discarded – undo
3801 3801
 				if ($i > 0) {
3802 3802
 					$sql .= " AND ";
3803 3803
 				}
3804
-				$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) . "%'";
3804
+				$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)."%'";
3805 3805
 				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
3806
-					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3806
+					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3807 3807
 				}
3808 3808
 				$sql .= ")";
3809 3809
 				$i++;
@@ -3812,8 +3812,8 @@  discard block
 block discarded – undo
3812 3812
 				$sql .= ")";
3813 3813
 			}
3814 3814
 			if (isModEnabled('barcode')) {
3815
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3816
-				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3815
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3816
+				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3817 3817
 			}
3818 3818
 			$sql .= ')';
3819 3819
 		}
@@ -3822,20 +3822,20 @@  discard block
 block discarded – undo
3822 3822
 
3823 3823
 		// Build output string
3824 3824
 
3825
-		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
3825
+		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
3826 3826
 		$result = $this->db->query($sql);
3827 3827
 		if ($result) {
3828
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3829
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3828
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3829
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3830 3830
 
3831 3831
 			$num = $this->db->num_rows($result);
3832 3832
 
3833 3833
 			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
3834
-			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
3834
+			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
3835 3835
 			if (!$selected) {
3836
-				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3836
+				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3837 3837
 			} else {
3838
-				$out .= '<option value="-1">' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3838
+				$out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3839 3839
 			}
3840 3840
 
3841 3841
 			$i = 0;
@@ -3850,7 +3850,7 @@  discard block
 block discarded – undo
3850 3850
 
3851 3851
 				$outkey = $objp->idprodfournprice; // id in table of price
3852 3852
 				if (!$outkey && $alsoproductwithnosupplierprice) {
3853
-					$outkey = 'idprod_' . $objp->rowid; // id of product
3853
+					$outkey = 'idprod_'.$objp->rowid; // id of product
3854 3854
 				}
3855 3855
 
3856 3856
 				$outref = $objp->ref;
@@ -3865,23 +3865,23 @@  discard block
 block discarded – undo
3865 3865
 				$outvalUnits = '';
3866 3866
 				if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3867 3867
 					if (!empty($objp->unit_short)) {
3868
-						$outvalUnits .= ' - ' . $objp->unit_short;
3868
+						$outvalUnits .= ' - '.$objp->unit_short;
3869 3869
 					}
3870 3870
 					if (!empty($objp->weight) && $objp->weight_units !== null) {
3871 3871
 						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3872
-						$outvalUnits .= ' - ' . $unitToShow;
3872
+						$outvalUnits .= ' - '.$unitToShow;
3873 3873
 					}
3874 3874
 					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3875
-						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3876
-						$outvalUnits .= ' - ' . $unitToShow;
3875
+						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3876
+						$outvalUnits .= ' - '.$unitToShow;
3877 3877
 					}
3878 3878
 					if (!empty($objp->surface) && $objp->surface_units !== null) {
3879 3879
 						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3880
-						$outvalUnits .= ' - ' . $unitToShow;
3880
+						$outvalUnits .= ' - '.$unitToShow;
3881 3881
 					}
3882 3882
 					if (!empty($objp->volume) && $objp->volume_units !== null) {
3883 3883
 						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3884
-						$outvalUnits .= ' - ' . $unitToShow;
3884
+						$outvalUnits .= ' - '.$unitToShow;
3885 3885
 					}
3886 3886
 					if ($outdurationvalue && $outdurationunit) {
3887 3887
 						$da = array(
@@ -3892,22 +3892,22 @@  discard block
 block discarded – undo
3892 3892
 							'y' => $langs->trans('Year')
3893 3893
 						);
3894 3894
 						if (isset($da[$outdurationunit])) {
3895
-							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3895
+							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3896 3896
 						}
3897 3897
 					}
3898 3898
 				}
3899 3899
 
3900 3900
 				$objRef = $objp->ref;
3901 3901
 				if ($filterkey && $filterkey != '') {
3902
-					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3902
+					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3903 3903
 				}
3904 3904
 				$objRefFourn = $objp->ref_fourn;
3905 3905
 				if ($filterkey && $filterkey != '') {
3906
-					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
3906
+					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1);
3907 3907
 				}
3908 3908
 				$label = $objp->label;
3909 3909
 				if ($filterkey && $filterkey != '') {
3910
-					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3910
+					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3911 3911
 				}
3912 3912
 
3913 3913
 				switch ($objp->fk_product_type) {
@@ -3930,21 +3930,21 @@  discard block
 block discarded – undo
3930 3930
 
3931 3931
 				$optlabel .= $objp->ref;
3932 3932
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3933
-					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
3933
+					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>';
3934 3934
 				}
3935 3935
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3936
-					$optlabel .= ' (' . $outbarcode . ')';
3936
+					$optlabel .= ' ('.$outbarcode.')';
3937 3937
 				}
3938
-				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3938
+				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3939 3939
 
3940 3940
 				$outvallabel = $objRef;
3941 3941
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3942
-					$outvallabel .= ' (' . $objRefFourn . ')';
3942
+					$outvallabel .= ' ('.$objRefFourn.')';
3943 3943
 				}
3944 3944
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3945
-					$outvallabel .= ' (' . $outbarcode . ')';
3945
+					$outvallabel .= ' ('.$outbarcode.')';
3946 3946
 				}
3947
-				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3947
+				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3948 3948
 
3949 3949
 				// Units
3950 3950
 				$optlabel .= $outvalUnits;
@@ -3961,7 +3961,7 @@  discard block
 block discarded – undo
3961 3961
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3962 3962
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3963 3963
 
3964
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3964
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3965 3965
 						$priceparser = new PriceParser($this->db);
3966 3966
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3967 3967
 						if ($price_result >= 0) {
@@ -3972,57 +3972,57 @@  discard block
 block discarded – undo
3972 3972
 						}
3973 3973
 					}
3974 3974
 					if ($objp->quantity == 1) {
3975
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3976
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
3975
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3976
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
3977 3977
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3978 3978
 						$outvallabel .= $langs->transnoentities("Unit");
3979 3979
 					} else {
3980
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3981
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3982
-						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3983
-						$outvallabel .= ' ' . $langs->transnoentities("Units");
3980
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3981
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3982
+						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3983
+						$outvallabel .= ' '.$langs->transnoentities("Units");
3984 3984
 					}
3985 3985
 
3986 3986
 					if ($objp->quantity > 1) {
3987
-						$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
3988
-						$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
3987
+						$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
3988
+						$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
3989 3989
 					}
3990 3990
 					if ($objp->remise_percent >= 1) {
3991
-						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3992
-						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3991
+						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3992
+						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3993 3993
 					}
3994 3994
 					if ($objp->duration) {
3995
-						$optlabel .= " - " . $objp->duration;
3996
-						$outvallabel .= " - " . $objp->duration;
3995
+						$optlabel .= " - ".$objp->duration;
3996
+						$outvallabel .= " - ".$objp->duration;
3997 3997
 					}
3998 3998
 					if (!$socid) {
3999
-						$optlabel .= " - " . dol_trunc($objp->name, 8);
4000
-						$outvallabel .= " - " . dol_trunc($objp->name, 8);
3999
+						$optlabel .= " - ".dol_trunc($objp->name, 8);
4000
+						$outvallabel .= " - ".dol_trunc($objp->name, 8);
4001 4001
 					}
4002 4002
 					if ($objp->supplier_reputation) {
4003 4003
 						//TODO dictionary
4004 4004
 						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
4005 4005
 
4006
-						$optlabel .= " - " . $reputations[$objp->supplier_reputation];
4007
-						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
4006
+						$optlabel .= " - ".$reputations[$objp->supplier_reputation];
4007
+						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];
4008 4008
 					}
4009 4009
 				} else {
4010
-					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
4011
-					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
4010
+					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
4011
+					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
4012 4012
 				}
4013 4013
 
4014 4014
 				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
4015 4015
 					$novirtualstock = ($showstockinlist == 2);
4016 4016
 
4017 4017
 					if ($user->hasRight('stock', 'lire')) {
4018
-						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
4018
+						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
4019 4019
 
4020 4020
 						if ($objp->stock > 0) {
4021 4021
 							$optlabel .= ' - <span class="product_line_stock_ok">';
4022 4022
 						} elseif ($objp->stock <= 0) {
4023 4023
 							$optlabel .= ' - <span class="product_line_stock_too_low">';
4024 4024
 						}
4025
-						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
4025
+						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
4026 4026
 						$optlabel .= '</span>';
4027 4027
 						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
4028 4028
 							$langs->load("stocks");
@@ -4032,9 +4032,9 @@  discard block
 block discarded – undo
4032 4032
 							$tmpproduct->load_virtual_stock();
4033 4033
 							$virtualstock = $tmpproduct->stock_theorique;
4034 4034
 
4035
-							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
4035
+							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
4036 4036
 
4037
-							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
4037
+							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
4038 4038
 							if ($virtualstock > 0) {
4039 4039
 								$optlabel .= '<span class="product_line_stock_ok">';
4040 4040
 							} elseif ($virtualstock <= 0) {
@@ -4048,7 +4048,7 @@  discard block
 block discarded – undo
4048 4048
 					}
4049 4049
 				}
4050 4050
 
4051
-				$optstart = '<option value="' . $outkey . '"';
4051
+				$optstart = '<option value="'.$outkey.'"';
4052 4052
 				if ($selected && $selected == $objp->idprodfournprice) {
4053 4053
 					$optstart .= ' selected';
4054 4054
 				}
@@ -4057,22 +4057,22 @@  discard block
 block discarded – undo
4057 4057
 				}
4058 4058
 
4059 4059
 				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
4060
-					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
4061
-					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
4062
-					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
4063
-					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
4064
-					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
4065
-					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
4066
-					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
4067
-					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
4068
-					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
4069
-					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
4060
+					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
4061
+					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
4062
+					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
4063
+					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
4064
+					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
4065
+					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
4066
+					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
4067
+					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
4068
+					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
4069
+					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';
4070 4070
 					if (isModEnabled('multicurrency')) {
4071
-						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
4072
-						$optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
4071
+						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';
4072
+						$optstart .= ' data-multicurrency-unitprice="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';
4073 4073
 					}
4074 4074
 				}
4075
-				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
4075
+				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
4076 4076
 
4077 4077
 				// set $parameters to call hook
4078 4078
 				$outarrayentry = array(
@@ -4081,9 +4081,9 @@  discard block
 block discarded – undo
4081 4081
 					'label' => $outvallabel,
4082 4082
 					'labelhtml' => $optlabel,
4083 4083
 					'qty' => $outqty,
4084
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty
4085
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4086
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4084
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4085
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4086
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4087 4087
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
4088 4088
 					'tva_tx' => price2num($objp->tva_tx),
4089 4089
 					'default_vat_code' => $objp->default_vat_code,
@@ -4113,18 +4113,18 @@  discard block
 block discarded – undo
4113 4113
 				// Add new entry
4114 4114
 				// "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
4115 4115
 				// "label" value of json key array is used by jQuery automatically as text for combo box
4116
-				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
4116
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
4117 4117
 				$outarraypush = array(
4118 4118
 					'key' => $outkey,
4119 4119
 					'value' => $outref,
4120 4120
 					'label' => $outvallabel,
4121 4121
 					'labelhtml' => $optlabel,
4122 4122
 					'qty' => $outqty,
4123
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty
4123
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4124 4124
 					'price_qty_ht_locale' => price($objp->fprice),
4125
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4125
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4126 4126
 					'price_unit_ht_locale' => price($objp->unitprice),
4127
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4127
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4128 4128
 					'tva_tx_formated' => price($objp->tva_tx),
4129 4129
 					'tva_tx' => price2num($objp->tva_tx),
4130 4130
 					'default_vat_code' => $objp->default_vat_code,
@@ -4157,7 +4157,7 @@  discard block
 block discarded – undo
4157 4157
 
4158 4158
 			$this->db->free($result);
4159 4159
 
4160
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
4160
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
4161 4161
 			$out .= ajax_combobox($htmlname);
4162 4162
 		} else {
4163 4163
 			dol_print_error($this->db);
@@ -4189,43 +4189,43 @@  discard block
 block discarded – undo
4189 4189
 		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
4190 4190
 		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
4191 4191
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
4192
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
4193
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4194
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
4195
-		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
4192
+		$sql .= " FROM ".$this->db->prefix()."product as p";
4193
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4194
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
4195
+		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
4196 4196
 		$sql .= " AND p.tobuy = 1";
4197 4197
 		$sql .= " AND s.fournisseur = 1";
4198
-		$sql .= " AND p.rowid = " . ((int) $productid);
4198
+		$sql .= " AND p.rowid = ".((int) $productid);
4199 4199
 		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) {
4200 4200
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
4201 4201
 		} else {
4202 4202
 			$sql .= " ORDER BY pfp.unitprice ASC";
4203 4203
 		}
4204 4204
 
4205
-		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
4205
+		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
4206 4206
 		$result = $this->db->query($sql);
4207 4207
 
4208 4208
 		if ($result) {
4209 4209
 			$num = $this->db->num_rows($result);
4210 4210
 
4211
-			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4211
+			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4212 4212
 
4213 4213
 			if (!$num) {
4214
-				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
4214
+				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
4215 4215
 			} else {
4216
-				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4216
+				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4217 4217
 				$form .= '<option value="0">&nbsp;</option>';
4218 4218
 
4219 4219
 				$i = 0;
4220 4220
 				while ($i < $num) {
4221 4221
 					$objp = $this->db->fetch_object($result);
4222 4222
 
4223
-					$opt = '<option value="' . $objp->idprodfournprice . '"';
4223
+					$opt = '<option value="'.$objp->idprodfournprice.'"';
4224 4224
 					//if there is only one supplier, preselect it
4225 4225
 					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) {
4226 4226
 						$opt .= ' selected';
4227 4227
 					}
4228
-					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
4228
+					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
4229 4229
 
4230 4230
 					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) {
4231 4231
 						$prod_supplier = new ProductFournisseur($this->db);
@@ -4235,7 +4235,7 @@  discard block
 block discarded – undo
4235 4235
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
4236 4236
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
4237 4237
 
4238
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4238
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4239 4239
 						$priceparser = new PriceParser($this->db);
4240 4240
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
4241 4241
 						if ($price_result >= 0) {
@@ -4246,10 +4246,10 @@  discard block
 block discarded – undo
4246 4246
 						}
4247 4247
 					}
4248 4248
 					if ($objp->quantity == 1) {
4249
-						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
4249
+						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
4250 4250
 					}
4251 4251
 
4252
-					$opt .= $objp->quantity . ' ';
4252
+					$opt .= $objp->quantity.' ';
4253 4253
 
4254 4254
 					if ($objp->quantity == 1) {
4255 4255
 						$opt .= $langs->trans("Unit");
@@ -4258,10 +4258,10 @@  discard block
 block discarded – undo
4258 4258
 					}
4259 4259
 					if ($objp->quantity > 1) {
4260 4260
 						$opt .= " - ";
4261
-						$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");
4261
+						$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");
4262 4262
 					}
4263 4263
 					if ($objp->duration) {
4264
-						$opt .= " - " . $objp->duration;
4264
+						$opt .= " - ".$objp->duration;
4265 4265
 					}
4266 4266
 					$opt .= "</option>\n";
4267 4267
 
@@ -4299,8 +4299,8 @@  discard block
 block discarded – undo
4299 4299
 		dol_syslog(__METHOD__, LOG_DEBUG);
4300 4300
 
4301 4301
 		$sql = "SELECT rowid, code, libelle as label, deposit_percent";
4302
-		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
4303
-		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
4302
+		$sql .= " FROM ".$this->db->prefix().'c_payment_term';
4303
+		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
4304 4304
 		$sql .= " AND active > 0";
4305 4305
 		$sql .= " ORDER BY sortorder";
4306 4306
 
@@ -4312,7 +4312,7 @@  discard block
 block discarded – undo
4312 4312
 				$obj = $this->db->fetch_object($resql);
4313 4313
 
4314 4314
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4315
-				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4315
+				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4316 4316
 				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
4317 4317
 				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
4318 4318
 				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -4340,7 +4340,7 @@  discard block
 block discarded – undo
4340 4340
 		// phpcs:enable
4341 4341
 		global $langs;
4342 4342
 
4343
-		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4343
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4344 4344
 		if ($num > 0) {
4345 4345
 			return 0; // Cache already loaded
4346 4346
 		}
@@ -4350,7 +4350,7 @@  discard block
 block discarded – undo
4350 4350
 		$langs->load('propal');
4351 4351
 
4352 4352
 		$sql = "SELECT rowid, code, label, position";
4353
-		$sql .= " FROM " . $this->db->prefix() . 'c_availability';
4353
+		$sql .= " FROM ".$this->db->prefix().'c_availability';
4354 4354
 		$sql .= " WHERE active > 0";
4355 4355
 
4356 4356
 		$resql = $this->db->query($sql);
@@ -4361,7 +4361,7 @@  discard block
 block discarded – undo
4361 4361
 				$obj = $this->db->fetch_object($resql);
4362 4362
 
4363 4363
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4364
-				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4364
+				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4365 4365
 				$this->cache_availability[$obj->rowid]['code'] = $obj->code;
4366 4366
 				$this->cache_availability[$obj->rowid]['label'] = $label;
4367 4367
 				$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -4393,17 +4393,17 @@  discard block
 block discarded – undo
4393 4393
 
4394 4394
 		$this->load_cache_availability();
4395 4395
 
4396
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4396
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4397 4397
 
4398
-		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4398
+		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4399 4399
 		if ($addempty) {
4400 4400
 			print '<option value="0">&nbsp;</option>';
4401 4401
 		}
4402 4402
 		foreach ($this->cache_availability as $id => $arrayavailability) {
4403 4403
 			if ($selected == $id) {
4404
-				print '<option value="' . $id . '" selected>';
4404
+				print '<option value="'.$id.'" selected>';
4405 4405
 			} else {
4406
-				print '<option value="' . $id . '">';
4406
+				print '<option value="'.$id.'">';
4407 4407
 			}
4408 4408
 			print dol_escape_htmltag($arrayavailability['label']);
4409 4409
 			print '</option>';
@@ -4424,13 +4424,13 @@  discard block
 block discarded – undo
4424 4424
 	{
4425 4425
 		global $langs;
4426 4426
 
4427
-		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4427
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4428 4428
 		if ($num > 0) {
4429 4429
 			return 0; // Cache already loaded
4430 4430
 		}
4431 4431
 
4432 4432
 		$sql = "SELECT rowid, code, label";
4433
-		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
4433
+		$sql .= " FROM ".$this->db->prefix().'c_input_reason';
4434 4434
 		$sql .= " WHERE active > 0";
4435 4435
 
4436 4436
 		$resql = $this->db->query($sql);
@@ -4443,8 +4443,8 @@  discard block
 block discarded – undo
4443 4443
 
4444 4444
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4445 4445
 				$label = ($obj->label != '-' ? $obj->label : '');
4446
-				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) {
4447
-					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4446
+				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) {
4447
+					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4448 4448
 				}
4449 4449
 				if ($langs->trans($obj->code) != $obj->code) {
4450 4450
 					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
@@ -4484,9 +4484,9 @@  discard block
 block discarded – undo
4484 4484
 
4485 4485
 		$this->loadCacheInputReason();
4486 4486
 
4487
-		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4487
+		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4488 4488
 		if ($addempty) {
4489
-			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
4489
+			print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
4490 4490
 		}
4491 4491
 		foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
4492 4492
 			if ($arraydemandreason['code'] == $exclude) {
@@ -4494,9 +4494,9 @@  discard block
 block discarded – undo
4494 4494
 			}
4495 4495
 
4496 4496
 			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
4497
-				print '<option value="' . $arraydemandreason['id'] . '" selected>';
4497
+				print '<option value="'.$arraydemandreason['id'].'" selected>';
4498 4498
 			} else {
4499
-				print '<option value="' . $arraydemandreason['id'] . '">';
4499
+				print '<option value="'.$arraydemandreason['id'].'">';
4500 4500
 			}
4501 4501
 			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
4502 4502
 			print $langs->trans($label);
@@ -4506,7 +4506,7 @@  discard block
 block discarded – undo
4506 4506
 		if ($user->admin && empty($notooltip)) {
4507 4507
 			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4508 4508
 		}
4509
-		print ajax_combobox('select_' . $htmlname);
4509
+		print ajax_combobox('select_'.$htmlname);
4510 4510
 	}
4511 4511
 
4512 4512
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -4521,7 +4521,7 @@  discard block
 block discarded – undo
4521 4521
 		// phpcs:enable
4522 4522
 		global $langs;
4523 4523
 
4524
-		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4524
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4525 4525
 		if ($num > 0) {
4526 4526
 			return $num; // Cache already loaded
4527 4527
 		}
@@ -4531,8 +4531,8 @@  discard block
 block discarded – undo
4531 4531
 		$this->cache_types_paiements = array();
4532 4532
 
4533 4533
 		$sql = "SELECT id, code, libelle as label, type, active";
4534
-		$sql .= " FROM " . $this->db->prefix() . "c_paiement";
4535
-		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
4534
+		$sql .= " FROM ".$this->db->prefix()."c_paiement";
4535
+		$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
4536 4536
 
4537 4537
 		$resql = $this->db->query($sql);
4538 4538
 		if ($resql) {
@@ -4542,7 +4542,7 @@  discard block
 block discarded – undo
4542 4542
 				$obj = $this->db->fetch_object($resql);
4543 4543
 
4544 4544
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4545
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4545
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4546 4546
 				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;
4547 4547
 				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;
4548 4548
 				$this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -4614,17 +4614,17 @@  discard block
 block discarded – undo
4614 4614
 		global $langs, $user, $conf;
4615 4615
 
4616 4616
 		$out = '';
4617
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4617
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4618 4618
 
4619 4619
 		$this->load_cache_conditions_paiements();
4620 4620
 
4621 4621
 		// Set default value if not already set by caller
4622 4622
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
4623
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4623
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4624 4624
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
4625 4625
 		}
4626 4626
 
4627
-		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4627
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4628 4628
 		if ($addempty) {
4629 4629
 			$out .= '<option value="0">&nbsp;</option>';
4630 4630
 		}
@@ -4638,9 +4638,9 @@  discard block
 block discarded – undo
4638 4638
 
4639 4639
 			if ($selected == $id) {
4640 4640
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4641
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4641
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4642 4642
 			} else {
4643
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4643
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4644 4644
 			}
4645 4645
 			$label = $arrayconditions['label'];
4646 4646
 
@@ -4658,21 +4658,21 @@  discard block
 block discarded – undo
4658 4658
 		$out .= ajax_combobox($htmlname);
4659 4659
 
4660 4660
 		if ($deposit_percent >= 0) {
4661
-			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4662
-			$out .= $langs->trans('DepositPercent') . ' : ';
4663
-			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';
4661
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4662
+			$out .= $langs->trans('DepositPercent').' : ';
4663
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';
4664 4664
 			$out .= '</span>';
4665 4665
 			$out .= '
4666
-				<script nonce="' . getNonce() . '">
4666
+				<script nonce="' . getNonce().'">
4667 4667
 					$(document).ready(function () {
4668
-						$("#' . $htmlname . '").change(function () {
4668
+						$("#' . $htmlname.'").change(function () {
4669 4669
 							let $selected = $(this).find("option:selected");
4670 4670
 							let depositPercent = $selected.attr("data-deposit_percent");
4671 4671
 
4672 4672
 							if (depositPercent.length > 0) {
4673
-								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
4673
+								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent);
4674 4674
 							} else {
4675
-								$("#' . $htmlname . '_deposit_percent_container").hide();
4675
+								$("#' . $htmlname.'_deposit_percent_container").hide();
4676 4676
 							}
4677 4677
 
4678 4678
 							return true;
@@ -4710,7 +4710,7 @@  discard block
 block discarded – undo
4710 4710
 
4711 4711
 		$out = '';
4712 4712
 
4713
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
4713
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
4714 4714
 
4715 4715
 		$filterarray = array();
4716 4716
 		if ($filtertype == 'CRDT') {
@@ -4725,11 +4725,11 @@  discard block
 block discarded – undo
4725 4725
 
4726 4726
 		// Set default value if not already set by caller
4727 4727
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) {
4728
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4728
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4729 4729
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID');
4730 4730
 		}
4731 4731
 
4732
-		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4732
+		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4733 4733
 		if ($empty) {
4734 4734
 			$out .= '<option value="">&nbsp;</option>';
4735 4735
 		}
@@ -4750,13 +4750,13 @@  discard block
 block discarded – undo
4750 4750
 			}
4751 4751
 
4752 4752
 			if ($format == 0) {
4753
-				$out .= '<option value="' . $id . '" data-code="'.$arraytypes['code'].'"';
4753
+				$out .= '<option value="'.$id.'" data-code="'.$arraytypes['code'].'"';
4754 4754
 			} elseif ($format == 1) {
4755
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4755
+				$out .= '<option value="'.$arraytypes['code'].'"';
4756 4756
 			} elseif ($format == 2) {
4757
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4757
+				$out .= '<option value="'.$arraytypes['code'].'"';
4758 4758
 			} elseif ($format == 3) {
4759
-				$out .= '<option value="' . $id . '"';
4759
+				$out .= '<option value="'.$id.'"';
4760 4760
 			}
4761 4761
 			// Print attribute selected or not
4762 4762
 			if ($format == 1 || $format == 2) {
@@ -4786,7 +4786,7 @@  discard block
 block discarded – undo
4786 4786
 		if ($user->admin && !$noadmininfo) {
4787 4787
 			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4788 4788
 		}
4789
-		$out .= ajax_combobox('select' . $htmlname);
4789
+		$out .= ajax_combobox('select'.$htmlname);
4790 4790
 
4791 4791
 		if (empty($nooutput)) {
4792 4792
 			print $out;
@@ -4808,22 +4808,22 @@  discard block
 block discarded – undo
4808 4808
 	{
4809 4809
 		global $langs;
4810 4810
 
4811
-		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4811
+		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4812 4812
 		$options = array(
4813 4813
 			'HT' => $langs->trans("HT"),
4814 4814
 			'TTC' => $langs->trans("TTC")
4815 4815
 		);
4816 4816
 		foreach ($options as $id => $value) {
4817 4817
 			if ($selected == $id) {
4818
-				$return .= '<option value="' . $id . '" selected>' . $value;
4818
+				$return .= '<option value="'.$id.'" selected>'.$value;
4819 4819
 			} else {
4820
-				$return .= '<option value="' . $id . '">' . $value;
4820
+				$return .= '<option value="'.$id.'">'.$value;
4821 4821
 			}
4822 4822
 			$return .= '</option>';
4823 4823
 		}
4824 4824
 		$return .= '</select>';
4825 4825
 		if ($addjscombo) {
4826
-			$return .= ajax_combobox('select_' . $htmlname);
4826
+			$return .= ajax_combobox('select_'.$htmlname);
4827 4827
 		}
4828 4828
 
4829 4829
 		return $return;
@@ -4841,7 +4841,7 @@  discard block
 block discarded – undo
4841 4841
 		// phpcs:enable
4842 4842
 		global $langs;
4843 4843
 
4844
-		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4844
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4845 4845
 		if ($num > 0) {
4846 4846
 			return $num; // Cache already loaded
4847 4847
 		}
@@ -4851,8 +4851,8 @@  discard block
 block discarded – undo
4851 4851
 		$this->cache_transport_mode = array();
4852 4852
 
4853 4853
 		$sql = "SELECT rowid, code, label, active";
4854
-		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";
4855
-		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")";
4854
+		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
4855
+		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
4856 4856
 
4857 4857
 		$resql = $this->db->query($sql);
4858 4858
 		if ($resql) {
@@ -4862,7 +4862,7 @@  discard block
 block discarded – undo
4862 4862
 				$obj = $this->db->fetch_object($resql);
4863 4863
 
4864 4864
 				// If traduction exist, we use it else we take the default label
4865
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4865
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4866 4866
 				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
4867 4867
 				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
4868 4868
 				$this->cache_transport_mode[$obj->rowid]['label'] = $label;
@@ -4896,11 +4896,11 @@  discard block
 block discarded – undo
4896 4896
 	{
4897 4897
 		global $langs, $user;
4898 4898
 
4899
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);
4899
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
4900 4900
 
4901 4901
 		$this->load_cache_transport_mode();
4902 4902
 
4903
-		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4903
+		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4904 4904
 		if ($empty) {
4905 4905
 			print '<option value="">&nbsp;</option>';
4906 4906
 		}
@@ -4916,13 +4916,13 @@  discard block
 block discarded – undo
4916 4916
 			}
4917 4917
 
4918 4918
 			if ($format == 0) {
4919
-				print '<option value="' . $id . '"';
4919
+				print '<option value="'.$id.'"';
4920 4920
 			} elseif ($format == 1) {
4921
-				print '<option value="' . $arraytypes['code'] . '"';
4921
+				print '<option value="'.$arraytypes['code'].'"';
4922 4922
 			} elseif ($format == 2) {
4923
-				print '<option value="' . $arraytypes['code'] . '"';
4923
+				print '<option value="'.$arraytypes['code'].'"';
4924 4924
 			} elseif ($format == 3) {
4925
-				print '<option value="' . $id . '"';
4925
+				print '<option value="'.$id.'"';
4926 4926
 			}
4927 4927
 			// If text is selected, we compare with code, else with id
4928 4928
 			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
@@ -4973,31 +4973,31 @@  discard block
 block discarded – undo
4973 4973
 		$langs->load("deliveries");
4974 4974
 
4975 4975
 		$sql = "SELECT rowid, code, libelle as label";
4976
-		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";
4976
+		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
4977 4977
 		$sql .= " WHERE active > 0";
4978 4978
 		if ($filtre) {
4979
-			$sql .= " AND " . $filtre;
4979
+			$sql .= " AND ".$filtre;
4980 4980
 		}
4981 4981
 		$sql .= " ORDER BY libelle ASC";
4982 4982
 
4983
-		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
4983
+		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
4984 4984
 		$result = $this->db->query($sql);
4985 4985
 		if ($result) {
4986 4986
 			$num = $this->db->num_rows($result);
4987 4987
 			$i = 0;
4988 4988
 			if ($num) {
4989
-				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4989
+				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4990 4990
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4991 4991
 					print '<option value="-1">&nbsp;</option>';
4992 4992
 				}
4993 4993
 				while ($i < $num) {
4994 4994
 					$obj = $this->db->fetch_object($result);
4995 4995
 					if ($selected == $obj->rowid) {
4996
-						print '<option value="' . $obj->rowid . '" selected>';
4996
+						print '<option value="'.$obj->rowid.'" selected>';
4997 4997
 					} else {
4998
-						print '<option value="' . $obj->rowid . '">';
4998
+						print '<option value="'.$obj->rowid.'">';
4999 4999
 					}
5000
-					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
5000
+					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
5001 5001
 					print '</option>';
5002 5002
 					$i++;
5003 5003
 				}
@@ -5006,7 +5006,7 @@  discard block
 block discarded – undo
5006 5006
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
5007 5007
 				}
5008 5008
 
5009
-				print ajax_combobox('select' . $htmlname);
5009
+				print ajax_combobox('select'.$htmlname);
5010 5010
 			} else {
5011 5011
 				print $langs->trans("NoShippingMethodDefined");
5012 5012
 			}
@@ -5031,16 +5031,16 @@  discard block
 block discarded – undo
5031 5031
 		$langs->load("deliveries");
5032 5032
 
5033 5033
 		if ($htmlname != "none") {
5034
-			print '<form method="POST" action="' . $page . '">';
5034
+			print '<form method="POST" action="'.$page.'">';
5035 5035
 			print '<input type="hidden" name="action" value="setshippingmethod">';
5036
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5036
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5037 5037
 			$this->selectShippingMethod($selected, $htmlname, '', $addempty);
5038
-			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
5038
+			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
5039 5039
 			print '</form>';
5040 5040
 		} else {
5041 5041
 			if ($selected) {
5042 5042
 				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
5043
-				print $langs->trans("SendingMethod" . strtoupper($code));
5043
+				print $langs->trans("SendingMethod".strtoupper($code));
5044 5044
 			} else {
5045 5045
 				print "&nbsp;";
5046 5046
 			}
@@ -5063,10 +5063,10 @@  discard block
 block discarded – undo
5063 5063
 
5064 5064
 		$opt = '<option value="" selected></option>';
5065 5065
 		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
5066
-		$sql .= ' FROM ' . $this->db->prefix() . 'facture';
5067
-		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
5066
+		$sql .= ' FROM '.$this->db->prefix().'facture';
5067
+		$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
5068 5068
 		$sql .= ' AND situation_counter >= 1';
5069
-		$sql .= ' AND fk_soc = ' . (int) $socid;
5069
+		$sql .= ' AND fk_soc = '.(int) $socid;
5070 5070
 		$sql .= ' AND type <> 2';
5071 5071
 		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
5072 5072
 		$resql = $this->db->query($sql);
@@ -5084,19 +5084,19 @@  discard block
 block discarded – undo
5084 5084
 						//Not prov?
5085 5085
 						if (substr($obj->ref, 1, 4) != 'PROV') {
5086 5086
 							if ($selected == $obj->rowid) {
5087
-								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
5087
+								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
5088 5088
 							} else {
5089
-								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
5089
+								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
5090 5090
 							}
5091 5091
 						}
5092 5092
 					}
5093 5093
 				}
5094 5094
 			}
5095 5095
 		} else {
5096
-			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
5096
+			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
5097 5097
 		}
5098 5098
 		if ($opt == '<option value ="" selected></option>') {
5099
-			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
5099
+			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
5100 5100
 		}
5101 5101
 		return $opt;
5102 5102
 	}
@@ -5116,12 +5116,12 @@  discard block
 block discarded – undo
5116 5116
 
5117 5117
 		$langs->load('products');
5118 5118
 
5119
-		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
5119
+		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
5120 5120
 
5121
-		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";
5121
+		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
5122 5122
 		$sql .= ' WHERE active > 0';
5123 5123
 		if (!empty($unit_type)) {
5124
-			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";
5124
+			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
5125 5125
 		}
5126 5126
 		$sql .= " ORDER BY sortorder";
5127 5127
 
@@ -5133,14 +5133,14 @@  discard block
 block discarded – undo
5133 5133
 
5134 5134
 			while ($res = $this->db->fetch_object($resql)) {
5135 5135
 				$unitLabel = $res->label;
5136
-				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before
5137
-					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
5136
+				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before
5137
+					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
5138 5138
 				}
5139 5139
 
5140 5140
 				if ($selected == $res->rowid) {
5141
-					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
5141
+					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
5142 5142
 				} else {
5143
-					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
5143
+					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
5144 5144
 				}
5145 5145
 			}
5146 5146
 			$return .= '</select>';
@@ -5175,29 +5175,29 @@  discard block
 block discarded – undo
5175 5175
 		$num = 0;
5176 5176
 
5177 5177
 		$sql = "SELECT rowid, label, bank, clos as status, currency_code";
5178
-		$sql .= " FROM " . $this->db->prefix() . "bank_account";
5179
-		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
5178
+		$sql .= " FROM ".$this->db->prefix()."bank_account";
5179
+		$sql .= " WHERE entity IN (".getEntity('bank_account').")";
5180 5180
 		if ($status != 2) {
5181
-			$sql .= " AND clos = " . (int) $status;
5181
+			$sql .= " AND clos = ".(int) $status;
5182 5182
 		}
5183 5183
 		if ($filtre) {	// TODO Support USF
5184
-			$sql .= " AND " . $filtre;
5184
+			$sql .= " AND ".$filtre;
5185 5185
 		}
5186 5186
 		$sql .= " ORDER BY label";
5187 5187
 
5188
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5188
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5189 5189
 		$result = $this->db->query($sql);
5190 5190
 		if ($result) {
5191 5191
 			$num = $this->db->num_rows($result);
5192 5192
 			$i = 0;
5193 5193
 
5194
-			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5194
+			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5195 5195
 
5196 5196
 			if ($num == 0) {
5197 5197
 				if ($status == 0) {
5198
-					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
5198
+					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
5199 5199
 				} else {
5200
-					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountDefined") . '</span>';
5200
+					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountDefined").'</span>';
5201 5201
 				}
5202 5202
 			} else {
5203 5203
 				if (!empty($useempty) && !is_numeric($useempty)) {
@@ -5213,25 +5213,25 @@  discard block
 block discarded – undo
5213 5213
 				$labeltoshow = trim($obj->label);
5214 5214
 				$labeltoshowhtml = trim($obj->label);
5215 5215
 				if ($showcurrency) {
5216
-					$labeltoshow .= ' (' . $obj->currency_code . ')';
5217
-					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $obj->currency_code . ')</span>';
5216
+					$labeltoshow .= ' ('.$obj->currency_code.')';
5217
+					$labeltoshowhtml .= ' <span class="opacitymedium">('.$obj->currency_code.')</span>';
5218 5218
 				}
5219 5219
 				if ($status == 2 && $obj->status == 1) {
5220
-					$labeltoshow .= ' (' . $langs->trans("Closed") . ')';
5221
-					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $langs->trans("Closed") . ')</span>';
5220
+					$labeltoshow .= ' ('.$langs->trans("Closed").')';
5221
+					$labeltoshowhtml .= ' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
5222 5222
 				}
5223 5223
 
5224 5224
 				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5225
-					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>';
5225
+					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>';
5226 5226
 				} else {
5227
-					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">';
5227
+					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">';
5228 5228
 				}
5229 5229
 				$out .= $labeltoshow;
5230 5230
 				$out .= '</option>';
5231 5231
 				$i++;
5232 5232
 			}
5233 5233
 			$out .= "</select>";
5234
-			$out .= ajax_combobox('select' . $htmlname);
5234
+			$out .= ajax_combobox('select'.$htmlname);
5235 5235
 		} else {
5236 5236
 			dol_print_error($this->db);
5237 5237
 		}
@@ -5270,22 +5270,22 @@  discard block
 block discarded – undo
5270 5270
 		$num = 0;
5271 5271
 
5272 5272
 		$sql = "SELECT rowid, label, bank, status, iban_prefix, bic";
5273
-		$sql .= " FROM " . $this->db->prefix() . "societe_rib";
5274
-		$sql.=  " WHERE type = 'ban'";
5273
+		$sql .= " FROM ".$this->db->prefix()."societe_rib";
5274
+		$sql .= " WHERE type = 'ban'";
5275 5275
 		if ($filtre) {	// TODO Support USF
5276
-			$sql .= " AND " . $filtre;
5276
+			$sql .= " AND ".$filtre;
5277 5277
 		}
5278 5278
 		$sql .= " ORDER BY label";
5279
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5279
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5280 5280
 		$result = $this->db->query($sql);
5281 5281
 		if ($result) {
5282 5282
 			$num = $this->db->num_rows($result);
5283 5283
 			$i = 0;
5284 5284
 
5285
-			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5285
+			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5286 5286
 
5287 5287
 			if ($num == 0) {
5288
-				$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountDefined") . '</span>';
5288
+				$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountDefined").'</span>';
5289 5289
 			} else {
5290 5290
 				if (!empty($useempty) && !is_numeric($useempty)) {
5291 5291
 					$out .= '<option value="-1">'.$langs->trans($useempty).'</option>';
@@ -5298,19 +5298,19 @@  discard block
 block discarded – undo
5298 5298
 				$obj = $this->db->fetch_object($result);
5299 5299
 				$iban = dolDecrypt($obj->iban_prefix);
5300 5300
 				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5301
-					$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '" selected>';
5301
+					$out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'" selected>';
5302 5302
 				} else {
5303
-					$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '">';
5303
+					$out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'">';
5304 5304
 				}
5305 5305
 				$out .= trim($obj->label);
5306 5306
 				if ($showibanbic) {
5307
-					$out .= ' (' . $iban . '/' .$obj->bic. ')';
5307
+					$out .= ' ('.$iban.'/'.$obj->bic.')';
5308 5308
 				}
5309 5309
 				$out .= '</option>';
5310 5310
 				$i++;
5311 5311
 			}
5312 5312
 			$out .= "</select>";
5313
-			$out .= ajax_combobox('select' . $htmlname);
5313
+			$out .= ajax_combobox('select'.$htmlname);
5314 5314
 		} else {
5315 5315
 			dol_print_error($this->db);
5316 5316
 		}
@@ -5344,23 +5344,23 @@  discard block
 block discarded – undo
5344 5344
 		$num = 0;
5345 5345
 
5346 5346
 		$sql = "SELECT rowid, name, fk_country, status, entity";
5347
-		$sql .= " FROM " . $this->db->prefix() . "establishment";
5347
+		$sql .= " FROM ".$this->db->prefix()."establishment";
5348 5348
 		$sql .= " WHERE 1=1";
5349 5349
 		if ($status != 2) {
5350
-			$sql .= " AND status = " . (int) $status;
5350
+			$sql .= " AND status = ".(int) $status;
5351 5351
 		}
5352 5352
 		if ($filtre) {	// TODO Support USF
5353
-			$sql .= " AND " . $filtre;
5353
+			$sql .= " AND ".$filtre;
5354 5354
 		}
5355 5355
 		$sql .= " ORDER BY name";
5356 5356
 
5357
-		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);
5357
+		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
5358 5358
 		$result = $this->db->query($sql);
5359 5359
 		if ($result) {
5360 5360
 			$num = $this->db->num_rows($result);
5361 5361
 			$i = 0;
5362 5362
 			if ($num) {
5363
-				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5363
+				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5364 5364
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5365 5365
 					print '<option value="-1">&nbsp;</option>';
5366 5366
 				}
@@ -5368,13 +5368,13 @@  discard block
 block discarded – undo
5368 5368
 				while ($i < $num) {
5369 5369
 					$obj = $this->db->fetch_object($result);
5370 5370
 					if ($selected == $obj->rowid) {
5371
-						print '<option value="' . $obj->rowid . '" selected>';
5371
+						print '<option value="'.$obj->rowid.'" selected>';
5372 5372
 					} else {
5373
-						print '<option value="' . $obj->rowid . '">';
5373
+						print '<option value="'.$obj->rowid.'">';
5374 5374
 					}
5375 5375
 					print trim($obj->name);
5376 5376
 					if ($status == 2 && $obj->status == 1) {
5377
-						print ' (' . $langs->trans("Closed") . ')';
5377
+						print ' ('.$langs->trans("Closed").')';
5378 5378
 					}
5379 5379
 					print '</option>';
5380 5380
 					$i++;
@@ -5382,9 +5382,9 @@  discard block
 block discarded – undo
5382 5382
 				print "</select>";
5383 5383
 			} else {
5384 5384
 				if ($status == 0) {
5385
-					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>';
5385
+					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
5386 5386
 				} else {
5387
-					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>';
5387
+					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
5388 5388
 				}
5389 5389
 			}
5390 5390
 
@@ -5408,20 +5408,20 @@  discard block
 block discarded – undo
5408 5408
 	{
5409 5409
 		global $langs;
5410 5410
 		if ($htmlname != "none") {
5411
-			print '<form method="POST" action="' . $page . '">';
5411
+			print '<form method="POST" action="'.$page.'">';
5412 5412
 			print '<input type="hidden" name="action" value="setbankaccount">';
5413
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5413
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5414 5414
 			print img_picto('', 'bank_account', 'class="pictofixedwidth"');
5415 5415
 			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
5416 5416
 			if ($nbaccountfound > 0) {
5417
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5417
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5418 5418
 			}
5419 5419
 			print '</form>';
5420 5420
 		} else {
5421 5421
 			$langs->load('banks');
5422 5422
 
5423 5423
 			if ($selected) {
5424
-				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
5424
+				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
5425 5425
 				$bankstatic = new Account($this->db);
5426 5426
 				$result = $bankstatic->fetch($selected);
5427 5427
 				if ($result) {
@@ -5448,24 +5448,24 @@  discard block
 block discarded – undo
5448 5448
 	{
5449 5449
 		global $langs;
5450 5450
 		if ($htmlname != "none") {
5451
-			print '<form method="POST" action="' . $page . '">';
5451
+			print '<form method="POST" action="'.$page.'">';
5452 5452
 			print '<input type="hidden" name="action" value="setbankaccountcustomer">';
5453
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5453
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5454 5454
 			$nbaccountfound = $this->selectRib($selected, $htmlname, $filtre, $addempty, '', $showibanbic);
5455 5455
 			if ($nbaccountfound > 0) {
5456
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5456
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5457 5457
 			}
5458 5458
 			print '</form>';
5459 5459
 		} else {
5460 5460
 			$langs->load('banks');
5461 5461
 
5462 5462
 			if ($selected) {
5463
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
5463
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
5464 5464
 				$bankstatic = new CompanyBankAccount($this->db);
5465 5465
 				$result = $bankstatic->fetch($selected);
5466 5466
 				if ($result) {
5467 5467
 					print $bankstatic->label;
5468
-					if ($showibanbic) print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')';
5468
+					if ($showibanbic) print ' ('.$bankstatic->iban.'/'.$bankstatic->bic.')';
5469 5469
 				}
5470 5470
 			} else {
5471 5471
 				print "&nbsp;";
@@ -5500,11 +5500,11 @@  discard block
 block discarded – undo
5500 5500
 		global $conf, $langs;
5501 5501
 		$langs->load("categories");
5502 5502
 
5503
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5503
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5504 5504
 
5505 5505
 		// For backward compatibility
5506 5506
 		if (is_numeric($type)) {
5507
-			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5507
+			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5508 5508
 		}
5509 5509
 
5510 5510
 		if ($type === Categorie::TYPE_BANK_LINE) {
@@ -5512,8 +5512,8 @@  discard block
 block discarded – undo
5512 5512
 			$cat = new Categorie($this->db);
5513 5513
 			$cate_arbo = array();
5514 5514
 			$sql = "SELECT c.label, c.rowid";
5515
-			$sql .= " FROM " . $this->db->prefix() . "categorie as c";
5516
-			$sql .= " WHERE entity = " . $conf->entity . " AND type = " . ((int) $cat->getMapId()[$type]);
5515
+			$sql .= " FROM ".$this->db->prefix()."categorie as c";
5516
+			$sql .= " WHERE entity = ".$conf->entity." AND type = ".((int) $cat->getMapId()[$type]);
5517 5517
 			$sql .= " ORDER BY c.label";
5518 5518
 			$result = $this->db->query($sql);
5519 5519
 			if ($result) {
@@ -5539,12 +5539,12 @@  discard block
 block discarded – undo
5539 5539
 		$outarrayrichhtml = array();
5540 5540
 
5541 5541
 
5542
-		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
5542
+		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
5543 5543
 		if (is_array($cate_arbo)) {
5544 5544
 			$num = count($cate_arbo);
5545 5545
 
5546 5546
 			if (!$num) {
5547
-				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
5547
+				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
5548 5548
 			} else {
5549 5549
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5550 5550
 					$output .= '<option value="-1">&nbsp;</option>';
@@ -5556,15 +5556,15 @@  discard block
 block discarded – undo
5556 5556
 						$add = '';
5557 5557
 					}
5558 5558
 
5559
-					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"');
5559
+					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"');
5560 5560
 					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5561 5561
 
5562 5562
 					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
5563 5563
 
5564 5564
 					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;
5565 5565
 
5566
-					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';
5567
-					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';
5566
+					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
5567
+					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
5568 5568
 					$output .= '>';
5569 5569
 					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5570 5570
 					$output .= '</option>';
@@ -5610,7 +5610,7 @@  discard block
 block discarded – undo
5610 5610
 	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
5611 5611
 	{
5612 5612
 		// phpcs:enable
5613
-		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5613
+		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5614 5614
 		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
5615 5615
 	}
5616 5616
 
@@ -5645,7 +5645,7 @@  discard block
 block discarded – undo
5645 5645
 	{
5646 5646
 		global $langs, $conf;
5647 5647
 
5648
-		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';
5648
+		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';
5649 5649
 		$formconfirm = '';
5650 5650
 		$inputok = array();
5651 5651
 		$inputko = array();
@@ -5669,27 +5669,27 @@  discard block
 block discarded – undo
5669 5669
 			foreach ($formquestion as $key => $input) {
5670 5670
 				if (is_array($input) && !empty($input)) {
5671 5671
 					if ($input['type'] == 'hidden') {
5672
-						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5673
-						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5672
+						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5673
+						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5674 5674
 
5675
-						$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";
5675
+						$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";
5676 5676
 					}
5677 5677
 				}
5678 5678
 			}
5679 5679
 
5680 5680
 			// Now add questions
5681 5681
 			$moreonecolumn = '';
5682
-			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";
5682
+			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5683 5683
 			foreach ($formquestion as $key => $input) {
5684 5684
 				if (is_array($input) && !empty($input)) {
5685
-					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.
5686
-					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5687
-					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5685
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5686
+					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5687
+					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5688 5688
 
5689 5689
 					if ($input['type'] == 'text') {
5690
-						$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";
5690
+						$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";
5691 5691
 					} elseif ($input['type'] == 'password') {
5692
-						$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";
5692
+						$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";
5693 5693
 					} elseif ($input['type'] == 'textarea') {
5694 5694
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
5695 5695
 						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
@@ -5697,8 +5697,8 @@  discard block
 block discarded – undo
5697 5697
 						$more .= '</textarea>';
5698 5698
 						$more .= '</div></div>'."\n";*/
5699 5699
 						$moreonecolumn .= '<div class="margintoponly">';
5700
-						$moreonecolumn .= $input['label'] . '<br>';
5701
-						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';
5700
+						$moreonecolumn .= $input['label'].'<br>';
5701
+						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
5702 5702
 						$moreonecolumn .= $input['value'];
5703 5703
 						$moreonecolumn .= '</textarea>';
5704 5704
 						$moreonecolumn .= '</div>';
@@ -5715,20 +5715,20 @@  discard block
 block discarded – undo
5715 5715
 						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
5716 5716
 						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
5717 5717
 
5718
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">';
5718
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5719 5719
 						if (!empty($input['label'])) {
5720
-							$more .= $input['label'] . '</div><div class="tagtd left">';
5720
+							$more .= $input['label'].'</div><div class="tagtd left">';
5721 5721
 						}
5722 5722
 						if ($input['type'] == 'select') {
5723 5723
 							$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);
5724 5724
 						} else {
5725 5725
 							$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);
5726 5726
 						}
5727
-						$more .= '</div></div>' . "\n";
5727
+						$more .= '</div></div>'."\n";
5728 5728
 					} elseif ($input['type'] == 'checkbox') {
5729 5729
 						$more .= '<div class="tagtr">';
5730
-						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">';
5731
-						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;
5730
+						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
5731
+						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
5732 5732
 						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
5733 5733
 							$more .= ' checked';
5734 5734
 						}
@@ -5739,19 +5739,19 @@  discard block
 block discarded – undo
5739 5739
 							$more .= ' disabled';
5740 5740
 						}
5741 5741
 						$more .= ' /></div>';
5742
-						$more .= '</div>' . "\n";
5742
+						$more .= '</div>'."\n";
5743 5743
 					} elseif ($input['type'] == 'radio') {
5744 5744
 						$i = 0;
5745 5745
 						foreach ($input['values'] as $selkey => $selval) {
5746 5746
 							$more .= '<div class="tagtr">';
5747 5747
 							if (isset($input['label'])) {
5748 5748
 								if ($i == 0) {
5749
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5749
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
5750 5750
 								} else {
5751
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
5751
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
5752 5752
 								}
5753 5753
 							}
5754
-							$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;
5754
+							$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;
5755 5755
 							if (!empty($input['disabled'])) {
5756 5756
 								$more .= ' disabled';
5757 5757
 							}
@@ -5759,12 +5759,12 @@  discard block
 block discarded – undo
5759 5759
 								$more .= ' checked="checked"';
5760 5760
 							}
5761 5761
 							$more .= ' /> ';
5762
-							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';
5763
-							$more .= '</div></div>' . "\n";
5762
+							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
5763
+							$more .= '</div></div>'."\n";
5764 5764
 							$i++;
5765 5765
 						}
5766 5766
 					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') {
5767
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5767
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
5768 5768
 						$more .= '<div class="tagtd">';
5769 5769
 						$addnowlink = (empty($input['datenow']) ? 0 : 1);
5770 5770
 						$h = $m = 0;
@@ -5782,24 +5782,24 @@  discard block
 block discarded – undo
5782 5782
 					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
5783 5783
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5784 5784
 						if (!empty($input['label'])) {
5785
-							$more .= $input['label'] . '</div><div class="tagtd">';
5785
+							$more .= $input['label'].'</div><div class="tagtd">';
5786 5786
 						}
5787 5787
 						$more .= $input['value'];
5788
-						$more .= '</div></div>' . "\n";
5788
+						$more .= '</div></div>'."\n";
5789 5789
 					} elseif ($input['type'] == 'onecolumn') {
5790 5790
 						$moreonecolumn .= '<div class="margintoponly">';
5791 5791
 						$moreonecolumn .= $input['value'];
5792
-						$moreonecolumn .= '</div>' . "\n";
5792
+						$moreonecolumn .= '</div>'."\n";
5793 5793
 					} elseif ($input['type'] == 'hidden') {
5794 5794
 						// Do nothing more, already added by a previous loop
5795 5795
 					} elseif ($input['type'] == 'separator') {
5796 5796
 						$more .= '<br>';
5797 5797
 					} else {
5798
-						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';
5798
+						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
5799 5799
 					}
5800 5800
 				}
5801 5801
 			}
5802
-			$more .= '</div>' . "\n";
5802
+			$more .= '</div>'."\n";
5803 5803
 			$more .= $moreonecolumn;
5804 5804
 		}
5805 5805
 
@@ -5821,10 +5821,10 @@  discard block
 block discarded – undo
5821 5821
 				$button = $useajax;
5822 5822
 				$useajax = 1;
5823 5823
 				$autoOpen = false;
5824
-				$dialogconfirm .= '-' . $button;
5824
+				$dialogconfirm .= '-'.$button;
5825 5825
 			}
5826
-			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes';
5827
-			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : '');
5826
+			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes';
5827
+			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : '');
5828 5828
 
5829 5829
 			// Add input fields into list of fields to read during submit (inputok and inputko)
5830 5830
 			if (is_array($formquestion)) {
@@ -5847,24 +5847,24 @@  discard block
 block discarded – undo
5847 5847
 			}
5848 5848
 
5849 5849
 			// Show JQuery confirm box.
5850
-			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
5850
+			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
5851 5851
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5852
-				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";
5852
+				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
5853 5853
 			}
5854 5854
 			if (!empty($more)) {
5855
-				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";
5855
+				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";
5856 5856
 			}
5857
-			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');
5858
-			$formconfirm .= '</div>' . "\n";
5857
+			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');
5858
+			$formconfirm .= '</div>'."\n";
5859 5859
 
5860
-			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";
5861
-			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5860
+			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
5861
+			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5862 5862
 			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
5863 5863
 			$formconfirm .= 'jQuery(document).ready(function() {
5864 5864
             $(function() {
5865
-            	$( "#' . $dialogconfirm . '" ).dialog(
5865
+            	$( "#' . $dialogconfirm.'" ).dialog(
5866 5866
             	{
5867
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
5867
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
5868 5868
 			if ($newselectedchoice == 'no') {
5869 5869
 				$formconfirm .= '
5870 5870
 						open: function() {
@@ -5874,24 +5874,24 @@  discard block
 block discarded – undo
5874 5874
 
5875 5875
 			$jsforcursor = '';
5876 5876
 			if ($useajax == 1) {
5877
-				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";
5878
-				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n";
5877
+				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
5878
+				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
5879 5879
 			}
5880 5880
 
5881 5881
 			$postconfirmas = 'GET';
5882 5882
 
5883 5883
 			$formconfirm .= '
5884 5884
                     resizable: false,
5885
-                    height: "' . $height . '",
5886
-                    width: "' . $width . '",
5885
+                    height: "' . $height.'",
5886
+                    width: "' . $width.'",
5887 5887
                     modal: true,
5888 5888
                     closeOnEscape: false,
5889 5889
                     buttons: {
5890
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
5891
-							var options = "token=' . urlencode(newToken()) . '";
5892
-                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */
5893
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5894
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
5890
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
5891
+							var options = "token=' . urlencode(newToken()).'";
5892
+                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */
5893
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5894
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
5895 5895
 
5896 5896
                          	if (inputok.length > 0) {
5897 5897
                          		$.each(inputok, function(i, inputname) {
@@ -5925,11 +5925,11 @@  discard block
 block discarded – undo
5925 5925
 							}
5926 5926
 	                        $(this).dialog("close");
5927 5927
                         },
5928
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() {
5929
-                        	var options = "token=' . urlencode(newToken()) . '";
5930
-                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */
5931
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5932
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
5928
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
5929
+                        	var options = "token=' . urlencode(newToken()).'";
5930
+                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */
5931
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5932
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
5933 5933
                          	if (inputko.length > 0) {
5934 5934
                          		$.each(inputko, function(i, inputname) {
5935 5935
                          			var more = "";
@@ -5961,10 +5961,10 @@  discard block
 block discarded – undo
5961 5961
                 }
5962 5962
                 );
5963 5963
 
5964
-            	var button = "' . $button . '";
5964
+            	var button = "' . $button.'";
5965 5965
             	if (button.length > 0) {
5966 5966
                 	$( "#" + button ).click(function() {
5967
-                		$("#' . $dialogconfirm . '").dialog("open");
5967
+                		$("#' . $dialogconfirm.'").dialog("open");
5968 5968
         			});
5969 5969
                 }
5970 5970
             });
@@ -5972,44 +5972,44 @@  discard block
 block discarded – undo
5972 5972
             </script>';
5973 5973
 			$formconfirm .= "<!-- end ajax formconfirm -->\n";
5974 5974
 		} else {
5975
-			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";
5975
+			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";
5976 5976
 
5977 5977
 			if (empty($disableformtag)) {
5978
-				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftnoright">' . "\n";
5978
+				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftnoright">'."\n";
5979 5979
 			}
5980 5980
 
5981
-			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
5982
-			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";
5981
+			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
5982
+			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
5983 5983
 
5984
-			$formconfirm .= '<table class="valid centpercent">' . "\n";
5984
+			$formconfirm .= '<table class="valid centpercent">'."\n";
5985 5985
 
5986 5986
 			// Line title
5987 5987
 			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';
5988
-			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title;
5989
-			$formconfirm .= '</td></tr>' . "\n";
5988
+			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title;
5989
+			$formconfirm .= '</td></tr>'."\n";
5990 5990
 
5991 5991
 			// Line text
5992 5992
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5993
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
5993
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
5994 5994
 			}
5995 5995
 
5996 5996
 			// Line form fields
5997 5997
 			if ($more) {
5998
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";
5998
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";
5999 5999
 				$formconfirm .= $more;
6000
-				$formconfirm .= '</td></tr>' . "\n";
6000
+				$formconfirm .= '</td></tr>'."\n";
6001 6001
 			}
6002 6002
 
6003 6003
 			// Line with question
6004 6004
 			$formconfirm .= '<tr class="valid">';
6005
-			$formconfirm .= '<td class="valid">' . $question . '</td>';
6005
+			$formconfirm .= '<td class="valid">'.$question.'</td>';
6006 6006
 			$formconfirm .= '<td class="valid center">';
6007 6007
 			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
6008
-			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">';
6008
+			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
6009 6009
 			$formconfirm .= '</td>';
6010
-			$formconfirm .= '</tr>' . "\n";
6010
+			$formconfirm .= '</tr>'."\n";
6011 6011
 
6012
-			$formconfirm .= '</table>' . "\n";
6012
+			$formconfirm .= '</table>'."\n";
6013 6013
 
6014 6014
 			if (empty($disableformtag)) {
6015 6015
 				$formconfirm .= "</form>\n";
@@ -6018,7 +6018,7 @@  discard block
 block discarded – undo
6018 6018
 
6019 6019
 			if (!empty($conf->use_javascript_ajax)) {
6020 6020
 				$formconfirm .= '<!-- code to disable button to avoid double clic -->';
6021
-				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
6021
+				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
6022 6022
 				$formconfirm .= '
6023 6023
 				$(document).ready(function () {
6024 6024
 					$(".confirmvalidatebutton").on("click", function() {
@@ -6030,7 +6030,7 @@  discard block
 block discarded – undo
6030 6030
 					});
6031 6031
 				});
6032 6032
 				';
6033
-				$formconfirm .= '</script>' . "\n";
6033
+				$formconfirm .= '</script>'."\n";
6034 6034
 			}
6035 6035
 
6036 6036
 			$formconfirm .= "<!-- end formconfirm -->\n";
@@ -6062,8 +6062,8 @@  discard block
 block discarded – undo
6062 6062
 		// phpcs:enable
6063 6063
 		global $langs;
6064 6064
 
6065
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
6066
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
6065
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
6066
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
6067 6067
 
6068 6068
 		$out = '';
6069 6069
 
@@ -6071,11 +6071,11 @@  discard block
 block discarded – undo
6071 6071
 
6072 6072
 		$langs->load("project");
6073 6073
 		if ($htmlname != "none") {
6074
-			$out .= '<form method="post" action="' . $page . '">';
6074
+			$out .= '<form method="post" action="'.$page.'">';
6075 6075
 			$out .= '<input type="hidden" name="action" value="classin">';
6076
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6076
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6077 6077
 			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);
6078
-			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6078
+			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6079 6079
 			$out .= '</form>';
6080 6080
 		} else {
6081 6081
 			$out .= '<span class="project_head_block">';
@@ -6084,7 +6084,7 @@  discard block
 block discarded – undo
6084 6084
 				$projet->fetch($selected);
6085 6085
 				$out .= $projet->getNomUrl(0, '', 1);
6086 6086
 			} else {
6087
-				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
6087
+				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';
6088 6088
 			}
6089 6089
 			$out .= '</span>';
6090 6090
 		}
@@ -6121,14 +6121,14 @@  discard block
 block discarded – undo
6121 6121
 		$out = '';
6122 6122
 
6123 6123
 		if ($htmlname != "none") {
6124
-			$out .= '<form method="POST" action="' . $page . '">';
6124
+			$out .= '<form method="POST" action="'.$page.'">';
6125 6125
 			$out .= '<input type="hidden" name="action" value="setconditions">';
6126
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6126
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6127 6127
 			if ($type) {
6128
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6128
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6129 6129
 			}
6130 6130
 			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
6131
-			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6131
+			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
6132 6132
 			$out .= '</form>';
6133 6133
 		} else {
6134 6134
 			if ($selected) {
@@ -6173,12 +6173,12 @@  discard block
 block discarded – undo
6173 6173
 		// phpcs:enable
6174 6174
 		global $langs;
6175 6175
 		if ($htmlname != "none") {
6176
-			print '<form method="post" action="' . $page . '">';
6176
+			print '<form method="post" action="'.$page.'">';
6177 6177
 			print '<input type="hidden" name="action" value="setavailability">';
6178
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6178
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6179 6179
 			$this->selectAvailabilityDelay($selected, $htmlname, '', $addempty);
6180
-			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6181
-			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">';
6180
+			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6181
+			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">';
6182 6182
 			print '</form>';
6183 6183
 		} else {
6184 6184
 			if ($selected) {
@@ -6204,11 +6204,11 @@  discard block
 block discarded – undo
6204 6204
 	{
6205 6205
 		global $langs;
6206 6206
 		if ($htmlname != "none") {
6207
-			print '<form method="post" action="' . $page . '">';
6207
+			print '<form method="post" action="'.$page.'">';
6208 6208
 			print '<input type="hidden" name="action" value="setdemandreason">';
6209
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6209
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6210 6210
 			$this->selectInputReason($selected, $htmlname, '-1', $addempty);
6211
-			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6211
+			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6212 6212
 			print '</form>';
6213 6213
 		} else {
6214 6214
 			if ($selected) {
@@ -6248,17 +6248,17 @@  discard block
 block discarded – undo
6248 6248
 		$ret = '';
6249 6249
 
6250 6250
 		if ($htmlname != "none") {
6251
-			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6252
-			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
6253
-			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
6251
+			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6252
+			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
6253
+			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
6254 6254
 			if ($type) {
6255
-				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6255
+				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6256 6256
 			}
6257 6257
 			$ret .= '<table class="nobordernopadding">';
6258 6258
 			$ret .= '<tr><td>';
6259
-			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
6259
+			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
6260 6260
 			$ret .= '</td>';
6261
-			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6261
+			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6262 6262
 			$ret .= '</tr></table></form>';
6263 6263
 		} else {
6264 6264
 			if ($displayhour) {
@@ -6293,15 +6293,15 @@  discard block
 block discarded – undo
6293 6293
 		global $langs;
6294 6294
 
6295 6295
 		if ($htmlname != "none") {
6296
-			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6297
-			print '<input type="hidden" name="action" value="set' . $htmlname . '">';
6298
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6296
+			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6297
+			print '<input type="hidden" name="action" value="set'.$htmlname.'">';
6298
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6299 6299
 			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
6300
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6300
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6301 6301
 			print '</form>';
6302 6302
 		} else {
6303 6303
 			if ($selected) {
6304
-				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
6304
+				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
6305 6305
 				$theuser = new User($this->db);
6306 6306
 				$theuser->fetch($selected);
6307 6307
 				print $theuser->getNomUrl(1);
@@ -6334,14 +6334,14 @@  discard block
 block discarded – undo
6334 6334
 
6335 6335
 		$out = '';
6336 6336
 		if ($htmlname != "none") {
6337
-			$out .= '<form method="POST" action="' . $page . '">';
6337
+			$out .= '<form method="POST" action="'.$page.'">';
6338 6338
 			$out .= '<input type="hidden" name="action" value="setmode">';
6339
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6339
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6340 6340
 			if ($type) {
6341
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6341
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6342 6342
 			}
6343 6343
 			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
6344
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6344
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6345 6345
 			$out .= '</form>';
6346 6346
 		} else {
6347 6347
 			if ($selected) {
@@ -6374,11 +6374,11 @@  discard block
 block discarded – undo
6374 6374
 	{
6375 6375
 		global $langs;
6376 6376
 		if ($htmlname != "none") {
6377
-			print '<form method="POST" action="' . $page . '">';
6377
+			print '<form method="POST" action="'.$page.'">';
6378 6378
 			print '<input type="hidden" name="action" value="settransportmode">';
6379
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6379
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6380 6380
 			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
6381
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6381
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6382 6382
 			print '</form>';
6383 6383
 		} else {
6384 6384
 			if ($selected) {
@@ -6405,14 +6405,14 @@  discard block
 block discarded – undo
6405 6405
 		// phpcs:enable
6406 6406
 		global $langs;
6407 6407
 		if ($htmlname != "none") {
6408
-			print '<form method="POST" action="' . $page . '">';
6408
+			print '<form method="POST" action="'.$page.'">';
6409 6409
 			print '<input type="hidden" name="action" value="setmulticurrencycode">';
6410
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6410
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6411 6411
 			print $this->selectMultiCurrency($selected, $htmlname, 0);
6412
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6412
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6413 6413
 			print '</form>';
6414 6414
 		} else {
6415
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6415
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6416 6416
 			print !empty($selected) ? currency_name($selected, 1) : '&nbsp;';
6417 6417
 		}
6418 6418
 	}
@@ -6434,22 +6434,22 @@  discard block
 block discarded – undo
6434 6434
 		global $langs, $mysoc, $conf;
6435 6435
 
6436 6436
 		if ($htmlname != "none") {
6437
-			print '<form method="POST" action="' . $page . '">';
6437
+			print '<form method="POST" action="'.$page.'">';
6438 6438
 			print '<input type="hidden" name="action" value="setmulticurrencyrate">';
6439
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6440
-			print '<input type="text" class="maxwidth75" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';
6439
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6440
+			print '<input type="text" class="maxwidth75" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
6441 6441
 			print '<select name="calculation_mode" id="calculation_mode">';
6442
-			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>';
6443
-			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>';
6442
+			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
6443
+			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
6444 6444
 			print '</select> ';
6445 6445
 			print ajax_combobox("calculation_mode");
6446
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6446
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6447 6447
 			print '</form>';
6448 6448
 		} else {
6449 6449
 			if (!empty($rate)) {
6450 6450
 				print price($rate, 1, $langs, 0, 0);
6451 6451
 				if ($currency && $rate != 1) {
6452
-					print ' &nbsp; <span class="opacitymedium">(' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')</span>';
6452
+					print ' &nbsp; <span class="opacitymedium">('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')</span>';
6453 6453
 				}
6454 6454
 			} else {
6455 6455
 				print 1;
@@ -6479,9 +6479,9 @@  discard block
 block discarded – undo
6479 6479
 		// phpcs:enable
6480 6480
 		global $conf, $langs;
6481 6481
 		if ($htmlname != "none") {
6482
-			print '<form method="post" action="' . $page . '">';
6482
+			print '<form method="post" action="'.$page.'">';
6483 6483
 			print '<input type="hidden" name="action" value="setabsolutediscount">';
6484
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6484
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6485 6485
 			print '<div class="inline-block">';
6486 6486
 			if (!empty($discount_type)) {
6487 6487
 				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
@@ -6519,24 +6519,24 @@  discard block
 block discarded – undo
6519 6519
 			print '</div>';
6520 6520
 			if (empty($hidelist)) {
6521 6521
 				print '<div class="inline-block" style="padding-right: 10px">';
6522
-				$newfilter = 'discount_type=' . intval($discount_type);
6522
+				$newfilter = 'discount_type='.intval($discount_type);
6523 6523
 				if (!empty($discount_type)) {
6524 6524
 					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
6525 6525
 				} else {
6526 6526
 					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
6527 6527
 				}
6528 6528
 				if ($filter) {
6529
-					$newfilter .= ' AND (' . $filter . ')';
6529
+					$newfilter .= ' AND ('.$filter.')';
6530 6530
 				}
6531 6531
 				// output the combo of discounts
6532 6532
 				$nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue);
6533 6533
 				if ($nbqualifiedlines > 0) {
6534
-					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"';
6534
+					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
6535 6535
 					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
6536
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6536
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6537 6537
 					}
6538 6538
 					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
6539
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6539
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6540 6540
 					}
6541 6541
 
6542 6542
 					print '>';
@@ -6576,23 +6576,23 @@  discard block
 block discarded – undo
6576 6576
 		global $langs;
6577 6577
 
6578 6578
 		if ($htmlname != "none") {
6579
-			print '<form method="post" action="' . $page . '">';
6579
+			print '<form method="post" action="'.$page.'">';
6580 6580
 			print '<input type="hidden" name="action" value="set_contact">';
6581
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6581
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6582 6582
 			print '<table class="nobordernopadding">';
6583 6583
 			print '<tr><td>';
6584 6584
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
6585 6585
 			$num = $this->num;
6586 6586
 			if ($num == 0) {
6587 6587
 				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
6588
-				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
6588
+				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$addcontact.'</a>';
6589 6589
 			}
6590 6590
 			print '</td>';
6591
-			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6591
+			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6592 6592
 			print '</tr></table></form>';
6593 6593
 		} else {
6594 6594
 			if ($selected) {
6595
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
6595
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
6596 6596
 				$contact = new Contact($this->db);
6597 6597
 				$contact->fetch($selected);
6598 6598
 				print $contact->getFullName($langs);
@@ -6627,20 +6627,20 @@  discard block
 block discarded – undo
6627 6627
 
6628 6628
 		$out = '';
6629 6629
 		if ($htmlname != "none") {
6630
-			$out .= '<form method="post" action="' . $page . '">';
6630
+			$out .= '<form method="post" action="'.$page.'">';
6631 6631
 			$out .= '<input type="hidden" name="action" value="set_thirdparty">';
6632
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6632
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6633 6633
 			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);
6634
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6634
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6635 6635
 			$out .= '</form>';
6636 6636
 		} else {
6637 6637
 			if ($selected) {
6638
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
6638
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
6639 6639
 				$soc = new Societe($this->db);
6640 6640
 				$soc->fetch($selected);
6641 6641
 				$out .= $soc->getNomUrl(0, '');
6642 6642
 			} else {
6643
-				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
6643
+				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
6644 6644
 			}
6645 6645
 		}
6646 6646
 
@@ -6690,22 +6690,22 @@  discard block
 block discarded – undo
6690 6690
 			$selected = 'EUR'; // Pour compatibilite
6691 6691
 		}
6692 6692
 
6693
-		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
6693
+		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
6694 6694
 		if ($useempty) {
6695 6695
 			$out .= '<option value="-1" selected></option>';
6696 6696
 		}
6697 6697
 		foreach ($langs->cache_currencies as $code_iso => $currency) {
6698 6698
 			$labeltoshow = $currency['label'];
6699 6699
 			if ($mode == 1) {
6700
-				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>';
6700
+				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>';
6701 6701
 			} else {
6702
-				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>';
6702
+				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>';
6703 6703
 			}
6704 6704
 
6705 6705
 			if ($selected && $selected == $code_iso) {
6706
-				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6706
+				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
6707 6707
 			} else {
6708
-				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6708
+				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
6709 6709
 			}
6710 6710
 			$out .= $labeltoshow;
6711 6711
 			$out .= '</option>';
@@ -6716,7 +6716,7 @@  discard block
 block discarded – undo
6716 6716
 		}
6717 6717
 
6718 6718
 		// Make select dynamic
6719
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6719
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6720 6720
 		$out .= ajax_combobox($htmlname);
6721 6721
 
6722 6722
 		return $out;
@@ -6742,10 +6742,10 @@  discard block
 block discarded – undo
6742 6742
 
6743 6743
 		$TCurrency = array();
6744 6744
 
6745
-		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
6746
-		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
6745
+		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
6746
+		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
6747 6747
 		if ($filter) {
6748
-			$sql .= " AND " . $filter;
6748
+			$sql .= " AND ".$filter;
6749 6749
 		}
6750 6750
 		$resql = $this->db->query($sql);
6751 6751
 		if ($resql) {
@@ -6755,7 +6755,7 @@  discard block
 block discarded – undo
6755 6755
 		}
6756 6756
 
6757 6757
 		$out = '';
6758
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
6758
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
6759 6759
 		if ($useempty) {
6760 6760
 			$out .= '<option value="">&nbsp;</option>';
6761 6761
 		}
@@ -6767,13 +6767,13 @@  discard block
 block discarded – undo
6767 6767
 			foreach ($langs->cache_currencies as $code_iso => $currency) {
6768 6768
 				if (isset($TCurrency[$code_iso])) {
6769 6769
 					if (!empty($selected) && $selected == $code_iso) {
6770
-						$out .= '<option value="' . $code_iso . '" selected="selected">';
6770
+						$out .= '<option value="'.$code_iso.'" selected="selected">';
6771 6771
 					} else {
6772
-						$out .= '<option value="' . $code_iso . '">';
6772
+						$out .= '<option value="'.$code_iso.'">';
6773 6773
 					}
6774 6774
 
6775 6775
 					$out .= $currency['label'];
6776
-					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
6776
+					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
6777 6777
 					$out .= '</option>';
6778 6778
 				}
6779 6779
 			}
@@ -6782,7 +6782,7 @@  discard block
 block discarded – undo
6782 6782
 		$out .= '</select>';
6783 6783
 
6784 6784
 		// Make select dynamic
6785
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6785
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6786 6786
 		$out .= ajax_combobox($htmlname);
6787 6787
 
6788 6788
 		return $out;
@@ -6813,7 +6813,7 @@  discard block
 block discarded – undo
6813 6813
 		$sql .= " WHERE t.fk_pays = c.rowid";
6814 6814
 		$sql .= " AND t.active > 0";
6815 6815
 		$sql .= " AND t.entity IN (".getEntity('c_tva').")";
6816
-		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
6816
+		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
6817 6817
 		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
6818 6818
 
6819 6819
 		$resql = $this->db->query($sql);
@@ -6825,30 +6825,30 @@  discard block
 block discarded – undo
6825 6825
 
6826 6826
 					$tmparray = array();
6827 6827
 					$tmparray['rowid']			= $obj->rowid;
6828
-					$tmparray['type_vat']		= $obj->type_vat;
6829
-					$tmparray['code']			= $obj->code;
6828
+					$tmparray['type_vat'] = $obj->type_vat;
6829
+					$tmparray['code'] = $obj->code;
6830 6830
 					$tmparray['txtva']			= $obj->taux;
6831
-					$tmparray['nprtva']			= $obj->recuperableonly;
6831
+					$tmparray['nprtva'] = $obj->recuperableonly;
6832 6832
 					$tmparray['localtax1']	    = $obj->localtax1;
6833 6833
 					$tmparray['localtax1_type']	= $obj->localtax1_type;
6834 6834
 					$tmparray['localtax2']	    = $obj->localtax2;
6835 6835
 					$tmparray['localtax2_type']	= $obj->localtax1_type;
6836
-					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or *
6837
-					$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
6836
+					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
6837
+					$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
6838 6838
 					$positiverates = '';
6839 6839
 					if ($obj->taux) {
6840
-						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;
6840
+						$positiverates .= ($positiverates ? '/' : '').$obj->taux;
6841 6841
 					}
6842 6842
 					if ($obj->localtax1) {
6843
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
6843
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
6844 6844
 					}
6845 6845
 					if ($obj->localtax2) {
6846
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
6846
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
6847 6847
 					}
6848 6848
 					if (empty($positiverates)) {
6849 6849
 						$positiverates = '0';
6850 6850
 					}
6851
-					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6851
+					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6852 6852
 
6853 6853
 					$this->cache_vatrates[$obj->rowid] = $tmparray;
6854 6854
 				}
@@ -6868,7 +6868,7 @@  discard block
 block discarded – undo
6868 6868
 				return -1;
6869 6869
 			}
6870 6870
 		} else {
6871
-			$this->error = '<span class="error">' . $this->db->error() . '</span>';
6871
+			$this->error = '<span class="error">'.$this->db->error().'</span>';
6872 6872
 			return -2;
6873 6873
 		}
6874 6874
 	}
@@ -6921,9 +6921,9 @@  discard block
 block discarded – undo
6921 6921
 		// Check parameters
6922 6922
 		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
6923 6923
 			if ($societe_vendeuse->id == $mysoc->id) {
6924
-				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>';
6924
+				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
6925 6925
 			} else {
6926
-				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>';
6926
+				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
6927 6927
 			}
6928 6928
 			return $return;
6929 6929
 		}
@@ -6935,12 +6935,12 @@  discard block
 block discarded – undo
6935 6935
 		// Define list of countries to use to search VAT rates to show
6936 6936
 		// First we defined code_country to use to find list
6937 6937
 		if (is_object($societe_vendeuse)) {
6938
-			$code_country = "'" . $societe_vendeuse->country_code . "'";
6938
+			$code_country = "'".$societe_vendeuse->country_code."'";
6939 6939
 		} else {
6940
-			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
6940
+			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
6941 6941
 		}
6942 6942
 		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on
6943
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6943
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6944 6944
 			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
6945 6945
 			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
6946 6946
 			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
@@ -6950,27 +6950,27 @@  discard block
 block discarded – undo
6950 6950
 					if ($type == 1) { // We know product is a service
6951 6951
 						switch ($selectVatComboMode) {
6952 6952
 							case '1':
6953
-								$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6953
+								$code_country .= ",'".$societe_acheteuse->country_code."'";
6954 6954
 								break;
6955 6955
 							case '2':
6956
-								$code_country = "'" . $societe_acheteuse->country_code . "'";
6956
+								$code_country = "'".$societe_acheteuse->country_code."'";
6957 6957
 								break;
6958 6958
 						}
6959 6959
 					}
6960 6960
 				} elseif (!$idprod) {  // We don't know type of product
6961 6961
 					switch ($selectVatComboMode) {
6962 6962
 						case '1':
6963
-							$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6963
+							$code_country .= ",'".$societe_acheteuse->country_code."'";
6964 6964
 							break;
6965 6965
 						case '2':
6966
-							$code_country = "'" . $societe_acheteuse->country_code . "'";
6966
+							$code_country = "'".$societe_acheteuse->country_code."'";
6967 6967
 							break;
6968 6968
 					}
6969 6969
 				} else {
6970 6970
 					$prodstatic = new Product($this->db);
6971 6971
 					$prodstatic->fetch($idprod);
6972 6972
 					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
6973
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6973
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6974 6974
 					}
6975 6975
 				}
6976 6976
 			}
@@ -7032,13 +7032,13 @@  discard block
 block discarded – undo
7032 7032
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
7033 7033
 				// of using supplier invoices (this is a very bad idea !)
7034 7034
 				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) {
7035
-					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
7035
+					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
7036 7036
 					$disabled = true;
7037 7037
 				}
7038 7038
 			}
7039 7039
 
7040 7040
 			if (!$options_only) {
7041
-				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
7041
+				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
7042 7042
 			}
7043 7043
 
7044 7044
 			$selectedfound = false;
@@ -7052,13 +7052,13 @@  discard block
 block discarded – undo
7052 7052
 				$key = $rate['txtva'];
7053 7053
 				$key .= $rate['nprtva'] ? '*' : '';
7054 7054
 				if ($mode > 0 && $rate['code']) {
7055
-					$key .= ' (' . $rate['code'] . ')';
7055
+					$key .= ' ('.$rate['code'].')';
7056 7056
 				}
7057 7057
 				if ($mode < 0) {
7058 7058
 					$key = $rate['rowid'];
7059 7059
 				}
7060 7060
 
7061
-				$return .= '<option value="' . $key . '"';
7061
+				$return .= '<option value="'.$key.'"';
7062 7062
 				if (!$selectedfound) {
7063 7063
 					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
7064 7064
 						if ($defaultcode == $rate['code']) {
@@ -7129,7 +7129,7 @@  discard block
 block discarded – undo
7129 7129
 	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 = '')
7130 7130
 	{
7131 7131
 		// phpcs:enable
7132
-		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
7132
+		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
7133 7133
 		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);
7134 7134
 		if (!empty($nooutput)) {
7135 7135
 			return $retstring;
@@ -7158,11 +7158,11 @@  discard block
 block discarded – undo
7158 7158
 	{
7159 7159
 		global $langs;
7160 7160
 
7161
-		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
7161
+		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
7162 7162
 		if ($forcenewline) {
7163 7163
 			$ret .= '<br>';
7164 7164
 		}
7165
-		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
7165
+		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
7166 7166
 		return $ret;
7167 7167
 	}
7168 7168
 
@@ -7229,7 +7229,7 @@  discard block
 block discarded – undo
7229 7229
 		$orig_set_time = $set_time;
7230 7230
 
7231 7231
 		if ($set_time === '' && $emptydate == 0) {
7232
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7232
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7233 7233
 			if ($gm == 'tzuser' || $gm == 'tzuserrel') {
7234 7234
 				$set_time = dol_now($gm);
7235 7235
 			} else {
@@ -7301,38 +7301,38 @@  discard block
 block discarded – undo
7301 7301
 				// Calendrier popup version eldy
7302 7302
 				if ($usecalendar == "eldy") {
7303 7303
 					// Input area to enter date manually
7304
-					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';
7304
+					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7305 7305
 					$retstring .= ($disabled ? ' disabled' : '');
7306
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7306
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7307 7307
 					$retstring .= ' autocomplete="off">';
7308 7308
 
7309 7309
 					// Icon calendar
7310 7310
 					$retstringbuttom = '';
7311 7311
 					if (!$disabled) {
7312
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
7313
-						$base = DOL_URL_ROOT . '/core/';
7314
-						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
7315
-						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
7312
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
7313
+						$base = DOL_URL_ROOT.'/core/';
7314
+						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
7315
+						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
7316 7316
 					} else {
7317
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7317
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7318 7318
 					}
7319
-					$retstring = $retstringbuttom . $retstring;
7319
+					$retstring = $retstringbuttom.$retstring;
7320 7320
 
7321
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7322
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7323
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7321
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7322
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7323
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7324 7324
 				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') {
7325 7325
 					if (!$disabled && $usecalendar != 'html') {
7326 7326
 						// Output javascript for datepicker
7327 7327
 						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100));
7328 7328
 						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100));
7329 7329
 
7330
-						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';
7331
-						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
7332
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
7330
+						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';
7331
+						$retstring .= "$(function(){ $('#".$prefix."').datepicker({
7332
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
7333 7333
 							autoclose: true,
7334 7334
 							todayHighlight: true,
7335
-							yearRange: '" . $minYear . ":" . $maxYear . "',";
7335
+							yearRange: '" . $minYear.":".$maxYear."',";
7336 7336
 						if (!empty($conf->dol_use_jmobile)) {
7337 7337
 							$retstring .= "
7338 7338
 								beforeShow: function (input, datePicker) {
@@ -7345,10 +7345,10 @@  discard block
 block discarded – undo
7345 7345
 						}
7346 7346
 						// Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php
7347 7347
 						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
7348
-							$buttonImage = $calendarpicto ?: DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png";
7348
+							$buttonImage = $calendarpicto ?: DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png";
7349 7349
 							$retstring .= "
7350 7350
 								showOn: 'button',	/* both has problem with autocompletion */
7351
-								buttonImage: '" . $buttonImage . "',
7351
+								buttonImage: '" . $buttonImage."',
7352 7352
 								buttonImageOnly: true";
7353 7353
 						}
7354 7354
 						$retstring .= "
@@ -7360,46 +7360,46 @@  discard block
 block discarded – undo
7360 7360
 					$retstring .= '<div class="nowraponall inline-block divfordateinput">';
7361 7361
 					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7362 7362
 					$retstring .= ($disabled ? ' disabled' : '');
7363
-					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
7364
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7363
+					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
7364
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7365 7365
 					$retstring .= ' autocomplete="off">';
7366 7366
 
7367 7367
 					// Icone calendrier
7368 7368
 					if ($disabled) {
7369
-						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7370
-						$retstring = $retstringbutton . $retstring;
7369
+						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7370
+						$retstring = $retstringbutton.$retstring;
7371 7371
 					}
7372 7372
 
7373 7373
 					$retstring .= '</div>';
7374
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7375
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7376
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7374
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7375
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7376
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7377 7377
 				} else {
7378 7378
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
7379 7379
 				}
7380 7380
 			} else {
7381 7381
 				// Show date with combo selects
7382 7382
 				// Day
7383
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
7383
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
7384 7384
 
7385 7385
 				if ($emptydate || $set_time == -1) {
7386 7386
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7387 7387
 				}
7388 7388
 
7389 7389
 				for ($day = 1; $day <= 31; $day++) {
7390
-					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
7390
+					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
7391 7391
 				}
7392 7392
 
7393 7393
 				$retstring .= "</select>";
7394 7394
 
7395
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
7395
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
7396 7396
 				if ($emptydate || $set_time == -1) {
7397 7397
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7398 7398
 				}
7399 7399
 
7400 7400
 				// Month
7401 7401
 				for ($month = 1; $month <= 12; $month++) {
7402
-					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
7402
+					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
7403 7403
 					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
7404 7404
 					$retstring .= "</option>";
7405 7405
 				}
@@ -7407,13 +7407,13 @@  discard block
 block discarded – undo
7407 7407
 
7408 7408
 				// Year
7409 7409
 				if ($emptydate || $set_time == -1) {
7410
-					$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 . '">';
7410
+					$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.'">';
7411 7411
 				} else {
7412
-					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
7412
+					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
7413 7413
 
7414 7414
 					$syear = (int) $syear;
7415 7415
 					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) {
7416
-						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
7416
+						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
7417 7417
 					}
7418 7418
 					$retstring .= "</select>\n";
7419 7419
 				}
@@ -7438,15 +7438,15 @@  discard block
 block discarded – undo
7438 7438
 			}
7439 7439
 
7440 7440
 			// Show hour
7441
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
7441
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
7442 7442
 			if ($emptyhours) {
7443 7443
 				$retstring .= '<option value="-1">&nbsp;</option>';
7444 7444
 			}
7445 7445
 			for ($hour = $hourstart; $hour < $hourend; $hour++) {
7446 7446
 				if (strlen($hour) < 2) {
7447
-					$hour = "0" . $hour;
7447
+					$hour = "0".$hour;
7448 7448
 				}
7449
-				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;
7449
+				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
7450 7450
 				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
7451 7451
 				$retstring .= '</option>';
7452 7452
 			}
@@ -7459,17 +7459,17 @@  discard block
 block discarded – undo
7459 7459
 
7460 7460
 		if ($m) {
7461 7461
 			// Show minutes
7462
-			$retstring .= '<select ' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
7462
+			$retstring .= '<select '.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
7463 7463
 			if ($emptyhours) {
7464 7464
 				$retstring .= '<option value="-1">&nbsp;</option>';
7465 7465
 			}
7466 7466
 			for ($min = 0; $min < 60; $min += $stepminutes) {
7467 7467
 				$min_str = sprintf("%02d", $min);
7468
-				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';
7468
+				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';
7469 7469
 			}
7470 7470
 			$retstring .= '</select>';
7471 7471
 
7472
-			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
7472
+			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
7473 7473
 		}
7474 7474
 
7475 7475
 		if ($d && $h) {
@@ -7492,10 +7492,10 @@  discard block
 block discarded – undo
7492 7492
 
7493 7493
 			// Generate the date part, depending on the use or not of the javascript calendar
7494 7494
 			if ($addnowlink == 1) { // server time expressed in user time setup
7495
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7496
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7497
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7498
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7495
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7496
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7497
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7498
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7499 7499
 			} elseif ($addnowlink == 2) {
7500 7500
 				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
7501 7501
 				 * This break application for foreign languages.
@@ -7504,10 +7504,10 @@  discard block
 block discarded – undo
7504 7504
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
7505 7505
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
7506 7506
 				*/
7507
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7508
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7509
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7510
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7507
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7508
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7509
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7510
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7511 7511
 			}
7512 7512
 			/*if ($usecalendar == "eldy")
7513 7513
 			{
@@ -7527,11 +7527,11 @@  discard block
 block discarded – undo
7527 7527
 				}
7528 7528
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
7529 7529
 				if ($addnowlink == 1) {
7530
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7531
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7530
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7531
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7532 7532
 				} elseif ($addnowlink == 2) {
7533
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';
7534
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7533
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
7534
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7535 7535
 				}
7536 7536
 
7537 7537
 				if ($fullday) {
@@ -7545,11 +7545,11 @@  discard block
 block discarded – undo
7545 7545
 				}
7546 7546
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
7547 7547
 				if ($addnowlink == 1) {
7548
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7549
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7548
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7549
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7550 7550
 				} elseif ($addnowlink == 2) {
7551
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';
7552
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7551
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
7552
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7553 7553
 				}
7554 7554
 				if ($fullday) {
7555 7555
 					$reset_scripts .= ' } ';
@@ -7557,7 +7557,7 @@  discard block
 block discarded – undo
7557 7557
 			}
7558 7558
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7559 7559
 			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
7560
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
7560
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
7561 7561
 				$retstring .= $langs->trans("Now");
7562 7562
 				$retstring .= '</button> ';
7563 7563
 			}
@@ -7569,16 +7569,16 @@  discard block
 block discarded – undo
7569 7569
 			$reset_scripts = "";
7570 7570
 
7571 7571
 			// Generate the date part, depending on the use or not of the javascript calendar
7572
-			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';
7573
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7574
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7575
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7572
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
7573
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7574
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7575
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7576 7576
 			// Update the hour part
7577 7577
 			if ($h) {
7578 7578
 				if ($fullday) {
7579 7579
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7580 7580
 				}
7581
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7581
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7582 7582
 				if ($fullday) {
7583 7583
 					$reset_scripts .= ' } ';
7584 7584
 				}
@@ -7588,14 +7588,14 @@  discard block
 block discarded – undo
7588 7588
 				if ($fullday) {
7589 7589
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7590 7590
 				}
7591
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7591
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7592 7592
 				if ($fullday) {
7593 7593
 					$reset_scripts .= ' } ';
7594 7594
 				}
7595 7595
 			}
7596 7596
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7597 7597
 			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
7598
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
7598
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
7599 7599
 				$retstring .= $langs->trans("DateStartPlusOne");
7600 7600
 				$retstring .= '</button> ';
7601 7601
 			}
@@ -7653,17 +7653,17 @@  discard block
 block discarded – undo
7653 7653
 			unset($TDurationTypes[$value]);
7654 7654
 		}
7655 7655
 
7656
-		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';
7656
+		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
7657 7657
 		foreach ($TDurationTypes as $key => $typeduration) {
7658
-			$retstring .= '<option value="' . $key . '"';
7658
+			$retstring .= '<option value="'.$key.'"';
7659 7659
 			if ($key == $selected) {
7660 7660
 				$retstring .= " selected";
7661 7661
 			}
7662
-			$retstring .= ">" . $typeduration . "</option>";
7662
+			$retstring .= ">".$typeduration."</option>";
7663 7663
 		}
7664 7664
 		$retstring .= "</select>";
7665 7665
 
7666
-		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration');
7666
+		$retstring .= ajax_combobox('select_'.$prefix.'type_duration');
7667 7667
 
7668 7668
 		return $retstring;
7669 7669
 	}
@@ -7695,30 +7695,30 @@  discard block
 block discarded – undo
7695 7695
 
7696 7696
 		// Hours
7697 7697
 		if ($iSecond != '') {
7698
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7698
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7699 7699
 
7700 7700
 			$hourSelected = convertSecondToTime($iSecond, 'allhour');
7701 7701
 			$minSelected = convertSecondToTime($iSecond, 'min');
7702 7702
 		}
7703 7703
 
7704 7704
 		if ($typehour == 'select') {
7705
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
7705
+			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
7706 7706
 			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours
7707
-				$retstring .= '<option value="' . $hour . '"';
7707
+				$retstring .= '<option value="'.$hour.'"';
7708 7708
 				if (is_numeric($hourSelected) && $hourSelected == $hour) {
7709 7709
 					$retstring .= " selected";
7710 7710
 				}
7711
-				$retstring .= ">" . $hour . "</option>";
7711
+				$retstring .= ">".$hour."</option>";
7712 7712
 			}
7713 7713
 			$retstring .= "</select>";
7714 7714
 		} elseif ($typehour == 'text' || $typehour == 'textselect') {
7715
-			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
7715
+			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
7716 7716
 		} else {
7717 7717
 			return 'BadValueForParameterTypeHour';
7718 7718
 		}
7719 7719
 
7720 7720
 		if ($typehour != 'text') {
7721
-			$retstring .= ' ' . $langs->trans('HourShort');
7721
+			$retstring .= ' '.$langs->trans('HourShort');
7722 7722
 		} else {
7723 7723
 			$retstring .= '<span class="">:</span>';
7724 7724
 		}
@@ -7733,21 +7733,21 @@  discard block
 block discarded – undo
7733 7733
 		}
7734 7734
 
7735 7735
 		if ($typehour == 'select' || $typehour == 'textselect') {
7736
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
7736
+			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
7737 7737
 			for ($min = 0; $min <= 55; $min += 5) {
7738
-				$retstring .= '<option value="' . $min . '"';
7738
+				$retstring .= '<option value="'.$min.'"';
7739 7739
 				if (is_numeric($minSelected) && $minSelected == $min) {
7740 7740
 					$retstring .= ' selected';
7741 7741
 				}
7742
-				$retstring .= '>' . $min . '</option>';
7742
+				$retstring .= '>'.$min.'</option>';
7743 7743
 			}
7744 7744
 			$retstring .= "</select>";
7745 7745
 		} elseif ($typehour == 'text') {
7746
-			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
7746
+			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
7747 7747
 		}
7748 7748
 
7749 7749
 		if ($typehour != 'text') {
7750
-			$retstring .= ' ' . $langs->trans('MinuteShort');
7750
+			$retstring .= ' '.$langs->trans('MinuteShort');
7751 7751
 		}
7752 7752
 
7753 7753
 		$retstring .= "</span>";
@@ -7795,7 +7795,7 @@  discard block
 block discarded – undo
7795 7795
 			$placeholder = '';
7796 7796
 
7797 7797
 			if ($selected && empty($selected_input_value)) {
7798
-				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7798
+				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7799 7799
 				$tickettmpselect = new Ticket($this->db);
7800 7800
 				$tickettmpselect->fetch($selected);
7801 7801
 				$selected_input_value = $tickettmpselect->ref;
@@ -7803,17 +7803,17 @@  discard block
 block discarded – undo
7803 7803
 			}
7804 7804
 
7805 7805
 			$urloption = '';
7806
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7806
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7807 7807
 
7808 7808
 			if (empty($hidelabel)) {
7809
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7809
+				$out .= $langs->trans("RefOrLabel").' : ';
7810 7810
 			} elseif ($hidelabel > 1) {
7811
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7811
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7812 7812
 				if ($hidelabel == 2) {
7813 7813
 					$out .= img_picto($langs->trans("Search"), 'search');
7814 7814
 				}
7815 7815
 			}
7816
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7816
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7817 7817
 			if ($hidelabel == 3) {
7818 7818
 				$out .= img_picto($langs->trans("Search"), 'search');
7819 7819
 			}
@@ -7857,8 +7857,8 @@  discard block
 block discarded – undo
7857 7857
 
7858 7858
 		$sql = "SELECT ";
7859 7859
 		$sql .= $selectFields;
7860
-		$sql .= " FROM " . $this->db->prefix() . "ticket as p";
7861
-		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')';
7860
+		$sql .= " FROM ".$this->db->prefix()."ticket as p";
7861
+		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
7862 7862
 
7863 7863
 		// Add criteria on ref/label
7864 7864
 		if ($filterkey != '') {
@@ -7874,7 +7874,7 @@  discard block
 block discarded – undo
7874 7874
 				if ($i > 0) {
7875 7875
 					$sql .= " AND ";
7876 7876
 				}
7877
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7877
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7878 7878
 				$sql .= ")";
7879 7879
 				$i++;
7880 7880
 			}
@@ -7887,22 +7887,22 @@  discard block
 block discarded – undo
7887 7887
 		$sql .= $this->db->plimit($limit, 0);
7888 7888
 
7889 7889
 		// Build output string
7890
-		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);
7890
+		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);
7891 7891
 		$result = $this->db->query($sql);
7892 7892
 		if ($result) {
7893
-			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7894
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
7893
+			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7894
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
7895 7895
 
7896 7896
 			$num = $this->db->num_rows($result);
7897 7897
 
7898 7898
 			$events = array();
7899 7899
 
7900 7900
 			if (!$forcecombo) {
7901
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7901
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7902 7902
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT'));
7903 7903
 			}
7904 7904
 
7905
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7905
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7906 7906
 
7907 7907
 			$textifempty = '';
7908 7908
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7919,7 +7919,7 @@  discard block
 block discarded – undo
7919 7919
 				}
7920 7920
 			}
7921 7921
 			if ($showempty) {
7922
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7922
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7923 7923
 			}
7924 7924
 
7925 7925
 			$i = 0;
@@ -7974,13 +7974,13 @@  discard block
 block discarded – undo
7974 7974
 		$outkey = $objp->rowid;
7975 7975
 		$outref = $objp->ref;
7976 7976
 
7977
-		$opt = '<option value="' . $objp->rowid . '"';
7977
+		$opt = '<option value="'.$objp->rowid.'"';
7978 7978
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7979 7979
 		$opt .= '>';
7980 7980
 		$opt .= $objp->ref;
7981 7981
 		$objRef = $objp->ref;
7982 7982
 		if (!empty($filterkey) && $filterkey != '') {
7983
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7983
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7984 7984
 		}
7985 7985
 
7986 7986
 		$opt .= "</option>\n";
@@ -8021,7 +8021,7 @@  discard block
 block discarded – undo
8021 8021
 			$placeholder = '';
8022 8022
 
8023 8023
 			if ($selected && empty($selected_input_value)) {
8024
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
8024
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
8025 8025
 				$projecttmpselect = new Project($this->db);
8026 8026
 				$projecttmpselect->fetch($selected);
8027 8027
 				$selected_input_value = $projecttmpselect->ref;
@@ -8029,17 +8029,17 @@  discard block
 block discarded – undo
8029 8029
 			}
8030 8030
 
8031 8031
 			$urloption = '';
8032
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8032
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8033 8033
 
8034 8034
 			if (empty($hidelabel)) {
8035
-				$out .= $langs->trans("RefOrLabel") . ' : ';
8035
+				$out .= $langs->trans("RefOrLabel").' : ';
8036 8036
 			} elseif ($hidelabel > 1) {
8037
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8037
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8038 8038
 				if ($hidelabel == 2) {
8039 8039
 					$out .= img_picto($langs->trans("Search"), 'search');
8040 8040
 				}
8041 8041
 			}
8042
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8042
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8043 8043
 			if ($hidelabel == 3) {
8044 8044
 				$out .= img_picto($langs->trans("Search"), 'search');
8045 8045
 			}
@@ -8082,8 +8082,8 @@  discard block
 block discarded – undo
8082 8082
 
8083 8083
 		$sql = "SELECT ";
8084 8084
 		$sql .= $selectFields;
8085
-		$sql .= " FROM " . $this->db->prefix() . "projet as p";
8086
-		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')';
8085
+		$sql .= " FROM ".$this->db->prefix()."projet as p";
8086
+		$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
8087 8087
 
8088 8088
 		// Add criteria on ref/label
8089 8089
 		if ($filterkey != '') {
@@ -8099,7 +8099,7 @@  discard block
 block discarded – undo
8099 8099
 				if ($i > 0) {
8100 8100
 					$sql .= " AND ";
8101 8101
 				}
8102
-				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8102
+				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
8103 8103
 				$sql .= "";
8104 8104
 				$i++;
8105 8105
 			}
@@ -8112,22 +8112,22 @@  discard block
 block discarded – undo
8112 8112
 		$sql .= $this->db->plimit($limit, 0);
8113 8113
 
8114 8114
 		// Build output string
8115
-		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);
8115
+		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
8116 8116
 		$result = $this->db->query($sql);
8117 8117
 		if ($result) {
8118
-			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
8119
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
8118
+			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
8119
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
8120 8120
 
8121 8121
 			$num = $this->db->num_rows($result);
8122 8122
 
8123 8123
 			$events = array();
8124 8124
 
8125 8125
 			if (!$forcecombo) {
8126
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8126
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8127 8127
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT'));
8128 8128
 			}
8129 8129
 
8130
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8130
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8131 8131
 
8132 8132
 			$textifempty = '';
8133 8133
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8144,7 +8144,7 @@  discard block
 block discarded – undo
8144 8144
 				}
8145 8145
 			}
8146 8146
 			if ($showempty) {
8147
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
8147
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
8148 8148
 			}
8149 8149
 
8150 8150
 			$i = 0;
@@ -8202,13 +8202,13 @@  discard block
 block discarded – undo
8202 8202
 		$outlabel = $objp->label;
8203 8203
 		$outtype = $objp->fk_product_type;
8204 8204
 
8205
-		$opt = '<option value="' . $objp->rowid . '"';
8205
+		$opt = '<option value="'.$objp->rowid.'"';
8206 8206
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8207 8207
 		$opt .= '>';
8208 8208
 		$opt .= $objp->ref;
8209 8209
 		$objRef = $objp->ref;
8210 8210
 		if (!empty($filterkey) && $filterkey != '') {
8211
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
8211
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
8212 8212
 		}
8213 8213
 
8214 8214
 		$opt .= "</option>\n";
@@ -8250,7 +8250,7 @@  discard block
 block discarded – undo
8250 8250
 			$placeholder = '';
8251 8251
 
8252 8252
 			if ($selected && empty($selected_input_value)) {
8253
-				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8253
+				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8254 8254
 				$adherenttmpselect = new Adherent($this->db);
8255 8255
 				$adherenttmpselect->fetch($selected);
8256 8256
 				$selected_input_value = $adherenttmpselect->ref;
@@ -8259,17 +8259,17 @@  discard block
 block discarded – undo
8259 8259
 
8260 8260
 			$urloption = '';
8261 8261
 
8262
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8262
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8263 8263
 
8264 8264
 			if (empty($hidelabel)) {
8265
-				$out .= $langs->trans("RefOrLabel") . ' : ';
8265
+				$out .= $langs->trans("RefOrLabel").' : ';
8266 8266
 			} elseif ($hidelabel > 1) {
8267
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8267
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8268 8268
 				if ($hidelabel == 2) {
8269 8269
 					$out .= img_picto($langs->trans("Search"), 'search');
8270 8270
 				}
8271 8271
 			}
8272
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8272
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8273 8273
 			if ($hidelabel == 3) {
8274 8274
 				$out .= img_picto($langs->trans("Search"), 'search');
8275 8275
 			}
@@ -8314,8 +8314,8 @@  discard block
 block discarded – undo
8314 8314
 
8315 8315
 		$sql = "SELECT ";
8316 8316
 		$sql .= $selectFields;
8317
-		$sql .= " FROM " . $this->db->prefix() . "adherent as p";
8318
-		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')';
8317
+		$sql .= " FROM ".$this->db->prefix()."adherent as p";
8318
+		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
8319 8319
 
8320 8320
 		// Add criteria on ref/label
8321 8321
 		if ($filterkey != '') {
@@ -8331,8 +8331,8 @@  discard block
 block discarded – undo
8331 8331
 				if ($i > 0) {
8332 8332
 					$sql .= " AND ";
8333 8333
 				}
8334
-				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8335
-				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
8334
+				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
8335
+				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
8336 8336
 				$i++;
8337 8337
 			}
8338 8338
 			if (count($search_crit) > 1) {
@@ -8341,27 +8341,27 @@  discard block
 block discarded – undo
8341 8341
 			$sql .= ')';
8342 8342
 		}
8343 8343
 		if ($status != -1) {
8344
-			$sql .= ' AND statut = ' . ((int) $status);
8344
+			$sql .= ' AND statut = '.((int) $status);
8345 8345
 		}
8346 8346
 		$sql .= $this->db->plimit($limit, 0);
8347 8347
 
8348 8348
 		// Build output string
8349
-		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);
8349
+		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
8350 8350
 		$result = $this->db->query($sql);
8351 8351
 		if ($result) {
8352
-			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8353
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
8352
+			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8353
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
8354 8354
 
8355 8355
 			$num = $this->db->num_rows($result);
8356 8356
 
8357 8357
 			$events = array();
8358 8358
 
8359 8359
 			if (!$forcecombo) {
8360
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8360
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8361 8361
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
8362 8362
 			}
8363 8363
 
8364
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8364
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8365 8365
 
8366 8366
 			$textifempty = '';
8367 8367
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8378,7 +8378,7 @@  discard block
 block discarded – undo
8378 8378
 				}
8379 8379
 			}
8380 8380
 			if ($showempty) {
8381
-				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
8381
+				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
8382 8382
 			}
8383 8383
 
8384 8384
 			$i = 0;
@@ -8434,11 +8434,11 @@  discard block
 block discarded – undo
8434 8434
 		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);
8435 8435
 		$outtype = $objp->fk_adherent_type;
8436 8436
 
8437
-		$opt = '<option value="' . $objp->rowid . '"';
8437
+		$opt = '<option value="'.$objp->rowid.'"';
8438 8438
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8439 8439
 		$opt .= '>';
8440 8440
 		if (!empty($filterkey) && $filterkey != '') {
8441
-			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1);
8441
+			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1);
8442 8442
 		}
8443 8443
 		$opt .= $outlabel;
8444 8444
 		$opt .= "</option>\n";
@@ -8493,8 +8493,8 @@  discard block
 block discarded – undo
8493 8493
 		$objecttmp = null;
8494 8494
 		$InfoFieldList = array();
8495 8495
 		$classname = '';
8496
-		$filter = '';  // Ensure filter has value (for static analysis)
8497
-		$sortfield = '';  // Ensure filter has value (for static analysis)
8496
+		$filter = ''; // Ensure filter has value (for static analysis)
8497
+		$sortfield = ''; // Ensure filter has value (for static analysis)
8498 8498
 
8499 8499
 		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield
8500 8500
 			// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield'
@@ -8538,9 +8538,9 @@  discard block
 block discarded – undo
8538 8538
 			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
8539 8539
 			$reg = array();
8540 8540
 			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
8541
-				$InfoFieldList[4] = $reg[1];    // take the sort field
8541
+				$InfoFieldList[4] = $reg[1]; // take the sort field
8542 8542
 			}
8543
-			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field
8543
+			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
8544 8544
 
8545 8545
 			$classname = $InfoFieldList[0];
8546 8546
 			$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1];
@@ -8571,8 +8571,8 @@  discard block
 block discarded – undo
8571 8571
 		);
8572 8572
 
8573 8573
 		if (!is_object($objecttmp)) {
8574
-			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8575
-			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8574
+			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8575
+			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8576 8576
 		}
8577 8577
 		'@phan-var-force CommonObject $objecttmp';
8578 8578
 		/** @var CommonObject $objecttmp */
@@ -8584,9 +8584,9 @@  discard block
 block discarded – undo
8584 8584
 		if ($prefixforautocompletemode == 'product') {
8585 8585
 			$prefixforautocompletemode = 'produit';
8586 8586
 		}
8587
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8587
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8588 8588
 
8589
-		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
8589
+		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);
8590 8590
 
8591 8591
 		// Generate the combo HTML component
8592 8592
 		$out = '';
@@ -8615,13 +8615,13 @@  discard block
 block discarded – undo
8615 8615
 			}
8616 8616
 
8617 8617
 			// Set url and param to call to get json of the search results
8618
-			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
8619
-			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
8618
+			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
8619
+			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
8620 8620
 
8621 8621
 			// Activate the auto complete using ajax call.
8622 8622
 			$out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0);
8623 8623
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
8624
-			$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) . '"' : '') . ' />';
8624
+			$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).'"' : '').' />';
8625 8625
 		} else {
8626 8626
 			// Immediate load of table record.
8627 8627
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8661,16 +8661,16 @@  discard block
 block discarded – undo
8661 8661
 		if ($prefixforautocompletemode == 'societe') {
8662 8662
 			$prefixforautocompletemode = 'company';
8663 8663
 		}
8664
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8664
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8665 8665
 
8666 8666
 		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...)
8667 8667
 			$tmpfieldstoshow = '';
8668 8668
 			foreach ($objecttmp->fields as $key => $val) {
8669
-				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) {
8669
+				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) {
8670 8670
 					continue;
8671 8671
 				}
8672 8672
 				if (!empty($val['showoncombobox'])) {
8673
-					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
8673
+					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
8674 8674
 				}
8675 8675
 			}
8676 8676
 			if ($tmpfieldstoshow) {
@@ -8707,25 +8707,25 @@  discard block
 block discarded – undo
8707 8707
 		$num = 0;
8708 8708
 
8709 8709
 		// Search data
8710
-		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . " as t";
8710
+		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)." as t";
8711 8711
 		if (!empty($objecttmp->isextrafieldmanaged)) {
8712
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . "_extrafields as e ON t.rowid = e.fk_object";
8712
+			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)."_extrafields as e ON t.rowid = e.fk_object";
8713 8713
 		}
8714 8714
 		if (!empty($objecttmp->parent_element)) {
8715 8715
 			$parent_properties = getElementProperties($objecttmp->parent_element);
8716
-			$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($parent_properties['table_element']) . " as o ON o.rowid = t.".$objecttmp->fk_parent_attribute;
8716
+			$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($parent_properties['table_element'])." as o ON o.rowid = t.".$objecttmp->fk_parent_attribute;
8717 8717
 		}
8718 8718
 		if (in_array($objecttmp->parent_element, ['commande', 'propal', 'facture', 'expedition'])) {
8719
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product as p ON p.rowid = t.fk_product";
8719
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = t.fk_product";
8720 8720
 		}
8721 8721
 		if (isset($objecttmp->ismultientitymanaged)) {
8722 8722
 			if (!is_numeric($objecttmp->ismultientitymanaged)) {
8723 8723
 				$tmparray = explode('@', $objecttmp->ismultientitymanaged);
8724
-				$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($tmparray[1]) . " as parenttable ON parenttable.rowid = t." . $this->db->sanitize($tmparray[0]);
8724
+				$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($tmparray[1])." as parenttable ON parenttable.rowid = t.".$this->db->sanitize($tmparray[0]);
8725 8725
 			}
8726 8726
 			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8727 8727
 				if (!$user->hasRight('societe', 'client', 'voir')) {
8728
-					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
8728
+					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
8729 8729
 				}
8730 8730
 			}
8731 8731
 		}
@@ -8745,27 +8745,27 @@  discard block
 block discarded – undo
8745 8745
 			$sql .= " WHERE 1=1";
8746 8746
 			if (isset($objecttmp->ismultientitymanaged)) {
8747 8747
 				if ($objecttmp->ismultientitymanaged == 1) {
8748
-					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
8748
+					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
8749 8749
 				}
8750 8750
 				if (!is_numeric($objecttmp->ismultientitymanaged)) {
8751
-					$sql .= " AND parenttable.entity = t." . $this->db->sanitize($tmparray[0]);
8751
+					$sql .= " AND parenttable.entity = t.".$this->db->sanitize($tmparray[0]);
8752 8752
 				}
8753 8753
 				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
8754 8754
 					if ($objecttmp->element == 'societe') {
8755
-						$sql .= " AND t.rowid = " . ((int) $user->socid);
8755
+						$sql .= " AND t.rowid = ".((int) $user->socid);
8756 8756
 					} else {
8757
-						$sql .= " AND t.fk_soc = " . ((int) $user->socid);
8757
+						$sql .= " AND t.fk_soc = ".((int) $user->socid);
8758 8758
 					}
8759 8759
 				}
8760 8760
 				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8761 8761
 					if (!$user->hasRight('societe', 'client', 'voir')) {
8762
-						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
8762
+						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
8763 8763
 					}
8764 8764
 				}
8765 8765
 			}
8766 8766
 			$splittedfieldstoshow = explode(',', $fieldstoshow);
8767 8767
 			foreach ($splittedfieldstoshow as &$field2) {
8768
-				if (is_numeric($pos=strpos($field2, ' '))) {
8768
+				if (is_numeric($pos = strpos($field2, ' '))) {
8769 8769
 					$field2 = substr($field2, 0, $pos);
8770 8770
 				}
8771 8771
 			}
@@ -8777,7 +8777,7 @@  discard block
 block discarded – undo
8777 8777
 				$errormessage = '';
8778 8778
 				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
8779 8779
 				if ($errormessage) {
8780
-					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;
8780
+					return 'Error forging a SQL request from an universal criteria: '.$errormessage;
8781 8781
 				}
8782 8782
 			}
8783 8783
 		}
@@ -8789,7 +8789,7 @@  discard block
 block discarded – undo
8789 8789
 		$resql = $this->db->query($sql);
8790 8790
 		if ($resql) {
8791 8791
 			// Construct $out and $outarray
8792
-			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
8792
+			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
8793 8793
 
8794 8794
 			// 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
8795 8795
 			$textifempty = '&nbsp;';
@@ -8803,7 +8803,7 @@  discard block
 block discarded – undo
8803 8803
 				}
8804 8804
 			}
8805 8805
 			if ($showempty) {
8806
-				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
8806
+				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";
8807 8807
 			}
8808 8808
 
8809 8809
 			$num = $this->db->num_rows($resql);
@@ -8826,9 +8826,9 @@  discard block
 block discarded – undo
8826 8826
 					}
8827 8827
 					if (empty($outputmode)) {
8828 8828
 						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
8829
-							$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>';
8829
+							$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>';
8830 8830
 						} else {
8831
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8831
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8832 8832
 						}
8833 8833
 					} else {
8834 8834
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -8841,10 +8841,10 @@  discard block
 block discarded – undo
8841 8841
 				}
8842 8842
 			}
8843 8843
 
8844
-			$out .= '</select>' . "\n";
8844
+			$out .= '</select>'."\n";
8845 8845
 
8846 8846
 			if (!$forcecombo) {
8847
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8847
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8848 8848
 				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));
8849 8849
 			}
8850 8850
 		} else {
@@ -8908,8 +8908,8 @@  discard block
 block discarded – undo
8908 8908
 			}
8909 8909
 		}
8910 8910
 		$idname = str_replace(array('[', ']'), array('', ''), $htmlname);
8911
-		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"';
8912
-		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
8911
+		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"';
8912
+		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
8913 8913
 		$out .= '>'."\n";
8914 8914
 
8915 8915
 		if ($show_empty) {
@@ -8920,7 +8920,7 @@  discard block
 block discarded – undo
8920 8920
 			if (!is_numeric($show_empty)) {
8921 8921
 				$textforempty = $show_empty;
8922 8922
 			}
8923
-			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
8923
+			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
8924 8924
 		}
8925 8925
 		if (is_array($array)) {
8926 8926
 			// Translate
@@ -8945,7 +8945,7 @@  discard block
 block discarded – undo
8945 8945
 					$value = $tmpvalue['label'];
8946 8946
 					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];
8947 8947
 					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';
8948
-					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';
8948
+					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';
8949 8949
 				} else {
8950 8950
 					$value = $tmpvalue;
8951 8951
 					//$valuehtml = $tmpvalue;
@@ -8961,9 +8961,9 @@  discard block
 block discarded – undo
8961 8961
 				}
8962 8962
 				if ($key_in_label) {
8963 8963
 					if (empty($nohtmlescape)) {
8964
-						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
8964
+						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
8965 8965
 					} else {
8966
-						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
8966
+						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
8967 8967
 					}
8968 8968
 				} else {
8969 8969
 					if (empty($nohtmlescape)) {
@@ -8975,8 +8975,8 @@  discard block
 block discarded – undo
8975 8975
 						$selectOptionValue = '&nbsp;';
8976 8976
 					}
8977 8977
 				}
8978
-				$out .= '<option value="' . $key . '"';
8979
-				$out .= $style . $disabled;
8978
+				$out .= '<option value="'.$key.'"';
8979
+				$out .= $style.$disabled;
8980 8980
 				if (is_array($id)) {
8981 8981
 					if (in_array($key, $id) && !$disabled) {
8982 8982
 						$out .= ' selected'; // To preselect a value
@@ -8988,7 +8988,7 @@  discard block
 block discarded – undo
8988 8988
 					}
8989 8989
 				}
8990 8990
 				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content.
8991
-					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';
8991
+					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
8992 8992
 				}
8993 8993
 
8994 8994
 				if (is_array($tmpvalue)) {
@@ -9011,7 +9011,7 @@  discard block
 block discarded – undo
9011 9011
 		// Add code for jquery to use multiselect
9012 9012
 		if ($addjscombo && $jsbeautify) {
9013 9013
 			// Enhance with select2
9014
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
9014
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
9015 9015
 			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);
9016 9016
 		}
9017 9017
 
@@ -9039,28 +9039,28 @@  discard block
 block discarded – undo
9039 9039
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
9040 9040
 	{
9041 9041
 		global $conf, $langs;
9042
-		global $delayedhtmlcontent;    // Will be used later outside of this function
9042
+		global $delayedhtmlcontent; // Will be used later outside of this function
9043 9043
 
9044 9044
 		// TODO Use an internal dolibarr component instead of select2
9045 9045
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
9046 9046
 			return '';
9047 9047
 		}
9048 9048
 
9049
-		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
9049
+		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
9050 9050
 
9051 9051
 		$outdelayed = '';
9052 9052
 		if (!empty($conf->use_javascript_ajax)) {
9053 9053
 			$tmpplugin = 'select2';
9054
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
9055
-		    	<script nonce="' . getNonce() . '">
9054
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
9055
+		    	<script nonce="' . getNonce().'">
9056 9056
 		    	$(document).ready(function () {
9057 9057
 
9058
-	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
9058
+	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
9059 9059
 
9060
-	                $(".' . $htmlname . '").select2({
9060
+	                $(".' . $htmlname.'").select2({
9061 9061
 				    	ajax: {
9062 9062
 					    	dir: "ltr",
9063
-					    	url: "' . $url . '",
9063
+					    	url: "' . $url.'",
9064 9064
 					    	dataType: \'json\',
9065 9065
 					    	delay: 250,
9066 9066
 					    	data: function (params) {
@@ -9087,9 +9087,9 @@  discard block
 block discarded – undo
9087 9087
 				    	},
9088 9088
 		 				language: select2arrayoflanguage,
9089 9089
 						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
9090
-					    placeholder: "' . dol_escape_js($placeholder) . '",
9090
+					    placeholder: "' . dol_escape_js($placeholder).'",
9091 9091
 				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
9092
-				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',
9092
+				    	minimumInputLength: ' . ((int) $minimumInputLength).',
9093 9093
 				        formatResult: function (result, container, query, escapeMarkup) {
9094 9094
 	                        return escapeMarkup(result.text);
9095 9095
 	                    },
@@ -9097,10 +9097,10 @@  discard block
 block discarded – undo
9097 9097
 
9098 9098
 	                ' . ($callurlonselect ? '
9099 9099
 	                /* Code to execute a GET when we select a value */
9100
-	                $(".' . $htmlname . '").change(function() {
9101
-				    	var selected = $(".' . $htmlname . '").val();
9100
+	                $(".' . $htmlname.'").change(function() {
9101
+				    	var selected = $(".' . $htmlname.'").val();
9102 9102
 	                	console.log("We select in selectArrayAjax the entry "+selected)
9103
-				        $(".' . $htmlname . '").val("");  /* reset visible combo value */
9103
+				        $(".' . $htmlname.'").val("");  /* reset visible combo value */
9104 9104
 	    			    $.each( saveRemoteData, function( key, value ) {
9105 9105
 	    				        if (key == selected)
9106 9106
 	    			            {
@@ -9108,7 +9108,7 @@  discard block
 block discarded – undo
9108 9108
 	    			                 location.assign(value.url);
9109 9109
 	    			            }
9110 9110
 	                    });
9111
-	    			});' : '') . '
9111
+	    			});' : '').'
9112 9112
 
9113 9113
 	    	   });
9114 9114
 		       </script>';
@@ -9144,14 +9144,14 @@  discard block
 block discarded – undo
9144 9144
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
9145 9145
 	{
9146 9146
 		global $conf, $langs;
9147
-		global $delayedhtmlcontent;    // Will be used later outside of this function
9147
+		global $delayedhtmlcontent; // Will be used later outside of this function
9148 9148
 
9149 9149
 		// TODO Use an internal dolibarr component instead of select2
9150 9150
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
9151 9151
 			return '';
9152 9152
 		}
9153 9153
 
9154
-		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
9154
+		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
9155 9155
 
9156 9156
 		$formattedarrayresult = array();
9157 9157
 
@@ -9166,20 +9166,20 @@  discard block
 block discarded – undo
9166 9166
 		$outdelayed = '';
9167 9167
 		if (!empty($conf->use_javascript_ajax)) {
9168 9168
 			$tmpplugin = 'select2';
9169
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
9170
-				<script nonce="' . getNonce() . '">
9169
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
9170
+				<script nonce="' . getNonce().'">
9171 9171
 				$(document).ready(function () {
9172
-					var data = ' . json_encode($formattedarrayresult) . ';
9172
+					var data = ' . json_encode($formattedarrayresult).';
9173 9173
 
9174
-					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
9174
+					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
9175 9175
 
9176
-					$(".' . $htmlname . '").select2({
9176
+					$(".' . $htmlname.'").select2({
9177 9177
 						data: data,
9178 9178
 						language: select2arrayoflanguage,
9179 9179
 						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
9180
-						placeholder: "' . dol_escape_js($placeholder) . '",
9180
+						placeholder: "' . dol_escape_js($placeholder).'",
9181 9181
 						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
9182
-						minimumInputLength: ' . $minimumInputLength . ',
9182
+						minimumInputLength: ' . $minimumInputLength.',
9183 9183
 						formatResult: function (result, container, query, escapeMarkup) {
9184 9184
 							return escapeMarkup(result.text);
9185 9185
 						},
@@ -9218,11 +9218,11 @@  discard block
 block discarded – undo
9218 9218
 
9219 9219
 					' . ($callurlonselect ? '
9220 9220
 					/* Code to execute a GET when we select a value */
9221
-					$(".' . $htmlname . '").change(function() {
9222
-						var selected = $(".' . $htmlname . '").val();
9221
+					$(".' . $htmlname.'").change(function() {
9222
+						var selected = $(".' . $htmlname.'").val();
9223 9223
 						console.log("We select "+selected)
9224 9224
 
9225
-						$(".' . $htmlname . '").val("");  /* reset visible combo value */
9225
+						$(".' . $htmlname.'").val("");  /* reset visible combo value */
9226 9226
 						$.each( saveRemoteData, function( key, value ) {
9227 9227
 							if (key == selected)
9228 9228
 							{
@@ -9230,7 +9230,7 @@  discard block
 block discarded – undo
9230 9230
 								location.assign(value.url);
9231 9231
 							}
9232 9232
 						});
9233
-					});' : '') . '
9233
+					});' : '').'
9234 9234
 
9235 9235
 				});
9236 9236
 				</script>';
@@ -9278,7 +9278,7 @@  discard block
 block discarded – undo
9278 9278
 		$useenhancedmultiselect = 0;
9279 9279
 		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
9280 9280
 			if ($addjscombo) {
9281
-				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0.
9281
+				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.
9282 9282
 			}
9283 9283
 		}
9284 9284
 
@@ -9287,7 +9287,7 @@  discard block
 block discarded – undo
9287 9287
 		// submitted to nothing.
9288 9288
 		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';
9289 9289
 		// Output select component
9290
-		$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";
9290
+		$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";
9291 9291
 		if (is_array($array) && !empty($array)) {
9292 9292
 			if ($value_as_key) {
9293 9293
 				$array = array_combine($array, $array);
@@ -9308,33 +9308,33 @@  discard block
 block discarded – undo
9308 9308
 						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml'];
9309 9309
 					}
9310 9310
 					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
9311
-					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
9311
+					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
9312 9312
 
9313
-					$out .= '<option value="' . $tmpkey . '"';
9313
+					$out .= '<option value="'.$tmpkey.'"';
9314 9314
 					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
9315 9315
 						$out .= ' selected';
9316 9316
 					}
9317 9317
 					if (!empty($tmplabelhtml)) {
9318
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9318
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9319 9319
 					} else {
9320
-						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
9321
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9320
+						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval;
9321
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9322 9322
 					}
9323 9323
 					$out .= '>';
9324 9324
 					$out .= dol_htmlentitiesbr($newval);
9325
-					$out .= '</option>' . "\n";
9325
+					$out .= '</option>'."\n";
9326 9326
 				}
9327 9327
 			}
9328 9328
 		}
9329
-		$out .= '</select>' . "\n";
9329
+		$out .= '</select>'."\n";
9330 9330
 
9331 9331
 		// Add code for jquery to use multiselect
9332 9332
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
9333
-			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
9334
-			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
9333
+			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
9334
+			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";
9335 9335
 			if ($addjscombo == 1) {
9336 9336
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
9337
-				$out .= 'function formatResult(record, container) {' . "\n";
9337
+				$out .= 'function formatResult(record, container) {'."\n";
9338 9338
 				// If property data-html set, we decode html entities and use this.
9339 9339
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
9340 9340
 				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {';
@@ -9342,26 +9342,26 @@  discard block
 block discarded – undo
9342 9342
 				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));';
9343 9343
 				$out .= '	}'."\n";
9344 9344
 				$out .= '	return record.text;';
9345
-				$out .= '}' . "\n";
9346
-				$out .= 'function formatSelection(record) {' . "\n";
9345
+				$out .= '}'."\n";
9346
+				$out .= 'function formatSelection(record) {'."\n";
9347 9347
 				if ($elemtype == 'category') {
9348
-					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9348
+					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9349 9349
 				} else {
9350 9350
 					$out .= 'return record.text;';
9351 9351
 				}
9352
-				$out .= '}' . "\n";
9352
+				$out .= '}'."\n";
9353 9353
 				$out .= '$(document).ready(function () {
9354
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
9354
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({';
9355 9355
 				if ($placeholder) {
9356 9356
 					$out .= '
9357 9357
 								placeholder: {
9358 9358
 								    id: \'-1\',
9359
-								    text: \'' . dol_escape_js($placeholder) . '\'
9359
+								    text: \'' . dol_escape_js($placeholder).'\'
9360 9360
 								  },';
9361 9361
 				}
9362 9362
 				$out .= '		dir: \'ltr\',
9363 9363
 								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
9364
-								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9364
+								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9365 9365
 								// Specify format function for dropdown item
9366 9366
 								formatResult: formatResult,
9367 9367
 							 	templateResult: formatResult,		/* For 4.0 */
@@ -9373,21 +9373,21 @@  discard block
 block discarded – undo
9373 9373
 
9374 9374
 							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
9375 9375
 								 the size only if component is not hidden by default on load */
9376
-							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
9376
+							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');
9377 9377
 						});' . "\n";
9378 9378
 			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
9379 9379
 				// Add other js lib
9380 9380
 				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
9381 9381
 				// ...
9382
-				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
9382
+				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';
9383 9383
 				$out .= '$(document).ready(function () {
9384
-							$(\'#' . $htmlname . '\').multiSelect({
9384
+							$(\'#' . $htmlname.'\').multiSelect({
9385 9385
 								containerHTML: \'<div class="multi-select-container">\',
9386 9386
 								menuHTML: \'<div class="multi-select-menu">\',
9387
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
9387
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
9388 9388
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
9389 9389
 								activeClass: \'multi-select-container--open\',
9390
-								noneText: \'' . $placeholder . '\'
9390
+								noneText: \'' . $placeholder.'\'
9391 9391
 							});
9392 9392
 						})';
9393 9393
 			}
@@ -9420,7 +9420,7 @@  discard block
 block discarded – undo
9420 9420
 			return '';
9421 9421
 		}
9422 9422
 
9423
-		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show
9423
+		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
9424 9424
 
9425 9425
 		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user
9426 9426
 			$tmparray = explode(',', $user->conf->$tmpvar);
@@ -9463,19 +9463,19 @@  discard block
 block discarded – undo
9463 9463
 				}
9464 9464
 
9465 9465
 				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
9466
-				$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>';
9467
-				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
9466
+				$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>';
9467
+				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
9468 9468
 			}
9469 9469
 		}
9470 9470
 
9471
-		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
9471
+		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
9472 9472
 
9473 9473
         <dl class="dropdown">
9474 9474
             <dt>
9475
-            <a href="#' . $htmlname . '">
9476
-              ' . img_picto('', 'list') . '
9475
+            <a href="#' . $htmlname.'">
9476
+              ' . img_picto('', 'list').'
9477 9477
             </a>
9478
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
9478
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
9479 9479
             </dt>
9480 9480
             <dd class="dropdowndd">
9481 9481
                 <div class="multiselectcheckbox'.$htmlname.'">
@@ -9487,19 +9487,19 @@  discard block
 block discarded – undo
9487 9487
             </dd>
9488 9488
         </dl>
9489 9489
 
9490
-        <script nonce="' . getNonce() . '" type="text/javascript">
9490
+        <script nonce="' . getNonce().'" type="text/javascript">
9491 9491
           jQuery(document).ready(function () {
9492
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
9492
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
9493 9493
                   console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
9494 9494
 
9495 9495
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST
9496 9496
 
9497 9497
                   var title = $(this).val() + ",";
9498 9498
                   if ($(this).is(\':checked\')) {
9499
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
9499
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
9500 9500
                   }
9501 9501
                   else {
9502
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
9502
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
9503 9503
                   }
9504 9504
                   // Now, we submit page
9505 9505
                   //$(this).parents(\'form:first\').submit();
@@ -9530,7 +9530,7 @@  discard block
 block discarded – undo
9530 9530
 	 */
9531 9531
 	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
9532 9532
 	{
9533
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
9533
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
9534 9534
 
9535 9535
 		$cat = new Categorie($this->db);
9536 9536
 		$categories = $cat->containing($id, $type);
@@ -9540,13 +9540,13 @@  discard block
 block discarded – undo
9540 9540
 			foreach ($categories as $c) {
9541 9541
 				$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
9542 9542
 				foreach ($ways as $way) {
9543
-					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
9543
+					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
9544 9544
 				}
9545 9545
 			}
9546 9546
 			if (empty($toprint)) {
9547 9547
 				return '';
9548 9548
 			} else {
9549
-				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
9549
+				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
9550 9550
 			}
9551 9551
 		}
9552 9552
 
@@ -9595,15 +9595,15 @@  discard block
 block discarded – undo
9595 9595
 
9596 9596
 
9597 9597
 			print '<div class="div-table-responsive-no-min">';
9598
-			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
9598
+			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
9599 9599
 
9600 9600
 			print '<tr class="liste_titre">';
9601
-			print '<td>' . $langs->trans("Type") . '</td>';
9602
-			print '<td>' . $langs->trans("Ref") . '</td>';
9601
+			print '<td>'.$langs->trans("Type").'</td>';
9602
+			print '<td>'.$langs->trans("Ref").'</td>';
9603 9603
 			print '<td class="center"></td>';
9604
-			print '<td class="center">' . $langs->trans("Date") . '</td>';
9605
-			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9606
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
9604
+			print '<td class="center">'.$langs->trans("Date").'</td>';
9605
+			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9606
+			print '<td class="right">'.$langs->trans("Status").'</td>';
9607 9607
 			print '<td></td>';
9608 9608
 			print '</tr>';
9609 9609
 
@@ -9622,13 +9622,13 @@  discard block
 block discarded – undo
9622 9622
 				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
9623 9623
 					$element = $regs[1];
9624 9624
 					$subelement = $regs[2];
9625
-					$tplpath = $element . '/' . $subelement;
9625
+					$tplpath = $element.'/'.$subelement;
9626 9626
 				}
9627 9627
 				$tplname = 'linkedobjectblock';
9628 9628
 
9629 9629
 				// To work with non standard path
9630 9630
 				if ($objecttype == 'facture') {
9631
-					$tplpath = 'compta/' . $element;
9631
+					$tplpath = 'compta/'.$element;
9632 9632
 					if (!isModEnabled('invoice')) {
9633 9633
 						continue; // Do not show if module disabled
9634 9634
 					}
@@ -9639,7 +9639,7 @@  discard block
 block discarded – undo
9639 9639
 						continue; // Do not show if module disabled
9640 9640
 					}
9641 9641
 				} elseif ($objecttype == 'propal') {
9642
-					$tplpath = 'comm/' . $element;
9642
+					$tplpath = 'comm/'.$element;
9643 9643
 					if (!isModEnabled('propal')) {
9644 9644
 						continue; // Do not show if module disabled
9645 9645
 					}
@@ -9692,7 +9692,7 @@  discard block
 block discarded – undo
9692 9692
 				$linkedObjectBlock = $objects;
9693 9693
 
9694 9694
 				// Output template part (modules that overwrite templates must declare this into descriptor)
9695
-				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
9695
+				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
9696 9696
 				foreach ($dirtpls as $reldir) {
9697 9697
 					$reldir = rtrim($reldir, '/');
9698 9698
 					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
@@ -9700,7 +9700,7 @@  discard block
 block discarded – undo
9700 9700
 						$noMoreLinkedObjectBlockAfter = 1;
9701 9701
 					}
9702 9702
 
9703
-					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
9703
+					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
9704 9704
 					if ($res) {
9705 9705
 						$nboftypesoutput++;
9706 9706
 						break;
@@ -9709,7 +9709,7 @@  discard block
 block discarded – undo
9709 9709
 			}
9710 9710
 
9711 9711
 			if (!$nboftypesoutput) {
9712
-				print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
9712
+				print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
9713 9713
 			}
9714 9714
 
9715 9715
 			print '</table>';
@@ -9757,14 +9757,14 @@  discard block
 block discarded – undo
9757 9757
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
9758 9758
 			$listofidcompanytoscan = (int) $object->thirdparty->id;
9759 9759
 			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) {
9760
-				$listofidcompanytoscan .= ',' . (int) $object->thirdparty->parent;
9760
+				$listofidcompanytoscan .= ','.(int) $object->thirdparty->parent;
9761 9761
 			}
9762 9762
 			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) {
9763
-				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
9763
+				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
9764 9764
 				$tmpproject = new Project($this->db);
9765 9765
 				$tmpproject->fetch($object->fk_project);
9766 9766
 				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
9767
-					$listofidcompanytoscan .= ',' . (int) $tmpproject->socid;
9767
+					$listofidcompanytoscan .= ','.(int) $tmpproject->socid;
9768 9768
 				}
9769 9769
 				unset($tmpproject);
9770 9770
 			}
@@ -9774,75 +9774,75 @@  discard block
 block discarded – undo
9774 9774
 					'enabled' => isModEnabled('propal'),
9775 9775
 					'perms' => 1,
9776 9776
 					'label' => 'LinkToProposal',
9777
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''),
9777
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''),
9778 9778
 				),
9779 9779
 				'shipping' => array(
9780 9780
 					'enabled' => isModEnabled('shipping'),
9781 9781
 					'perms' => 1,
9782 9782
 					'label' => 'LinkToExpedition',
9783
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : ''),
9783
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : ''),
9784 9784
 				),
9785 9785
 				'order' => array(
9786 9786
 					'enabled' => isModEnabled('order'),
9787 9787
 					'perms' => 1,
9788 9788
 					'label' => 'LinkToOrder',
9789
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : ''),
9789
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : ''),
9790 9790
 					'linkname' => 'commande',
9791 9791
 				),
9792 9792
 				'invoice' => array(
9793 9793
 					'enabled' => isModEnabled('invoice'),
9794 9794
 					'perms' => 1,
9795 9795
 					'label' => 'LinkToInvoice',
9796
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9796
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9797 9797
 					'linkname' => 'facture',
9798 9798
 				),
9799 9799
 				'invoice_template' => array(
9800 9800
 					'enabled' => isModEnabled('invoice'),
9801 9801
 					'perms' => 1,
9802 9802
 					'label' => 'LinkToTemplateInvoice',
9803
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9803
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9804 9804
 				),
9805 9805
 				'contrat' => array(
9806 9806
 					'enabled' => isModEnabled('contract'),
9807 9807
 					'perms' => 1,
9808 9808
 					'label' => 'LinkToContract',
9809 9809
 					'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
9810
-							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',
9810
+							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',
9811 9811
 				),
9812 9812
 				'fichinter' => array(
9813 9813
 					'enabled' => isModEnabled('intervention'),
9814 9814
 					'perms' => 1,
9815 9815
 					'label' => 'LinkToIntervention',
9816
-					'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') . ')',
9816
+					'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').')',
9817 9817
 				),
9818 9818
 				'supplier_proposal' => array(
9819 9819
 					'enabled' => isModEnabled('supplier_proposal'),
9820 9820
 					'perms' => 1,
9821 9821
 					'label' => 'LinkToSupplierProposal',
9822
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''),
9822
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''),
9823 9823
 				),
9824 9824
 				'order_supplier' => array(
9825 9825
 					'enabled' => isModEnabled("supplier_order"),
9826 9826
 					'perms' => 1,
9827 9827
 					'label' => 'LinkToSupplierOrder',
9828
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : ''),
9828
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : ''),
9829 9829
 				),
9830 9830
 				'invoice_supplier' => array(
9831 9831
 					'enabled' => isModEnabled("supplier_invoice"),
9832 9832
 					'perms' => 1, 'label' => 'LinkToSupplierInvoice',
9833
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9833
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9834 9834
 				),
9835 9835
 				'ticket' => array(
9836 9836
 					'enabled' => isModEnabled('ticket'),
9837 9837
 					'perms' => 1,
9838 9838
 					'label' => 'LinkToTicket',
9839
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : ''),
9839
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : ''),
9840 9840
 				),
9841 9841
 				'mo' => array(
9842 9842
 					'enabled' => isModEnabled('mrp'),
9843 9843
 					'perms' => 1,
9844 9844
 					'label' => 'LinkToMo',
9845
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''),
9845
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''),
9846 9846
 				),
9847 9847
 			);
9848 9848
 		}
@@ -9884,23 +9884,23 @@  discard block
 block discarded – undo
9884 9884
 			}
9885 9885
 
9886 9886
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
9887
-				$htmltoenteralink .= '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
9887
+				$htmltoenteralink .= '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
9888 9888
 
9889 9889
 				// Section for free ref input
9890 9890
 				if (!getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
9891 9891
 					$htmltoenteralink .= '<br>'."\n";
9892 9892
 					$htmltoenteralink .= '<!-- form to add a link from anywhere -->'."\n";
9893
-					$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
9894
-					$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">';
9893
+					$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
9894
+					$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">';
9895 9895
 					$htmltoenteralink .= '<input type="hidden" name="action" value="addlinkbyref">';
9896
-					$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">';
9897
-					$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">';
9896
+					$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">';
9897
+					$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">';
9898 9898
 					$htmltoenteralink .= '<table class="noborder">';
9899 9899
 					$htmltoenteralink .= '<tr class="liste_titre">';
9900 9900
 					//print '<td>' . $langs->trans("Ref") . '</td>';
9901
-					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
9902
-					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
9903
-					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
9901
+					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;';
9902
+					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;';
9903
+					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
9904 9904
 					$htmltoenteralink .= '</tr>';
9905 9905
 					$htmltoenteralink .= '</table>';
9906 9906
 					$htmltoenteralink .= '</form>';
@@ -9919,18 +9919,18 @@  discard block
 block discarded – undo
9919 9919
 							$htmltoenteralink .= '<br>';
9920 9920
 						}
9921 9921
 						$htmltoenteralink .= '<!-- form to add a link from object to same thirdparty -->'."\n";
9922
-						$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
9923
-						$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">';
9922
+						$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
9923
+						$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">';
9924 9924
 						$htmltoenteralink .= '<input type="hidden" name="action" value="addlink">';
9925
-						$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">';
9926
-						$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">';
9925
+						$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">';
9926
+						$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">';
9927 9927
 						$htmltoenteralink .= '<table class="noborder">';
9928 9928
 						$htmltoenteralink .= '<tr class="liste_titre">';
9929 9929
 						$htmltoenteralink .= '<td class="nowrap"></td>';
9930
-						$htmltoenteralink .= '<td>' . $langs->trans("Ref") . '</td>';
9931
-						$htmltoenteralink .= '<td>' . $langs->trans("RefCustomer") . '</td>';
9932
-						$htmltoenteralink .= '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9933
-						$htmltoenteralink .= '<td>' . $langs->trans("Company") . '</td>';
9930
+						$htmltoenteralink .= '<td>'.$langs->trans("Ref").'</td>';
9931
+						$htmltoenteralink .= '<td>'.$langs->trans("RefCustomer").'</td>';
9932
+						$htmltoenteralink .= '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9933
+						$htmltoenteralink .= '<td>'.$langs->trans("Company").'</td>';
9934 9934
 						$htmltoenteralink .= '</tr>';
9935 9935
 						while ($i < $num) {
9936 9936
 							$objp = $this->db->fetch_object($resqllist);
@@ -9945,30 +9945,30 @@  discard block
 block discarded – undo
9945 9945
 							if ($alreadylinked) {
9946 9946
 								$htmltoenteralink .= img_picto('', 'link');
9947 9947
 							} else {
9948
-								$htmltoenteralink .= '<input type="checkbox" name="idtolinkto[' . $key . '_' . $objp->rowid . ']" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';
9948
+								$htmltoenteralink .= '<input type="checkbox" name="idtolinkto['.$key.'_'.$objp->rowid.']" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
9949 9949
 							}
9950 9950
 							$htmltoenteralink .= '</td>';
9951
-							$htmltoenteralink .= '<td><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';
9952
-							$htmltoenteralink .= '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';
9951
+							$htmltoenteralink .= '<td><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
9952
+							$htmltoenteralink .= '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';
9953 9953
 							$htmltoenteralink .= '<td class="right">';
9954 9954
 							if ($possiblelink['label'] == 'LinkToContract') {
9955
-								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' ';
9955
+								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
9956 9956
 							}
9957
-							$htmltoenteralink .= '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';
9957
+							$htmltoenteralink .= '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
9958 9958
 							$htmltoenteralink .= '</td>';
9959
-							$htmltoenteralink .= '<td>' . $objp->name . '</td>';
9959
+							$htmltoenteralink .= '<td>'.$objp->name.'</td>';
9960 9960
 							$htmltoenteralink .= '</tr>';
9961 9961
 							$i++;
9962 9962
 						}
9963 9963
 						$htmltoenteralink .= '</table>';
9964 9964
 						$htmltoenteralink .= '<div class="center">';
9965 9965
 						if ($num) {
9966
-							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="' . $langs->trans('ToLink') . '">';
9966
+							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="'.$langs->trans('ToLink').'">';
9967 9967
 						}
9968 9968
 						if (empty($conf->use_javascript_ajax)) {
9969
-							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9969
+							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9970 9970
 						} else {
9971
-							$htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9971
+							$htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9972 9972
 						}
9973 9973
 						$htmltoenteralink .= '</form>';
9974 9974
 					}
@@ -9982,10 +9982,10 @@  discard block
 block discarded – undo
9982 9982
 
9983 9983
 				// Complete the list for the combo box
9984 9984
 				if ($num > 0 || !getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
9985
-					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
9985
+					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
9986 9986
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
9987 9987
 				} else {
9988
-					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
9988
+					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
9989 9989
 				}
9990 9990
 			}
9991 9991
 		}
@@ -9995,11 +9995,11 @@  discard block
 block discarded – undo
9995 9995
 			<dl class="dropdown" id="linktoobjectname">
9996 9996
 			';
9997 9997
 			if (!empty($conf->use_javascript_ajax)) {
9998
-				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>';
9998
+				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
9999 9999
 			}
10000 10000
 			$linktoelem .= '<dd>
10001 10001
 			<div class="multiselectlinkto">
10002
-			<ul class="ulselectedfields">' . $linktoelemlist . '
10002
+			<ul class="ulselectedfields">' . $linktoelemlist.'
10003 10003
 			</ul>
10004 10004
 			</div>
10005 10005
 			</dd>
@@ -10010,7 +10010,7 @@  discard block
 block discarded – undo
10010 10010
 
10011 10011
 		if (!empty($conf->use_javascript_ajax)) {
10012 10012
 			print '<!-- Add js to show linkto box -->
10013
-				<script nonce="' . getNonce() . '">
10013
+				<script nonce="' . getNonce().'">
10014 10014
 				jQuery(document).ready(function() {
10015 10015
 					jQuery(".linkto").click(function() {
10016 10016
 						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list");
@@ -10057,19 +10057,19 @@  discard block
 block discarded – undo
10057 10057
 
10058 10058
 		$disabled = ($disabled ? ' disabled' : '');
10059 10059
 
10060
-		$resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
10060
+		$resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
10061 10061
 		if ($useempty) {
10062
-			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10062
+			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
10063 10063
 		}
10064 10064
 		if (("$value" == 'yes') || ($value == 1)) {
10065
-			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";
10066
-			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";
10065
+			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
10066
+			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
10067 10067
 		} else {
10068 10068
 			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
10069
-			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";
10070
-			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";
10069
+			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
10070
+			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
10071 10071
 		}
10072
-		$resultyesno .= '</select>' . "\n";
10072
+		$resultyesno .= '</select>'."\n";
10073 10073
 
10074 10074
 		if ($addjscombo) {
10075 10075
 			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
@@ -10093,12 +10093,12 @@  discard block
 block discarded – undo
10093 10093
 	{
10094 10094
 		// phpcs:enable
10095 10095
 		$sql = "SELECT rowid, label";
10096
-		$sql .= " FROM " . $this->db->prefix() . "export_model";
10097
-		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";
10096
+		$sql .= " FROM ".$this->db->prefix()."export_model";
10097
+		$sql .= " WHERE type = '".$this->db->escape($type)."'";
10098 10098
 		$sql .= " ORDER BY rowid";
10099 10099
 		$result = $this->db->query($sql);
10100 10100
 		if ($result) {
10101
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
10101
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
10102 10102
 			if ($useempty) {
10103 10103
 				print '<option value="-1">&nbsp;</option>';
10104 10104
 			}
@@ -10108,9 +10108,9 @@  discard block
 block discarded – undo
10108 10108
 			while ($i < $num) {
10109 10109
 				$obj = $this->db->fetch_object($result);
10110 10110
 				if ($selected == $obj->rowid) {
10111
-					print '<option value="' . $obj->rowid . '" selected>';
10111
+					print '<option value="'.$obj->rowid.'" selected>';
10112 10112
 				} else {
10113
-					print '<option value="' . $obj->rowid . '">';
10113
+					print '<option value="'.$obj->rowid.'">';
10114 10114
 				}
10115 10115
 				print $obj->label;
10116 10116
 				print '</option>';
@@ -10201,8 +10201,8 @@  discard block
 block discarded – undo
10201 10201
 				$stringforfirstkey .= ' CTL +';
10202 10202
 			}
10203 10203
 
10204
-			$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>';
10205
-			$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>';
10204
+			$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>';
10205
+			$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>';
10206 10206
 		}
10207 10207
 
10208 10208
 		//print "xx".$previous_ref."x".$next_ref;
@@ -10210,18 +10210,18 @@  discard block
 block discarded – undo
10210 10210
 
10211 10211
 		// Right part of banner
10212 10212
 		if ($morehtmlright) {
10213
-			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
10213
+			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
10214 10214
 		}
10215 10215
 
10216 10216
 		if ($previous_ref || $next_ref || $morehtml) {
10217 10217
 			$ret .= '<div class="pagination paginationref"><ul class="right">';
10218 10218
 		}
10219 10219
 		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
10220
-			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
10220
+			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
10221 10221
 		}
10222 10222
 		if ($shownav && ($previous_ref || $next_ref)) {
10223
-			$ret .= '<li class="pagination">' . $previous_ref . '</li>';
10224
-			$ret .= '<li class="pagination">' . $next_ref . '</li>';
10223
+			$ret .= '<li class="pagination">'.$previous_ref.'</li>';
10224
+			$ret .= '<li class="pagination">'.$next_ref.'</li>';
10225 10225
 		}
10226 10226
 		if ($previous_ref || $next_ref || $morehtml) {
10227 10227
 			$ret .= '</ul></div>';
@@ -10236,7 +10236,7 @@  discard block
 block discarded – undo
10236 10236
 			$morehtmlstatus = $hookmanager->resPrint;
10237 10237
 		}
10238 10238
 		if ($morehtmlstatus) {
10239
-			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
10239
+			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
10240 10240
 		}
10241 10241
 
10242 10242
 		$parameters = array();
@@ -10250,14 +10250,14 @@  discard block
 block discarded – undo
10250 10250
 		// Left part of banner
10251 10251
 		if ($morehtmlleft) {
10252 10252
 			if ($conf->browser->layout == 'phone') {
10253
-				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';
10253
+				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';
10254 10254
 			} else {
10255
-				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';
10255
+				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
10256 10256
 			}
10257 10257
 		}
10258 10258
 
10259 10259
 		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
10260
-		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
10260
+		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
10261 10261
 
10262 10262
 		// For thirdparty, contact, user, member, the ref is the id, so we show something else
10263 10263
 		if ($object->element == 'societe') {
@@ -10271,7 +10271,7 @@  discard block
 block discarded – undo
10271 10271
 
10272 10272
 			if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
10273 10273
 				if (!is_object($extralanguages)) {
10274
-					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
10274
+					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
10275 10275
 					$extralanguages = new ExtraLanguages($this->db);
10276 10276
 				}
10277 10277
 				$extralanguages->fetch_name_extralanguages('societe');
@@ -10286,21 +10286,21 @@  discard block
 block discarded – undo
10286 10286
 						if ($object->array_languages['name'][$extralangcode]) {
10287 10287
 							$htmltext .= $object->array_languages['name'][$extralangcode];
10288 10288
 						} else {
10289
-							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>';
10289
+							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>';
10290 10290
 						}
10291 10291
 					}
10292
-					$ret .= '<!-- Show translations of name -->' . "\n";
10292
+					$ret .= '<!-- Show translations of name -->'."\n";
10293 10293
 					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
10294 10294
 				}
10295 10295
 			}
10296 10296
 		} elseif ($object->element == 'member') {
10297 10297
 			'@phan-var-force Adherent $object';
10298
-			$ret .= $object->ref . '<br>';
10298
+			$ret .= $object->ref.'<br>';
10299 10299
 			$fullname = $object->getFullName($langs);
10300 10300
 			if ($object->morphy == 'mor' && $object->societe) {
10301
-				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
10301
+				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
10302 10302
 			} else {
10303
-				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
10303
+				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
10304 10304
 			}
10305 10305
 		} elseif (in_array($object->element, array('contact', 'user'))) {
10306 10306
 			$ret .= '<span class="valignmiddle">'.dol_htmlentities($object->getFullName($langs)).'</span>'.$addgendertxt;
@@ -10308,7 +10308,7 @@  discard block
 block discarded – undo
10308 10308
 			$ret .= dol_htmlentities($object->name);
10309 10309
 		} elseif (in_array($object->element, array('action', 'agenda'))) {
10310 10310
 			'@phan-var-force ActionComm $object';
10311
-			$ret .= $object->ref . '<br>' . $object->label;
10311
+			$ret .= $object->ref.'<br>'.$object->label;
10312 10312
 		} elseif (in_array($object->element, array('adherent_type'))) {
10313 10313
 			$ret .= $object->label;
10314 10314
 		} elseif ($object->element == 'ecm_directories') {
@@ -10361,9 +10361,9 @@  discard block
 block discarded – undo
10361 10361
 		}
10362 10362
 
10363 10363
 		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty
10364
-		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
10365
-		$out = '<!-- url barcode = ' . $url . ' -->';
10366
-		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';
10364
+		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
10365
+		$out = '<!-- url barcode = '.$url.' -->';
10366
+		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';
10367 10367
 
10368 10368
 		return $out;
10369 10369
 	}
@@ -10390,7 +10390,7 @@  discard block
 block discarded – undo
10390 10390
 		global $conf, $langs;
10391 10391
 
10392 10392
 		$entity = (empty($object->entity) ? $conf->entity : $object->entity);
10393
-		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10393
+		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10394 10394
 
10395 10395
 		$dir = '';
10396 10396
 		$file = '';
@@ -10403,28 +10403,28 @@  discard block
 block discarded – undo
10403 10403
 			if (!empty($object->logo)) {
10404 10404
 				if (dolIsAllowedForPreview($object->logo)) {
10405 10405
 					if ((string) $imagesize == 'mini') {
10406
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10406
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10407 10407
 					} elseif ((string) $imagesize == 'small') {
10408
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
10408
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');
10409 10409
 					} else {
10410
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10410
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10411 10411
 					}
10412
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10412
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10413 10413
 				}
10414 10414
 			}
10415 10415
 			$email = $object->email;
10416 10416
 		} elseif ($modulepart == 'contact') {
10417
-			$dir = $conf->societe->multidir_output[$entity] . '/contact';
10417
+			$dir = $conf->societe->multidir_output[$entity].'/contact';
10418 10418
 			if (!empty($object->photo)) {
10419 10419
 				if (dolIsAllowedForPreview($object->photo)) {
10420 10420
 					if ((string) $imagesize == 'mini') {
10421
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10421
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10422 10422
 					} elseif ((string) $imagesize == 'small') {
10423
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10423
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');
10424 10424
 					} else {
10425
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10425
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10426 10426
 					}
10427
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10427
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10428 10428
 				}
10429 10429
 			}
10430 10430
 			$email = $object->email;
@@ -10434,17 +10434,17 @@  discard block
 block discarded – undo
10434 10434
 			if (!empty($object->photo)) {
10435 10435
 				if (dolIsAllowedForPreview($object->photo)) {
10436 10436
 					if ((string) $imagesize == 'mini') {
10437
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10437
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10438 10438
 					} elseif ((string) $imagesize == 'small') {
10439
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10439
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
10440 10440
 					} else {
10441
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10441
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10442 10442
 					}
10443
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10443
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10444 10444
 				}
10445 10445
 			}
10446 10446
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10447
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10447
+				$altfile = $object->id.".jpg"; // For backward compatibility
10448 10448
 			}
10449 10449
 			$email = $object->email;
10450 10450
 			$capture = 'user';
@@ -10453,17 +10453,17 @@  discard block
 block discarded – undo
10453 10453
 			if (!empty($object->photo)) {
10454 10454
 				if (dolIsAllowedForPreview($object->photo)) {
10455 10455
 					if ((string) $imagesize == 'mini') {
10456
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10456
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10457 10457
 					} elseif ((string) $imagesize == 'small') {
10458
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10458
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
10459 10459
 					} else {
10460
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10460
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10461 10461
 					}
10462
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10462
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10463 10463
 				}
10464 10464
 			}
10465 10465
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10466
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10466
+				$altfile = $object->id.".jpg"; // For backward compatibility
10467 10467
 			}
10468 10468
 			$email = $object->email;
10469 10469
 			$capture = 'user';
@@ -10489,35 +10489,35 @@  discard block
 block discarded – undo
10489 10489
 		$ret = '';
10490 10490
 
10491 10491
 		if ($dir) {
10492
-			if ($file && file_exists($dir . "/" . $file)) {
10492
+			if ($file && file_exists($dir."/".$file)) {
10493 10493
 				if ($addlinktofullsize) {
10494
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10494
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10495 10495
 					if ($urladvanced) {
10496
-						$ret .= '<a href="' . $urladvanced . '">';
10496
+						$ret .= '<a href="'.$urladvanced.'">';
10497 10497
 					} else {
10498
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10498
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10499 10499
 					}
10500 10500
 				}
10501
-				$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 . '">';
10501
+				$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.'">';
10502 10502
 				if ($addlinktofullsize) {
10503 10503
 					$ret .= '</a>';
10504 10504
 				}
10505
-			} elseif ($altfile && file_exists($dir . "/" . $altfile)) {
10505
+			} elseif ($altfile && file_exists($dir."/".$altfile)) {
10506 10506
 				if ($addlinktofullsize) {
10507
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10507
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10508 10508
 					if ($urladvanced) {
10509
-						$ret .= '<a href="' . $urladvanced . '">';
10509
+						$ret .= '<a href="'.$urladvanced.'">';
10510 10510
 					} else {
10511
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10511
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10512 10512
 					}
10513 10513
 				}
10514
-				$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 . '">';
10514
+				$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.'">';
10515 10515
 				if ($addlinktofullsize) {
10516 10516
 					$ret .= '</a>';
10517 10517
 				}
10518 10518
 			} else {
10519 10519
 				$nophoto = '/public/theme/common/nophoto.png';
10520
-				$defaultimg = 'identicon';        // For gravatar
10520
+				$defaultimg = 'identicon'; // For gravatar
10521 10521
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found
10522 10522
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) {
10523 10523
 						$nophoto = 'company';
@@ -10535,13 +10535,13 @@  discard block
 block discarded – undo
10535 10535
 				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
10536 10536
 					// see https://gravatar.com/site/implement/images/php/
10537 10537
 					$ret .= '<!-- Put link to gravatar -->';
10538
-					$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
10538
+					$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
10539 10539
 				} else {
10540 10540
 					if ($nophoto == 'company') {
10541
-						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
10541
+						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>';
10542 10542
 						//$ret .= '<div class="difforspanimgright"></div>';
10543 10543
 					} else {
10544
-						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
10544
+						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
10545 10545
 					}
10546 10546
 				}
10547 10547
 			}
@@ -10552,15 +10552,15 @@  discard block
 block discarded – undo
10552 10552
 				}
10553 10553
 				$ret .= '<table class="nobordernopadding centpercent">';
10554 10554
 				if ($object->photo) {
10555
-					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>';
10555
+					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
10556 10556
 				}
10557 10557
 				$ret .= '<tr><td class="tdoverflow">';
10558 10558
 				$maxfilesizearray = getMaxFileSizeArray();
10559 10559
 				$maxmin = $maxfilesizearray['maxmin'];
10560 10560
 				if ($maxmin > 0) {
10561
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
10561
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
10562 10562
 				}
10563
-				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';
10563
+				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
10564 10564
 				$ret .= '</td></tr>';
10565 10565
 				$ret .= '</table>';
10566 10566
 			}
@@ -10614,38 +10614,38 @@  discard block
 block discarded – undo
10614 10614
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10615 10615
 			$sql .= ", e.label";
10616 10616
 		}
10617
-		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";
10617
+		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
10618 10618
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10619
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";
10619
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
10620 10620
 			if ($force_entity) {
10621
-				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";
10621
+				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
10622 10622
 			} else {
10623 10623
 				$sql .= " WHERE ug.entity IS NOT NULL";
10624 10624
 			}
10625 10625
 		} else {
10626
-			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";
10626
+			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";
10627 10627
 		}
10628 10628
 		if (is_array($exclude) && $excludeGroups) {
10629
-			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")";
10629
+			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")";
10630 10630
 		}
10631 10631
 		if (is_array($include) && $includeGroups) {
10632
-			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")";
10632
+			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")";
10633 10633
 		}
10634 10634
 		$sql .= " ORDER BY ug.nom ASC";
10635 10635
 
10636
-		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
10636
+		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
10637 10637
 		$resql = $this->db->query($sql);
10638 10638
 		if ($resql) {
10639 10639
 			// Enhance with select2
10640
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10640
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10641 10641
 
10642
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
10642
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
10643 10643
 
10644 10644
 			$num = $this->db->num_rows($resql);
10645 10645
 			$i = 0;
10646 10646
 			if ($num) {
10647 10647
 				if ($show_empty && !$multiple) {
10648
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10648
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
10649 10649
 				}
10650 10650
 
10651 10651
 				while ($i < $num) {
@@ -10658,11 +10658,11 @@  discard block
 block discarded – undo
10658 10658
 					$label = $obj->name;
10659 10659
 					$labelhtml = $obj->name;
10660 10660
 					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
10661
-						$label .= " (" . $obj->label . ")";
10662
-						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>';
10661
+						$label .= " (".$obj->label.")";
10662
+						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>';
10663 10663
 					}
10664 10664
 
10665
-					$out .= '<option value="' . $obj->rowid . '"';
10665
+					$out .= '<option value="'.$obj->rowid.'"';
10666 10666
 					if ($disableline) {
10667 10667
 						$out .= ' disabled';
10668 10668
 					}
@@ -10678,9 +10678,9 @@  discard block
 block discarded – undo
10678 10678
 				}
10679 10679
 			} else {
10680 10680
 				if ($show_empty) {
10681
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
10681
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
10682 10682
 				}
10683
-				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
10683
+				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
10684 10684
 			}
10685 10685
 			$out .= '</select>';
10686 10686
 
@@ -10724,25 +10724,25 @@  discard block
 block discarded – undo
10724 10724
 		$out = '';
10725 10725
 
10726 10726
 		if (!empty($conf->use_javascript_ajax)) {
10727
-			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';
10727
+			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';
10728 10728
 		}
10729
-		$out .= '<script nonce="' . getNonce() . '">
10729
+		$out .= '<script nonce="'.getNonce().'">
10730 10730
             $(document).ready(function() {
10731
-                $("#' . $cssclass . 's").click(function() {
10731
+                $("#' . $cssclass.'s").click(function() {
10732 10732
                     if($(this).is(\':checked\')){
10733
-                        console.log("We check all ' . $cssclass . ' and trigger the change method");
10734
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
10733
+                        console.log("We check all ' . $cssclass.' and trigger the change method");
10734
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
10735 10735
                     }
10736 10736
                     else
10737 10737
                     {
10738 10738
                         console.log("We uncheck all");
10739
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
10739
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
10740 10740
                     }' . "\n";
10741 10741
 		if ($calljsfunction) {
10742
-			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10742
+			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10743 10743
 		}
10744 10744
 		$out .= '         });
10745
-        	        $(".' . $cssclass . '").change(function() {
10745
+        	        $(".' . $cssclass.'").change(function() {
10746 10746
 					$(this).closest("tr").toggleClass("highlight", this.checked);
10747 10747
 				});
10748 10748
 		 	});
@@ -10787,67 +10787,67 @@  discard block
 block discarded – undo
10787 10787
 		global $langs, $user;
10788 10788
 
10789 10789
 		$out = '';
10790
-		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";
10791
-		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")";
10790
+		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
10791
+		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
10792 10792
 		if (!empty($excludeid)) {
10793
-			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")";
10793
+			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
10794 10794
 		}
10795 10795
 		$sql .= " ORDER BY label";
10796 10796
 
10797 10797
 		$resql = $this->db->query($sql);
10798 10798
 		if ($resql) {
10799
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';
10799
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
10800 10800
 			if ($useempty) {
10801 10801
 				$out .= '<option value="0">&nbsp;</option>';
10802 10802
 			}
10803 10803
 
10804 10804
 			while ($obj = $this->db->fetch_object($resql)) {
10805
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
10805
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
10806 10806
 			}
10807 10807
 			$out .= '</select>';
10808
-			$out .= ajax_combobox('select_' . $htmlname);
10808
+			$out .= ajax_combobox('select_'.$htmlname);
10809 10809
 
10810 10810
 			if (!empty($htmlname) && $user->admin && $info_admin) {
10811
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10811
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10812 10812
 			}
10813 10813
 
10814 10814
 			if (!empty($target)) {
10815
-				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10815
+				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10816 10816
 				$resql = $this->db->query($sql);
10817 10817
 				if ($resql) {
10818 10818
 					if ($this->db->num_rows($resql) > 0) {
10819 10819
 						$obj = $this->db->fetch_object($resql);
10820
-						$out .= '<script nonce="' . getNonce() . '">
10820
+						$out .= '<script nonce="'.getNonce().'">
10821 10821
 							$(function() {
10822
-								$("select[name=' . $target . ']").on("change", function() {
10822
+								$("select[name=' . $target.']").on("change", function() {
10823 10823
 									var current_val = $(this).val();
10824
-									if (current_val == ' . $obj->id . ') {';
10824
+									if (current_val == ' . $obj->id.') {';
10825 10825
 						if (!empty($default_selected) || !empty($selected)) {
10826
-							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
10826
+							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
10827 10827
 						}
10828 10828
 
10829 10829
 						$out .= '
10830
-										$("select[name=' . $htmlname . ']").change();
10830
+										$("select[name=' . $htmlname.']").change();
10831 10831
 									}
10832 10832
 								});
10833 10833
 
10834
-								$("select[name=' . $htmlname . ']").change(function() {
10834
+								$("select[name=' . $htmlname.']").change(function() {
10835 10835
 
10836
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
10836
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
10837 10837
 										// get price of kilometer to fill the unit price
10838 10838
 										$.ajax({
10839 10839
 											method: "POST",
10840 10840
 											dataType: "json",
10841
-											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' },
10842
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '",
10841
+											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' },
10842
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'",
10843 10843
 										}).done(function( data, textStatus, jqXHR ) {
10844 10844
 											console.log(data);
10845 10845
 											if (typeof data.up != "undefined") {
10846 10846
 												$("input[name=value_unit]").val(data.up);
10847
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
10847
+												$("select[name=' . $htmlname.']").attr("title", data.title);
10848 10848
 											} else {
10849 10849
 												$("input[name=value_unit]").val("");
10850
-												$("select[name=' . $htmlname . ']").attr("title", "");
10850
+												$("select[name=' . $htmlname.']").attr("title", "");
10851 10851
 											}
10852 10852
 										});
10853 10853
 									}
@@ -10877,18 +10877,18 @@  discard block
 block discarded – undo
10877 10877
 		global $conf, $langs;
10878 10878
 
10879 10879
 		$out = '';
10880
-		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";
10881
-		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";
10880
+		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
10881
+		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
10882 10882
 
10883 10883
 		$resql = $this->db->query($sql);
10884 10884
 		if ($resql) {
10885
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10885
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10886 10886
 			if ($useempty) {
10887 10887
 				$out .= '<option value="0"></option>';
10888 10888
 			}
10889 10889
 
10890 10890
 			while ($obj = $this->db->fetch_object($resql)) {
10891
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
10891
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
10892 10892
 			}
10893 10893
 			$out .= '</select>';
10894 10894
 		} else {
@@ -10919,12 +10919,12 @@  discard block
 block discarded – undo
10919 10919
 
10920 10920
 		$resql = $this->db->query($sql);
10921 10921
 		if ($resql) {
10922
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10922
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10923 10923
 			if ($useempty) {
10924 10924
 				$out .= '<option value="0"></option>';
10925 10925
 			}
10926 10926
 			if ($allchoice) {
10927
-				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
10927
+				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
10928 10928
 			}
10929 10929
 
10930 10930
 			$field = 'code';
@@ -10934,7 +10934,7 @@  discard block
 block discarded – undo
10934 10934
 
10935 10935
 			while ($obj = $this->db->fetch_object($resql)) {
10936 10936
 				$key = $langs->trans($obj->code);
10937
-				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
10937
+				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
10938 10938
 			}
10939 10939
 			$out .= '</select>';
10940 10940
 
@@ -10968,7 +10968,7 @@  discard block
 block discarded – undo
10968 10968
 	{
10969 10969
 		global $user, $conf, $langs;
10970 10970
 
10971
-		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
10971
+		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
10972 10972
 
10973 10973
 		if (is_null($usertofilter)) {
10974 10974
 			$usertofilter = $user;
@@ -10992,10 +10992,10 @@  discard block
 block discarded – undo
10992 10992
 		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
10993 10993
             p.title, p.fk_soc, p.fk_statut, p.public,";
10994 10994
 		$sql .= ' s.nom as name';
10995
-		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
10996
-		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';
10997
-		$sql .= ' ' . $this->db->prefix() . 'facture as f';
10998
-		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
10995
+		$sql .= ' FROM '.$this->db->prefix().'projet as p';
10996
+		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
10997
+		$sql .= ' '.$this->db->prefix().'facture as f';
10998
+		$sql .= " WHERE p.entity IN (".getEntity('project').")";
10999 10999
 		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
11000 11000
 		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
11001 11001
 		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
@@ -11006,14 +11006,14 @@  discard block
 block discarded – undo
11006 11006
 		if ($resql) {
11007 11007
 			// Use select2 selector
11008 11008
 			if (!empty($conf->use_javascript_ajax)) {
11009
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
11009
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
11010 11010
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
11011 11011
 				$out .= $comboenhancement;
11012 11012
 				$morecss = 'minwidth200imp maxwidth500';
11013 11013
 			}
11014 11014
 
11015 11015
 			if (empty($option_only)) {
11016
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
11016
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
11017 11017
 			}
11018 11018
 			if (!empty($show_empty)) {
11019 11019
 				$out .= '<option value="0" class="optiongrey">';
@@ -11043,33 +11043,33 @@  discard block
 block discarded – undo
11043 11043
 						if ($showproject == 'all') {
11044 11044
 							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
11045 11045
 							if ($obj->name) {
11046
-								$labeltoshow .= ' - ' . $obj->name; // Soc name
11046
+								$labeltoshow .= ' - '.$obj->name; // Soc name
11047 11047
 							}
11048 11048
 
11049 11049
 							$disabled = 0;
11050 11050
 							if ($obj->fk_statut == Project::STATUS_DRAFT) {
11051 11051
 								$disabled = 1;
11052
-								$labeltoshow .= ' - ' . $langs->trans("Draft");
11052
+								$labeltoshow .= ' - '.$langs->trans("Draft");
11053 11053
 							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
11054 11054
 								if ($discard_closed == 2) {
11055 11055
 									$disabled = 1;
11056 11056
 								}
11057
-								$labeltoshow .= ' - ' . $langs->trans("Closed");
11057
+								$labeltoshow .= ' - '.$langs->trans("Closed");
11058 11058
 							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
11059 11059
 								$disabled = 1;
11060
-								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
11060
+								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
11061 11061
 							}
11062 11062
 						}
11063 11063
 
11064 11064
 						if (!empty($selected) && $selected == $obj->rowid) {
11065
-							$out .= '<option value="' . $obj->rowid . '" selected';
11065
+							$out .= '<option value="'.$obj->rowid.'" selected';
11066 11066
 							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
11067
-							$out .= '>' . $labeltoshow . '</option>';
11067
+							$out .= '>'.$labeltoshow.'</option>';
11068 11068
 						} else {
11069 11069
 							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
11070 11070
 								$resultat = '';
11071 11071
 							} else {
11072
-								$resultat = '<option value="' . $obj->rowid . '"';
11072
+								$resultat = '<option value="'.$obj->rowid.'"';
11073 11073
 								if ($disabled) {
11074 11074
 									$resultat .= ' disabled';
11075 11075
 								}
@@ -11121,22 +11121,22 @@  discard block
 block discarded – undo
11121 11121
 
11122 11122
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
11123 11123
 		//$sql.= ', el.fk_source';
11124
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
11125
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
11124
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
11125
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
11126 11126
 		$sql .= " ORDER BY f.titre ASC";
11127 11127
 
11128 11128
 		$resql = $this->db->query($sql);
11129 11129
 		if ($resql) {
11130 11130
 			// Use select2 selector
11131 11131
 			if (!empty($conf->use_javascript_ajax)) {
11132
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
11132
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
11133 11133
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
11134 11134
 				$out .= $comboenhancement;
11135 11135
 				$morecss = 'minwidth200imp maxwidth500';
11136 11136
 			}
11137 11137
 
11138 11138
 			if (empty($option_only)) {
11139
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
11139
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
11140 11140
 			}
11141 11141
 			if (!empty($show_empty)) {
11142 11142
 				$out .= '<option value="0" class="optiongrey">';
@@ -11155,19 +11155,19 @@  discard block
 block discarded – undo
11155 11155
 					$disabled = 0;
11156 11156
 					if (!empty($obj->suspended)) {
11157 11157
 						$disabled = 1;
11158
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
11158
+						$labeltoshow .= ' - '.$langs->trans("Closed");
11159 11159
 					}
11160 11160
 
11161 11161
 
11162 11162
 					if (!empty($selected) && $selected == $obj->rowid) {
11163
-						$out .= '<option value="' . $obj->rowid . '" selected';
11163
+						$out .= '<option value="'.$obj->rowid.'" selected';
11164 11164
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
11165
-						$out .= '>' . $labeltoshow . '</option>';
11165
+						$out .= '>'.$labeltoshow.'</option>';
11166 11166
 					} else {
11167 11167
 						if ($disabled && ($selected != $obj->rowid)) {
11168 11168
 							$resultat = '';
11169 11169
 						} else {
11170
-							$resultat = '<option value="' . $obj->rowid . '"';
11170
+							$resultat = '<option value="'.$obj->rowid.'"';
11171 11171
 							if ($disabled) {
11172 11172
 								$resultat .= ' disabled';
11173 11173
 							}
@@ -11212,14 +11212,14 @@  discard block
 block discarded – undo
11212 11212
 		$formother = new FormOther($this->db);
11213 11213
 
11214 11214
 		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with ()
11215
-			$search_component_params_hidden = '(' . $search_component_params_hidden . ')';
11215
+			$search_component_params_hidden = '('.$search_component_params_hidden.')';
11216 11216
 		}
11217 11217
 
11218 11218
 		$ret = '';
11219 11219
 
11220 11220
 		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';
11221 11221
 		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
11222
-		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
11222
+		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
11223 11223
 		$ret .= '</a>';
11224 11224
 
11225 11225
 		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
@@ -11263,30 +11263,30 @@  discard block
 block discarded – undo
11263 11263
 			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
11264 11264
 		}
11265 11265
 		$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%')) -->";
11266
-		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';
11266
+		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
11267 11267
 		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";
11268 11268
 
11269 11269
 		// TODO : Use $arrayoffiltercriterias instead of $arrayofcriterias
11270 11270
 		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields
11271 11271
 		foreach ($arrayofcriterias as $criteria) {
11272 11272
 			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) {
11273
-				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
11273
+				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
11274 11274
 					continue;
11275 11275
 				}
11276 11276
 				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) {
11277 11277
 					continue;
11278 11278
 				}
11279 11279
 				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
11280
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';
11281
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';
11282
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';
11283
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';
11284
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';
11285
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';
11286
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';
11287
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';
11280
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
11281
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
11282
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
11283
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
11284
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
11285
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
11286
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
11287
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
11288 11288
 				} else {
11289
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';
11289
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
11290 11290
 				}
11291 11291
 			}
11292 11292
 		}
@@ -11294,7 +11294,7 @@  discard block
 block discarded – undo
11294 11294
 		$ret .= '</div>';
11295 11295
 
11296 11296
 		$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";
11297
-		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
11297
+		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
11298 11298
 
11299 11299
 		$ret .= '</div>';
11300 11300
 		$ret .= '</div>';
@@ -11351,7 +11351,7 @@  discard block
 block discarded – undo
11351 11351
 		// Convert $arrayoffiltercriterias into a json object that can be used in jquery to build the search component dynamically
11352 11352
 		$arrayoffiltercriterias_json = json_encode($arrayoffiltercriterias);
11353 11353
 		$ret .= '<script>
11354
-			var arrayoffiltercriterias = ' . $arrayoffiltercriterias_json . ';
11354
+			var arrayoffiltercriterias = ' . $arrayoffiltercriterias_json.';
11355 11355
 		</script>';
11356 11356
 
11357 11357
 
@@ -11365,9 +11365,9 @@  discard block
 block discarded – undo
11365 11365
 		$ret .= '<div class="search-component-assistance">';
11366 11366
 		$ret .= '<div>';
11367 11367
 
11368
-		$ret .= '<p class="assistance-title">' . img_picto('', 'filter') . ' ' . $langs->trans('FilterAssistance') . ' </p>';
11368
+		$ret .= '<p class="assistance-title">'.img_picto('', 'filter').' '.$langs->trans('FilterAssistance').' </p>';
11369 11369
 
11370
-		$ret .= '<p class="assistance-errors error" style="display:none">' . $langs->trans('AllFieldsRequired') . ' </p>';
11370
+		$ret .= '<p class="assistance-errors error" style="display:none">'.$langs->trans('AllFieldsRequired').' </p>';
11371 11371
 
11372 11372
 		$ret .= '<div class="operand">';
11373 11373
 		$ret .= $form->selectarray('search_filter_field', $arrayoffilterfieldslabel, '', $langs->trans("Fields"), 0, 0, '', 0, 0, 0, '', 'width250', 1);
@@ -11381,7 +11381,7 @@  discard block
 block discarded – undo
11381 11381
 		$ret .= '</select>';
11382 11382
 		$ret .= '<script>$(document).ready(function() {';
11383 11383
 		$ret .= '   $(".operator-selector").select2({';
11384
-		$ret .= '       placeholder: \'' . dol_escape_js($langs->trans('Operator')) . '\'';
11384
+		$ret .= '       placeholder: \''.dol_escape_js($langs->trans('Operator')).'\'';
11385 11385
 		$ret .= '   });';
11386 11386
 		$ret .= '});</script>';
11387 11387
 		$ret .= '</div>';
@@ -11390,12 +11390,12 @@  discard block
 block discarded – undo
11390 11390
 
11391 11391
 		$ret .= '<div class="value">';
11392 11392
 		// Input field for entering values
11393
-		$ret .= '<input type="text" class="flat width100 value-input" placeholder="' . dolPrintHTML($langs->trans('Value')) . '">';
11393
+		$ret .= '<input type="text" class="flat width100 value-input" placeholder="'.dolPrintHTML($langs->trans('Value')).'">';
11394 11394
 
11395 11395
 		// Date selector
11396 11396
 		$dateOne = '';
11397 11397
 		$ret .= '<span class="date-one" style="display:none">';
11398
-		$ret .=  $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '');
11398
+		$ret .= $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '');
11399 11399
 		$ret .= '</span>';
11400 11400
 
11401 11401
 		// Value selector (will be populated dynamically) based on search_filter_field value if a selected value has an array of values
@@ -11404,7 +11404,7 @@  discard block
 block discarded – undo
11404 11404
 		$ret .= '<script>
11405 11405
 			$(document).ready(function() {
11406 11406
 				$("#value-selector").select2({
11407
-					placeholder: "' . dol_escape_js($langs->trans('Value')) . '"
11407
+					placeholder: "' . dol_escape_js($langs->trans('Value')).'"
11408 11408
 				});
11409 11409
 				$("#value-selector").hide();
11410 11410
 				$("#value-selector").next(".select2-container").hide();
@@ -11414,7 +11414,7 @@  discard block
 block discarded – undo
11414 11414
 		$ret .= '</div>';
11415 11415
 
11416 11416
 		$ret .= '<div class="btn-div">';
11417
-		$ret .= '<button class="button buttongen button-save add-filter-btn" type="button">' . $langs->trans("addToFilter") . '</button>';
11417
+		$ret .= '<button class="button buttongen button-save add-filter-btn" type="button">'.$langs->trans("addToFilter").'</button>';
11418 11418
 		$ret .= '</div>';
11419 11419
 
11420 11420
 		$ret .= '</div>';
@@ -11580,7 +11580,7 @@  discard block
 block discarded – undo
11580 11580
 
11581 11581
 		$TModels = array();
11582 11582
 
11583
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
11583
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
11584 11584
 		$formmail = new FormMail($this->db);
11585 11585
 		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
11586 11586
 
@@ -11593,20 +11593,20 @@  discard block
 block discarded – undo
11593 11593
 			}
11594 11594
 		}
11595 11595
 
11596
-		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';
11596
+		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
11597 11597
 
11598 11598
 		foreach ($TModels as $id_model => $label_model) {
11599
-			$retstring .= '<option value="' . $id_model . '"';
11599
+			$retstring .= '<option value="'.$id_model.'"';
11600 11600
 			if (!empty($selected) && $selected == $id_model) {
11601 11601
 				$retstring .= "selected";
11602 11602
 			}
11603
-			$retstring .= ">" . $label_model . "</option>";
11603
+			$retstring .= ">".$label_model."</option>";
11604 11604
 		}
11605 11605
 
11606 11606
 		$retstring .= "</select>";
11607 11607
 
11608 11608
 		if ($addjscombo) {
11609
-			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail');
11609
+			$retstring .= ajax_combobox('select_'.$prefix.'model_mail');
11610 11610
 		}
11611 11611
 
11612 11612
 		return $retstring;
@@ -11657,16 +11657,16 @@  discard block
 block discarded – undo
11657 11657
 
11658 11658
 		foreach ($buttons as $button) {
11659 11659
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
11660
-			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';
11660
+			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
11661 11661
 		}
11662 11662
 		$retstring .= $withoutdiv ? '' : '</div>';
11663 11663
 
11664 11664
 		if ($dol_openinpopup) {
11665
-			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n";
11666
-			$retstring .= '<script nonce="' . getNonce() . '">';
11665
+			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n";
11666
+			$retstring .= '<script nonce="'.getNonce().'">';
11667 11667
 			$retstring .= 'jQuery(".button-cancel").click(function(e) {
11668
-				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\');
11669
-				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\');
11668
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\');
11669
+				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\');
11670 11670
 				 });';
11671 11671
 			$retstring .= '</script>';
11672 11672
 		}
@@ -11695,7 +11695,7 @@  discard block
 block discarded – undo
11695 11695
 		dol_syslog(__METHOD__, LOG_DEBUG);
11696 11696
 
11697 11697
 		$sql = "SELECT rowid, code, label as label";
11698
-		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';
11698
+		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';
11699 11699
 		$sql .= " WHERE active = 1";
11700 11700
 
11701 11701
 		$resql = $this->db->query($sql);
@@ -11706,7 +11706,7 @@  discard block
 block discarded – undo
11706 11706
 				$obj = $this->db->fetch_object($resql);
11707 11707
 
11708 11708
 				// If translation exists, we use it, otherwise we take the default wording
11709
-				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11709
+				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11710 11710
 				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;
11711 11711
 				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;
11712 11712
 				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label;
@@ -11738,18 +11738,18 @@  discard block
 block discarded – undo
11738 11738
 		global $langs, $user;
11739 11739
 
11740 11740
 		$out = '';
11741
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
11741
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
11742 11742
 
11743 11743
 		$this->load_cache_invoice_subtype();
11744 11744
 
11745
-		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
11745
+		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
11746 11746
 		if ($addempty) {
11747 11747
 			$out .= '<option value="0">&nbsp;</option>';
11748 11748
 		}
11749 11749
 
11750 11750
 		foreach ($this->cache_invoice_subtype as $rowid => $subtype) {
11751 11751
 			$label = $subtype['label'];
11752
-			$out .= '<option value="' . $subtype['rowid'] . '"';
11752
+			$out .= '<option value="'.$subtype['rowid'].'"';
11753 11753
 			if ($selected == $subtype['rowid']) {
11754 11754
 				$out .= ' selected="selected"';
11755 11755
 			}
Please login to merge, or discard this patch.
htdocs/accountancy/class/bookkeeping.class.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 				if (empty($this->piece_num)) {
373 373
 					$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
374 374
 					$sqlnum .= " FROM ".$this->db->prefix().$this->table_element;
375
-					$sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
375
+					$sqlnum .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
376 376
 
377 377
 					$resqlnum = $this->db->query($sqlnum);
378 378
 					if ($resqlnum) {
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 		}
469 469
 
470 470
 		// Call triggers
471
-		if (! $error && ! $notrigger) {
471
+		if (!$error && !$notrigger) {
472 472
 			$result = $this->call_trigger('BOOKKEEPING_CREATE', $user);
473 473
 			if ($result < 0) {
474 474
 				$error++;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
553 553
 
554 554
 		global $action;
555
-		$hookmanager->initHooks(array($this->element . 'dao'));
555
+		$hookmanager->initHooks(array($this->element.'dao'));
556 556
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
557 557
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
558 558
 		if ($reshook > 0) {
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		if (!$error) {
720 720
 			$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element.$mode);
721 721
 			// Call triggers
722
-			if (! $notrigger) {
722
+			if (!$notrigger) {
723 723
 				$result = $this->call_trigger('BOOKKEEPING_CREATE', $user);
724 724
 				if ($result < 0) {
725 725
 					$error++;
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 		$sql .= " t.date_validated as date_validation";
785 785
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.$mode.' as t';
786 786
 		$sql .= ' WHERE 1 = 1';
787
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
787
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
788 788
 		if (null !== $ref) {
789 789
 			$sql .= " AND t.rowid = ".((int) $ref);
790 790
 		} else {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			}
957 957
 		}
958 958
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
959
-		$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
959
+		$sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
960 960
 		if (count($sqlwhere) > 0) {
961 961
 			$sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere);
962 962
 		}
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 		$sql .= " t.date_validated as date_validation";
1092 1092
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1093 1093
 
1094
-		$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1094
+		$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1095 1095
 		if ($showAlreadyExportMovements == 0) {
1096 1096
 			$sql .= " AND t.date_export IS NULL";
1097 1097
 		}
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 		$sql .= " SUM(t.debit) as debit,";
1260 1260
 		$sql .= " SUM(t.credit) as credit";
1261 1261
 		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
1262
-		$sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
1262
+		$sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
1263 1263
 
1264 1264
 		// Manage filter
1265 1265
 		if (is_array($filter)) {
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 		}
1488 1488
 
1489 1489
 		// Call triggers
1490
-		if (! $error && ! $notrigger) {
1490
+		if (!$error && !$notrigger) {
1491 1491
 			$result = $this->call_trigger('BOOKKEEPING_MODIFY', $user);
1492 1492
 			if ($result < 0) {
1493 1493
 				$error++;
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
 		$this->db->begin();
1581 1581
 
1582 1582
 		// Call triggers
1583
-		if (! $error && ! $notrigger) {
1583
+		if (!$error && !$notrigger) {
1584 1584
 			$result = $this->call_trigger('BOOKKEEPING_DELETE', $user);
1585 1585
 			if ($result < 0) {
1586 1586
 				$error++;
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
 		if (!empty($journal)) {
1684 1684
 			$sql .= " AND code_journal = '".$this->db->escape($journal)."'";
1685 1685
 		}
1686
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1686
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1687 1687
 		// Exclusion of validated entries at the time of deletion
1688 1688
 		$sql .= " AND date_validated IS NULL";
1689 1689
 		$sql .= $sql_filter;
@@ -1730,8 +1730,8 @@  discard block
 block discarded – undo
1730 1730
 		$sql = "DELETE";
1731 1731
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1732 1732
 		$sql .= " WHERE piece_num = ".(int) $piecenum;
1733
-		$sql .= " AND date_validated IS NULL";		// For security, exclusion of validated entries at the time of deletion
1734
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1733
+		$sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
1734
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1735 1735
 		$sql .= $sql_filter;
1736 1736
 
1737 1737
 		$resql = $this->db->query($sql);
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
 		}
1860 1860
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1861 1861
 		$sql .= " WHERE piece_num = ".((int) $piecenum);
1862
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1862
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1863 1863
 
1864 1864
 		dol_syslog(__METHOD__, LOG_DEBUG);
1865 1865
 		$result = $this->db->query($sql);
@@ -1900,7 +1900,7 @@  discard block
 block discarded – undo
1900 1900
 		global $conf;
1901 1901
 
1902 1902
 		$sql = "SELECT MAX(piece_num)+1 as max FROM ".$this->db->prefix().$this->table_element.$mode;
1903
-		$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1903
+		$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1904 1904
 
1905 1905
 		dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG);
1906 1906
 
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
 		}
1945 1945
 		$sql .= " FROM ".$this->db->prefix().$this->table_element.$mode;
1946 1946
 		$sql .= " WHERE piece_num = ".((int) $piecenum);
1947
-		$sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
1947
+		$sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
1948 1948
 
1949 1949
 		dol_syslog(__METHOD__, LOG_DEBUG);
1950 1950
 		$result = $this->db->query($sql);
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 		$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,";
2010 2010
 		$sql .= " date_validated as date_validation";
2011 2011
 		$sql .= " FROM ".$this->db->prefix().$this->table_element;
2012
-		$sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2012
+		$sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2013 2013
 
2014 2014
 		dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG);
2015 2015
 
@@ -2087,7 +2087,7 @@  discard block
 block discarded – undo
2087 2087
 
2088 2088
 			if (!$error) {
2089 2089
 				// Delete if there is an empty line
2090
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";
2090
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";
2091 2091
 				$resql = $this->db->query($sql);
2092 2092
 				if (!$resql) {
2093 2093
 					$error++;
@@ -2105,7 +2105,7 @@  discard block
 block discarded – undo
2105 2105
 				$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
2106 2106
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2107 2107
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
2108
-				$sql .= ' FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
2108
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = '.((int) $conf->entity);
2109 2109
 				$sql .= $sql_filter;
2110 2110
 				$resql = $this->db->query($sql);
2111 2111
 				if (!$resql) {
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
 			}
2117 2117
 
2118 2118
 			if (!$error) {
2119
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2119
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2120 2120
 				$resql = $this->db->query($sql);
2121 2121
 				if (!$resql) {
2122 2122
 					$error++;
@@ -2126,7 +2126,7 @@  discard block
 block discarded – undo
2126 2126
 			}
2127 2127
 		} elseif ($direction == 1) {
2128 2128
 			if (!$error) {
2129
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2129
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2130 2130
 				$resql = $this->db->query($sql);
2131 2131
 				if (!$resql) {
2132 2132
 					$error++;
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 				$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
2145 2145
 				$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
2146 2146
 				$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
2147
-				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2147
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2148 2148
 				$sql .= $sql_filter;
2149 2149
 				$resql = $this->db->query($sql);
2150 2150
 				if (!$resql) {
@@ -2155,7 +2155,7 @@  discard block
 block discarded – undo
2155 2155
 			}
2156 2156
 
2157 2157
 			if (!$error) {
2158
-				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
2158
+				$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity);
2159 2159
 				$sql .= $sql_filter;
2160 2160
 				$resql = $this->db->query($sql);
2161 2161
 				if (!$resql) {
@@ -2212,7 +2212,7 @@  discard block
 block discarded – undo
2212 2212
 		$sql .= " AND aa.active = 1";
2213 2213
 		$sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
2214 2214
 		$sql .= " AND asy.rowid = ".((int) $pcgver);
2215
-		$sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2215
+		$sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2216 2216
 		$sql .= " ORDER BY account_number ASC";
2217 2217
 
2218 2218
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
@@ -2276,7 +2276,7 @@  discard block
 block discarded – undo
2276 2276
 		$sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1";
2277 2277
 		$sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1";
2278 2278
 		$sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'";
2279
-		$sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2279
+		$sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2280 2280
 
2281 2281
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
2282 2282
 		$resql = $this->db->query($sql);
@@ -2316,7 +2316,7 @@  discard block
 block discarded – undo
2316 2316
 		$sql .= " AND asy.rowid = ".((int) $pcgver);
2317 2317
 		$sql .= " AND aa.active = 1";
2318 2318
 		$sql .= " LEFT JOIN ".$this->db->prefix()."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
2319
-		$sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features
2319
+		$sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features
2320 2320
 
2321 2321
 		dol_syslog(get_class($this)."::select_account", LOG_DEBUG);
2322 2322
 		$resql = $this->db->query($sql);
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 		global $conf;
2350 2350
 
2351 2351
 		$alias = trim($alias);
2352
-		$alias = !empty($alias) && strpos($alias, '.') === false ? $alias . "." : $alias;
2352
+		$alias = !empty($alias) && strpos($alias, '.') === false ? $alias."." : $alias;
2353 2353
 
2354 2354
 		if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) {
2355 2355
 			$result = $this->loadFiscalPeriods($force, 'active');
@@ -2362,10 +2362,10 @@  discard block
 block discarded – undo
2362 2362
 				$i = 0;
2363 2363
 				foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) {
2364 2364
 					$sql_list[$i] = "(";
2365
-					$sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date";
2365
+					$sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start'])."' <= ".$this->db->sanitize($alias)."doc_date";
2366 2366
 					if (!empty($fiscal_period['date_end'])) {
2367 2367
 						$sql_list[$i] .= " AND ";
2368
-						$sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end'])."'";
2368
+						$sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '".$this->db->idate($fiscal_period['date_end'])."'";
2369 2369
 					}
2370 2370
 					$sql_list[$i] .= ")";
2371 2371
 					$i++;
@@ -2454,17 +2454,17 @@  discard block
 block discarded – undo
2454 2454
 			// Avoid trunc with dot in accountancy for the compatibility with another accounting software
2455 2455
 			$accountingLabelOperation = dol_trunc($thirdpartyname, $truncThirdpartyName, 'right', 'UTF-8', 1);
2456 2456
 			if (!empty($reference)) {
2457
-				$accountingLabelOperation .= ' - '. $reference;
2457
+				$accountingLabelOperation .= ' - '.$reference;
2458 2458
 			}
2459 2459
 			if (!empty($labelaccount)) {
2460
-				$accountingLabelOperation .= ' - '. $labelaccount;
2460
+				$accountingLabelOperation .= ' - '.$labelaccount;
2461 2461
 			}
2462 2462
 		} elseif (getDolGlobalString('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 1) {
2463 2463
 			$truncThirdpartyName = 32;
2464 2464
 			// Avoid trunc with dot in accountancy for the compatibility with another accounting software
2465 2465
 			$accountingLabelOperation = dol_trunc($thirdpartyname, $truncThirdpartyName, 'right', 'UTF-8', 1);
2466 2466
 			if (!empty($reference)) {
2467
-				$accountingLabelOperation .= ' - '. $reference;
2467
+				$accountingLabelOperation .= ' - '.$reference;
2468 2468
 			}
2469 2469
 		} elseif (getDolGlobalString('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 2) {
2470 2470
 			$truncThirdpartyName = 64;
@@ -2534,8 +2534,8 @@  discard block
 block discarded – undo
2534 2534
 		if ($mode == 'active') {
2535 2535
 			if (!isset($conf->cache['active_fiscal_period_cached']) || $force) {
2536 2536
 				$sql = "SELECT date_start, date_end";
2537
-				$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2538
-				$sql .= " WHERE entity = " . ((int) $conf->entity);
2537
+				$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2538
+				$sql .= " WHERE entity = ".((int) $conf->entity);
2539 2539
 				$sql .= " AND statut = 0";
2540 2540
 
2541 2541
 				$resql = $this->db->query($sql);
@@ -2557,8 +2557,8 @@  discard block
 block discarded – undo
2557 2557
 		if ($mode == 'closed') {
2558 2558
 			if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) {
2559 2559
 				$sql = "SELECT date_start, date_end";
2560
-				$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2561
-				$sql .= " WHERE entity = " . ((int) $conf->entity);
2560
+				$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2561
+				$sql .= " WHERE entity = ".((int) $conf->entity);
2562 2562
 				$sql .= " AND statut = 1";
2563 2563
 
2564 2564
 				$resql = $this->db->query($sql);
@@ -2593,10 +2593,10 @@  discard block
 block discarded – undo
2593 2593
 		$list = array();
2594 2594
 
2595 2595
 		$sql = "SELECT rowid, label, date_start, date_end, statut";
2596
-		$sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear";
2597
-		$sql .= " WHERE entity = " . ((int) $conf->entity);
2596
+		$sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear";
2597
+		$sql .= " WHERE entity = ".((int) $conf->entity);
2598 2598
 		if (!empty($filter)) {
2599
-			$sql .= " AND (" . $this->db->sanitize($filter, 1, 1, 1) . ')';
2599
+			$sql .= " AND (".$this->db->sanitize($filter, 1, 1, 1).')';
2600 2600
 		}
2601 2601
 		$sql .= $this->db->order('date_start', 'ASC');
2602 2602
 
@@ -2636,13 +2636,13 @@  discard block
 block discarded – undo
2636 2636
 
2637 2637
 		$sql = "SELECT YEAR(b.doc_date) as year";
2638 2638
 		for ($i = 1; $i <= 12; $i++) {
2639
-			$sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0") . ") AS month".((int) $i);
2639
+			$sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0").") AS month".((int) $i);
2640 2640
 		}
2641 2641
 		$sql .= ", COUNT(b.rowid) as total";
2642
-		$sql .= " FROM " . $this->db->prefix() . $this->table_element . " as b";
2643
-		$sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'";
2644
-		$sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'";
2645
-		$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
2642
+		$sql .= " FROM ".$this->db->prefix().$this->table_element." as b";
2643
+		$sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'";
2644
+		$sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'";
2645
+		$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy
2646 2646
 
2647 2647
 		// Get count for each month into the fiscal period
2648 2648
 		if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
@@ -2650,7 +2650,7 @@  discard block
 block discarded – undo
2650 2650
 			$sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX.'accounting_fiscalyear as af WHERE b.doc_date >= af.date_start AND b.doc_date <= af.date_end AND af.entity = '.((int) $conf->entity)." AND af.statut = 1)";
2651 2651
 		} else {
2652 2652
 			// Filter on the unitary flag/date lock on each record
2653
-			$sql .= " AND date_validated IS NULL";	// not locked
2653
+			$sql .= " AND date_validated IS NULL"; // not locked
2654 2654
 		}
2655 2655
 
2656 2656
 		$sql .= " GROUP BY YEAR(b.doc_date)";
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 				'total' => (int) $obj->total,
2672 2672
 			);
2673 2673
 			for ($i = 1; $i <= 12; $i++) {
2674
-				$year_list['count'][$i] = (int) $obj->{'month' . $i};
2674
+				$year_list['count'][$i] = (int) $obj->{'month'.$i};
2675 2675
 			}
2676 2676
 
2677 2677
 			$list[] = $year_list;
@@ -2699,11 +2699,11 @@  discard block
 block discarded – undo
2699 2699
 		$now = dol_now();
2700 2700
 
2701 2701
 		// Specify as export : update field date_validated on selected month/year
2702
-		$sql = " UPDATE " . $this->db->prefix() . $this->table_element;
2703
-		$sql .= " SET date_validated = '" . $this->db->idate($now) . "'";
2704
-		$sql .= " WHERE entity = " . ((int) $conf->entity);
2705
-		$sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'";
2706
-		$sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'";
2702
+		$sql = " UPDATE ".$this->db->prefix().$this->table_element;
2703
+		$sql .= " SET date_validated = '".$this->db->idate($now)."'";
2704
+		$sql .= " WHERE entity = ".((int) $conf->entity);
2705
+		$sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'";
2706
+		$sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'";
2707 2707
 		$sql .= " AND date_validated IS NULL";
2708 2708
 
2709 2709
 		dol_syslog(__METHOD__, LOG_DEBUG);
@@ -2736,27 +2736,27 @@  discard block
 block discarded – undo
2736 2736
 
2737 2737
 			$pcg_type_filter = array();
2738 2738
 			foreach ($accounting_groups_used_for_income_statement as $item) {
2739
-				$pcg_type_filter[] = "'" . $this->db->escape($item) . "'";
2739
+				$pcg_type_filter[] = "'".$this->db->escape($item)."'";
2740 2740
 			}
2741 2741
 
2742 2742
 			$sql = 'SELECT';
2743 2743
 			$sql .= " t.numero_compte,";
2744 2744
 			$sql .= " aa.pcg_type,";
2745 2745
 			$sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result";
2746
-			$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
2747
-			$sql .= ' LEFT JOIN  ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte';
2748
-			$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
2749
-			$sql .= " AND aa.entity = " . ((int) $conf->entity);
2750
-			$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . $this->db->prefix() . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')';
2751
-			$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
2752
-			$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'";
2753
-			$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'";
2746
+			$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
2747
+			$sql .= ' LEFT JOIN  '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte';
2748
+			$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
2749
+			$sql .= " AND aa.entity = ".((int) $conf->entity);
2750
+			$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
2751
+			$sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')';
2752
+			$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'";
2753
+			$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'";
2754 2754
 			$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
2755 2755
 
2756 2756
 			$resql = $this->db->query($sql);
2757 2757
 			if (!$resql) {
2758
-				$this->errors[] = 'Error ' . $this->db->lasterror();
2759
-				dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2758
+				$this->errors[] = 'Error '.$this->db->lasterror();
2759
+				dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2760 2760
 			} else {
2761 2761
 				while ($obj = $this->db->fetch_object($resql)) {
2762 2762
 					$income_statement_amount += $obj->accounting_result;
@@ -2795,7 +2795,7 @@  discard block
 block discarded – undo
2795 2795
 			return -1;
2796 2796
 		} elseif (empty($fiscal_period->id)) {
2797 2797
 			$langs->loadLangs(array('errors', 'compta'));
2798
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')';
2798
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')';
2799 2799
 			return -1;
2800 2800
 		}
2801 2801
 
@@ -2814,7 +2814,7 @@  discard block
 block discarded – undo
2814 2814
 			return -1;
2815 2815
 		} elseif (empty($new_fiscal_period->id)) {
2816 2816
 			$langs->loadLangs(array('errors', 'compta'));
2817
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')';
2817
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')';
2818 2818
 			return -1;
2819 2819
 		}
2820 2820
 
@@ -2834,7 +2834,7 @@  discard block
 block discarded – undo
2834 2834
 			$journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL'));
2835 2835
 			if (empty($journal_id)) {
2836 2836
 				$langs->loadLangs(array('errors', 'accountancy'));
2837
-				$this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')';
2837
+				$this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')';
2838 2838
 				$error++;
2839 2839
 			}
2840 2840
 
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
 					$error++;
2849 2849
 				} elseif ($result == 0) {
2850 2850
 					$langs->loadLangs(array('errors', 'accountancy'));
2851
-					$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')';
2851
+					$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')';
2852 2852
 					$error++;
2853 2853
 				}
2854 2854
 			} else {
@@ -2862,7 +2862,7 @@  discard block
 block discarded – undo
2862 2862
 				$pcg_type_filter = array();
2863 2863
 				$tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement);
2864 2864
 				foreach ($tmp as $item) {
2865
-					$pcg_type_filter[] = "'" . $this->db->escape($item) . "'";
2865
+					$pcg_type_filter[] = "'".$this->db->escape($item)."'";
2866 2866
 				}
2867 2867
 
2868 2868
 				$sql = 'SELECT';
@@ -2872,14 +2872,14 @@  discard block
 block discarded – undo
2872 2872
 				}
2873 2873
 				$sql .= " aa.pcg_type,";
2874 2874
 				$sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance";
2875
-				$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
2876
-				$sql .= ' LEFT JOIN  ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte';
2877
-				$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
2878
-				$sql .= " AND aa.entity = ". ((int) $conf->entity);
2875
+				$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
2876
+				$sql .= ' LEFT JOIN  '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte';
2877
+				$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
2878
+				$sql .= " AND aa.entity = ".((int) $conf->entity);
2879 2879
 				$sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
2880
-				$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
2881
-				$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
2882
-				$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
2880
+				$sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')';
2881
+				$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'";
2882
+				$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'";
2883 2883
 				$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
2884 2884
 				if ($separate_auxiliary_account) {
2885 2885
 					$sql .= " , NULLIF(t.subledger_account, '')";
@@ -2889,8 +2889,8 @@  discard block
 block discarded – undo
2889 2889
 
2890 2890
 				$resql = $this->db->query($sql);
2891 2891
 				if (!$resql) {
2892
-					$this->errors[] = 'Error ' . $this->db->lasterror();
2893
-					dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2892
+					$this->errors[] = 'Error '.$this->db->lasterror();
2893
+					dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2894 2894
 
2895 2895
 					$error++;
2896 2896
 				} else {
@@ -2919,14 +2919,14 @@  discard block
 block discarded – undo
2919 2919
 								$bookkeeping->subledger_account = $obj->subledger_account;
2920 2920
 								$sql = 'SELECT';
2921 2921
 								$sql .= " subledger_label";
2922
-								$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
2923
-								$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
2922
+								$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
2923
+								$sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'";
2924 2924
 								$sql .= " ORDER BY doc_date DESC";
2925 2925
 								$sql .= " LIMIT 1";
2926 2926
 								$result = $this->db->query($sql);
2927 2927
 								if (!$result) {
2928
-									$this->errors[] = 'Error: ' . $this->db->lasterror();
2929
-									dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2928
+									$this->errors[] = 'Error: '.$this->db->lasterror();
2929
+									dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2930 2930
 									$error++;
2931 2931
 								}
2932 2932
 								$objtmp = $this->db->fetch_object($result);
@@ -2982,14 +2982,14 @@  discard block
 block discarded – undo
2982 2982
 							$bookkeeping->subledger_account = $obj->subledger_account;
2983 2983
 							$sql = 'SELECT';
2984 2984
 							$sql .= " subledger_label";
2985
-							$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
2986
-							$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
2985
+							$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
2986
+							$sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'";
2987 2987
 							$sql .= " ORDER BY doc_date DESC";
2988 2988
 							$sql .= " LIMIT 1";
2989 2989
 							$result = $this->db->query($sql);
2990 2990
 							if (!$result) {
2991
-								$this->errors[] = 'Error: ' . $this->db->lasterror();
2992
-								dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
2991
+								$this->errors[] = 'Error: '.$this->db->lasterror();
2992
+								dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
2993 2993
 								$error++;
2994 2994
 							}
2995 2995
 							$objtmp = $this->db->fetch_object($result);
@@ -3061,7 +3061,7 @@  discard block
 block discarded – undo
3061 3061
 			return -1;
3062 3062
 		} elseif (empty($fiscal_period->id)) {
3063 3063
 			$langs->loadLangs(array('errors', 'compta'));
3064
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')';
3064
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')';
3065 3065
 			return -1;
3066 3066
 		}
3067 3067
 
@@ -3080,7 +3080,7 @@  discard block
 block discarded – undo
3080 3080
 			return -1;
3081 3081
 		} elseif (empty($new_fiscal_period->id)) {
3082 3082
 			$langs->loadLangs(array('errors', 'compta'));
3083
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')';
3083
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')';
3084 3084
 			return -1;
3085 3085
 		}
3086 3086
 
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
 			return -1;
3101 3101
 		} elseif ($result == 0) {
3102 3102
 			$langs->loadLangs(array('errors', 'accountancy'));
3103
-			$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal');
3103
+			$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal');
3104 3104
 			return -1;
3105 3105
 		}
3106 3106
 
@@ -3108,18 +3108,18 @@  discard block
 block discarded – undo
3108 3108
 		$this->db->begin();
3109 3109
 
3110 3110
 		$sql = 'SELECT t.rowid';
3111
-		$sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t';
3112
-		$sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features
3113
-		$sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'";
3114
-		$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'";
3115
-		$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'";
3116
-		$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
3117
-		$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
3111
+		$sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t';
3112
+		$sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features
3113
+		$sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'";
3114
+		$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'";
3115
+		$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'";
3116
+		$sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'";
3117
+		$sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'";
3118 3118
 
3119 3119
 		$resql = $this->db->query($sql);
3120 3120
 		if (!$resql) {
3121
-			$this->errors[] = 'Error ' . $this->db->lasterror();
3122
-			dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
3121
+			$this->errors[] = 'Error '.$this->db->lasterror();
3122
+			dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
3123 3123
 
3124 3124
 			$error++;
3125 3125
 		} else {
@@ -3134,7 +3134,7 @@  discard block
 block discarded – undo
3134 3134
 					break;
3135 3135
 				} elseif ($result == 0) {
3136 3136
 					$langs->loadLangs(array('errors', 'accountancy'));
3137
-					$this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid;
3137
+					$this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid;
3138 3138
 					$error++;
3139 3139
 					break;
3140 3140
 				}
Please login to merge, or discard this patch.
htdocs/comm/action/index.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	$conf->global->AGENDA_EXT_NB = 5;
59 59
 }
60 60
 $MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB');
61
-$DELAYFORCACHE = 300;	// 300 seconds
61
+$DELAYFORCACHE = 300; // 300 seconds
62 62
 
63 63
 $disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
64 64
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
 $mode = GETPOST('mode', 'aZ09');
117 117
 if (empty($mode) && preg_match('/show_/', $action)) {
118
-	$mode = $action;	// For backward compatibility
118
+	$mode = $action; // For backward compatibility
119 119
 }
120 120
 $resourceid = GETPOST("search_resourceid", 'int');
121 121
 $year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y");
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 	$status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
153 153
 }
154 154
 
155
-$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month');	// default for app
156
-$defaultview = getDolUserString('AGENDA_DEFAULT_VIEW', $defaultview);	// default for user
155
+$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app
156
+$defaultview = getDolUserString('AGENDA_DEFAULT_VIEW', $defaultview); // default for user
157 157
 if (empty($mode) && !GETPOSTISSET('mode')) {
158 158
 	$mode = $defaultview;
159 159
 }
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 
564 564
 $viewmode .= '</div>';
565 565
 
566
-$viewmode .= '<span class="marginrightonly"></span>';	// To add a space before the navigation tools
566
+$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools
567 567
 
568 568
 
569 569
 $newparam = '';
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	$sql .= " WHERE bc.status = 1";
601 601
 	$sql .= " AND ba.status = 1";
602 602
 	if (!empty($filtert) && $filtert != -1) {
603
-		$sql .= " AND bc.visibility = ".(int) $filtert ;
603
+		$sql .= " AND bc.visibility = ".(int) $filtert;
604 604
 	}
605 605
 	$resql = $db->query($sql);
606 606
 	if ($resql) {
@@ -654,9 +654,9 @@  discard block
 block discarded – undo
654 654
 	if ($user->hasRight("holiday", "read")) {
655 655
 		$s .= '
656 656
             <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday
657
-					? ' checked' : '') . '>
657
+					? ' checked' : '').'>
658 658
                 <label for="check_holiday" class="labelcalendar">
659
-                    <span class="check_holiday_text">' . $langs->trans("Holidays") . '</span>
659
+                    <span class="check_holiday_text">' . $langs->trans("Holidays").'</span>
660 660
                 </label> &nbsp;
661 661
             </div>';
662 662
 	}
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 		$s .= '</script>'."\n";
683 683
 
684 684
 		foreach ($showextcals as $val) {
685
-			$htmlname = md5($val['name']);	// not used for security purpose, only to get a string with no special char
685
+			$htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char
686 686
 
687 687
 			if (!empty($val['default']) || GETPOSTINT('check_ext'.$htmlname)) {
688 688
 				$default = "checked";
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 		// event->datep and event->datef must be GMT date.
932 932
 		if ($event->fulldayevent) {
933 933
 			$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
934
-			$event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver');	// If saved in $tzforfullday = gmt, we must invert date to be in user tz
934
+			$event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz
935 935
 			$event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver');
936 936
 		} else {
937 937
 			// Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1)
@@ -1009,8 +1009,8 @@  discard block
 block discarded – undo
1009 1009
 			// Loop on each day covered by action to prepare an index to show on calendar
1010 1010
 			$loop = true;
1011 1011
 			$j = 0;
1012
-			$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');	// $mois, $jour, $annee has been set for user tz
1013
-			$daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt');	// $moisend, $jourend, $anneeend has been set for user tz
1012
+			$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz
1013
+			$daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz
1014 1014
 			/*
1015 1015
 			 print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>';
1016 1016
 			 print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>';
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 
1139 1139
 	if ($mode == 'show_day') {
1140 1140
 		// Request only leaves for the current selected day
1141
-		$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin";	// date_debut and date_fin are date without time
1141
+		$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time
1142 1142
 	} elseif ($mode == 'show_week') {
1143 1143
 		// Restrict on current month (we get more, but we will filter later)
1144 1144
 		$sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'";
@@ -1684,7 +1684,7 @@  discard block
 block discarded – undo
1684 1684
 
1685 1685
 	for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1686 1686
 		// Show days of the current week
1687
-		$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');		// $firstdaytoshow is in timezone of server
1687
+		$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server
1688 1688
 		$tmpday = (int) dol_print_date($curtime, '%d', 'tzuserrel');
1689 1689
 		$tmpmonth = (int) dol_print_date($curtime, '%m', 'tzuserrel');
1690 1690
 		$tmpyear = (int) dol_print_date($curtime, '%Y', 'tzuserrel');
@@ -1919,9 +1919,9 @@  discard block
 block discarded – undo
1919 1919
 	$tmpholiday = new Holiday($db);
1920 1920
 
1921 1921
 	foreach ($eventarray as $daykey => $notused) {		// daykey is the 'YYYYMMDD' to show according to user
1922
-		$annee = (int) dol_print_date($daykey, '%Y', 'gmt');	// We use gmt because we want the value represented by string 'YYYYMMDD'
1923
-		$mois =  (int) dol_print_date($daykey, '%m', 'gmt');	// We use gmt because we want the value represented by string 'YYYYMMDD'
1924
-		$jour =  (int) dol_print_date($daykey, '%d', 'gmt');	// We use gmt because we want the value represented by string 'YYYYMMDD'
1922
+		$annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1923
+		$mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1924
+		$jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1925 1925
 
1926 1926
 		//print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n";
1927 1927
 		//print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' day='.$day.' month='.$month.' year='.$year."<br>\n";
@@ -2215,7 +2215,7 @@  discard block
 block discarded – undo
2215 2215
 								$event->label = $titletoshow;
2216 2216
 								// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
2217 2217
 								$titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
2218
-								$titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0);	// do not add 'inline-block' in css here: it makes the title transformed completely into '...'
2218
+								$titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...'
2219 2219
 								$event->label = $savlabel;
2220 2220
 							}
2221 2221
 
Please login to merge, or discard this patch.
htdocs/comm/action/card.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 $offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
83 83
 $remindertype = GETPOST('selectremindertype', 'aZ09');
84 84
 $modelmail = GETPOSTINT('actioncommsendmodel_mail');
85
-$complete = GETPOST('complete', 'alpha');	// 'na' must be allowed
85
+$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed
86 86
 $private = GETPOST('private', 'alphanohtml');
87 87
 if ($complete == 'na' || $complete == -2) {
88 88
 	$complete = -1;
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	if (GETPOSTISSET("contactid")) {
458 458
 		$object->contact_id = GETPOSTINT("contactid");
459 459
 
460
-		$object->contact = $contact;	// For backward compatibility
460
+		$object->contact = $contact; // For backward compatibility
461 461
 	}
462 462
 
463 463
 	if (GETPOSTINT('socid') > 0) {
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 				if (is_array($listofresourceid) && count($listofresourceid)) {
552 552
 					foreach ($listofresourceid as $resource_id => $val) {
553 553
 						$resource_type = 'dolresource';
554
-						$busy = 1;//GETPOSTINT('busy');
554
+						$busy = 1; //GETPOSTINT('busy');
555 555
 
556 556
 						// Resources association
557 557
 						if (getDolGlobalString('RESOURCE_USED_IN_EVENT_CHECK')) {
@@ -567,24 +567,24 @@  discard block
 block discarded – undo
567 567
 							}
568 568
 
569 569
 							$sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label";
570
-							$sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er";
571
-							$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($resource_type) . "'";
572
-							$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'";
573
-							$sql .= " WHERE er.resource_id = " . ((int) $resource_id);
570
+							$sql .= " FROM ".MAIN_DB_PREFIX."element_resources as er";
571
+							$sql .= " INNER JOIN ".MAIN_DB_PREFIX."resource as r ON r.rowid = er.resource_id AND er.resource_type = '".$db->escape($resource_type)."'";
572
+							$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as ac ON ac.id = er.element_id AND er.element_type = '".$db->escape($object->element)."'";
573
+							$sql .= " WHERE er.resource_id = ".((int) $resource_id);
574 574
 							$sql .= " AND er.busy = 1";
575 575
 							$sql .= " AND (";
576 576
 
577 577
 							// event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end)
578
-							$sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))";
578
+							$sql .= " (ac.datep <= '".$db->idate($eventDateStart)."' AND (ac.datep2 IS NULL OR ac.datep2 >= '".$db->idate($eventDateStart)."'))";
579 579
 							// event date end between ac.datep and ac.datep2
580 580
 							if (!empty($eventDateEnd)) {
581
-								$sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))";
581
+								$sql .= " OR (ac.datep <= '".$db->idate($eventDateEnd)."' AND (ac.datep2 >= '".$db->idate($eventDateEnd)."'))";
582 582
 							}
583 583
 							// event date start before ac.datep and event date end after ac.datep2
584 584
 							$sql .= " OR (";
585
-							$sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'";
585
+							$sql .= "ac.datep >= '".$db->idate($eventDateStart)."'";
586 586
 							if (!empty($eventDateEnd)) {
587
-								$sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')";
587
+								$sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($eventDateEnd)."')";
588 588
 							}
589 589
 							$sql .= ")";
590 590
 
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 								if ($db->num_rows($resql) > 0) {
599 599
 									// Resource already in use
600 600
 									$error++;
601
-									$object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : ';
601
+									$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
602 602
 									while ($obj = $db->fetch_object($resql)) {
603
-										$object->error .= '<br> - ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']');
603
+										$object->error .= '<br> - '.$langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label.' ['.$obj->ac_id.']');
604 604
 									}
605 605
 									$object->errors[] = $object->error;
606 606
 								}
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 			if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) {
706 706
 				$firstdatearray = dol_get_first_day_week(GETPOSTINT("apday"), GETPOSTINT("apmonth"), GETPOSTINT("apyear"));
707 707
 				$datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel');
708
-				$datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd');//We begin the week after
708
+				$datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd'); //We begin the week after
709 709
 				$dayoffset = 7;
710 710
 				$monthoffset = 0;
711 711
 			} elseif ($selectedrecurrulefreq == 'MONTHLY' && !empty($selectedrecurrulebymonthday)) {
712 712
 				$firstday = $selectedrecurrulebymonthday;
713
-				$firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth");//We begin the week after
713
+				$firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth"); //We begin the week after
714 714
 				$datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel');
715 715
 				$dayoffset = 0;
716 716
 				$monthoffset = 1;
@@ -815,9 +815,9 @@  discard block
 block discarded – undo
815 815
 
816 816
 				// increment date for recurrent events
817 817
 				$datep = dol_time_plus_duree($datep, $dayoffset, 'd');
818
-				$datep = dol_time_plus_duree($datep, $monthoffset, 'm');  // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
818
+				$datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
819 819
 				$datef = dol_time_plus_duree($datef, $dayoffset, 'd');
820
-				$datef = dol_time_plus_duree($datef, $monthoffset, 'm');  // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
820
+				$datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
821 821
 			}
822 822
 		}
823 823
 		if (!empty($backtopage) && !$error) {
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') {
1161 1161
 	$error = 0;
1162 1162
 
1163
-	$shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel');		// We take the date visible by user $newdate is also date visible by user.
1163
+	$shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user.
1164 1164
 	$smin = (int) dol_print_date($object->datep, "%M", 'tzuserrel');
1165 1165
 
1166 1166
 	$newdate = GETPOST('newdate', 'alpha');
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 								if (new_startdate > old_enddate) {
1335 1335
 									var timeDiff = old_enddate - old_startdate;
1336 1336
 									var new_enddate = new Date(new_startdate.getTime() + timeDiff);
1337
-									$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '"));
1337
+									$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'"));
1338 1338
 									$("#p2day").val(new_enddate.getDate());
1339 1339
 									$("#p2month").val(new_enddate.getMonth() + 1);
1340 1340
 									$("#p2year").val(new_enddate.getFullYear());
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 		$default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV');
1393 1393
 		print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
1394 1394
 		$selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default);
1395
-		print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1);	// TODO Replace 0 with -2 in onlyautoornot
1395
+		print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot
1396 1396
 		print '</td></tr>';
1397 1397
 	}
1398 1398
 
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 		}
1732 1732
 		//var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject);
1733 1733
 
1734
-		if (! in_array($origin, array('societe', 'project', 'task', 'user'))) {
1734
+		if (!in_array($origin, array('societe', 'project', 'task', 'user'))) {
1735 1735
 			// We do not use link for object that already contains a hard coded field to make links with agenda events
1736 1736
 			print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>';
1737 1737
 			print '<td colspan="3">';
@@ -1820,7 +1820,7 @@  discard block
 block discarded – undo
1820 1820
 						$("#addreminder").prop("checked", true);
1821 1821
 
1822 1822
 						// Set period with default reminder period
1823
-						$("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset) . '\');
1823
+						$("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset).'\');
1824 1824
 						$("#select_offsetunittype_duration").select2("destroy");
1825 1825
 						$("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\');
1826 1826
 						$("#select_offsetunittype_duration").select2();
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
 			$object->socpeopleassigned[$id] = array('id' => $tmpid);
1918 1918
 		}
1919 1919
 		$object->contact_id   = GETPOSTINT("contactid");
1920
-		$object->fk_project  = GETPOSTINT("projectid");
1920
+		$object->fk_project = GETPOSTINT("projectid");
1921 1921
 
1922 1922
 		$object->note_private = GETPOST("note", 'restricthtml');
1923 1923
 	}
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
 									if (new_startdate > old_enddate) {
1996 1996
 										var timeDiff = old_enddate - old_startdate;
1997 1997
 										var new_enddate = new Date(new_startdate.getTime() + timeDiff);
1998
-										$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '"));
1998
+										$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'"));
1999 1999
 										$("#p2day").val(new_enddate.getDate());
2000 2000
 										$("#p2month").val(new_enddate.getMonth() + 1);
2001 2001
 										$("#p2year").val(new_enddate.getFullYear());
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 		if ($backtopage) {
2021 2021
 			print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">';
2022 2022
 		}
2023
-		if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
2023
+		if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && !preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
2024 2024
 			print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
2025 2025
 		}
2026 2026
 
@@ -2144,8 +2144,8 @@  discard block
 block discarded – undo
2144 2144
 					'type' => 'user',
2145 2145
 					//'transparency'=>$object->userassigned[$user->id]['transparency'],
2146 2146
 					'transparency' => $object->transparency, // Force transparency on ownerfrom event
2147
-					'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status']: null),
2148
-					'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory']:null)
2147
+					'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status'] : null),
2148
+					'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory'] : null)
2149 2149
 				);
2150 2150
 			}
2151 2151
 			if (!empty($object->userassigned)) {	// Now concat assigned users
@@ -2446,7 +2446,7 @@  discard block
 block discarded – undo
2446 2446
 					});
2447 2447
 			   })';
2448 2448
 			print '</script>'."\n";
2449
-			print '</div>';		// End of div for reminderparameters
2449
+			print '</div>'; // End of div for reminderparameters
2450 2450
 		}
2451 2451
 
2452 2452
 		print dol_get_fiche_end();
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
 
2719 2719
 		// Priority
2720 2720
 		if (getDolGlobalString('AGENDA_SUPPORT_PRIORITY_IN_EVENTS')) {
2721
-			print '<tr><td class="nowrap" class="titlefield">' . $langs->trans("Priority") . '</td><td>';
2721
+			print '<tr><td class="nowrap" class="titlefield">'.$langs->trans("Priority").'</td><td>';
2722 2722
 			print($object->priority ? $object->priority : '');
2723 2723
 			print '</td></tr>';
2724 2724
 		}
Please login to merge, or discard this patch.