Completed
Branch develop (429f5d)
by
unknown
25:51
created
test/phpunit/SecurityTest.php 1 patch
Spacing   +62 added lines, -62 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
 
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 		// Now string not allowed
641 641
 
642 642
 		$s = '4 <5';
643
-		$result = (string) dol_eval($s, 1, 1, '2');		// in mode 2, char < is allowed only if followed by a space
643
+		$result = (string) dol_eval($s, 1, 1, '2'); // in mode 2, char < is allowed only if followed by a space
644 644
 		print "result = ".$result."\n";
645 645
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result, 'Test 4 <5 - The string was not detected as evil');
646 646
 
647 647
 		$s = '4 < 5';
648
-		$result = (string) dol_eval($s, 1, 1, '1');		// in mode 1, char < is always forbidden
648
+		$result = (string) dol_eval($s, 1, 1, '1'); // in mode 1, char < is always forbidden
649 649
 		print "result = ".$result."\n";
650 650
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result, 'Test 4 < 5 - The string was not detected as evil');
651 651
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		print "result = ".$result."\n";
660 660
 		$this->assertStringContainsString('Bad string syntax to evaluate', $result, 'The string was not detected as evil');
661 661
 
662
-		$result = dol_eval('$a=function() { }; $a', 1, 1, '0');		// result of dol_eval may be an object Closure
662
+		$result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure
663 663
 		print "result5 = ".json_encode($result)."\n";
664 664
 		$this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil');
665 665
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
 		// Must be allowed
703 703
 
704
-		global $leftmenu;	// Used into strings to eval
704
+		global $leftmenu; // Used into strings to eval
705 705
 
706 706
 		$leftmenu = 'AAA';
707 707
 		$result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1');
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
 		$this->assertFalse($result);
726 726
 
727 727
 		$leftmenu = 'XXX';
728
-		$conf->global->MAIN_FEATURES_LEVEL = 1;		// Force for the case option is -1
728
+		$conf->global->MAIN_FEATURES_LEVEL = 1; // Force for the case option is -1
729 729
 		$string = '(isModEnabled("agenda") || isModEnabled("resource")) && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 0 && preg_match(\'/^(admintools|all|XXX)/\', $leftmenu)';
730 730
 		$result = dol_eval($string, 1, 1, '1');
731 731
 		print "result17 = ".$result."\n";
732 732
 		$this->assertTrue($result);
733 733
 
734
-		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0);	// Should return false and not a 'Bad string syntax to evaluate ...'
734
+		$result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...'
735 735
 		print "result18 = ".$result."\n";
736 736
 		$this->assertFalse($result);
737 737
 
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
 		global $conf;
773 773
 
774 774
 		// Set options for cleaning data
775
-		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;	// disabled, does not work on HTML5 and some libxml versions
775
+		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions
776 776
 		// Enable option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible
777 777
 		if (extension_loaded('tidy') && class_exists("tidy")) {
778 778
 			$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
779 779
 		} else {
780 780
 			$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
781 781
 		}
782
-		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;	// disabled, does not work on HTML5 and some libxml versions
782
+		$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions
783 783
 
784 784
 
785 785
 		// dolPrintHTML - With dolPrintHTML(), only content not already in HTML is encoded with HTML.
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 		//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1);
793 793
 		$result = dolPrintHTML($stringtotest);
794 794
 		print __METHOD__." result=".$result."\n";
795
-		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 1');    // Expected '' because should failed because login 'auto' does not exists
795
+		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 1'); // Expected '' because should failed because login 'auto' does not exists
796 796
 
797 797
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
798 798
 		$stringtotest = "&quot; &gt; &lt; <b>bold</b>";
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 		//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1);
804 804
 		$result = dolPrintHTML($stringtotest);
805 805
 		print __METHOD__." result=".$result."\n";
806
-		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 2');    // Expected '' because should failed because login 'auto' does not exists
806
+		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 2'); // Expected '' because should failed because login 'auto' does not exists
807 807
 
808 808
 
809 809
 		// dolPrintHTMLForAttribute - With dolPrintHTMLForAttribute(), the content is HTML encode, even if it is already HTML content.
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1);
817 817
 		$result = dolPrintHTMLForAttribute($stringtotest);
818 818
 		print __METHOD__." result=".$result."\n";
819
-		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 1');    // Expected '' because should failed because login 'auto' does not exists
819
+		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 1'); // Expected '' because should failed because login 'auto' does not exists
820 820
 
821 821
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
822 822
 		$stringtotest = "&quot; &gt; &lt; <b>bold</b>";
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		//$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1);
828 828
 		$result = dolPrintHTMLForAttribute($stringtotest);
829 829
 		print __METHOD__." result=".$result."\n";
830
-		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 2');    // Expected '' because should failed because login 'auto' does not exists
830
+		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 2'); // Expected '' because should failed because login 'auto' does not exists
831 831
 
832 832
 
833 833
 		// dolPrintHTMLForAttributeUrl - With dolPrintHTMLForAttributeUrl(), the param should already be and HTML URL encoded
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		// $result = dol_escape_htmltag(dol_string_onlythesehtmltags($s, 1, 1, 1, 0, array()), 0, 0, '', $escapeonlyhtmltags, 1);
838 838
 		$result = dolPrintHTMLForAttributeUrl($stringtotest);
839 839
 		print __METHOD__." result=".$result."\n";
840
-		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttributeUrl test 1');    // Expected '' because should failed because login 'auto' does not exists
840
+		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttributeUrl test 1'); // Expected '' because should failed because login 'auto' does not exists
841 841
 
842 842
 		// For a string that is already HTML (contains HTML tags) with special tags but badly formatted
843 843
 		$stringtotest = "aa & &amp; a=%10";
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 		// $result = dol_escape_htmltag(dol_string_onlythesehtmltags($s, 1, 1, 1, 0, array()), 0, 0, '', $escapeonlyhtmltags, 1);
846 846
 		$result = dolPrintHTMLForAttributeUrl($stringtotest);
847 847
 		print __METHOD__." result=".$result."\n";
848
-		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttributeUrl test 2');    // Expected '' because should failed because login 'auto' does not exists
848
+		$this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttributeUrl test 2'); // Expected '' because should failed because login 'auto' does not exists
849 849
 
850 850
 
851 851
 		// dolPrintHTML
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 		// With cleaning options of HTML TIDY
924 924
 		if (extension_loaded('tidy') && class_exists("tidy")) {
925 925
 			$stringtotest = "Message<br>with ' and &egrave; and &#39; !";
926
-			$stringexpected = "Message<br>\nwith ' and &egrave; and ' !";		// The &#39; is modified into ' because html tidy fix it.
926
+			$stringexpected = "Message<br>\nwith ' and &egrave; and ' !"; // The &#39; is modified into ' because html tidy fix it.
927 927
 			/*
928 928
 			var_dump($stringtotest);
929 929
 			var_dump(dol_htmlentitiesbr($stringtotest));
@@ -955,11 +955,11 @@  discard block
 block discarded – undo
955 955
 		$this->assertEquals('a', $result);
956 956
 
957 957
 		// Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range
958
-		$arraytmp = array(0 => '&#9989;', 1 => '9989;');	// Encoded as decimal
958
+		$arraytmp = array(0 => '&#9989;', 1 => '9989;'); // Encoded as decimal
959 959
 		$result = realCharForNumericEntities($arraytmp);
960 960
 		$this->assertEquals('✅', $result);
961 961
 
962
-		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;');	// Encoded as hexadecimal
962
+		$arraytmp = array(0 => '&#x2705;', 1 => 'x2705;'); // Encoded as hexadecimal
963 963
 		$result = realCharForNumericEntities($arraytmp);
964 964
 		$this->assertEquals('✅', $result);
965 965
 
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
 		// For a string with js and link with restricthtmlallowlinkscript
1030 1030
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
1031 1031
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
1032
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
1032
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
1033 1033
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
1034 1034
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
1035 1035
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 		// For a string with js and link with restricthtmlallowlinkscript
1043 1043
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
1044 1044
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
1045
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
1045
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
1046 1046
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
1047 1047
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
1048 1048
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 		// For a string with js and link with restricthtmlallowlinkscript
1056 1056
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
1057 1057
 		$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
1058
-		$s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
1058
+		$s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700">
1059 1059
 		<link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
1060 1060
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
1061 1061
 		<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>';
Please login to merge, or discard this patch.
htdocs/public/payment/paymentok.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 $paramcreditor = 'ONLINE_PAYMENT_CREDITOR';
156 156
 $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix;
157 157
 if (getDolGlobalString($paramcreditorlong)) {
158
-	$creditor = getDolGlobalString($paramcreditorlong);	// use label long of the seller to show
158
+	$creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show
159 159
 } elseif (getDolGlobalString($paramcreditor)) {
160
-	$creditor = getDolGlobalString($paramcreditor);		// use label short of the seller to show
160
+	$creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show
161 161
 }
162 162
 
163 163
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 $head = '';
214 214
 if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) {
215
-	$head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
215
+	$head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
216 216
 }
217 217
 
218 218
 $conf->dol_hide_topmenu = 1;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	}
273 273
 	if (getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT')) {
274 274
 		print '<div class="backimagepublicpayment">';
275
-		print '<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="' . getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT').'">';
275
+		print '<img id="idMAIN_IMAGE_PUBLIC_PAYMENT" src="'.getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT').'">';
276 276
 		print '</div>';
277 277
 	}
278 278
 
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
 		// Get on url call
288 288
 		$onlinetoken        = $PAYPALTOKEN;
289 289
 		$fulltag            = $FULLTAG;
290
-		$payerID 			= !empty($PAYPALPAYERID) ? $PAYPALPAYERID : '';
290
+		$payerID = !empty($PAYPALPAYERID) ? $PAYPALPAYERID : '';
291 291
 		// Set by newpayment.php
292 292
 		$currencyCodeType   = $_SESSION['currencyCodeType'];
293 293
 		$FinalPaymentAmt    = $_SESSION["FinalPaymentAmt"];
294
-		$paymentType        = $_SESSION['PaymentType'];			// Value can be 'Mark', 'Sole', 'Sale' for example
294
+		$paymentType        = $_SESSION['PaymentType']; // Value can be 'Mark', 'Sole', 'Sale' for example
295 295
 		// From env
296 296
 		$ipaddress          = $_SESSION['ipaddress'];
297 297
 
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
 	$ipaddress = $_SESSION['ipaddress'];
394 394
 }
395 395
 if (empty($TRANSACTIONID)) {
396
-	$TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' :$_SESSION['TRANSACTIONID'];	// pi_... or ch_...
396
+	$TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID']; // pi_... or ch_...
397 397
 	if (empty($TRANSACTIONID) && GETPOST('payment_intent', 'alphanohtml')) {
398 398
 		// For the case we use STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2
399
-		$TRANSACTIONID   = GETPOST('payment_intent', 'alphanohtml');
399
+		$TRANSACTIONID = GETPOST('payment_intent', 'alphanohtml');
400 400
 	}
401 401
 }
402 402
 if (empty($FinalPaymentAmt)) {
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 				if (empty($adht->caneditamount)) {	// If we didn't allow members to choose their membership amount (if the amount is allowed in edit mode, no need to check)
499 499
 					if ($object->status == $object::STATUS_DRAFT) {		// If the member is not yet validated, we check that the amount is the same as expected.
500 500
 						$typeid = $object->typeid;
501
-						$amountbytype = $adht->amountByType(1);		// Load the array of amount per type
501
+						$amountbytype = $adht->amountByType(1); // Load the array of amount per type
502 502
 
503 503
 						// Set amount for the subscription:
504 504
 						// - First check the amount of the member type.
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 				if (getDolGlobalInt('MEMBER_MIN_AMOUNT')) {
529 529
 					if ($FinalPaymentAmt < getDolGlobalInt('MEMBER_MIN_AMOUNT')) {
530 530
 						$error++;
531
-						$errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed (' . getDolGlobalString('MEMBER_MIN_AMOUNT').'). May be a hack to try to pay a different amount ?';
531
+						$errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed ('.getDolGlobalString('MEMBER_MIN_AMOUNT').'). May be a hack to try to pay a different amount ?';
532 532
 						$postactionmessages[] = $errmsg;
533 533
 						$ispostactionok = -1;
534 534
 						dol_syslog("Failed to validate member (amount propagated from payment page is lower than allowed minimum): ".$errmsg, LOG_ERR, 0, '_payment');
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 					dol_syslog("Failed to validate member (bad currency check): ".$errmsg, LOG_ERR, 0, '_payment');
545 545
 				}
546 546
 
547
-				if (! $error) {
547
+				if (!$error) {
548 548
 					// We validate the member (no effect if it is already validated)
549 549
 					$result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible
550 550
 					if ($result < 0 || empty($object->datevalid)) {
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 						$thirdparty = new Societe($db);
712 712
 						$thirdparty->fetch($thirdparty_id);
713 713
 
714
-						include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';	// This also set $stripearrayofkeysbyenv
714
+						include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This also set $stripearrayofkeysbyenv
715 715
 						$stripe = new Stripe($db);
716 716
 						//$stripeacc = $stripe->getStripeAccount($service);		Already defined previously
717 717
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 
727 727
 								if (preg_match('/^pi_/', $TRANSACTIONID)) {
728 728
 									// This may throw an error if not found.
729
-									$chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID);	// payment_intent (pi_...)
729
+									$chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID); // payment_intent (pi_...)
730 730
 								} else {
731 731
 									// This throw an error if not found
732 732
 									$chpi = \Stripe\Charge::retrieve($TRANSACTIONID); // old method, contains the charge id (ch_...)
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 				// Create external user
786 786
 				if (getDolGlobalString('ADHERENT_CREATE_EXTERNAL_USER_LOGIN')) {
787 787
 					$nuser = new User($db);
788
-					$tmpuser = dol_clone($object, 0);		// $object is type Adherent
788
+					$tmpuser = dol_clone($object, 0); // $object is type Adherent
789 789
 
790 790
 					// Check if a user login already exists for this member or not
791 791
 					$found = 0;
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 				$paiement->paiementid   = $paymentTypeId;
951 951
 				$paiement->num_payment = '';
952 952
 				$paiement->note_public  = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
953
-				$paiement->ext_payment_id = $TRANSACTIONID;		// TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue.
953
+				$paiement->ext_payment_id = $TRANSACTIONID; // TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue.
954 954
 				//$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer->id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];	// TODO LDR It would be better if we could store this. Do we have customer->id and publishable_key ?
955 955
 				$paiement->ext_payment_site = $service;
956 956
 
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 			$ispostactionok = -1;
1023 1023
 		}
1024 1024
 	} elseif (array_key_exists('ORD', $tmptag) && $tmptag['ORD'] > 0) {
1025
-		include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
1025
+		include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
1026 1026
 		$object = new Commande($db);
1027 1027
 		$result = $object->fetch((int) $tmptag['ORD']);
1028 1028
 		if ($result) {
@@ -1061,14 +1061,14 @@  discard block
 block discarded – undo
1061 1061
 			// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
1062 1062
 			if (isModEnabled('invoice')) {
1063 1063
 				if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1064
-					include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1064
+					include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1065 1065
 					$invoice = new Facture($db);
1066 1066
 					$result = $invoice->createFromOrder($object, $user);
1067 1067
 					if ($result > 0) {
1068 1068
 						$object->classifyBilled($user);
1069 1069
 						$invoice->validate($user);
1070 1070
 						// Creation of payment line
1071
-						include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
1071
+						include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1072 1072
 						$paiement = new Paiement($db);
1073 1073
 						$paiement->datepaye = $now;
1074 1074
 						if ($currencyCodeType == $conf->currency) {
@@ -1082,14 +1082,14 @@  discard block
 block discarded – undo
1082 1082
 						}
1083 1083
 						$paiement->paiementid = $paymentTypeId;
1084 1084
 						$paiement->num_payment = '';
1085
-						$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
1086
-						$paiement->ext_payment_id = $TRANSACTIONID;		// pi_... for Stripe, ...
1087
-						$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1085
+						$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1086
+						$paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ...
1087
+						$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1088 1088
 
1089 1089
 						if (!$error) {
1090 1090
 							$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
1091 1091
 							if ($paiement_id < 0) {
1092
-								$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1092
+								$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1093 1093
 								$ispostactionok = -1;
1094 1094
 								$error++;
1095 1095
 							} else {
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 								}
1127 1127
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
1128 1128
 								if ($result < 0) {
1129
-									$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1129
+									$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1130 1130
 									$ispostactionok = -1;
1131 1131
 									$error++;
1132 1132
 								} else {
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 									$ispostactionok = 1;
1135 1135
 								}
1136 1136
 							} else {
1137
-								$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
1137
+								$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
1138 1138
 								$ispostactionok = -1;
1139 1139
 								$error++;
1140 1140
 							}
@@ -1146,11 +1146,11 @@  discard block
 block discarded – undo
1146 1146
 							$db->rollback();
1147 1147
 						}
1148 1148
 					} else {
1149
-						$postactionmessages[] = 'Failed to create invoice form order ' . $tmptag['ORD'] . '.';
1149
+						$postactionmessages[] = 'Failed to create invoice form order '.$tmptag['ORD'].'.';
1150 1150
 						$ispostactionok = -1;
1151 1151
 					}
1152 1152
 				} else {
1153
-					$postactionmessages[] = 'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt . ') or "payment type id" (' . $paymentTypeId . ') to record the payment of order ' . $tmptag['ORD'] . '. May be payment was already recorded.';
1153
+					$postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type id" ('.$paymentTypeId.') to record the payment of order '.$tmptag['ORD'].'. May be payment was already recorded.';
1154 1154
 					$ispostactionok = -1;
1155 1155
 				}
1156 1156
 			} else {
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 				$ispostactionok = -1;
1159 1159
 			}
1160 1160
 		} else {
1161
-			$postactionmessages[] = 'Order paid ' . $tmptag['ORD'] . ' was not found';
1161
+			$postactionmessages[] = 'Order paid '.$tmptag['ORD'].' was not found';
1162 1162
 			$ispostactionok = -1;
1163 1163
 		}
1164 1164
 	} elseif (array_key_exists('DON', $tmptag) && $tmptag['DON'] > 0) {
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 				$paiement->datep = $now;
1216 1216
 				$paiement->paymenttype = $paymentTypeId;
1217 1217
 				$paiement->num_payment = '';
1218
-				$paiement->note_public  = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1218
+				$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1219 1219
 				$paiement->ext_payment_id = $TRANSACTIONID;
1220 1220
 				$paiement->ext_payment_site = $service;
1221 1221
 
@@ -1432,7 +1432,7 @@  discard block
 block discarded – undo
1432 1432
 						$db->rollback();
1433 1433
 					}
1434 1434
 
1435
-					if (! $error) {
1435
+					if (!$error) {
1436 1436
 						// Sending mail
1437 1437
 						$thirdparty = new Societe($db);
1438 1438
 						$resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc);
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 							// Get email content from template
1451 1451
 							$arraydefaultmessage = null;
1452 1452
 
1453
-							$idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT');	// Email to send for Event organization registration
1453
+							$idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'); // Email to send for Event organization registration
1454 1454
 
1455 1455
 							if (!empty($idoftemplatetouse)) {
1456 1456
 								$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
@@ -1652,18 +1652,18 @@  discard block
 block discarded – undo
1652 1652
 						} else {
1653 1653
 							$booth->status = ConferenceOrBooth::STATUS_SUGGESTED;
1654 1654
 							$resultboothupdate = $booth->update($user);
1655
-							if ($resultboothupdate<0) {
1655
+							if ($resultboothupdate < 0) {
1656 1656
 								// Finding the thirdparty by getting the invoice
1657 1657
 								$invoice = new Facture($db);
1658 1658
 								$resultinvoice = $invoice->fetch($ref);
1659
-								if ($resultinvoice<0) {
1659
+								if ($resultinvoice < 0) {
1660 1660
 									$postactionmessages[] = 'Could not find the associated invoice.';
1661 1661
 									$ispostactionok = -1;
1662 1662
 									$error++;
1663 1663
 								} else {
1664 1664
 									$thirdparty = new Societe($db);
1665 1665
 									$resultthirdparty = $thirdparty->fetch($invoice->socid);
1666
-									if ($resultthirdparty<0) {
1666
+									if ($resultthirdparty < 0) {
1667 1667
 										$error++;
1668 1668
 										setEventMessages(null, $thirdparty->errors, "errors");
1669 1669
 									} else {
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 										// Get email content from template
1680 1680
 										$arraydefaultmessage = null;
1681 1681
 
1682
-										$idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH');	// Email sent after registration for a Booth
1682
+										$idoftemplatetouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'); // Email sent after registration for a Booth
1683 1683
 
1684 1684
 										if (!empty($idoftemplatetouse)) {
1685 1685
 											$arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $idoftemplatetouse, 1, '');
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
 			$ispostactionok = -1;
1736 1736
 		}
1737 1737
 	} elseif (array_key_exists('CON', $tmptag) && $tmptag['CON'] > 0) {
1738
-		include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
1738
+		include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
1739 1739
 		$object = new Contrat($db);
1740 1740
 		$result = $object->fetch((int) $tmptag['CON']);
1741 1741
 		if ($result) {
@@ -1773,14 +1773,14 @@  discard block
 block discarded – undo
1773 1773
 			// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
1774 1774
 			if (isModEnabled('invoice')) {
1775 1775
 				if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
1776
-					include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1776
+					include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1777 1777
 					$invoice = new Facture($db);
1778 1778
 					$result = $invoice->createFromContract($object, $user, array((int) $contract_lines));
1779 1779
 					if ($result > 0) {
1780 1780
 						// $object->classifyBilled($user);
1781 1781
 						$invoice->validate($user);
1782 1782
 						// Creation of payment line
1783
-						include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
1783
+						include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1784 1784
 						$paiement = new Paiement($db);
1785 1785
 						$paiement->datepaye = $now;
1786 1786
 						if ($currencyCodeType == $conf->currency) {
@@ -1794,14 +1794,14 @@  discard block
 block discarded – undo
1794 1794
 						}
1795 1795
 						$paiement->paiementid = $paymentTypeId;
1796 1796
 						$paiement->num_payment = '';
1797
-						$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
1798
-						$paiement->ext_payment_id = $TRANSACTIONID;		// pi_... for Stripe, ...
1799
-						$paiement->ext_payment_site = $service;			// 'StripeLive' or 'Stripe', or ...
1797
+						$paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress;
1798
+						$paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ...
1799
+						$paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ...
1800 1800
 
1801 1801
 						if (!$error) {
1802 1802
 							$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
1803 1803
 							if ($paiement_id < 0) {
1804
-								$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1804
+								$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1805 1805
 								$ispostactionok = -1;
1806 1806
 								$error++;
1807 1807
 							} else {
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 								}
1839 1839
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
1840 1840
 								if ($result < 0) {
1841
-									$postactionmessages[] = $paiement->error . ' ' . implode("<br>\n", $paiement->errors);
1841
+									$postactionmessages[] = $paiement->error.' '.implode("<br>\n", $paiement->errors);
1842 1842
 									$ispostactionok = -1;
1843 1843
 									$error++;
1844 1844
 								} else {
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
 									$ispostactionok = 1;
1847 1847
 								}
1848 1848
 							} else {
1849
-								$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
1849
+								$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
1850 1850
 								$ispostactionok = -1;
1851 1851
 								$error++;
1852 1852
 							}
@@ -1858,15 +1858,15 @@  discard block
 block discarded – undo
1858 1858
 							$db->rollback();
1859 1859
 						}
1860 1860
 					} else {
1861
-						$msg = 'Failed to create invoice form contract ' . $tmptag['CON'];
1861
+						$msg = 'Failed to create invoice form contract '.$tmptag['CON'];
1862 1862
 						if (!empty($tmptag['COL'])) {
1863
-							$msg .= ' and col '. $tmptag['COL'] .'.';
1863
+							$msg .= ' and col '.$tmptag['COL'].'.';
1864 1864
 						}
1865 1865
 						$postactionmessages[] = $msg;
1866 1866
 						$ispostactionok = -1;
1867 1867
 					}
1868 1868
 				} else {
1869
-					$postactionmessages[] = 'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt . ') or "payment type id" (' . $paymentTypeId . ') to record the payment of contract ' . $tmptag['CON'] .'. Maybe payment was already recorded.';
1869
+					$postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type id" ('.$paymentTypeId.') to record the payment of contract '.$tmptag['CON'].'. Maybe payment was already recorded.';
1870 1870
 					$ispostactionok = -1;
1871 1871
 				}
1872 1872
 			} else {
@@ -1874,9 +1874,9 @@  discard block
 block discarded – undo
1874 1874
 				$ispostactionok = -1;
1875 1875
 			}
1876 1876
 		} else {
1877
-			$msg = 'Contract paid ' . $tmptag['CON'] . ' was not found';
1877
+			$msg = 'Contract paid '.$tmptag['CON'].' was not found';
1878 1878
 			if (!empty($tmptag['COL'])) {
1879
-				$msg .= ' for col '.$tmptag['COL'] .'.';
1879
+				$msg .= ' for col '.$tmptag['COL'].'.';
1880 1880
 			}
1881 1881
 			$postactionmessages[] = $msg;
1882 1882
 			$ispostactionok = -1;
@@ -1892,8 +1892,8 @@  discard block
 block discarded – undo
1892 1892
 	$payerID            = empty($PAYPALPAYERID) ? $_SESSION['payerID'] : $PAYPALPAYERID;
1893 1893
 	// Set by newpayment.php
1894 1894
 	$currencyCodeType   = empty($_SESSION['currencyCodeType']) ? '' : $_SESSION['currencyCodeType'];
1895
-	$FinalPaymentAmt    = empty($_SESSION["FinalPaymentAmt"]) ? '': $_SESSION["FinalPaymentAmt"];
1896
-	$paymentType        = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType'];	// Seems used by paypal only
1895
+	$FinalPaymentAmt    = empty($_SESSION["FinalPaymentAmt"]) ? '' : $_SESSION["FinalPaymentAmt"];
1896
+	$paymentType        = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only
1897 1897
 
1898 1898
 	if (is_object($object) && method_exists($object, 'call_trigger')) {
1899 1899
 		// Call trigger
@@ -2135,16 +2135,16 @@  discard block
 block discarded – undo
2135 2135
 		// Redirect to a success page
2136 2136
 		// Paymentok page must be created for the specific website
2137 2137
 		if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) {
2138
-			$ext_urlok = $ws_virtuelhost . '/paymentok.php?fulltag='.$FULLTAG;
2138
+			$ext_urlok = $ws_virtuelhost.'/paymentok.php?fulltag='.$FULLTAG;
2139 2139
 		} else {
2140 2140
 			$ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG;
2141 2141
 		}
2142
-		print "<script>window.top.location.href = '".dol_escape_js($ext_urlok) ."';</script>";
2142
+		print "<script>window.top.location.href = '".dol_escape_js($ext_urlok)."';</script>";
2143 2143
 	} else {
2144 2144
 		// Redirect to an error page
2145 2145
 		// Paymentko page must be created for the specific website
2146 2146
 		if (!defined('USEDOLIBARRSERVER') && !empty($ws_virtuelhost)) {
2147
-			$ext_urlko = $ws_virtuelhost . '/paymentko.php?fulltag='.$FULLTAG;
2147
+			$ext_urlko = $ws_virtuelhost.'/paymentko.php?fulltag='.$FULLTAG;
2148 2148
 		} else {
2149 2149
 			$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG;
2150 2150
 		}
Please login to merge, or discard this patch.
htdocs/user/class/user.class.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -687,11 +687,11 @@  discard block
 block discarded – undo
687 687
 
688 688
 				$this->job = $obj->job;
689 689
 				$this->signature = $obj->signature;
690
-				$this->admin		= $obj->admin;
690
+				$this->admin = $obj->admin;
691 691
 				$this->note_public = $obj->note_public;
692 692
 				$this->note_private = $obj->note_private;
693 693
 
694
-				$this->statut		= $obj->status;			// deprecated
694
+				$this->statut		= $obj->status; // deprecated
695 695
 				$this->status		= $obj->status;
696 696
 
697 697
 				$this->photo		= $obj->photo;
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 			require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php';
824 824
 
825 825
 			$defaultValues = new DefaultValues($this->db);
826
-			$result = $defaultValues->fetchAll('', '', 0, 0, '(t.user_id:in:0,'.$this->id.') AND (entity:in:'.(isset($this->entity) ? $this->entity : $conf->entity).','.$conf->entity.')');	// User 0 (all) + me (if defined)
826
+			$result = $defaultValues->fetchAll('', '', 0, 0, '(t.user_id:in:0,'.$this->id.') AND (entity:in:'.(isset($this->entity) ? $this->entity : $conf->entity).','.$conf->entity.')'); // User 0 (all) + me (if defined)
827 827
 			//$result = $defaultValues->fetchAll('', '', 0, 0, array('t.user_id'=>array(0, $this->id), 'entity'=>array((isset($this->entity) ? $this->entity : $conf->entity), $conf->entity)));	// User 0 (all) + me (if defined)
828 828
 
829 829
 			if (!is_array($result) && $result < 0) {
@@ -938,16 +938,16 @@  discard block
 block discarded – undo
938 938
 		// Special case for external user
939 939
 		if (!empty($this->socid)) {
940 940
 			if ($module == 'societe' && ($permlevel1 == 'creer' || $permlevel1 == 'write')) {
941
-				return 0;	// An external user never has the permission ->societe->write to see all thirdparties (always restricted to himself)
941
+				return 0; // An external user never has the permission ->societe->write to see all thirdparties (always restricted to himself)
942 942
 			}
943 943
 			if ($module == 'societe' && $permlevel1 == 'client' && $permlevel2 == 'voir') {
944
-				return 0;	// An external user never has the permission ->societe->client->voir to see all thirdparties (always restricted to himself)
944
+				return 0; // An external user never has the permission ->societe->client->voir to see all thirdparties (always restricted to himself)
945 945
 			}
946 946
 			if ($module == 'societe' && $permlevel1 == 'export') {
947
-				return 0;	// An external user never has the permission ->societe->export to see all thirdparties (always restricted to himself)
947
+				return 0; // An external user never has the permission ->societe->export to see all thirdparties (always restricted to himself)
948 948
 			}
949 949
 			if ($module == 'societe' && ($permlevel1 == 'supprimer' || $permlevel1 == 'delete')) {
950
-				return 0;	// An external user never has the permission ->societe->delete to see all thirdparties (always restricted to himself)
950
+				return 0; // An external user never has the permission ->societe->delete to see all thirdparties (always restricted to himself)
951 951
 			}
952 952
 		}
953 953
 
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 			$sql .= " FROM ".$this->db->prefix()."rights_def";
1096 1096
 			$sql .= " WHERE entity = ".((int) $entity);
1097 1097
 			if (!empty($whereforadd) && $whereforadd != 'allmodules') {
1098
-				$sql .= " AND (".$whereforadd.")";	// Note: parenthesis are important because whereforadd can contains OR. Also note that $whereforadd is already sanitized
1098
+				$sql .= " AND (".$whereforadd.")"; // Note: parenthesis are important because whereforadd can contains OR. Also note that $whereforadd is already sanitized
1099 1099
 			}
1100 1100
 
1101 1101
 			$sqldelete = "DELETE FROM ".$this->db->prefix()."user_rights";
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
 			$sql .= " FROM ".$this->db->prefix()."rights_def";
1232 1232
 			$sql .= " WHERE entity IN (".$this->db->sanitize($entity, 0, 0, 0, 0).")";
1233 1233
 			if (!empty($wherefordel) && $wherefordel != 'allmodules') {
1234
-				$sql .= " AND (".$wherefordel.")";	// Note: parenthesis are important because wherefordel can contains OR. Also note that $wherefordel is already sanitized
1234
+				$sql .= " AND (".$wherefordel.")"; // Note: parenthesis are important because wherefordel can contains OR. Also note that $wherefordel is already sanitized
1235 1235
 			}
1236 1236
 
1237 1237
 			// avoid admin to remove his own important rights
@@ -1410,12 +1410,12 @@  discard block
 block discarded – undo
1410 1410
 					$sql .= " AND r.entity = ".((int) $conf->entity);
1411 1411
 				}
1412 1412
 			} else {
1413
-				$sql .= " AND gr.entity = ".((int) $conf->entity);	// Only groups created in current entity
1413
+				$sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity
1414 1414
 				// The entity on the table gu=usergroup_user should be useless and should never be used because it is already into gr and r.
1415 1415
 				// but when using MULTICOMPANY_TRANSVERSE_MODE, we may have inserted record that make rubbish result here due to the duplicate record of
1416 1416
 				// other entities, so we are forced to add a filter on gu here
1417 1417
 				$sql .= " AND gu.entity IN (0,".$conf->entity.")";
1418
-				$sql .= " AND r.entity = ".((int) $conf->entity);	// Only permission of modules enabled in current entity
1418
+				$sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity
1419 1419
 			}
1420 1420
 			// End of strange business rule
1421 1421
 			$sql .= " AND gr.fk_usergroup = gu.fk_usergroup";
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
 		$this->civility_code = $member->civility_code;
1969 1969
 		$this->lastname     = $member->lastname;
1970 1970
 		$this->firstname    = $member->firstname;
1971
-		$this->gender		= $member->gender;
1971
+		$this->gender = $member->gender;
1972 1972
 		$this->email        = $member->email;
1973 1973
 		$this->fk_member    = $member->id;
1974 1974
 		$this->address      = $member->address;
@@ -2106,45 +2106,45 @@  discard block
 block discarded – undo
2106 2106
 		$this->lastname						= trim((string) $this->lastname);
2107 2107
 		$this->firstname					= trim((string) $this->firstname);
2108 2108
 		$this->ref_employee					= trim((string) $this->ref_employee);
2109
-		$this->national_registration_number	= trim((string) $this->national_registration_number);
2109
+		$this->national_registration_number = trim((string) $this->national_registration_number);
2110 2110
 		$this->employee						= ($this->employee > 0 ? $this->employee : 0);
2111 2111
 		$this->login						= trim((string) $this->login);
2112
-		$this->gender						= trim((string) $this->gender);
2112
+		$this->gender = trim((string) $this->gender);
2113 2113
 
2114 2114
 		$this->pass							= trim((string) $this->pass);
2115
-		$this->api_key						= trim((string) $this->api_key);
2116
-		$this->datestartvalidity			= empty($this->datestartvalidity) ? '' : $this->datestartvalidity;
2117
-		$this->dateendvalidity				= empty($this->dateendvalidity) ? '' : $this->dateendvalidity;
2115
+		$this->api_key = trim((string) $this->api_key);
2116
+		$this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity;
2117
+		$this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity;
2118 2118
 
2119
-		$this->address						= trim((string) $this->address);
2120
-		$this->zip							= trim((string) $this->zip);
2121
-		$this->town							= trim((string) $this->town);
2119
+		$this->address = trim((string) $this->address);
2120
+		$this->zip = trim((string) $this->zip);
2121
+		$this->town = trim((string) $this->town);
2122 2122
 
2123
-		$this->state_id						= ($this->state_id > 0 ? $this->state_id : 0);
2123
+		$this->state_id = ($this->state_id > 0 ? $this->state_id : 0);
2124 2124
 		$this->country_id					= ($this->country_id > 0 ? $this->country_id : 0);
2125
-		$this->office_phone					= trim((string) $this->office_phone);
2125
+		$this->office_phone = trim((string) $this->office_phone);
2126 2126
 		$this->office_fax					= trim((string) $this->office_fax);
2127
-		$this->user_mobile					= trim((string) $this->user_mobile);
2128
-		$this->personal_mobile				= trim((string) $this->personal_mobile);
2129
-		$this->email						= trim((string) $this->email);
2130
-		$this->personal_email				= trim((string) $this->personal_email);
2131
-
2132
-		$this->job							= trim((string) $this->job);
2133
-		$this->signature					= trim((string) $this->signature);
2134
-		$this->note_public					= trim((string) $this->note_public);
2135
-		$this->note_private					= trim((string) $this->note_private);
2136
-		$this->openid						= trim((string) $this->openid);
2137
-		$this->admin						= ($this->admin > 0 ? $this->admin : 0);
2138
-
2139
-		$this->accountancy_code_user_general	= trim((string) $this->accountancy_code_user_general);
2127
+		$this->user_mobile = trim((string) $this->user_mobile);
2128
+		$this->personal_mobile = trim((string) $this->personal_mobile);
2129
+		$this->email = trim((string) $this->email);
2130
+		$this->personal_email = trim((string) $this->personal_email);
2131
+
2132
+		$this->job = trim((string) $this->job);
2133
+		$this->signature = trim((string) $this->signature);
2134
+		$this->note_public = trim((string) $this->note_public);
2135
+		$this->note_private = trim((string) $this->note_private);
2136
+		$this->openid = trim((string) $this->openid);
2137
+		$this->admin = ($this->admin > 0 ? $this->admin : 0);
2138
+
2139
+		$this->accountancy_code_user_general = trim((string) $this->accountancy_code_user_general);
2140 2140
 		$this->accountancy_code				= trim((string) $this->accountancy_code);
2141
-		$this->color						= trim((string) $this->color);
2142
-		$this->dateemployment				= empty($this->dateemployment) ? '' : $this->dateemployment;
2141
+		$this->color = trim((string) $this->color);
2142
+		$this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment;
2143 2143
 		$this->dateemploymentend			= empty($this->dateemploymentend) ? '' : $this->dateemploymentend;
2144 2144
 
2145
-		$this->birth						= empty($this->birth) ? '' : $this->birth;
2146
-		$this->fk_warehouse					= (int) $this->fk_warehouse;
2147
-		$this->fk_establishment				= (int) $this->fk_establishment;
2145
+		$this->birth = empty($this->birth) ? '' : $this->birth;
2146
+		$this->fk_warehouse = (int) $this->fk_warehouse;
2147
+		$this->fk_establishment = (int) $this->fk_establishment;
2148 2148
 
2149 2149
 		$this->setUpperOrLowerCase();
2150 2150
 
@@ -2912,7 +2912,7 @@  discard block
 block discarded – undo
2912 2912
 		$sql .= " WHERE fk_user  = ".((int) $this->id);
2913 2913
 		$sql .= " AND fk_usergroup = ".((int) $group);
2914 2914
 		if (empty($entity)) {
2915
-			$sql .= " AND entity IN (0, 1)";	// group may be in entity 0 (so $entity=0) and link with user into entity 1.
2915
+			$sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1.
2916 2916
 		} else {
2917 2917
 			$sql .= " AND entity = ".((int) $entity);
2918 2918
 		}
@@ -3173,7 +3173,7 @@  discard block
 block discarded – undo
3173 3173
 				$linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
3174 3174
 			}
3175 3175
 			$linkclose .= ($label ? ' title="'.dolPrintHTMLForAttribute($label).'"' : ' title="tocomplete"');
3176
-			$linkclose .= $dataparams . ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
3176
+			$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
3177 3177
 		} else {
3178 3178
 			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
3179 3179
 		}
@@ -3412,11 +3412,11 @@  discard block
 block discarded – undo
3412 3412
 		global $conf;
3413 3413
 		$dn = '';
3414 3414
 		if ($mode == 0) {
3415
-			$dn = getDolGlobalString('LDAP_KEY_USERS') . "=".$info[getDolGlobalString('LDAP_KEY_USERS')]."," . getDolGlobalString('LDAP_USER_DN');
3415
+			$dn = getDolGlobalString('LDAP_KEY_USERS')."=".$info[getDolGlobalString('LDAP_KEY_USERS')].",".getDolGlobalString('LDAP_USER_DN');
3416 3416
 		} elseif ($mode == 1) {
3417 3417
 			$dn = getDolGlobalString('LDAP_USER_DN');
3418 3418
 		} elseif ($mode == 2) {
3419
-			$dn = getDolGlobalString('LDAP_KEY_USERS') . "=".$info[getDolGlobalString('LDAP_KEY_USERS')];
3419
+			$dn = getDolGlobalString('LDAP_KEY_USERS')."=".$info[getDolGlobalString('LDAP_KEY_USERS')];
3420 3420
 		}
3421 3421
 		return $dn;
3422 3422
 	}
@@ -3631,7 +3631,7 @@  discard block
 block discarded – undo
3631 3631
 		$this->iplastlogin = '127.0.0.1';
3632 3632
 		$this->datepreviouslogin = $now;
3633 3633
 		$this->ippreviouslogin = '127.0.0.1';
3634
-		$this->statut = 1;		// deprecated
3634
+		$this->statut = 1; // deprecated
3635 3635
 		$this->status = 1;
3636 3636
 
3637 3637
 		$this->entity = 1;
Please login to merge, or discard this patch.
htdocs/core/lib/payments.lib.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	// Load translation files required by the page
214 214
 	$langs->loadLangs(array('payment', 'stripe'));
215 215
 
216
-	$servicename = '';	// Link is a generic link for all payments services (paypal, stripe, ...)
216
+	$servicename = ''; // Link is a generic link for all payments services (paypal, stripe, ...)
217 217
 
218 218
 	$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'</span><br>';
219 219
 	$url = getOnlinePaymentUrl(0, $type, $ref, $amount);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
264 264
 	//$urlwithroot=DOL_MAIN_URL_ROOT;					// This is to use same domain name than current
265 265
 
266
-	$urltouse = DOL_MAIN_URL_ROOT;						// Should be "https://www.mydomain.com/mydolibarr" for example
266
+	$urltouse = DOL_MAIN_URL_ROOT; // Should be "https://www.mydomain.com/mydolibarr" for example
267 267
 	//dol_syslog("getOnlinePaymentUrl DOL_MAIN_URL_ROOT=".DOL_MAIN_URL_ROOT);
268 268
 
269 269
 	if ((string) $localorexternal == '1') {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			} else {
298 298
 				$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
299 299
 				if ($mode == 1) {
300
-					$out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + order_ref)";
300
+					$out .= "hash('".getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + order_ref)";
301 301
 				}
302 302
 				if ($mode == 0) {
303 303
 					$out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5');
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			} else {
321 321
 				$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
322 322
 				if ($mode == 1) {
323
-					$out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)";
323
+					$out .= "hash('".getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)";
324 324
 				}
325 325
 				if ($mode == 0) {
326 326
 					$out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5');
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 			} else {
344 344
 				$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
345 345
 				if ($mode == 1) {
346
-					$out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + contractline_ref)";
346
+					$out .= "hash('".getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + contractline_ref)";
347 347
 				}
348 348
 				if ($mode == 0) {
349 349
 					$out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5');
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 			} else {
370 370
 				$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
371 371
 				if ($mode == 1) {	// mode tuto
372
-					$out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$newtype."' + member_ref)";
372
+					$out .= "hash('".getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$newtype."' + member_ref)";
373 373
 				}
374 374
 				if ($mode == 0) {	// mode real
375 375
 					$out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$newtype.$ref, 'sha1md5');
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 			} else {
393 393
 				$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
394 394
 				if ($mode == 1) {
395
-					$out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + donation_ref)";
395
+					$out .= "hash('".getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + donation_ref)";
396 396
 				}
397 397
 				if ($mode == 0) {
398 398
 					$out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5');
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 			} else {
416 416
 				$out .= '&securekey='.($mode ? '<span style="color: #666666">' : '');
417 417
 				if ($mode == 1) {
418
-					$out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)";
418
+					$out .= "hash('".getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)";
419 419
 				}
420 420
 				if ($mode == 0) {
421 421
 					$out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5');
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 1 patch
Spacing   +1256 added lines, -1256 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 . ($tag != 'td' ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
692
+			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.($tag != 'td' ? ' 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
 
@@ -1552,30 +1552,30 @@  discard block
 block discarded – undo
1552 1552
 			$sql .= ", s.address, s.zip, s.town";
1553 1553
 			$sql .= ", dictp.code as country_code";
1554 1554
 		}
1555
-		$sql .= " FROM " . $this->db->prefix() . "societe as s";
1555
+		$sql .= " FROM ".$this->db->prefix()."societe as s";
1556 1556
 		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1557
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
1557
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
1558 1558
 		}
1559 1559
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1560
-			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
1560
+			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
1561 1561
 		}
1562
-		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1562
+		$sql .= " WHERE s.entity IN (".getEntity('societe').")";
1563 1563
 		if (!empty($user->socid)) {
1564
-			$sql .= " AND s.rowid = " . ((int) $user->socid);
1564
+			$sql .= " AND s.rowid = ".((int) $user->socid);
1565 1565
 		}
1566 1566
 		if ($filter) {
1567 1567
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1568 1568
 			// if not, by testSqlAndScriptInject() only.
1569
-			$sql .= " AND (" . $filter . ")";
1569
+			$sql .= " AND (".$filter.")";
1570 1570
 		}
1571 1571
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1572
-			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
1572
+			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1573 1573
 		}
1574 1574
 		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) {
1575 1575
 			$sql .= " AND s.status <> 0";
1576 1576
 		}
1577 1577
 		if (!empty($excludeids)) {
1578
-			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")";
1578
+			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")";
1579 1579
 		}
1580 1580
 		// Add where from hooks
1581 1581
 		$parameters = array();
@@ -1595,17 +1595,17 @@  discard block
 block discarded – undo
1595 1595
 				if ($i > 0) {
1596 1596
 					$sql .= " AND ";
1597 1597
 				}
1598
-				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1598
+				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
1599 1599
 				$i++;
1600 1600
 			}
1601 1601
 			if (count($search_crit) > 1) {
1602 1602
 				$sql .= ")";
1603 1603
 			}
1604 1604
 			if (isModEnabled('barcode')) {
1605
-				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1605
+				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1606 1606
 			}
1607
-			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1608
-			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1607
+			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1608
+			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1609 1609
 			$sql .= ")";
1610 1610
 		}
1611 1611
 		$sql .= $this->db->order("nom", "ASC");
@@ -1616,7 +1616,7 @@  discard block
 block discarded – undo
1616 1616
 		$resql = $this->db->query($sql);
1617 1617
 		if ($resql) {
1618 1618
 			// Construct $out and $outarray
1619
-			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
1619
+			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
1620 1620
 
1621 1621
 			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');
1622 1622
 			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
 				}
1630 1630
 			}
1631 1631
 			if ($showempty) {
1632
-				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : '&nbsp;') . '</span>') . '">' . $textifempty . '</option>' . "\n";
1632
+				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
1633 1633
 			}
1634 1634
 
1635 1635
 			$companytemp = new Societe($this->db);
@@ -1642,18 +1642,18 @@  discard block
 block discarded – undo
1642 1642
 					$label = '';
1643 1643
 					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
1644 1644
 						if (($obj->client) && (!empty($obj->code_client))) {
1645
-							$label = $obj->code_client . ' - ';
1645
+							$label = $obj->code_client.' - ';
1646 1646
 						}
1647 1647
 						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
1648
-							$label .= $obj->code_fournisseur . ' - ';
1648
+							$label .= $obj->code_fournisseur.' - ';
1649 1649
 						}
1650
-						$label .= ' ' . $obj->name;
1650
+						$label .= ' '.$obj->name;
1651 1651
 					} else {
1652 1652
 						$label = $obj->name;
1653 1653
 					}
1654 1654
 
1655 1655
 					if (!empty($obj->name_alias)) {
1656
-						$label .= ' (' . $obj->name_alias . ')';
1656
+						$label .= ' ('.$obj->name_alias.')';
1657 1657
 					}
1658 1658
 
1659 1659
 					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) {
@@ -1668,7 +1668,7 @@  discard block
 block discarded – undo
1668 1668
 						$companytemp->fournisseur = $obj->fournisseur;
1669 1669
 						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');
1670 1670
 						if ($tmptype) {
1671
-							$labelhtml .= ' ' . $tmptype;
1671
+							$labelhtml .= ' '.$tmptype;
1672 1672
 						}
1673 1673
 
1674 1674
 						if ($obj->client || $obj->fournisseur) {
@@ -1678,10 +1678,10 @@  discard block
 block discarded – undo
1678 1678
 							$label .= $langs->trans("Customer");
1679 1679
 						}
1680 1680
 						if ($obj->client == 2 || $obj->client == 3) {
1681
-							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1681
+							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect");
1682 1682
 						}
1683 1683
 						if ($obj->fournisseur) {
1684
-							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1684
+							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier");
1685 1685
 						}
1686 1686
 						if ($obj->client || $obj->fournisseur) {
1687 1687
 							$label .= ')';
@@ -1689,9 +1689,9 @@  discard block
 block discarded – undo
1689 1689
 					}
1690 1690
 
1691 1691
 					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1692
-						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');
1692
+						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
1693 1693
 						if (!empty($obj->country_code)) {
1694
-							$s .= ', ' . $langs->trans('Country' . $obj->country_code);
1694
+							$s .= ', '.$langs->trans('Country'.$obj->country_code);
1695 1695
 						}
1696 1696
 						$label .= $s;
1697 1697
 						$labelhtml .= $s;
@@ -1699,9 +1699,9 @@  discard block
 block discarded – undo
1699 1699
 
1700 1700
 					if (empty($outputmode)) {
1701 1701
 						if (in_array($obj->rowid, $selected)) {
1702
-							$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>';
1702
+							$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>';
1703 1703
 						} else {
1704
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1704
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1705 1705
 						}
1706 1706
 					} else {
1707 1707
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@@ -1713,9 +1713,9 @@  discard block
 block discarded – undo
1713 1713
 					}
1714 1714
 				}
1715 1715
 			}
1716
-			$out .= '</select>' . "\n";
1716
+			$out .= '</select>'."\n";
1717 1717
 			if (!$forcecombo) {
1718
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1718
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1719 1719
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT"));
1720 1720
 			}
1721 1721
 		} else {
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 		}
1805 1805
 
1806 1806
 		if (!is_object($hookmanager)) {
1807
-			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1807
+			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1808 1808
 			$hookmanager = new HookManager($this->db);
1809 1809
 		}
1810 1810
 
@@ -1813,14 +1813,14 @@  discard block
 block discarded – undo
1813 1813
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1814 1814
 			$sql .= ", s.nom as company, s.town AS company_town";
1815 1815
 		}
1816
-		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
1816
+		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
1817 1817
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1818
-			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
1818
+			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
1819 1819
 		}
1820
-		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
1820
+		$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
1821 1821
 		$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact
1822 1822
 		if ($socid > 0 || $socid == -1) {
1823
-			$sql .= " AND sp.fk_soc = " . ((int) $socid);
1823
+			$sql .= " AND sp.fk_soc = ".((int) $socid);
1824 1824
 		}
1825 1825
 		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) {
1826 1826
 			$sql .= " AND sp.statut <> 0";
@@ -1828,7 +1828,7 @@  discard block
 block discarded – undo
1828 1828
 		if ($filter) {
1829 1829
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1830 1830
 			// if not, by testSqlAndScriptInject() only.
1831
-			$sql .= " AND (" . $filter . ")";
1831
+			$sql .= " AND (".$filter.")";
1832 1832
 		}
1833 1833
 		// Add where from hooks
1834 1834
 		$parameters = array();
@@ -1836,30 +1836,30 @@  discard block
 block discarded – undo
1836 1836
 		$sql .= $hookmanager->resPrint;
1837 1837
 		$sql .= " ORDER BY sp.lastname ASC";
1838 1838
 
1839
-		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);
1839
+		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
1840 1840
 		$resql = $this->db->query($sql);
1841 1841
 		if ($resql) {
1842 1842
 			$num = $this->db->num_rows($resql);
1843 1843
 
1844 1844
 			if ($htmlname != 'none' && !$options_only) {
1845
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1845
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1846 1846
 			}
1847 1847
 
1848 1848
 			if ($showempty && !is_numeric($showempty)) {
1849 1849
 				$textforempty = $showempty;
1850
-				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';
1850
+				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
1851 1851
 			} else {
1852 1852
 				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1853
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1853
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1854 1854
 				}
1855 1855
 				if ($showempty == 2) {
1856
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>';
1856
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
1857 1857
 				}
1858 1858
 			}
1859 1859
 
1860 1860
 			$i = 0;
1861 1861
 			if ($num) {
1862
-				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1862
+				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1863 1863
 				$contactstatic = new Contact($this->db);
1864 1864
 
1865 1865
 				while ($i < $num) {
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 						}
1896 1896
 						$extendedInfos = implode(' - ', $extendedInfos);
1897 1897
 						if (!empty($extendedInfos)) {
1898
-							$extendedInfos = ' - ' . $extendedInfos;
1898
+							$extendedInfos = ' - '.$extendedInfos;
1899 1899
 						}
1900 1900
 					}
1901 1901
 
@@ -1913,35 +1913,35 @@  discard block
 block discarded – undo
1913 1913
 								$disabled = 1;
1914 1914
 							}
1915 1915
 							if (!empty($selected) && in_array($obj->rowid, $selected)) {
1916
-								$out .= '<option value="' . $obj->rowid . '"';
1916
+								$out .= '<option value="'.$obj->rowid.'"';
1917 1917
 								if ($disabled) {
1918 1918
 									$out .= ' disabled';
1919 1919
 								}
1920 1920
 								$out .= ' selected>';
1921 1921
 
1922
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1922
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1923 1923
 								if ($showfunction && $obj->poste) {
1924
-									$tmplabel .= ' (' . $obj->poste . ')';
1924
+									$tmplabel .= ' ('.$obj->poste.')';
1925 1925
 								}
1926 1926
 								if (($showsoc > 0) && $obj->company) {
1927
-									$tmplabel .= ' - (' . $obj->company . ')';
1927
+									$tmplabel .= ' - ('.$obj->company.')';
1928 1928
 								}
1929 1929
 
1930 1930
 								$out .= $tmplabel;
1931 1931
 								$out .= '</option>';
1932 1932
 							} else {
1933
-								$out .= '<option value="' . $obj->rowid . '"';
1933
+								$out .= '<option value="'.$obj->rowid.'"';
1934 1934
 								if ($disabled) {
1935 1935
 									$out .= ' disabled';
1936 1936
 								}
1937 1937
 								$out .= '>';
1938 1938
 
1939
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1939
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1940 1940
 								if ($showfunction && $obj->poste) {
1941
-									$tmplabel .= ' (' . $obj->poste . ')';
1941
+									$tmplabel .= ' ('.$obj->poste.')';
1942 1942
 								}
1943 1943
 								if (($showsoc > 0) && $obj->company) {
1944
-									$tmplabel .= ' - (' . $obj->company . ')';
1944
+									$tmplabel .= ' - ('.$obj->company.')';
1945 1945
 								}
1946 1946
 
1947 1947
 								$out .= $tmplabel;
@@ -1949,12 +1949,12 @@  discard block
 block discarded – undo
1949 1949
 							}
1950 1950
 						} else {
1951 1951
 							if (in_array($obj->rowid, $selected)) {
1952
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1952
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1953 1953
 								if ($showfunction && $obj->poste) {
1954
-									$tmplabel .= ' (' . $obj->poste . ')';
1954
+									$tmplabel .= ' ('.$obj->poste.')';
1955 1955
 								}
1956 1956
 								if (($showsoc > 0) && $obj->company) {
1957
-									$tmplabel .= ' - (' . $obj->company . ')';
1957
+									$tmplabel .= ' - ('.$obj->company.')';
1958 1958
 								}
1959 1959
 
1960 1960
 								$out .= $tmplabel;
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
 				}
1970 1970
 			} else {
1971 1971
 				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1972
-				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';
1972
+				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';
1973 1973
 				$out .= $labeltoshow;
1974 1974
 				$out .= '</option>';
1975 1975
 			}
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 			}
1991 1991
 
1992 1992
 			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
1993
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1993
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1994 1994
 				$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT"));
1995 1995
 			}
1996 1996
 
@@ -2029,18 +2029,18 @@  discard block
 block discarded – undo
2029 2029
 		// On recherche les remises
2030 2030
 		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
2031 2031
 		$sql .= " re.description, re.fk_facture_source";
2032
-		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
2033
-		$sql .= " WHERE re.fk_soc = " . (int) $socid;
2034
-		$sql .= " AND re.entity = " . $conf->entity;
2032
+		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";
2033
+		$sql .= " WHERE re.fk_soc = ".(int) $socid;
2034
+		$sql .= " AND re.entity = ".$conf->entity;
2035 2035
 		if ($filter) {
2036
-			$sql .= " AND " . $filter;
2036
+			$sql .= " AND ".$filter;
2037 2037
 		}
2038 2038
 		$sql .= " ORDER BY re.description ASC";
2039 2039
 
2040
-		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
2040
+		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
2041 2041
 		$resql = $this->db->query($sql);
2042 2042
 		if ($resql) {
2043
-			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';
2043
+			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
2044 2044
 			$num = $this->db->num_rows($resql);
2045 2045
 
2046 2046
 			$qualifiedlines = $num;
@@ -2078,16 +2078,16 @@  discard block
 block discarded – undo
2078 2078
 					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) {
2079 2079
 						$tmpfac = new Facture($this->db);
2080 2080
 						if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
2081
-							$desc = $desc . ' - ' . $tmpfac->ref;
2081
+							$desc = $desc.' - '.$tmpfac->ref;
2082 2082
 						}
2083 2083
 					}
2084 2084
 
2085
-					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
2085
+					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
2086 2086
 					$i++;
2087 2087
 				}
2088 2088
 			}
2089 2089
 			print '</select>';
2090
-			print ajax_combobox('select_' . $htmlname);
2090
+			print ajax_combobox('select_'.$htmlname);
2091 2091
 
2092 2092
 			return $qualifiedlines;
2093 2093
 		} else {
@@ -2196,14 +2196,14 @@  discard block
 block discarded – undo
2196 2196
 		if ($showlabelofentity) {
2197 2197
 			$sql .= ", e.label";
2198 2198
 		}
2199
-		$sql .= " FROM " . $this->db->prefix() . "user as u";
2199
+		$sql .= " FROM ".$this->db->prefix()."user as u";
2200 2200
 		if ($showlabelofentity) {
2201
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
2201
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
2202 2202
 		}
2203 2203
 		// Condition here should be the same than into societe->getSalesRepresentatives().
2204 2204
 		if ($userissuperadminentityone && $force_entity != 'default') {
2205 2205
 			if (!empty($force_entity)) {
2206
-				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
2206
+				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
2207 2207
 			} else {
2208 2208
 				$sql .= " WHERE u.entity IS NOT NULL";
2209 2209
 			}
@@ -2211,18 +2211,18 @@  discard block
 block discarded – undo
2211 2211
 			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) {
2212 2212
 				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))";
2213 2213
 			} else {
2214
-				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
2214
+				$sql .= " WHERE u.entity IN (".getEntity('user').")";
2215 2215
 			}
2216 2216
 		}
2217 2217
 
2218 2218
 		if (!empty($user->socid)) {
2219
-			$sql .= " AND u.fk_soc = " . ((int) $user->socid);
2219
+			$sql .= " AND u.fk_soc = ".((int) $user->socid);
2220 2220
 		}
2221 2221
 		if (is_array($exclude) && $excludeUsers) {
2222
-			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
2222
+			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")";
2223 2223
 		}
2224 2224
 		if ($includeUsers) {
2225
-			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")";
2225
+			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")";
2226 2226
 		}
2227 2227
 		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
2228 2228
 			$sql .= " AND u.statut <> 0";
@@ -2259,7 +2259,7 @@  discard block
 block discarded – undo
2259 2259
 			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
2260 2260
 		}
2261 2261
 
2262
-		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);
2262
+		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
2263 2263
 
2264 2264
 		$resql = $this->db->query($sql);
2265 2265
 		if ($resql) {
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
 			$i = 0;
2268 2268
 			if ($num) {
2269 2269
 				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
2270
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
2270
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
2271 2271
 				if ($show_empty && !$multiple) {
2272 2272
 					$textforempty = ' ';
2273 2273
 					if (!empty($conf->use_javascript_ajax)) {
@@ -2276,7 +2276,7 @@  discard block
 block discarded – undo
2276 2276
 					if (!is_numeric($show_empty)) {
2277 2277
 						$textforempty = $show_empty;
2278 2278
 					}
2279
-					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
2279
+					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
2280 2280
 
2281 2281
 					$outarray[($show_empty < 0 ? $show_empty : -1)] = $textforempty;
2282 2282
 					$outarray2[($show_empty < 0 ? $show_empty : -1)] = array(
@@ -2288,13 +2288,13 @@  discard block
 block discarded – undo
2288 2288
 					);
2289 2289
 				}
2290 2290
 				if ($show_every) {
2291
-					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
2291
+					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
2292 2292
 
2293
-					$outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --';
2293
+					$outarray[-2] = '-- '.$langs->trans("Everybody").' --';
2294 2294
 					$outarray2[-2] = array(
2295 2295
 						'id' => -2,
2296
-						'label' => '-- ' . $langs->trans("Everybody") . ' --',
2297
-						'labelhtml' => '-- ' . $langs->trans("Everybody") . ' --',
2296
+						'label' => '-- '.$langs->trans("Everybody").' --',
2297
+						'labelhtml' => '-- '.$langs->trans("Everybody").' --',
2298 2298
 						'color' => '',
2299 2299
 						'picto' => ''
2300 2300
 					);
@@ -2345,21 +2345,21 @@  discard block
 block discarded – undo
2345 2345
 					}
2346 2346
 					if ($showstatus >= 0) {
2347 2347
 						if ($obj->status == 1 && $showstatus == 1) {
2348
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
2349
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled');
2348
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
2349
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
2350 2350
 						}
2351 2351
 						if ($obj->status == 0 && $showstatus == 1) {
2352
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
2353
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled');
2352
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
2353
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
2354 2354
 						}
2355 2355
 					}
2356 2356
 					if ($showlabelofentity) {
2357 2357
 						if (empty($obj->entity)) {
2358
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
2359
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
2358
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
2359
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
2360 2360
 						} else {
2361 2361
 							if ($obj->entity != $conf->entity) {
2362
-								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2362
+								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2363 2363
 								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2364 2364
 							}
2365 2365
 						}
@@ -2368,13 +2368,13 @@  discard block
 block discarded – undo
2368 2368
 					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');
2369 2369
 					if (!empty($disableline) && $disableline != '1') {
2370 2370
 						// Add text from $enableonlytext parameter
2371
-						$moreinfo .= ' - ' . $disableline;
2372
-						$moreinfohtml .= ' - ' . $disableline;
2371
+						$moreinfo .= ' - '.$disableline;
2372
+						$moreinfohtml .= ' - '.$disableline;
2373 2373
 					}
2374 2374
 					$labeltoshow .= $moreinfo;
2375 2375
 					$labeltoshowhtml .= $moreinfohtml;
2376 2376
 
2377
-					$out .= '<option value="' . $obj->rowid . '"';
2377
+					$out .= '<option value="'.$obj->rowid.'"';
2378 2378
 					if (!empty($disableline)) {
2379 2379
 						$out .= ' disabled';
2380 2380
 					}
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
 					}
2384 2384
 					$out .= ' data-html="';
2385 2385
 
2386
-					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';
2386
+					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
2387 2387
 					if ($showstatus >= 0 && $obj->status == 0) {
2388 2388
 						$outhtml .= '<strike class="opacitymediumxxx">';
2389 2389
 					}
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 					$out .= $labeltoshow;
2399 2399
 					$out .= '</option>';
2400 2400
 
2401
-					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
2401
+					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
2402 2402
 					$outarray2[$userstatic->id] = array(
2403 2403
 						'id' => $userstatic->id,
2404 2404
 						'label' => $labeltoshow,
@@ -2410,14 +2410,14 @@  discard block
 block discarded – undo
2410 2410
 					$i++;
2411 2411
 				}
2412 2412
 			} else {
2413
-				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
2414
-				$out .= '<option value="">' . $langs->trans("None") . '</option>';
2413
+				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
2414
+				$out .= '<option value="">'.$langs->trans("None").'</option>';
2415 2415
 			}
2416 2416
 			$out .= '</select>';
2417 2417
 
2418 2418
 			if ($num && !$forcecombo) {
2419 2419
 				// Enhance with select2
2420
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2420
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2421 2421
 				$out .= ajax_combobox($htmlname);
2422 2422
 			}
2423 2423
 		} else {
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
 			$out .= $userstatic->getNomUrl(-1);
2495 2495
 			if ($i == 0) {
2496 2496
 				$ownerid = $value['id'];
2497
-				$out .= ' (' . $langs->trans("Owner") . ')';
2497
+				$out .= ' ('.$langs->trans("Owner").')';
2498 2498
 			}
2499 2499
 			// Add picto to delete owner/assignee
2500 2500
 			if ($nbassignetouser > 1 && $action != 'view') {
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
 						$canremoveassignee = 0;
2506 2506
 					}
2507 2507
 					if (!$user->hasRight('agenda', 'allactions', 'create')) {
2508
-						$canremoveassignee = 0;		// Can't remove the owner
2508
+						$canremoveassignee = 0; // Can't remove the owner
2509 2509
 					}
2510 2510
 				} else {
2511 2511
 					// We are not on the owner of the event but on a secondary assignee
@@ -2513,14 +2513,14 @@  discard block
 block discarded – undo
2513 2513
 				if ($canremoveassignee) {
2514 2514
 					// If user has all permission, he should be ableto remove a assignee.
2515 2515
 					// If user has not all permission, he can onlyremove assignee of other (he can't remove itself)
2516
-					$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 . '">';
2516
+					$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.'">';
2517 2517
 				}
2518 2518
 			}
2519 2519
 			// Show my availability
2520 2520
 			if ($showproperties) {
2521 2521
 				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
2522 2522
 					$out .= '<div class="myavailability inline-block">';
2523
-					$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>';
2523
+					$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>';
2524 2524
 					$out .= '</div>';
2525 2525
 				}
2526 2526
 			}
@@ -2537,15 +2537,15 @@  discard block
 block discarded – undo
2537 2537
 		// Method with no ajax
2538 2538
 		if ($action != 'view') {
2539 2539
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
2540
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2540
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2541 2541
 			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
2542 2542
 			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
2543
-			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }';
2544
-			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }';
2543
+			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';
2544
+			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }';
2545 2545
 			$out .= '});';
2546 2546
 			$out .= '})</script>';
2547 2547
 			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2548
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2548
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2549 2549
 			$out .= '<br>';
2550 2550
 		}
2551 2551
 
@@ -2604,13 +2604,13 @@  discard block
 block discarded – undo
2604 2604
 			$resourcestatic->fetch($value['id']);
2605 2605
 			$out .= $resourcestatic->getNomUrl(-1);
2606 2606
 			if ($nbassignetoresource >= 1 && $action != 'view') {
2607
-				$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 . '">';
2607
+				$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.'">';
2608 2608
 			}
2609 2609
 			// Show my availability
2610 2610
 			if ($showproperties) {
2611 2611
 				if (is_array($listofresourceid) && count($listofresourceid)) {
2612 2612
 					$out .= '<div class="myavailability inline-block">';
2613
-					$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>';
2613
+					$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>';
2614 2614
 					$out .= '</div>';
2615 2615
 				}
2616 2616
 			}
@@ -2627,11 +2627,11 @@  discard block
 block discarded – undo
2627 2627
 		// Method with no ajax
2628 2628
 		if ($action != 'view') {
2629 2629
 			$out .= '<input type="hidden" class="removedassignedresourcehidden" name="removedassignedresource" value="">';
2630
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2630
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2631 2631
 			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });';
2632 2632
 			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());';
2633
-			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }';
2634
-			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }';
2633
+			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }';
2634
+			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }';
2635 2635
 			$out .= '});';
2636 2636
 			$out .= '})</script>';
2637 2637
 
@@ -2639,7 +2639,7 @@  discard block
 block discarded – undo
2639 2639
 			$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
2640 2640
 			$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);
2641 2641
 			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2642
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2642
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2643 2643
 			$out .= '<br>';
2644 2644
 		}
2645 2645
 
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
 			$placeholder = (is_numeric($showempty) ? '' : 'placeholder="'.dolPrintHTML($showempty).'"');
2703 2703
 
2704 2704
 			if ($selected && empty($selected_input_value)) {
2705
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2705
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2706 2706
 				$producttmpselect = new Product($this->db);
2707 2707
 				$producttmpselect->fetch($selected);
2708 2708
 				$selected_input_value = $producttmpselect->ref;
@@ -2717,21 +2717,21 @@  discard block
 block discarded – undo
2717 2717
 				}
2718 2718
 			}
2719 2719
 			// mode=1 means customers products
2720
-			$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;
2720
+			$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;
2721 2721
 			if ((int) $warehouseId > 0) {
2722
-				$urloption .= '&warehouseid=' . (int) $warehouseId;
2722
+				$urloption .= '&warehouseid='.(int) $warehouseId;
2723 2723
 			}
2724 2724
 
2725
-			$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);
2725
+			$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);
2726 2726
 
2727 2727
 			if (isModEnabled('variants') && is_array($selected_combinations)) {
2728 2728
 				// Code to automatically insert with javascript the select of attributes under the select of product
2729 2729
 				// when a parent of variant has been selected.
2730 2730
 				$out .= '
2731 2731
 				<!-- script to auto show attributes select tags if a variant was selected -->
2732
-				<script nonce="' . getNonce() . '">
2732
+				<script nonce="' . getNonce().'">
2733 2733
 					// auto show attributes fields
2734
-					selected = ' . json_encode($selected_combinations) . ';
2734
+					selected = ' . json_encode($selected_combinations).';
2735 2735
 					combvalues = {};
2736 2736
 
2737 2737
 					jQuery(document).ready(function () {
@@ -2742,7 +2742,7 @@  discard block
 block discarded – undo
2742 2742
 							}
2743 2743
 						});
2744 2744
 
2745
-						jQuery("input#' . $htmlname . '").change(function () {
2745
+						jQuery("input#' . $htmlname.'").change(function () {
2746 2746
 
2747 2747
 							if (!jQuery(this).val()) {
2748 2748
 								jQuery(\'div#attributes_box\').empty();
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 
2752 2752
 							console.log("A change has started. We get variants fields to inject html select");
2753 2753
 
2754
-							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", {
2754
+							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
2755 2755
 								id: jQuery(this).val()
2756 2756
 							}, function (data) {
2757 2757
 								jQuery(\'div#attributes_box\').empty();
@@ -2794,22 +2794,22 @@  discard block
 block discarded – undo
2794 2794
 							})
2795 2795
 						});
2796 2796
 
2797
-						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . '
2797
+						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').'
2798 2798
 					});
2799 2799
 				</script>
2800 2800
                 ';
2801 2801
 			}
2802 2802
 
2803 2803
 			if (empty($hidelabel)) {
2804
-				$placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"';
2804
+				$placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"';
2805 2805
 			} elseif ($hidelabel > 1) {
2806
-				$placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"';
2806
+				$placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"';
2807 2807
 				if ($hidelabel == 2) {
2808 2808
 					$out .= img_picto($langs->trans("Search"), 'search');
2809 2809
 				}
2810 2810
 			}
2811 2811
 
2812
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
2812
+			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
2813 2813
 			if ($hidelabel == 3) {
2814 2814
 				$out .= img_picto($langs->trans("Search"), 'search');
2815 2815
 			}
@@ -2846,33 +2846,33 @@  discard block
 block discarded – undo
2846 2846
 		// phpcs:enable
2847 2847
 		global $db;
2848 2848
 
2849
-		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2849
+		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2850 2850
 
2851 2851
 		$error = 0;
2852 2852
 		$out = '';
2853 2853
 
2854 2854
 		if (!$forcecombo) {
2855
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2855
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2856 2856
 			$events = array();
2857 2857
 			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2858 2858
 		}
2859 2859
 
2860
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2860
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2861 2861
 
2862 2862
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2863
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2864
-		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2863
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2864
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2865 2865
 		if (!empty($status)) {
2866
-			$sql .= ' AND status = ' . (int) $status;
2866
+			$sql .= ' AND status = '.(int) $status;
2867 2867
 		}
2868 2868
 		if (!empty($type)) {
2869
-			$sql .= ' AND bomtype = ' . (int) $type;
2869
+			$sql .= ' AND bomtype = '.(int) $type;
2870 2870
 		}
2871 2871
 		if (!empty($TProducts)) {
2872
-			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2872
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2873 2873
 		}
2874 2874
 		if (!empty($limit)) {
2875
-			$sql .= ' LIMIT ' . (int) $limit;
2875
+			$sql .= ' LIMIT '.(int) $limit;
2876 2876
 		}
2877 2877
 		$resql = $db->query($sql);
2878 2878
 		if ($resql) {
@@ -2886,11 +2886,11 @@  discard block
 block discarded – undo
2886 2886
 			while ($obj = $db->fetch_object($resql)) {
2887 2887
 				$product = new Product($db);
2888 2888
 				$res = $product->fetch($obj->fk_product);
2889
-				$out .= '<option value="' . $obj->rowid . '"';
2889
+				$out .= '<option value="'.$obj->rowid.'"';
2890 2890
 				if ($obj->rowid == $selected) {
2891 2891
 					$out .= 'selected';
2892 2892
 				}
2893
-				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2893
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2894 2894
 			}
2895 2895
 		} else {
2896 2896
 			$error++;
@@ -2948,7 +2948,7 @@  discard block
 block discarded – undo
2948 2948
 
2949 2949
 		$warehouseStatusArray = array();
2950 2950
 		if (!empty($warehouseStatus)) {
2951
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2951
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2952 2952
 			if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2953 2953
 				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2954 2954
 			}
@@ -2962,9 +2962,9 @@  discard block
 block discarded – undo
2962 2962
 
2963 2963
 		$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";
2964 2964
 		if (count($warehouseStatusArray)) {
2965
-			$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
2965
+			$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
2966 2966
 		} else {
2967
-			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
2967
+			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
2968 2968
 		}
2969 2969
 
2970 2970
 		$sql = "SELECT ";
@@ -2980,9 +2980,9 @@  discard block
 block discarded – undo
2980 2980
 
2981 2981
 		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
2982 2982
 			//Product category
2983
-			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
2984
-						FROM " . $this->db->prefix() . "categorie_product
2985
-						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
2983
+			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
2984
+						FROM " . $this->db->prefix()."categorie_product
2985
+						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid
2986 2986
 						LIMIT 1
2987 2987
 				) AS categorie_product_id ";
2988 2988
 		}
@@ -3008,15 +3008,15 @@  discard block
 block discarded – undo
3008 3008
 		}
3009 3009
 		// Price by quantity
3010 3010
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
3011
-			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
3011
+			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
3012 3012
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
3013
-				$sql .= " AND price_level = " . ((int) $price_level);
3013
+				$sql .= " AND price_level = ".((int) $price_level);
3014 3014
 			}
3015 3015
 			$sql .= " ORDER BY date_price";
3016 3016
 			$sql .= " DESC LIMIT 1) as price_rowid";
3017
-			$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
3017
+			$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
3018 3018
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
3019
-				$sql .= " AND price_level = " . ((int) $price_level);
3019
+				$sql .= " AND price_level = ".((int) $price_level);
3020 3020
 			}
3021 3021
 			$sql .= " ORDER BY date_price";
3022 3022
 			$sql .= " DESC LIMIT 1) as price_by_qty";
@@ -3026,7 +3026,7 @@  discard block
 block discarded – undo
3026 3026
 		$sql .= " FROM ".$this->db->prefix()."product as p";
3027 3027
 
3028 3028
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) {
3029
-			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")";
3029
+			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")";
3030 3030
 		}
3031 3031
 
3032 3032
 		// Add from (left join) from hooks
@@ -3035,53 +3035,53 @@  discard block
 block discarded – undo
3035 3035
 		$sql .= $hookmanager->resPrint;
3036 3036
 
3037 3037
 		if (count($warehouseStatusArray)) {
3038
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
3039
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
3040
-			$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.
3038
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
3039
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
3040
+			$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.
3041 3041
 		}
3042 3042
 
3043 3043
 		// include search in supplier ref
3044 3044
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3045
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3045
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3046 3046
 		}
3047 3047
 
3048 3048
 		//Price by customer
3049 3049
 		if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
3050
-			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
3050
+			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
3051 3051
 		}
3052 3052
 		// Units
3053 3053
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3054
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3054
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3055 3055
 		}
3056 3056
 		// Multilang : we add translation
3057 3057
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
3058
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
3058
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
3059 3059
 			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) {
3060
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
3060
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
3061 3061
 				$soc = new Societe($this->db);
3062 3062
 				$result = $soc->fetch($socid);
3063 3063
 				if ($result > 0 && !empty($soc->default_lang)) {
3064
-					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
3064
+					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
3065 3065
 				} else {
3066
-					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3066
+					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3067 3067
 				}
3068 3068
 			} else {
3069
-				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3069
+				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3070 3070
 			}
3071 3071
 		}
3072 3072
 
3073 3073
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3074
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3074
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3075 3075
 		}
3076 3076
 
3077
-		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
3077
+		$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
3078 3078
 
3079 3079
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3080 3080
 			$sql .= " AND pac.rowid IS NULL";
3081 3081
 		}
3082 3082
 
3083 3083
 		if ($finished == 0) {
3084
-			$sql .= " AND p.finished = " . ((int) $finished);
3084
+			$sql .= " AND p.finished = ".((int) $finished);
3085 3085
 		} elseif ($finished == 1) {
3086 3086
 			$sql .= " AND p.finished = ".((int) $finished);
3087 3087
 		}
@@ -3089,11 +3089,11 @@  discard block
 block discarded – undo
3089 3089
 			$sql .= " AND p.tosell = ".((int) $status);
3090 3090
 		}
3091 3091
 		if ($status_purchase >= 0) {
3092
-			$sql .= " AND p.tobuy = " . ((int) $status_purchase);
3092
+			$sql .= " AND p.tobuy = ".((int) $status_purchase);
3093 3093
 		}
3094 3094
 		// Filter by product type
3095 3095
 		if (strval($filtertype) != '') {
3096
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3096
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3097 3097
 		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
3098 3098
 			$sql .= " AND p.fk_product_type = 1";
3099 3099
 		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
@@ -3101,7 +3101,7 @@  discard block
 block discarded – undo
3101 3101
 		}
3102 3102
 
3103 3103
 		if ((int) $warehouseId > 0) {
3104
-			$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)";
3104
+			$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)";
3105 3105
 		}
3106 3106
 
3107 3107
 		// Add where from hooks
@@ -3122,21 +3122,21 @@  discard block
 block discarded – undo
3122 3122
 				if ($i > 0) {
3123 3123
 					$sql .= " AND ";
3124 3124
 				}
3125
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3125
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3126 3126
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
3127
-					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3127
+					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3128 3128
 				}
3129 3129
 				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
3130
-					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3130
+					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
3131 3131
 				}
3132 3132
 				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) {
3133
-					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3133
+					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3134 3134
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
3135
-						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3135
+						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3136 3136
 					}
3137 3137
 				}
3138 3138
 				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3139
-					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3139
+					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3140 3140
 				}
3141 3141
 				$sql .= ")";
3142 3142
 				$i++;
@@ -3145,12 +3145,12 @@  discard block
 block discarded – undo
3145 3145
 				$sql .= ")";
3146 3146
 			}
3147 3147
 			if (isModEnabled('barcode')) {
3148
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3148
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3149 3149
 			}
3150 3150
 			$sql .= ')';
3151 3151
 		}
3152 3152
 		if (count($warehouseStatusArray)) {
3153
-			$sql .= " GROUP BY " . $selectFields;
3153
+			$sql .= " GROUP BY ".$selectFields;
3154 3154
 		}
3155 3155
 
3156 3156
 		//Sort by category
@@ -3165,23 +3165,23 @@  discard block
 block discarded – undo
3165 3165
 		$sql .= $this->db->plimit($limit, 0);
3166 3166
 
3167 3167
 		// Build output string
3168
-		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
3168
+		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
3169 3169
 		$result = $this->db->query($sql);
3170 3170
 		if ($result) {
3171
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3172
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3173
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3171
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3172
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3173
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3174 3174
 
3175 3175
 			$num = $this->db->num_rows($result);
3176 3176
 
3177 3177
 			$events = array();
3178 3178
 
3179 3179
 			if (!$forcecombo) {
3180
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
3180
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
3181 3181
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
3182 3182
 			}
3183 3183
 
3184
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
3184
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
3185 3185
 
3186 3186
 			$textifempty = '';
3187 3187
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -3198,7 +3198,7 @@  discard block
 block discarded – undo
3198 3198
 				}
3199 3199
 			}
3200 3200
 			if ($showempty) {
3201
-				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : '&nbsp;') . '</option>';
3201
+				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
3202 3202
 			}
3203 3203
 
3204 3204
 			$i = 0;
@@ -3209,11 +3209,11 @@  discard block
 block discarded – undo
3209 3209
 
3210 3210
 				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
3211 3211
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
3212
-					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
3213
-					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
3212
+					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
3213
+					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
3214 3214
 					$sql .= " ORDER BY quantity ASC";
3215 3215
 
3216
-					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
3216
+					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
3217 3217
 					$result2 = $this->db->query($sql);
3218 3218
 					if ($result2) {
3219 3219
 						$nb_prices = $this->db->num_rows($result2);
@@ -3251,7 +3251,7 @@  discard block
 block discarded – undo
3251 3251
 						$price_product = new Product($this->db);
3252 3252
 						$price_product->fetch($objp->rowid, '', '', 1);
3253 3253
 
3254
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3254
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3255 3255
 						$priceparser = new PriceParser($this->db);
3256 3256
 						$price_result = $priceparser->parseProduct($price_product);
3257 3257
 						if ($price_result >= 0) {
@@ -3337,7 +3337,7 @@  discard block
 block discarded – undo
3337 3337
 			$label = $objp->label_translated;
3338 3338
 		}
3339 3339
 		if (!empty($filterkey) && $filterkey != '') {
3340
-			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3340
+			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3341 3341
 		}
3342 3342
 
3343 3343
 		$outkey = $objp->rowid;
@@ -3358,32 +3358,32 @@  discard block
 block discarded – undo
3358 3358
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
3359 3359
 
3360 3360
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3361
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
3361
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
3362 3362
 		}
3363 3363
 
3364 3364
 		// Units
3365 3365
 		$outvalUnits = '';
3366 3366
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3367 3367
 			if (!empty($objp->unit_short)) {
3368
-				$outvalUnits .= ' - ' . $objp->unit_short;
3368
+				$outvalUnits .= ' - '.$objp->unit_short;
3369 3369
 			}
3370 3370
 		}
3371 3371
 		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) {
3372 3372
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
3373 3373
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3374
-				$outvalUnits .= ' - ' . $unitToShow;
3374
+				$outvalUnits .= ' - '.$unitToShow;
3375 3375
 			}
3376 3376
 			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3377
-				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3378
-				$outvalUnits .= ' - ' . $unitToShow;
3377
+				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3378
+				$outvalUnits .= ' - '.$unitToShow;
3379 3379
 			}
3380 3380
 			if (!empty($objp->surface) && $objp->surface_units !== null) {
3381 3381
 				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3382
-				$outvalUnits .= ' - ' . $unitToShow;
3382
+				$outvalUnits .= ' - '.$unitToShow;
3383 3383
 			}
3384 3384
 			if (!empty($objp->volume) && $objp->volume_units !== null) {
3385 3385
 				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3386
-				$outvalUnits .= ' - ' . $unitToShow;
3386
+				$outvalUnits .= ' - '.$unitToShow;
3387 3387
 			}
3388 3388
 		}
3389 3389
 		if ($outdurationvalue && $outdurationunit) {
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
 				'y' => $langs->trans('Year')
3396 3396
 			);
3397 3397
 			if (isset($da[$outdurationunit])) {
3398
-				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3398
+				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3399 3399
 			}
3400 3400
 		}
3401 3401
 
@@ -3415,31 +3415,31 @@  discard block
 block discarded – undo
3415 3415
 		$labeltoshow = '';
3416 3416
 		$labeltoshow .= $objp->ref;
3417 3417
 		if (!empty($objp->custref)) {
3418
-			$labeltoshow .= ' (' . $objp->custref . ')';
3418
+			$labeltoshow .= ' ('.$objp->custref.')';
3419 3419
 		}
3420 3420
 		if ($outbarcode) {
3421
-			$labeltoshow .= ' (' . $outbarcode . ')';
3421
+			$labeltoshow .= ' ('.$outbarcode.')';
3422 3422
 		}
3423
-		$labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle);
3423
+		$labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle);
3424 3424
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3425
-			$labeltoshow .= ' (' . getCountry($outorigin, '1') . ')';
3425
+			$labeltoshow .= ' ('.getCountry($outorigin, '1').')';
3426 3426
 		}
3427 3427
 
3428 3428
 		// Set $labltoshowhtml
3429 3429
 		$labeltoshowhtml = '';
3430 3430
 		$labeltoshowhtml .= $objp->ref;
3431 3431
 		if (!empty($objp->custref)) {
3432
-			$labeltoshowhtml .= ' (' . $objp->custref . ')';
3432
+			$labeltoshowhtml .= ' ('.$objp->custref.')';
3433 3433
 		}
3434 3434
 		if (!empty($filterkey) && $filterkey != '') {
3435
-			$labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3435
+			$labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3436 3436
 		}
3437 3437
 		if ($outbarcode) {
3438
-			$labeltoshowhtml .= ' (' . $outbarcode . ')';
3438
+			$labeltoshowhtml .= ' ('.$outbarcode.')';
3439 3439
 		}
3440
-		$labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle);
3440
+		$labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle);
3441 3441
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3442
-			$labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')';
3442
+			$labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')';
3443 3443
 		}
3444 3444
 
3445 3445
 		// Stock
@@ -3447,14 +3447,14 @@  discard block
 block discarded – undo
3447 3447
 		$labeltoshowhtmlstock = '';
3448 3448
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3449 3449
 			if ($user->hasRight('stock', 'lire')) {
3450
-				$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3450
+				$labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3451 3451
 
3452 3452
 				if ($objp->stock > 0) {
3453 3453
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">';
3454 3454
 				} elseif ($objp->stock <= 0) {
3455 3455
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">';
3456 3456
 				}
3457
-				$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3457
+				$labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3458 3458
 				$labeltoshowhtmlstock .= '</span>';
3459 3459
 
3460 3460
 				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
@@ -3465,9 +3465,9 @@  discard block
 block discarded – undo
3465 3465
 					$tmpproduct->load_virtual_stock();
3466 3466
 					$virtualstock = $tmpproduct->stock_theorique;
3467 3467
 
3468
-					$labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3468
+					$labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3469 3469
 
3470
-					$labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3470
+					$labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':';
3471 3471
 					if ($virtualstock > 0) {
3472 3472
 						$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">';
3473 3473
 					} elseif ($virtualstock <= 0) {
@@ -3488,35 +3488,35 @@  discard block
 block discarded – undo
3488 3488
 		// If we need a particular price level (from 1 to n)
3489 3489
 		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) {
3490 3490
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
3491
-			$sql .= " FROM " . $this->db->prefix() . "product_price";
3492
-			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
3493
-			$sql .= " AND entity IN (" . getEntity('productprice') . ")";
3494
-			$sql .= " AND price_level = " . ((int) $price_level);
3491
+			$sql .= " FROM ".$this->db->prefix()."product_price";
3492
+			$sql .= " WHERE fk_product = ".((int) $objp->rowid);
3493
+			$sql .= " AND entity IN (".getEntity('productprice').")";
3494
+			$sql .= " AND price_level = ".((int) $price_level);
3495 3495
 			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
3496 3496
 			$sql .= " LIMIT 1";
3497 3497
 
3498
-			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);
3498
+			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
3499 3499
 			$result2 = $this->db->query($sql);
3500 3500
 			if ($result2) {
3501 3501
 				$objp2 = $this->db->fetch_object($result2);
3502 3502
 				if ($objp2) {
3503 3503
 					$found = 1;
3504 3504
 					if ($objp2->price_base_type == 'HT') {
3505
-						$labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3506
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3505
+						$labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3506
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3507 3507
 					} else {
3508
-						$labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3509
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3508
+						$labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3509
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3510 3510
 					}
3511 3511
 					$outprice_ht = price($objp2->price);
3512 3512
 					$outprice_ttc = price($objp2->price_ttc);
3513 3513
 					$outpricebasetype = $objp2->price_base_type;
3514 3514
 					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility
3515
-						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
3516
-						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
3515
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3516
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3517 3517
 					} else {
3518
-						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice
3519
-						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice
3518
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3519
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3520 3520
 					}
3521 3521
 				}
3522 3522
 			} else {
@@ -3530,13 +3530,13 @@  discard block
 block discarded – undo
3530 3530
 			$outqty = $objp->quantity;
3531 3531
 			$outdiscount = $objp->remise_percent;
3532 3532
 			if ($objp->quantity == 1) {
3533
-				$labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";
3534
-				$labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";
3533
+				$labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
3534
+				$labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
3535 3535
 				$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3536 3536
 				$labeltoshowhtmlprice .= $langs->transnoentities("Unit");
3537 3537
 			} else {
3538
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3539
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3538
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3539
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3540 3540
 				$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3541 3541
 				$labeltoshowhtmlprice .= $langs->transnoentities("Units");
3542 3542
 			}
@@ -3544,16 +3544,16 @@  discard block
 block discarded – undo
3544 3544
 			$outprice_ht = price($objp->unitprice);
3545 3545
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3546 3546
 			$outpricebasetype = $objp->price_base_type;
3547
-			$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
3548
-			$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
+			$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
3548
+			$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
3549 3549
 		}
3550 3550
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3551
-			$labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3552
-			$labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3551
+			$labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3552
+			$labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3553 3553
 		}
3554 3554
 		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
3555
-			$labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3556
-			$labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3555
+			$labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3556
+			$labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3557 3557
 		}
3558 3558
 
3559 3559
 		// Price by customer
@@ -3562,11 +3562,11 @@  discard block
 block discarded – undo
3562 3562
 				$found = 1;
3563 3563
 
3564 3564
 				if ($objp->custprice_base_type == 'HT') {
3565
-					$labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3566
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3565
+					$labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3566
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3567 3567
 				} else {
3568
-					$labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3569
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3568
+					$labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3569
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3570 3570
 				}
3571 3571
 
3572 3572
 				$outprice_ht = price($objp->custprice);
@@ -3580,11 +3580,11 @@  discard block
 block discarded – undo
3580 3580
 		// If level no defined or multiprice not found, we used the default price
3581 3581
 		if (empty($hidepriceinlabel) && !$found) {
3582 3582
 			if ($objp->price_base_type == 'HT') {
3583
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3584
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3583
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3584
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3585 3585
 			} else {
3586
-				$labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3587
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3586
+				$labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3587
+				$labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3588 3588
 			}
3589 3589
 			$outprice_ht = price($objp->price);
3590 3590
 			$outprice_ttc = price($objp->price_ttc);
@@ -3594,14 +3594,14 @@  discard block
 block discarded – undo
3594 3594
 		}
3595 3595
 
3596 3596
 		// Build options
3597
-		$opt = '<option value="' . $objp->rowid . '"';
3597
+		$opt = '<option value="'.$objp->rowid.'"';
3598 3598
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
3599 3599
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
3600
-			$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 . '"';
3600
+			$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.'"';
3601 3601
 		}
3602 3602
 		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
3603
-			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
3604
-			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
3603
+			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
3604
+			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
3605 3605
 		}
3606 3606
 
3607 3607
 		if ($stocktag == 1) {
@@ -3696,7 +3696,7 @@  discard block
 block discarded – undo
3696 3696
 		$selected_input_value = '';
3697 3697
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
3698 3698
 			if ($selected > 0) {
3699
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3699
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3700 3700
 				$producttmpselect = new Product($this->db);
3701 3701
 				$producttmpselect->fetch($selected);
3702 3702
 				$selected_input_value = $producttmpselect->ref;
@@ -3704,10 +3704,10 @@  discard block
 block discarded – undo
3704 3704
 			}
3705 3705
 
3706 3706
 			// mode=2 means suppliers products
3707
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
3708
-			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3707
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
3708
+			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3709 3709
 
3710
-			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>';
3710
+			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
3711 3711
 		} else {
3712 3712
 			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
3713 3713
 		}
@@ -3765,25 +3765,25 @@  discard block
 block discarded – undo
3765 3765
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3766 3766
 			$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";
3767 3767
 		}
3768
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3769
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
3768
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3769
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
3770 3770
 		if ($socid > 0) {
3771
-			$sql .= " AND pfp.fk_soc = " . ((int) $socid);
3771
+			$sql .= " AND pfp.fk_soc = ".((int) $socid);
3772 3772
 		}
3773
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3773
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3774 3774
 		// Units
3775 3775
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3776
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3776
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3777 3777
 		}
3778
-		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
3778
+		$sql .= " WHERE p.entity IN (".getEntity('product').")";
3779 3779
 		if ($statut != -1) {
3780
-			$sql .= " AND p.tobuy = " . ((int) $statut);
3780
+			$sql .= " AND p.tobuy = ".((int) $statut);
3781 3781
 		}
3782 3782
 		if (strval($filtertype) != '') {
3783
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3783
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3784 3784
 		}
3785 3785
 		if (!empty($filtre)) {
3786
-			$sql .= " " . $filtre;
3786
+			$sql .= " ".$filtre;
3787 3787
 		}
3788 3788
 		// Add where from hooks
3789 3789
 		$parameters = array();
@@ -3803,9 +3803,9 @@  discard block
 block discarded – undo
3803 3803
 				if ($i > 0) {
3804 3804
 					$sql .= " AND ";
3805 3805
 				}
3806
-				$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) . "%'";
3806
+				$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)."%'";
3807 3807
 				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
3808
-					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3808
+					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3809 3809
 				}
3810 3810
 				$sql .= ")";
3811 3811
 				$i++;
@@ -3814,8 +3814,8 @@  discard block
 block discarded – undo
3814 3814
 				$sql .= ")";
3815 3815
 			}
3816 3816
 			if (isModEnabled('barcode')) {
3817
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3818
-				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3817
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3818
+				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3819 3819
 			}
3820 3820
 			$sql .= ')';
3821 3821
 		}
@@ -3824,20 +3824,20 @@  discard block
 block discarded – undo
3824 3824
 
3825 3825
 		// Build output string
3826 3826
 
3827
-		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
3827
+		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
3828 3828
 		$result = $this->db->query($sql);
3829 3829
 		if ($result) {
3830
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3831
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3830
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3831
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3832 3832
 
3833 3833
 			$num = $this->db->num_rows($result);
3834 3834
 
3835 3835
 			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
3836
-			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
3836
+			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
3837 3837
 			if (!$selected) {
3838
-				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3838
+				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3839 3839
 			} else {
3840
-				$out .= '<option value="-1">' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3840
+				$out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3841 3841
 			}
3842 3842
 
3843 3843
 			$i = 0;
@@ -3852,7 +3852,7 @@  discard block
 block discarded – undo
3852 3852
 
3853 3853
 				$outkey = $objp->idprodfournprice; // id in table of price
3854 3854
 				if (!$outkey && $alsoproductwithnosupplierprice) {
3855
-					$outkey = 'idprod_' . $objp->rowid; // id of product
3855
+					$outkey = 'idprod_'.$objp->rowid; // id of product
3856 3856
 				}
3857 3857
 
3858 3858
 				$outref = $objp->ref;
@@ -3867,23 +3867,23 @@  discard block
 block discarded – undo
3867 3867
 				$outvalUnits = '';
3868 3868
 				if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3869 3869
 					if (!empty($objp->unit_short)) {
3870
-						$outvalUnits .= ' - ' . $objp->unit_short;
3870
+						$outvalUnits .= ' - '.$objp->unit_short;
3871 3871
 					}
3872 3872
 					if (!empty($objp->weight) && $objp->weight_units !== null) {
3873 3873
 						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3874
-						$outvalUnits .= ' - ' . $unitToShow;
3874
+						$outvalUnits .= ' - '.$unitToShow;
3875 3875
 					}
3876 3876
 					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3877
-						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3878
-						$outvalUnits .= ' - ' . $unitToShow;
3877
+						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3878
+						$outvalUnits .= ' - '.$unitToShow;
3879 3879
 					}
3880 3880
 					if (!empty($objp->surface) && $objp->surface_units !== null) {
3881 3881
 						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3882
-						$outvalUnits .= ' - ' . $unitToShow;
3882
+						$outvalUnits .= ' - '.$unitToShow;
3883 3883
 					}
3884 3884
 					if (!empty($objp->volume) && $objp->volume_units !== null) {
3885 3885
 						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3886
-						$outvalUnits .= ' - ' . $unitToShow;
3886
+						$outvalUnits .= ' - '.$unitToShow;
3887 3887
 					}
3888 3888
 					if ($outdurationvalue && $outdurationunit) {
3889 3889
 						$da = array(
@@ -3894,22 +3894,22 @@  discard block
 block discarded – undo
3894 3894
 							'y' => $langs->trans('Year')
3895 3895
 						);
3896 3896
 						if (isset($da[$outdurationunit])) {
3897
-							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3897
+							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3898 3898
 						}
3899 3899
 					}
3900 3900
 				}
3901 3901
 
3902 3902
 				$objRef = $objp->ref;
3903 3903
 				if ($filterkey && $filterkey != '') {
3904
-					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3904
+					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3905 3905
 				}
3906 3906
 				$objRefFourn = $objp->ref_fourn;
3907 3907
 				if ($filterkey && $filterkey != '') {
3908
-					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
3908
+					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1);
3909 3909
 				}
3910 3910
 				$label = $objp->label;
3911 3911
 				if ($filterkey && $filterkey != '') {
3912
-					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3912
+					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3913 3913
 				}
3914 3914
 
3915 3915
 				switch ($objp->fk_product_type) {
@@ -3932,21 +3932,21 @@  discard block
 block discarded – undo
3932 3932
 
3933 3933
 				$optlabel .= $objp->ref;
3934 3934
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3935
-					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
3935
+					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>';
3936 3936
 				}
3937 3937
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3938
-					$optlabel .= ' (' . $outbarcode . ')';
3938
+					$optlabel .= ' ('.$outbarcode.')';
3939 3939
 				}
3940
-				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3940
+				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3941 3941
 
3942 3942
 				$outvallabel = $objRef;
3943 3943
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3944
-					$outvallabel .= ' (' . $objRefFourn . ')';
3944
+					$outvallabel .= ' ('.$objRefFourn.')';
3945 3945
 				}
3946 3946
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3947
-					$outvallabel .= ' (' . $outbarcode . ')';
3947
+					$outvallabel .= ' ('.$outbarcode.')';
3948 3948
 				}
3949
-				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3949
+				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3950 3950
 
3951 3951
 				// Units
3952 3952
 				$optlabel .= $outvalUnits;
@@ -3963,7 +3963,7 @@  discard block
 block discarded – undo
3963 3963
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3964 3964
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3965 3965
 
3966
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3966
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3967 3967
 						$priceparser = new PriceParser($this->db);
3968 3968
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3969 3969
 						if ($price_result >= 0) {
@@ -3974,57 +3974,57 @@  discard block
 block discarded – undo
3974 3974
 						}
3975 3975
 					}
3976 3976
 					if ($objp->quantity == 1) {
3977
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3978
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
3977
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3978
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
3979 3979
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3980 3980
 						$outvallabel .= $langs->transnoentities("Unit");
3981 3981
 					} else {
3982
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3983
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3984
-						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3985
-						$outvallabel .= ' ' . $langs->transnoentities("Units");
3982
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3983
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3984
+						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3985
+						$outvallabel .= ' '.$langs->transnoentities("Units");
3986 3986
 					}
3987 3987
 
3988 3988
 					if ($objp->quantity > 1) {
3989
-						$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
3990
-						$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
+						$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
3990
+						$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
3991 3991
 					}
3992 3992
 					if ($objp->remise_percent >= 1) {
3993
-						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3994
-						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3993
+						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3994
+						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3995 3995
 					}
3996 3996
 					if ($objp->duration) {
3997
-						$optlabel .= " - " . $objp->duration;
3998
-						$outvallabel .= " - " . $objp->duration;
3997
+						$optlabel .= " - ".$objp->duration;
3998
+						$outvallabel .= " - ".$objp->duration;
3999 3999
 					}
4000 4000
 					if (!$socid) {
4001
-						$optlabel .= " - " . dol_trunc($objp->name, 8);
4002
-						$outvallabel .= " - " . dol_trunc($objp->name, 8);
4001
+						$optlabel .= " - ".dol_trunc($objp->name, 8);
4002
+						$outvallabel .= " - ".dol_trunc($objp->name, 8);
4003 4003
 					}
4004 4004
 					if ($objp->supplier_reputation) {
4005 4005
 						//TODO dictionary
4006 4006
 						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
4007 4007
 
4008
-						$optlabel .= " - " . $reputations[$objp->supplier_reputation];
4009
-						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
4008
+						$optlabel .= " - ".$reputations[$objp->supplier_reputation];
4009
+						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];
4010 4010
 					}
4011 4011
 				} else {
4012
-					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
4013
-					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
4012
+					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
4013
+					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
4014 4014
 				}
4015 4015
 
4016 4016
 				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
4017 4017
 					$novirtualstock = ($showstockinlist == 2);
4018 4018
 
4019 4019
 					if ($user->hasRight('stock', 'lire')) {
4020
-						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
4020
+						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
4021 4021
 
4022 4022
 						if ($objp->stock > 0) {
4023 4023
 							$optlabel .= ' - <span class="product_line_stock_ok">';
4024 4024
 						} elseif ($objp->stock <= 0) {
4025 4025
 							$optlabel .= ' - <span class="product_line_stock_too_low">';
4026 4026
 						}
4027
-						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
4027
+						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
4028 4028
 						$optlabel .= '</span>';
4029 4029
 						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
4030 4030
 							$langs->load("stocks");
@@ -4034,9 +4034,9 @@  discard block
 block discarded – undo
4034 4034
 							$tmpproduct->load_virtual_stock();
4035 4035
 							$virtualstock = $tmpproduct->stock_theorique;
4036 4036
 
4037
-							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
4037
+							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
4038 4038
 
4039
-							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
4039
+							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
4040 4040
 							if ($virtualstock > 0) {
4041 4041
 								$optlabel .= '<span class="product_line_stock_ok">';
4042 4042
 							} elseif ($virtualstock <= 0) {
@@ -4050,7 +4050,7 @@  discard block
 block discarded – undo
4050 4050
 					}
4051 4051
 				}
4052 4052
 
4053
-				$optstart = '<option value="' . $outkey . '"';
4053
+				$optstart = '<option value="'.$outkey.'"';
4054 4054
 				if ($selected && $selected == $objp->idprodfournprice) {
4055 4055
 					$optstart .= ' selected';
4056 4056
 				}
@@ -4059,22 +4059,22 @@  discard block
 block discarded – undo
4059 4059
 				}
4060 4060
 
4061 4061
 				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
4062
-					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
4063
-					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
4064
-					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
4065
-					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
4066
-					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
4067
-					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
4068
-					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
4069
-					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
4070
-					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
4071
-					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
4062
+					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
4063
+					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
4064
+					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
4065
+					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
4066
+					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
4067
+					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
4068
+					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
4069
+					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
4070
+					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
4071
+					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';
4072 4072
 					if (isModEnabled('multicurrency')) {
4073
-						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
4074
-						$optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
4073
+						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';
4074
+						$optstart .= ' data-multicurrency-unitprice="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';
4075 4075
 					}
4076 4076
 				}
4077
-				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
4077
+				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
4078 4078
 
4079 4079
 				// set $parameters to call hook
4080 4080
 				$outarrayentry = array(
@@ -4083,9 +4083,9 @@  discard block
 block discarded – undo
4083 4083
 					'label' => $outvallabel,
4084 4084
 					'labelhtml' => $optlabel,
4085 4085
 					'qty' => $outqty,
4086
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty
4087
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4088
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4086
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4087
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4088
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4089 4089
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
4090 4090
 					'tva_tx' => price2num($objp->tva_tx),
4091 4091
 					'default_vat_code' => $objp->default_vat_code,
@@ -4115,18 +4115,18 @@  discard block
 block discarded – undo
4115 4115
 				// Add new entry
4116 4116
 				// "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
4117 4117
 				// "label" value of json key array is used by jQuery automatically as text for combo box
4118
-				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
4118
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
4119 4119
 				$outarraypush = array(
4120 4120
 					'key' => $outkey,
4121 4121
 					'value' => $outref,
4122 4122
 					'label' => $outvallabel,
4123 4123
 					'labelhtml' => $optlabel,
4124 4124
 					'qty' => $outqty,
4125
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty
4125
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4126 4126
 					'price_qty_ht_locale' => price($objp->fprice),
4127
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4127
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4128 4128
 					'price_unit_ht_locale' => price($objp->unitprice),
4129
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4129
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4130 4130
 					'tva_tx_formated' => price($objp->tva_tx),
4131 4131
 					'tva_tx' => price2num($objp->tva_tx),
4132 4132
 					'default_vat_code' => $objp->default_vat_code,
@@ -4159,7 +4159,7 @@  discard block
 block discarded – undo
4159 4159
 
4160 4160
 			$this->db->free($result);
4161 4161
 
4162
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
4162
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
4163 4163
 			$out .= ajax_combobox($htmlname);
4164 4164
 		} else {
4165 4165
 			dol_print_error($this->db);
@@ -4191,43 +4191,43 @@  discard block
 block discarded – undo
4191 4191
 		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
4192 4192
 		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
4193 4193
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
4194
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
4195
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4196
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
4197
-		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
4194
+		$sql .= " FROM ".$this->db->prefix()."product as p";
4195
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4196
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
4197
+		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
4198 4198
 		$sql .= " AND p.tobuy = 1";
4199 4199
 		$sql .= " AND s.fournisseur = 1";
4200
-		$sql .= " AND p.rowid = " . ((int) $productid);
4200
+		$sql .= " AND p.rowid = ".((int) $productid);
4201 4201
 		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) {
4202 4202
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
4203 4203
 		} else {
4204 4204
 			$sql .= " ORDER BY pfp.unitprice ASC";
4205 4205
 		}
4206 4206
 
4207
-		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
4207
+		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
4208 4208
 		$result = $this->db->query($sql);
4209 4209
 
4210 4210
 		if ($result) {
4211 4211
 			$num = $this->db->num_rows($result);
4212 4212
 
4213
-			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4213
+			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4214 4214
 
4215 4215
 			if (!$num) {
4216
-				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
4216
+				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
4217 4217
 			} else {
4218
-				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4218
+				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4219 4219
 				$form .= '<option value="0">&nbsp;</option>';
4220 4220
 
4221 4221
 				$i = 0;
4222 4222
 				while ($i < $num) {
4223 4223
 					$objp = $this->db->fetch_object($result);
4224 4224
 
4225
-					$opt = '<option value="' . $objp->idprodfournprice . '"';
4225
+					$opt = '<option value="'.$objp->idprodfournprice.'"';
4226 4226
 					//if there is only one supplier, preselect it
4227 4227
 					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) {
4228 4228
 						$opt .= ' selected';
4229 4229
 					}
4230
-					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
4230
+					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
4231 4231
 
4232 4232
 					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) {
4233 4233
 						$prod_supplier = new ProductFournisseur($this->db);
@@ -4237,7 +4237,7 @@  discard block
 block discarded – undo
4237 4237
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
4238 4238
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
4239 4239
 
4240
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4240
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4241 4241
 						$priceparser = new PriceParser($this->db);
4242 4242
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
4243 4243
 						if ($price_result >= 0) {
@@ -4248,10 +4248,10 @@  discard block
 block discarded – undo
4248 4248
 						}
4249 4249
 					}
4250 4250
 					if ($objp->quantity == 1) {
4251
-						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
4251
+						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
4252 4252
 					}
4253 4253
 
4254
-					$opt .= $objp->quantity . ' ';
4254
+					$opt .= $objp->quantity.' ';
4255 4255
 
4256 4256
 					if ($objp->quantity == 1) {
4257 4257
 						$opt .= $langs->trans("Unit");
@@ -4260,10 +4260,10 @@  discard block
 block discarded – undo
4260 4260
 					}
4261 4261
 					if ($objp->quantity > 1) {
4262 4262
 						$opt .= " - ";
4263
-						$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");
4263
+						$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");
4264 4264
 					}
4265 4265
 					if ($objp->duration) {
4266
-						$opt .= " - " . $objp->duration;
4266
+						$opt .= " - ".$objp->duration;
4267 4267
 					}
4268 4268
 					$opt .= "</option>\n";
4269 4269
 
@@ -4301,8 +4301,8 @@  discard block
 block discarded – undo
4301 4301
 		dol_syslog(__METHOD__, LOG_DEBUG);
4302 4302
 
4303 4303
 		$sql = "SELECT rowid, code, libelle as label, deposit_percent";
4304
-		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
4305
-		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
4304
+		$sql .= " FROM ".$this->db->prefix().'c_payment_term';
4305
+		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
4306 4306
 		$sql .= " AND active > 0";
4307 4307
 		$sql .= " ORDER BY sortorder";
4308 4308
 
@@ -4314,7 +4314,7 @@  discard block
 block discarded – undo
4314 4314
 				$obj = $this->db->fetch_object($resql);
4315 4315
 
4316 4316
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4317
-				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4317
+				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4318 4318
 				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
4319 4319
 				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
4320 4320
 				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -4342,7 +4342,7 @@  discard block
 block discarded – undo
4342 4342
 		// phpcs:enable
4343 4343
 		global $langs;
4344 4344
 
4345
-		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4345
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4346 4346
 		if ($num > 0) {
4347 4347
 			return 0; // Cache already loaded
4348 4348
 		}
@@ -4352,7 +4352,7 @@  discard block
 block discarded – undo
4352 4352
 		$langs->load('propal');
4353 4353
 
4354 4354
 		$sql = "SELECT rowid, code, label, position";
4355
-		$sql .= " FROM " . $this->db->prefix() . 'c_availability';
4355
+		$sql .= " FROM ".$this->db->prefix().'c_availability';
4356 4356
 		$sql .= " WHERE active > 0";
4357 4357
 
4358 4358
 		$resql = $this->db->query($sql);
@@ -4363,7 +4363,7 @@  discard block
 block discarded – undo
4363 4363
 				$obj = $this->db->fetch_object($resql);
4364 4364
 
4365 4365
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4366
-				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4366
+				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4367 4367
 				$this->cache_availability[$obj->rowid]['code'] = $obj->code;
4368 4368
 				$this->cache_availability[$obj->rowid]['label'] = $label;
4369 4369
 				$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -4395,17 +4395,17 @@  discard block
 block discarded – undo
4395 4395
 
4396 4396
 		$this->load_cache_availability();
4397 4397
 
4398
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4398
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4399 4399
 
4400
-		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4400
+		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4401 4401
 		if ($addempty) {
4402 4402
 			print '<option value="0">&nbsp;</option>';
4403 4403
 		}
4404 4404
 		foreach ($this->cache_availability as $id => $arrayavailability) {
4405 4405
 			if ($selected == $id) {
4406
-				print '<option value="' . $id . '" selected>';
4406
+				print '<option value="'.$id.'" selected>';
4407 4407
 			} else {
4408
-				print '<option value="' . $id . '">';
4408
+				print '<option value="'.$id.'">';
4409 4409
 			}
4410 4410
 			print dol_escape_htmltag($arrayavailability['label']);
4411 4411
 			print '</option>';
@@ -4426,13 +4426,13 @@  discard block
 block discarded – undo
4426 4426
 	{
4427 4427
 		global $langs;
4428 4428
 
4429
-		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4429
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4430 4430
 		if ($num > 0) {
4431 4431
 			return 0; // Cache already loaded
4432 4432
 		}
4433 4433
 
4434 4434
 		$sql = "SELECT rowid, code, label";
4435
-		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
4435
+		$sql .= " FROM ".$this->db->prefix().'c_input_reason';
4436 4436
 		$sql .= " WHERE active > 0";
4437 4437
 
4438 4438
 		$resql = $this->db->query($sql);
@@ -4445,8 +4445,8 @@  discard block
 block discarded – undo
4445 4445
 
4446 4446
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4447 4447
 				$label = ($obj->label != '-' ? $obj->label : '');
4448
-				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) {
4449
-					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4448
+				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) {
4449
+					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4450 4450
 				}
4451 4451
 				if ($langs->trans($obj->code) != $obj->code) {
4452 4452
 					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
@@ -4486,9 +4486,9 @@  discard block
 block discarded – undo
4486 4486
 
4487 4487
 		$this->loadCacheInputReason();
4488 4488
 
4489
-		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4489
+		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4490 4490
 		if ($addempty) {
4491
-			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
4491
+			print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
4492 4492
 		}
4493 4493
 		foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
4494 4494
 			if ($arraydemandreason['code'] == $exclude) {
@@ -4496,9 +4496,9 @@  discard block
 block discarded – undo
4496 4496
 			}
4497 4497
 
4498 4498
 			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
4499
-				print '<option value="' . $arraydemandreason['id'] . '" selected>';
4499
+				print '<option value="'.$arraydemandreason['id'].'" selected>';
4500 4500
 			} else {
4501
-				print '<option value="' . $arraydemandreason['id'] . '">';
4501
+				print '<option value="'.$arraydemandreason['id'].'">';
4502 4502
 			}
4503 4503
 			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
4504 4504
 			print $langs->trans($label);
@@ -4508,7 +4508,7 @@  discard block
 block discarded – undo
4508 4508
 		if ($user->admin && empty($notooltip)) {
4509 4509
 			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4510 4510
 		}
4511
-		print ajax_combobox('select_' . $htmlname);
4511
+		print ajax_combobox('select_'.$htmlname);
4512 4512
 	}
4513 4513
 
4514 4514
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -4523,7 +4523,7 @@  discard block
 block discarded – undo
4523 4523
 		// phpcs:enable
4524 4524
 		global $langs;
4525 4525
 
4526
-		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4526
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4527 4527
 		if ($num > 0) {
4528 4528
 			return $num; // Cache already loaded
4529 4529
 		}
@@ -4533,8 +4533,8 @@  discard block
 block discarded – undo
4533 4533
 		$this->cache_types_paiements = array();
4534 4534
 
4535 4535
 		$sql = "SELECT id, code, libelle as label, type, active";
4536
-		$sql .= " FROM " . $this->db->prefix() . "c_paiement";
4537
-		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
4536
+		$sql .= " FROM ".$this->db->prefix()."c_paiement";
4537
+		$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
4538 4538
 
4539 4539
 		$resql = $this->db->query($sql);
4540 4540
 		if ($resql) {
@@ -4544,7 +4544,7 @@  discard block
 block discarded – undo
4544 4544
 				$obj = $this->db->fetch_object($resql);
4545 4545
 
4546 4546
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4547
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4547
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4548 4548
 				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;
4549 4549
 				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;
4550 4550
 				$this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -4616,17 +4616,17 @@  discard block
 block discarded – undo
4616 4616
 		global $langs, $user, $conf;
4617 4617
 
4618 4618
 		$out = '';
4619
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4619
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4620 4620
 
4621 4621
 		$this->load_cache_conditions_paiements();
4622 4622
 
4623 4623
 		// Set default value if not already set by caller
4624 4624
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
4625
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4625
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4626 4626
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
4627 4627
 		}
4628 4628
 
4629
-		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4629
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4630 4630
 		if ($addempty) {
4631 4631
 			$out .= '<option value="0">&nbsp;</option>';
4632 4632
 		}
@@ -4640,9 +4640,9 @@  discard block
 block discarded – undo
4640 4640
 
4641 4641
 			if ($selected == $id) {
4642 4642
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4643
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4643
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4644 4644
 			} else {
4645
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4645
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4646 4646
 			}
4647 4647
 			$label = $arrayconditions['label'];
4648 4648
 
@@ -4660,21 +4660,21 @@  discard block
 block discarded – undo
4660 4660
 		$out .= ajax_combobox($htmlname);
4661 4661
 
4662 4662
 		if ($deposit_percent >= 0) {
4663
-			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4664
-			$out .= $langs->trans('DepositPercent') . ' : ';
4665
-			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';
4663
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4664
+			$out .= $langs->trans('DepositPercent').' : ';
4665
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';
4666 4666
 			$out .= '</span>';
4667 4667
 			$out .= '
4668
-				<script nonce="' . getNonce() . '">
4668
+				<script nonce="' . getNonce().'">
4669 4669
 					$(document).ready(function () {
4670
-						$("#' . $htmlname . '").change(function () {
4670
+						$("#' . $htmlname.'").change(function () {
4671 4671
 							let $selected = $(this).find("option:selected");
4672 4672
 							let depositPercent = $selected.attr("data-deposit_percent");
4673 4673
 
4674 4674
 							if (depositPercent.length > 0) {
4675
-								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
4675
+								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent);
4676 4676
 							} else {
4677
-								$("#' . $htmlname . '_deposit_percent_container").hide();
4677
+								$("#' . $htmlname.'_deposit_percent_container").hide();
4678 4678
 							}
4679 4679
 
4680 4680
 							return true;
@@ -4712,7 +4712,7 @@  discard block
 block discarded – undo
4712 4712
 
4713 4713
 		$out = '';
4714 4714
 
4715
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
4715
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
4716 4716
 
4717 4717
 		$filterarray = array();
4718 4718
 		if ($filtertype == 'CRDT') {
@@ -4727,11 +4727,11 @@  discard block
 block discarded – undo
4727 4727
 
4728 4728
 		// Set default value if not already set by caller
4729 4729
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) {
4730
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4730
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4731 4731
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID');
4732 4732
 		}
4733 4733
 
4734
-		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4734
+		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4735 4735
 		if ($empty) {
4736 4736
 			$out .= '<option value="">&nbsp;</option>';
4737 4737
 		}
@@ -4752,13 +4752,13 @@  discard block
 block discarded – undo
4752 4752
 			}
4753 4753
 
4754 4754
 			if ($format == 0) {
4755
-				$out .= '<option value="' . $id . '" data-code="'.$arraytypes['code'].'"';
4755
+				$out .= '<option value="'.$id.'" data-code="'.$arraytypes['code'].'"';
4756 4756
 			} elseif ($format == 1) {
4757
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4757
+				$out .= '<option value="'.$arraytypes['code'].'"';
4758 4758
 			} elseif ($format == 2) {
4759
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4759
+				$out .= '<option value="'.$arraytypes['code'].'"';
4760 4760
 			} elseif ($format == 3) {
4761
-				$out .= '<option value="' . $id . '"';
4761
+				$out .= '<option value="'.$id.'"';
4762 4762
 			}
4763 4763
 			// Print attribute selected or not
4764 4764
 			if ($format == 1 || $format == 2) {
@@ -4788,7 +4788,7 @@  discard block
 block discarded – undo
4788 4788
 		if ($user->admin && !$noadmininfo) {
4789 4789
 			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4790 4790
 		}
4791
-		$out .= ajax_combobox('select' . $htmlname);
4791
+		$out .= ajax_combobox('select'.$htmlname);
4792 4792
 
4793 4793
 		if (empty($nooutput)) {
4794 4794
 			print $out;
@@ -4810,22 +4810,22 @@  discard block
 block discarded – undo
4810 4810
 	{
4811 4811
 		global $langs;
4812 4812
 
4813
-		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4813
+		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4814 4814
 		$options = array(
4815 4815
 			'HT' => $langs->trans("HT"),
4816 4816
 			'TTC' => $langs->trans("TTC")
4817 4817
 		);
4818 4818
 		foreach ($options as $id => $value) {
4819 4819
 			if ($selected == $id) {
4820
-				$return .= '<option value="' . $id . '" selected>' . $value;
4820
+				$return .= '<option value="'.$id.'" selected>'.$value;
4821 4821
 			} else {
4822
-				$return .= '<option value="' . $id . '">' . $value;
4822
+				$return .= '<option value="'.$id.'">'.$value;
4823 4823
 			}
4824 4824
 			$return .= '</option>';
4825 4825
 		}
4826 4826
 		$return .= '</select>';
4827 4827
 		if ($addjscombo) {
4828
-			$return .= ajax_combobox('select_' . $htmlname);
4828
+			$return .= ajax_combobox('select_'.$htmlname);
4829 4829
 		}
4830 4830
 
4831 4831
 		return $return;
@@ -4843,7 +4843,7 @@  discard block
 block discarded – undo
4843 4843
 		// phpcs:enable
4844 4844
 		global $langs;
4845 4845
 
4846
-		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4846
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4847 4847
 		if ($num > 0) {
4848 4848
 			return $num; // Cache already loaded
4849 4849
 		}
@@ -4853,8 +4853,8 @@  discard block
 block discarded – undo
4853 4853
 		$this->cache_transport_mode = array();
4854 4854
 
4855 4855
 		$sql = "SELECT rowid, code, label, active";
4856
-		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";
4857
-		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")";
4856
+		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
4857
+		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
4858 4858
 
4859 4859
 		$resql = $this->db->query($sql);
4860 4860
 		if ($resql) {
@@ -4864,7 +4864,7 @@  discard block
 block discarded – undo
4864 4864
 				$obj = $this->db->fetch_object($resql);
4865 4865
 
4866 4866
 				// If traduction exist, we use it else we take the default label
4867
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4867
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4868 4868
 				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
4869 4869
 				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
4870 4870
 				$this->cache_transport_mode[$obj->rowid]['label'] = $label;
@@ -4898,11 +4898,11 @@  discard block
 block discarded – undo
4898 4898
 	{
4899 4899
 		global $langs, $user;
4900 4900
 
4901
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);
4901
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
4902 4902
 
4903 4903
 		$this->load_cache_transport_mode();
4904 4904
 
4905
-		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4905
+		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4906 4906
 		if ($empty) {
4907 4907
 			print '<option value="">&nbsp;</option>';
4908 4908
 		}
@@ -4918,13 +4918,13 @@  discard block
 block discarded – undo
4918 4918
 			}
4919 4919
 
4920 4920
 			if ($format == 0) {
4921
-				print '<option value="' . $id . '"';
4921
+				print '<option value="'.$id.'"';
4922 4922
 			} elseif ($format == 1) {
4923
-				print '<option value="' . $arraytypes['code'] . '"';
4923
+				print '<option value="'.$arraytypes['code'].'"';
4924 4924
 			} elseif ($format == 2) {
4925
-				print '<option value="' . $arraytypes['code'] . '"';
4925
+				print '<option value="'.$arraytypes['code'].'"';
4926 4926
 			} elseif ($format == 3) {
4927
-				print '<option value="' . $id . '"';
4927
+				print '<option value="'.$id.'"';
4928 4928
 			}
4929 4929
 			// If text is selected, we compare with code, else with id
4930 4930
 			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
@@ -4975,31 +4975,31 @@  discard block
 block discarded – undo
4975 4975
 		$langs->load("deliveries");
4976 4976
 
4977 4977
 		$sql = "SELECT rowid, code, libelle as label";
4978
-		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";
4978
+		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
4979 4979
 		$sql .= " WHERE active > 0";
4980 4980
 		if ($filtre) {
4981
-			$sql .= " AND " . $filtre;
4981
+			$sql .= " AND ".$filtre;
4982 4982
 		}
4983 4983
 		$sql .= " ORDER BY libelle ASC";
4984 4984
 
4985
-		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
4985
+		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
4986 4986
 		$result = $this->db->query($sql);
4987 4987
 		if ($result) {
4988 4988
 			$num = $this->db->num_rows($result);
4989 4989
 			$i = 0;
4990 4990
 			if ($num) {
4991
-				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4991
+				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4992 4992
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4993 4993
 					print '<option value="-1">&nbsp;</option>';
4994 4994
 				}
4995 4995
 				while ($i < $num) {
4996 4996
 					$obj = $this->db->fetch_object($result);
4997 4997
 					if ($selected == $obj->rowid) {
4998
-						print '<option value="' . $obj->rowid . '" selected>';
4998
+						print '<option value="'.$obj->rowid.'" selected>';
4999 4999
 					} else {
5000
-						print '<option value="' . $obj->rowid . '">';
5000
+						print '<option value="'.$obj->rowid.'">';
5001 5001
 					}
5002
-					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
5002
+					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
5003 5003
 					print '</option>';
5004 5004
 					$i++;
5005 5005
 				}
@@ -5008,7 +5008,7 @@  discard block
 block discarded – undo
5008 5008
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
5009 5009
 				}
5010 5010
 
5011
-				print ajax_combobox('select' . $htmlname);
5011
+				print ajax_combobox('select'.$htmlname);
5012 5012
 			} else {
5013 5013
 				print $langs->trans("NoShippingMethodDefined");
5014 5014
 			}
@@ -5033,16 +5033,16 @@  discard block
 block discarded – undo
5033 5033
 		$langs->load("deliveries");
5034 5034
 
5035 5035
 		if ($htmlname != "none") {
5036
-			print '<form method="POST" action="' . $page . '">';
5036
+			print '<form method="POST" action="'.$page.'">';
5037 5037
 			print '<input type="hidden" name="action" value="setshippingmethod">';
5038
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5038
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5039 5039
 			$this->selectShippingMethod($selected, $htmlname, '', $addempty);
5040
-			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
5040
+			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
5041 5041
 			print '</form>';
5042 5042
 		} else {
5043 5043
 			if ($selected) {
5044 5044
 				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
5045
-				print $langs->trans("SendingMethod" . strtoupper($code));
5045
+				print $langs->trans("SendingMethod".strtoupper($code));
5046 5046
 			} else {
5047 5047
 				print "&nbsp;";
5048 5048
 			}
@@ -5065,10 +5065,10 @@  discard block
 block discarded – undo
5065 5065
 
5066 5066
 		$opt = '<option value="" selected></option>';
5067 5067
 		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
5068
-		$sql .= ' FROM ' . $this->db->prefix() . 'facture';
5069
-		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
5068
+		$sql .= ' FROM '.$this->db->prefix().'facture';
5069
+		$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
5070 5070
 		$sql .= ' AND situation_counter >= 1';
5071
-		$sql .= ' AND fk_soc = ' . (int) $socid;
5071
+		$sql .= ' AND fk_soc = '.(int) $socid;
5072 5072
 		$sql .= ' AND type <> 2';
5073 5073
 		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
5074 5074
 		$resql = $this->db->query($sql);
@@ -5086,19 +5086,19 @@  discard block
 block discarded – undo
5086 5086
 						//Not prov?
5087 5087
 						if (substr($obj->ref, 1, 4) != 'PROV') {
5088 5088
 							if ($selected == $obj->rowid) {
5089
-								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
5089
+								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
5090 5090
 							} else {
5091
-								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
5091
+								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
5092 5092
 							}
5093 5093
 						}
5094 5094
 					}
5095 5095
 				}
5096 5096
 			}
5097 5097
 		} else {
5098
-			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
5098
+			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
5099 5099
 		}
5100 5100
 		if ($opt == '<option value ="" selected></option>') {
5101
-			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
5101
+			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
5102 5102
 		}
5103 5103
 		return $opt;
5104 5104
 	}
@@ -5118,12 +5118,12 @@  discard block
 block discarded – undo
5118 5118
 
5119 5119
 		$langs->load('products');
5120 5120
 
5121
-		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
5121
+		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
5122 5122
 
5123
-		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";
5123
+		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
5124 5124
 		$sql .= ' WHERE active > 0';
5125 5125
 		if (!empty($unit_type)) {
5126
-			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";
5126
+			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
5127 5127
 		}
5128 5128
 		$sql .= " ORDER BY sortorder";
5129 5129
 
@@ -5135,14 +5135,14 @@  discard block
 block discarded – undo
5135 5135
 
5136 5136
 			while ($res = $this->db->fetch_object($resql)) {
5137 5137
 				$unitLabel = $res->label;
5138
-				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before
5139
-					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
5138
+				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before
5139
+					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
5140 5140
 				}
5141 5141
 
5142 5142
 				if ($selected == $res->rowid) {
5143
-					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
5143
+					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
5144 5144
 				} else {
5145
-					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
5145
+					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
5146 5146
 				}
5147 5147
 			}
5148 5148
 			$return .= '</select>';
@@ -5179,29 +5179,29 @@  discard block
 block discarded – undo
5179 5179
 		$num = 0;
5180 5180
 
5181 5181
 		$sql = "SELECT rowid, label, bank, clos as status, currency_code";
5182
-		$sql .= " FROM " . $this->db->prefix() . "bank_account";
5183
-		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
5182
+		$sql .= " FROM ".$this->db->prefix()."bank_account";
5183
+		$sql .= " WHERE entity IN (".getEntity('bank_account').")";
5184 5184
 		if ($status != 2) {
5185
-			$sql .= " AND clos = " . (int) $status;
5185
+			$sql .= " AND clos = ".(int) $status;
5186 5186
 		}
5187 5187
 		if ($filtre) {	// TODO Support USF
5188
-			$sql .= " AND " . $filtre;
5188
+			$sql .= " AND ".$filtre;
5189 5189
 		}
5190 5190
 		$sql .= " ORDER BY label";
5191 5191
 
5192
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5192
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5193 5193
 		$result = $this->db->query($sql);
5194 5194
 		if ($result) {
5195 5195
 			$num = $this->db->num_rows($result);
5196 5196
 			$i = 0;
5197 5197
 
5198
-			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5198
+			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5199 5199
 
5200 5200
 			if ($num == 0) {
5201 5201
 				if ($status == 0) {
5202
-					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
5202
+					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
5203 5203
 				} else {
5204
-					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountDefined") . '</span>';
5204
+					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountDefined").'</span>';
5205 5205
 				}
5206 5206
 			} else {
5207 5207
 				if (!empty($useempty) && !is_numeric($useempty)) {
@@ -5217,25 +5217,25 @@  discard block
 block discarded – undo
5217 5217
 				$labeltoshow = trim($obj->label);
5218 5218
 				$labeltoshowhtml = trim($obj->label);
5219 5219
 				if ($showcurrency) {
5220
-					$labeltoshow .= ' (' . $obj->currency_code . ')';
5221
-					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $obj->currency_code . ')</span>';
5220
+					$labeltoshow .= ' ('.$obj->currency_code.')';
5221
+					$labeltoshowhtml .= ' <span class="opacitymedium">('.$obj->currency_code.')</span>';
5222 5222
 				}
5223 5223
 				if ($status == 2 && $obj->status == 1) {
5224
-					$labeltoshow .= ' (' . $langs->trans("Closed") . ')';
5225
-					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $langs->trans("Closed") . ')</span>';
5224
+					$labeltoshow .= ' ('.$langs->trans("Closed").')';
5225
+					$labeltoshowhtml .= ' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
5226 5226
 				}
5227 5227
 
5228 5228
 				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5229
-					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>';
5229
+					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>';
5230 5230
 				} else {
5231
-					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">';
5231
+					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">';
5232 5232
 				}
5233 5233
 				$out .= $labeltoshow;
5234 5234
 				$out .= '</option>';
5235 5235
 				$i++;
5236 5236
 			}
5237 5237
 			$out .= "</select>";
5238
-			$out .= ajax_combobox('select' . $htmlname);
5238
+			$out .= ajax_combobox('select'.$htmlname);
5239 5239
 		} else {
5240 5240
 			dol_print_error($this->db);
5241 5241
 		}
@@ -5274,22 +5274,22 @@  discard block
 block discarded – undo
5274 5274
 		$num = 0;
5275 5275
 
5276 5276
 		$sql = "SELECT rowid, label, bank, status, iban_prefix, bic";
5277
-		$sql .= " FROM " . $this->db->prefix() . "societe_rib";
5278
-		$sql .=  " WHERE type = 'ban'";
5277
+		$sql .= " FROM ".$this->db->prefix()."societe_rib";
5278
+		$sql .= " WHERE type = 'ban'";
5279 5279
 		if ($filtre) {	// TODO Support USF
5280
-			$sql .= " AND " . $filtre;
5280
+			$sql .= " AND ".$filtre;
5281 5281
 		}
5282 5282
 		$sql .= " ORDER BY label";
5283
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5283
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5284 5284
 		$result = $this->db->query($sql);
5285 5285
 		if ($result) {
5286 5286
 			$num = $this->db->num_rows($result);
5287 5287
 			$i = 0;
5288 5288
 
5289
-			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5289
+			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5290 5290
 
5291 5291
 			if ($num == 0) {
5292
-				$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountDefined") . '</span>';
5292
+				$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountDefined").'</span>';
5293 5293
 			} else {
5294 5294
 				if (!empty($useempty) && !is_numeric($useempty)) {
5295 5295
 					$out .= '<option value="-1">'.$langs->trans($useempty).'</option>';
@@ -5302,19 +5302,19 @@  discard block
 block discarded – undo
5302 5302
 				$obj = $this->db->fetch_object($result);
5303 5303
 				$iban = dolDecrypt($obj->iban_prefix);
5304 5304
 				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5305
-					$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '" selected>';
5305
+					$out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'" selected>';
5306 5306
 				} else {
5307
-					$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '">';
5307
+					$out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'">';
5308 5308
 				}
5309 5309
 				$out .= trim($obj->label);
5310 5310
 				if ($showibanbic) {
5311
-					$out .= ' (' . $iban . '/' .$obj->bic. ')';
5311
+					$out .= ' ('.$iban.'/'.$obj->bic.')';
5312 5312
 				}
5313 5313
 				$out .= '</option>';
5314 5314
 				$i++;
5315 5315
 			}
5316 5316
 			$out .= "</select>";
5317
-			$out .= ajax_combobox('select' . $htmlname);
5317
+			$out .= ajax_combobox('select'.$htmlname);
5318 5318
 		} else {
5319 5319
 			dol_print_error($this->db);
5320 5320
 		}
@@ -5348,23 +5348,23 @@  discard block
 block discarded – undo
5348 5348
 		$num = 0;
5349 5349
 
5350 5350
 		$sql = "SELECT rowid, name, fk_country, status, entity";
5351
-		$sql .= " FROM " . $this->db->prefix() . "establishment";
5351
+		$sql .= " FROM ".$this->db->prefix()."establishment";
5352 5352
 		$sql .= " WHERE 1=1";
5353 5353
 		if ($status != 2) {
5354
-			$sql .= " AND status = " . (int) $status;
5354
+			$sql .= " AND status = ".(int) $status;
5355 5355
 		}
5356 5356
 		if ($filtre) {	// TODO Support USF
5357
-			$sql .= " AND " . $filtre;
5357
+			$sql .= " AND ".$filtre;
5358 5358
 		}
5359 5359
 		$sql .= " ORDER BY name";
5360 5360
 
5361
-		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);
5361
+		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
5362 5362
 		$result = $this->db->query($sql);
5363 5363
 		if ($result) {
5364 5364
 			$num = $this->db->num_rows($result);
5365 5365
 			$i = 0;
5366 5366
 			if ($num) {
5367
-				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5367
+				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5368 5368
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5369 5369
 					print '<option value="-1">&nbsp;</option>';
5370 5370
 				}
@@ -5372,13 +5372,13 @@  discard block
 block discarded – undo
5372 5372
 				while ($i < $num) {
5373 5373
 					$obj = $this->db->fetch_object($result);
5374 5374
 					if ($selected == $obj->rowid) {
5375
-						print '<option value="' . $obj->rowid . '" selected>';
5375
+						print '<option value="'.$obj->rowid.'" selected>';
5376 5376
 					} else {
5377
-						print '<option value="' . $obj->rowid . '">';
5377
+						print '<option value="'.$obj->rowid.'">';
5378 5378
 					}
5379 5379
 					print trim($obj->name);
5380 5380
 					if ($status == 2 && $obj->status == 1) {
5381
-						print ' (' . $langs->trans("Closed") . ')';
5381
+						print ' ('.$langs->trans("Closed").')';
5382 5382
 					}
5383 5383
 					print '</option>';
5384 5384
 					$i++;
@@ -5386,9 +5386,9 @@  discard block
 block discarded – undo
5386 5386
 				print "</select>";
5387 5387
 			} else {
5388 5388
 				if ($status == 0) {
5389
-					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>';
5389
+					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
5390 5390
 				} else {
5391
-					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>';
5391
+					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
5392 5392
 				}
5393 5393
 			}
5394 5394
 
@@ -5412,20 +5412,20 @@  discard block
 block discarded – undo
5412 5412
 	{
5413 5413
 		global $langs;
5414 5414
 		if ($htmlname != "none") {
5415
-			print '<form method="POST" action="' . $page . '">';
5415
+			print '<form method="POST" action="'.$page.'">';
5416 5416
 			print '<input type="hidden" name="action" value="setbankaccount">';
5417
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5417
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5418 5418
 			print img_picto('', 'bank_account', 'class="pictofixedwidth"');
5419 5419
 			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
5420 5420
 			if ($nbaccountfound > 0) {
5421
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5421
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5422 5422
 			}
5423 5423
 			print '</form>';
5424 5424
 		} else {
5425 5425
 			$langs->load('banks');
5426 5426
 
5427 5427
 			if ($selected) {
5428
-				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
5428
+				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
5429 5429
 				$bankstatic = new Account($this->db);
5430 5430
 				$result = $bankstatic->fetch($selected);
5431 5431
 				if ($result) {
@@ -5452,25 +5452,25 @@  discard block
 block discarded – undo
5452 5452
 	{
5453 5453
 		global $langs;
5454 5454
 		if ($htmlname != "none") {
5455
-			print '<form method="POST" action="' . $page . '">';
5455
+			print '<form method="POST" action="'.$page.'">';
5456 5456
 			print '<input type="hidden" name="action" value="setbankaccountcustomer">';
5457
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5457
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5458 5458
 			$nbaccountfound = $this->selectRib($selected, $htmlname, $filtre, $addempty, '', $showibanbic);
5459 5459
 			if ($nbaccountfound > 0) {
5460
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5460
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5461 5461
 			}
5462 5462
 			print '</form>';
5463 5463
 		} else {
5464 5464
 			$langs->load('banks');
5465 5465
 
5466 5466
 			if ($selected) {
5467
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
5467
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
5468 5468
 				$bankstatic = new CompanyBankAccount($this->db);
5469 5469
 				$result = $bankstatic->fetch($selected);
5470 5470
 				if ($result) {
5471 5471
 					print $bankstatic->label;
5472 5472
 					if ($showibanbic) {
5473
-						print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')';
5473
+						print ' ('.$bankstatic->iban.'/'.$bankstatic->bic.')';
5474 5474
 					}
5475 5475
 				}
5476 5476
 			} else {
@@ -5506,11 +5506,11 @@  discard block
 block discarded – undo
5506 5506
 		global $conf, $langs;
5507 5507
 		$langs->load("categories");
5508 5508
 
5509
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5509
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5510 5510
 
5511 5511
 		// For backward compatibility
5512 5512
 		if (is_numeric($type)) {
5513
-			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5513
+			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5514 5514
 		}
5515 5515
 
5516 5516
 		if ($type === Categorie::TYPE_BANK_LINE) {
@@ -5518,8 +5518,8 @@  discard block
 block discarded – undo
5518 5518
 			$cat = new Categorie($this->db);
5519 5519
 			$cate_arbo = array();
5520 5520
 			$sql = "SELECT c.label, c.rowid";
5521
-			$sql .= " FROM " . $this->db->prefix() . "categorie as c";
5522
-			$sql .= " WHERE entity = " . $conf->entity . " AND type = " . ((int) $cat->getMapId()[$type]);
5521
+			$sql .= " FROM ".$this->db->prefix()."categorie as c";
5522
+			$sql .= " WHERE entity = ".$conf->entity." AND type = ".((int) $cat->getMapId()[$type]);
5523 5523
 			$sql .= " ORDER BY c.label";
5524 5524
 			$result = $this->db->query($sql);
5525 5525
 			if ($result) {
@@ -5545,12 +5545,12 @@  discard block
 block discarded – undo
5545 5545
 		$outarrayrichhtml = array();
5546 5546
 
5547 5547
 
5548
-		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
5548
+		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
5549 5549
 		if (is_array($cate_arbo)) {
5550 5550
 			$num = count($cate_arbo);
5551 5551
 
5552 5552
 			if (!$num) {
5553
-				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
5553
+				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
5554 5554
 			} else {
5555 5555
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5556 5556
 					$output .= '<option value="-1">&nbsp;</option>';
@@ -5562,15 +5562,15 @@  discard block
 block discarded – undo
5562 5562
 						$add = '';
5563 5563
 					}
5564 5564
 
5565
-					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"');
5565
+					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"');
5566 5566
 					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5567 5567
 
5568 5568
 					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
5569 5569
 
5570 5570
 					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;
5571 5571
 
5572
-					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';
5573
-					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';
5572
+					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
5573
+					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
5574 5574
 					$output .= '>';
5575 5575
 					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5576 5576
 					$output .= '</option>';
@@ -5616,7 +5616,7 @@  discard block
 block discarded – undo
5616 5616
 	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
5617 5617
 	{
5618 5618
 		// phpcs:enable
5619
-		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5619
+		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5620 5620
 		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
5621 5621
 	}
5622 5622
 
@@ -5651,7 +5651,7 @@  discard block
 block discarded – undo
5651 5651
 	{
5652 5652
 		global $langs, $conf;
5653 5653
 
5654
-		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';
5654
+		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';
5655 5655
 		$formconfirm = '';
5656 5656
 		$inputok = array();
5657 5657
 		$inputko = array();
@@ -5675,27 +5675,27 @@  discard block
 block discarded – undo
5675 5675
 			foreach ($formquestion as $key => $input) {
5676 5676
 				if (is_array($input) && !empty($input)) {
5677 5677
 					if ($input['type'] == 'hidden') {
5678
-						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5679
-						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5678
+						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5679
+						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5680 5680
 
5681
-						$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";
5681
+						$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";
5682 5682
 					}
5683 5683
 				}
5684 5684
 			}
5685 5685
 
5686 5686
 			// Now add questions
5687 5687
 			$moreonecolumn = '';
5688
-			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";
5688
+			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5689 5689
 			foreach ($formquestion as $key => $input) {
5690 5690
 				if (is_array($input) && !empty($input)) {
5691
-					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.
5692
-					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5693
-					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5691
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5692
+					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5693
+					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5694 5694
 
5695 5695
 					if ($input['type'] == 'text') {
5696
-						$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";
5696
+						$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";
5697 5697
 					} elseif ($input['type'] == 'password') {
5698
-						$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";
5698
+						$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";
5699 5699
 					} elseif ($input['type'] == 'textarea') {
5700 5700
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
5701 5701
 						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
@@ -5703,8 +5703,8 @@  discard block
 block discarded – undo
5703 5703
 						$more .= '</textarea>';
5704 5704
 						$more .= '</div></div>'."\n";*/
5705 5705
 						$moreonecolumn .= '<div class="margintoponly">';
5706
-						$moreonecolumn .= $input['label'] . '<br>';
5707
-						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';
5706
+						$moreonecolumn .= $input['label'].'<br>';
5707
+						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
5708 5708
 						$moreonecolumn .= $input['value'];
5709 5709
 						$moreonecolumn .= '</textarea>';
5710 5710
 						$moreonecolumn .= '</div>';
@@ -5721,20 +5721,20 @@  discard block
 block discarded – undo
5721 5721
 						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
5722 5722
 						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
5723 5723
 
5724
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">';
5724
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5725 5725
 						if (!empty($input['label'])) {
5726
-							$more .= $input['label'] . '</div><div class="tagtd left">';
5726
+							$more .= $input['label'].'</div><div class="tagtd left">';
5727 5727
 						}
5728 5728
 						if ($input['type'] == 'select') {
5729 5729
 							$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);
5730 5730
 						} else {
5731 5731
 							$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);
5732 5732
 						}
5733
-						$more .= '</div></div>' . "\n";
5733
+						$more .= '</div></div>'."\n";
5734 5734
 					} elseif ($input['type'] == 'checkbox') {
5735 5735
 						$more .= '<div class="tagtr">';
5736
-						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">';
5737
-						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;
5736
+						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
5737
+						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
5738 5738
 						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
5739 5739
 							$more .= ' checked';
5740 5740
 						}
@@ -5745,19 +5745,19 @@  discard block
 block discarded – undo
5745 5745
 							$more .= ' disabled';
5746 5746
 						}
5747 5747
 						$more .= ' /></div>';
5748
-						$more .= '</div>' . "\n";
5748
+						$more .= '</div>'."\n";
5749 5749
 					} elseif ($input['type'] == 'radio') {
5750 5750
 						$i = 0;
5751 5751
 						foreach ($input['values'] as $selkey => $selval) {
5752 5752
 							$more .= '<div class="tagtr">';
5753 5753
 							if (isset($input['label'])) {
5754 5754
 								if ($i == 0) {
5755
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5755
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
5756 5756
 								} else {
5757
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
5757
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
5758 5758
 								}
5759 5759
 							}
5760
-							$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;
5760
+							$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;
5761 5761
 							if (!empty($input['disabled'])) {
5762 5762
 								$more .= ' disabled';
5763 5763
 							}
@@ -5765,12 +5765,12 @@  discard block
 block discarded – undo
5765 5765
 								$more .= ' checked="checked"';
5766 5766
 							}
5767 5767
 							$more .= ' /> ';
5768
-							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';
5769
-							$more .= '</div></div>' . "\n";
5768
+							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
5769
+							$more .= '</div></div>'."\n";
5770 5770
 							$i++;
5771 5771
 						}
5772 5772
 					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') {
5773
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5773
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
5774 5774
 						$more .= '<div class="tagtd">';
5775 5775
 						$addnowlink = (empty($input['datenow']) ? 0 : 1);
5776 5776
 						$h = $m = 0;
@@ -5788,24 +5788,24 @@  discard block
 block discarded – undo
5788 5788
 					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
5789 5789
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5790 5790
 						if (!empty($input['label'])) {
5791
-							$more .= $input['label'] . '</div><div class="tagtd">';
5791
+							$more .= $input['label'].'</div><div class="tagtd">';
5792 5792
 						}
5793 5793
 						$more .= $input['value'];
5794
-						$more .= '</div></div>' . "\n";
5794
+						$more .= '</div></div>'."\n";
5795 5795
 					} elseif ($input['type'] == 'onecolumn') {
5796 5796
 						$moreonecolumn .= '<div class="margintoponly">';
5797 5797
 						$moreonecolumn .= $input['value'];
5798
-						$moreonecolumn .= '</div>' . "\n";
5798
+						$moreonecolumn .= '</div>'."\n";
5799 5799
 					} elseif ($input['type'] == 'hidden') {
5800 5800
 						// Do nothing more, already added by a previous loop
5801 5801
 					} elseif ($input['type'] == 'separator') {
5802 5802
 						$more .= '<br>';
5803 5803
 					} else {
5804
-						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';
5804
+						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
5805 5805
 					}
5806 5806
 				}
5807 5807
 			}
5808
-			$more .= '</div>' . "\n";
5808
+			$more .= '</div>'."\n";
5809 5809
 			$more .= $moreonecolumn;
5810 5810
 		}
5811 5811
 
@@ -5827,10 +5827,10 @@  discard block
 block discarded – undo
5827 5827
 				$button = $useajax;
5828 5828
 				$useajax = 1;
5829 5829
 				$autoOpen = false;
5830
-				$dialogconfirm .= '-' . $button;
5830
+				$dialogconfirm .= '-'.$button;
5831 5831
 			}
5832
-			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes';
5833
-			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : '');
5832
+			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes';
5833
+			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : '');
5834 5834
 
5835 5835
 			// Add input fields into list of fields to read during submit (inputok and inputko)
5836 5836
 			if (is_array($formquestion)) {
@@ -5853,24 +5853,24 @@  discard block
 block discarded – undo
5853 5853
 			}
5854 5854
 
5855 5855
 			// Show JQuery confirm box.
5856
-			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
5856
+			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
5857 5857
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5858
-				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";
5858
+				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
5859 5859
 			}
5860 5860
 			if (!empty($more)) {
5861
-				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";
5861
+				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";
5862 5862
 			}
5863
-			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');
5864
-			$formconfirm .= '</div>' . "\n";
5863
+			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');
5864
+			$formconfirm .= '</div>'."\n";
5865 5865
 
5866
-			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";
5867
-			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5866
+			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
5867
+			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5868 5868
 			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
5869 5869
 			$formconfirm .= 'jQuery(document).ready(function() {
5870 5870
             $(function() {
5871
-            	$( "#' . $dialogconfirm . '" ).dialog(
5871
+            	$( "#' . $dialogconfirm.'" ).dialog(
5872 5872
             	{
5873
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
5873
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
5874 5874
 			if ($newselectedchoice == 'no') {
5875 5875
 				$formconfirm .= '
5876 5876
 						open: function() {
@@ -5880,24 +5880,24 @@  discard block
 block discarded – undo
5880 5880
 
5881 5881
 			$jsforcursor = '';
5882 5882
 			if ($useajax == 1) {
5883
-				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";
5884
-				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n";
5883
+				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
5884
+				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
5885 5885
 			}
5886 5886
 
5887 5887
 			$postconfirmas = 'GET';
5888 5888
 
5889 5889
 			$formconfirm .= '
5890 5890
                     resizable: false,
5891
-                    height: "' . $height . '",
5892
-                    width: "' . $width . '",
5891
+                    height: "' . $height.'",
5892
+                    width: "' . $width.'",
5893 5893
                     modal: true,
5894 5894
                     closeOnEscape: false,
5895 5895
                     buttons: {
5896
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
5897
-							var options = "token=' . urlencode(newToken()) . '";
5898
-                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */
5899
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5900
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
5896
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
5897
+							var options = "token=' . urlencode(newToken()).'";
5898
+                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */
5899
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5900
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
5901 5901
 
5902 5902
                          	if (inputok.length > 0) {
5903 5903
                          		$.each(inputok, function(i, inputname) {
@@ -5931,11 +5931,11 @@  discard block
 block discarded – undo
5931 5931
 							}
5932 5932
 	                        $(this).dialog("close");
5933 5933
                         },
5934
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() {
5935
-                        	var options = "token=' . urlencode(newToken()) . '";
5936
-                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */
5937
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5938
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
5934
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
5935
+                        	var options = "token=' . urlencode(newToken()).'";
5936
+                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */
5937
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5938
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
5939 5939
                          	if (inputko.length > 0) {
5940 5940
                          		$.each(inputko, function(i, inputname) {
5941 5941
                          			var more = "";
@@ -5967,10 +5967,10 @@  discard block
 block discarded – undo
5967 5967
                 }
5968 5968
                 );
5969 5969
 
5970
-            	var button = "' . $button . '";
5970
+            	var button = "' . $button.'";
5971 5971
             	if (button.length > 0) {
5972 5972
                 	$( "#" + button ).click(function() {
5973
-                		$("#' . $dialogconfirm . '").dialog("open");
5973
+                		$("#' . $dialogconfirm.'").dialog("open");
5974 5974
         			});
5975 5975
                 }
5976 5976
             });
@@ -5978,44 +5978,44 @@  discard block
 block discarded – undo
5978 5978
             </script>';
5979 5979
 			$formconfirm .= "<!-- end ajax formconfirm -->\n";
5980 5980
 		} else {
5981
-			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";
5981
+			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";
5982 5982
 
5983 5983
 			if (empty($disableformtag)) {
5984
-				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftnoright">' . "\n";
5984
+				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftnoright">'."\n";
5985 5985
 			}
5986 5986
 
5987
-			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
5988
-			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";
5987
+			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
5988
+			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
5989 5989
 
5990
-			$formconfirm .= '<table class="valid centpercent">' . "\n";
5990
+			$formconfirm .= '<table class="valid centpercent">'."\n";
5991 5991
 
5992 5992
 			// Line title
5993 5993
 			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';
5994
-			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title;
5995
-			$formconfirm .= '</td></tr>' . "\n";
5994
+			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title;
5995
+			$formconfirm .= '</td></tr>'."\n";
5996 5996
 
5997 5997
 			// Line text
5998 5998
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5999
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
5999
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
6000 6000
 			}
6001 6001
 
6002 6002
 			// Line form fields
6003 6003
 			if ($more) {
6004
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";
6004
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";
6005 6005
 				$formconfirm .= $more;
6006
-				$formconfirm .= '</td></tr>' . "\n";
6006
+				$formconfirm .= '</td></tr>'."\n";
6007 6007
 			}
6008 6008
 
6009 6009
 			// Line with question
6010 6010
 			$formconfirm .= '<tr class="valid">';
6011
-			$formconfirm .= '<td class="valid">' . $question . '</td>';
6011
+			$formconfirm .= '<td class="valid">'.$question.'</td>';
6012 6012
 			$formconfirm .= '<td class="valid center">';
6013 6013
 			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
6014
-			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">';
6014
+			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
6015 6015
 			$formconfirm .= '</td>';
6016
-			$formconfirm .= '</tr>' . "\n";
6016
+			$formconfirm .= '</tr>'."\n";
6017 6017
 
6018
-			$formconfirm .= '</table>' . "\n";
6018
+			$formconfirm .= '</table>'."\n";
6019 6019
 
6020 6020
 			if (empty($disableformtag)) {
6021 6021
 				$formconfirm .= "</form>\n";
@@ -6024,7 +6024,7 @@  discard block
 block discarded – undo
6024 6024
 
6025 6025
 			if (!empty($conf->use_javascript_ajax)) {
6026 6026
 				$formconfirm .= '<!-- code to disable button to avoid double clic -->';
6027
-				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
6027
+				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
6028 6028
 				$formconfirm .= '
6029 6029
 				$(document).ready(function () {
6030 6030
 					$(".confirmvalidatebutton").on("click", function() {
@@ -6036,7 +6036,7 @@  discard block
 block discarded – undo
6036 6036
 					});
6037 6037
 				});
6038 6038
 				';
6039
-				$formconfirm .= '</script>' . "\n";
6039
+				$formconfirm .= '</script>'."\n";
6040 6040
 			}
6041 6041
 
6042 6042
 			$formconfirm .= "<!-- end formconfirm -->\n";
@@ -6068,8 +6068,8 @@  discard block
 block discarded – undo
6068 6068
 		// phpcs:enable
6069 6069
 		global $langs;
6070 6070
 
6071
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
6072
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
6071
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
6072
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
6073 6073
 
6074 6074
 		$out = '';
6075 6075
 
@@ -6077,11 +6077,11 @@  discard block
 block discarded – undo
6077 6077
 
6078 6078
 		$langs->load("project");
6079 6079
 		if ($htmlname != "none") {
6080
-			$out .= '<form method="post" action="' . $page . '">';
6080
+			$out .= '<form method="post" action="'.$page.'">';
6081 6081
 			$out .= '<input type="hidden" name="action" value="classin">';
6082
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6082
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6083 6083
 			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);
6084
-			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6084
+			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6085 6085
 			$out .= '</form>';
6086 6086
 		} else {
6087 6087
 			$out .= '<span class="project_head_block">';
@@ -6090,7 +6090,7 @@  discard block
 block discarded – undo
6090 6090
 				$projet->fetch($selected);
6091 6091
 				$out .= $projet->getNomUrl(0, '', 1);
6092 6092
 			} else {
6093
-				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
6093
+				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';
6094 6094
 			}
6095 6095
 			$out .= '</span>';
6096 6096
 		}
@@ -6127,14 +6127,14 @@  discard block
 block discarded – undo
6127 6127
 		$out = '';
6128 6128
 
6129 6129
 		if ($htmlname != "none") {
6130
-			$out .= '<form method="POST" action="' . $page . '">';
6130
+			$out .= '<form method="POST" action="'.$page.'">';
6131 6131
 			$out .= '<input type="hidden" name="action" value="setconditions">';
6132
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6132
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6133 6133
 			if ($type) {
6134
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6134
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6135 6135
 			}
6136 6136
 			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
6137
-			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6137
+			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
6138 6138
 			$out .= '</form>';
6139 6139
 		} else {
6140 6140
 			if ($selected) {
@@ -6179,12 +6179,12 @@  discard block
 block discarded – undo
6179 6179
 		// phpcs:enable
6180 6180
 		global $langs;
6181 6181
 		if ($htmlname != "none") {
6182
-			print '<form method="post" action="' . $page . '">';
6182
+			print '<form method="post" action="'.$page.'">';
6183 6183
 			print '<input type="hidden" name="action" value="setavailability">';
6184
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6184
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6185 6185
 			$this->selectAvailabilityDelay($selected, $htmlname, '', $addempty);
6186
-			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6187
-			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">';
6186
+			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6187
+			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">';
6188 6188
 			print '</form>';
6189 6189
 		} else {
6190 6190
 			if ($selected) {
@@ -6210,11 +6210,11 @@  discard block
 block discarded – undo
6210 6210
 	{
6211 6211
 		global $langs;
6212 6212
 		if ($htmlname != "none") {
6213
-			print '<form method="post" action="' . $page . '">';
6213
+			print '<form method="post" action="'.$page.'">';
6214 6214
 			print '<input type="hidden" name="action" value="setdemandreason">';
6215
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6215
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6216 6216
 			$this->selectInputReason($selected, $htmlname, '-1', $addempty);
6217
-			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6217
+			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6218 6218
 			print '</form>';
6219 6219
 		} else {
6220 6220
 			if ($selected) {
@@ -6254,17 +6254,17 @@  discard block
 block discarded – undo
6254 6254
 		$ret = '';
6255 6255
 
6256 6256
 		if ($htmlname != "none") {
6257
-			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6258
-			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
6259
-			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
6257
+			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6258
+			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
6259
+			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
6260 6260
 			if ($type) {
6261
-				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6261
+				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6262 6262
 			}
6263 6263
 			$ret .= '<table class="nobordernopadding">';
6264 6264
 			$ret .= '<tr><td>';
6265
-			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
6265
+			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
6266 6266
 			$ret .= '</td>';
6267
-			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6267
+			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6268 6268
 			$ret .= '</tr></table></form>';
6269 6269
 		} else {
6270 6270
 			if ($displayhour) {
@@ -6299,15 +6299,15 @@  discard block
 block discarded – undo
6299 6299
 		global $langs;
6300 6300
 
6301 6301
 		if ($htmlname != "none") {
6302
-			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6303
-			print '<input type="hidden" name="action" value="set' . $htmlname . '">';
6304
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6302
+			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6303
+			print '<input type="hidden" name="action" value="set'.$htmlname.'">';
6304
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6305 6305
 			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
6306
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6306
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6307 6307
 			print '</form>';
6308 6308
 		} else {
6309 6309
 			if ($selected) {
6310
-				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
6310
+				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
6311 6311
 				$theuser = new User($this->db);
6312 6312
 				$theuser->fetch($selected);
6313 6313
 				print $theuser->getNomUrl(1);
@@ -6340,14 +6340,14 @@  discard block
 block discarded – undo
6340 6340
 
6341 6341
 		$out = '';
6342 6342
 		if ($htmlname != "none") {
6343
-			$out .= '<form method="POST" action="' . $page . '">';
6343
+			$out .= '<form method="POST" action="'.$page.'">';
6344 6344
 			$out .= '<input type="hidden" name="action" value="setmode">';
6345
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6345
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6346 6346
 			if ($type) {
6347
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6347
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6348 6348
 			}
6349 6349
 			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
6350
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6350
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6351 6351
 			$out .= '</form>';
6352 6352
 		} else {
6353 6353
 			if ($selected) {
@@ -6380,11 +6380,11 @@  discard block
 block discarded – undo
6380 6380
 	{
6381 6381
 		global $langs;
6382 6382
 		if ($htmlname != "none") {
6383
-			print '<form method="POST" action="' . $page . '">';
6383
+			print '<form method="POST" action="'.$page.'">';
6384 6384
 			print '<input type="hidden" name="action" value="settransportmode">';
6385
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6385
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6386 6386
 			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
6387
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6387
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6388 6388
 			print '</form>';
6389 6389
 		} else {
6390 6390
 			if ($selected) {
@@ -6411,14 +6411,14 @@  discard block
 block discarded – undo
6411 6411
 		// phpcs:enable
6412 6412
 		global $langs;
6413 6413
 		if ($htmlname != "none") {
6414
-			print '<form method="POST" action="' . $page . '">';
6414
+			print '<form method="POST" action="'.$page.'">';
6415 6415
 			print '<input type="hidden" name="action" value="setmulticurrencycode">';
6416
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6416
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6417 6417
 			print $this->selectMultiCurrency($selected, $htmlname, 0);
6418
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6418
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6419 6419
 			print '</form>';
6420 6420
 		} else {
6421
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6421
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6422 6422
 			print !empty($selected) ? currency_name($selected, 1) : '&nbsp;';
6423 6423
 		}
6424 6424
 	}
@@ -6440,22 +6440,22 @@  discard block
 block discarded – undo
6440 6440
 		global $langs, $mysoc, $conf;
6441 6441
 
6442 6442
 		if ($htmlname != "none") {
6443
-			print '<form method="POST" action="' . $page . '">';
6443
+			print '<form method="POST" action="'.$page.'">';
6444 6444
 			print '<input type="hidden" name="action" value="setmulticurrencyrate">';
6445
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6446
-			print '<input type="text" class="maxwidth75" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';
6445
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6446
+			print '<input type="text" class="maxwidth75" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
6447 6447
 			print '<select name="calculation_mode" id="calculation_mode">';
6448
-			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>';
6449
-			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>';
6448
+			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
6449
+			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
6450 6450
 			print '</select> ';
6451 6451
 			print ajax_combobox("calculation_mode");
6452
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6452
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6453 6453
 			print '</form>';
6454 6454
 		} else {
6455 6455
 			if (!empty($rate)) {
6456 6456
 				print price($rate, 1, $langs, 0, 0);
6457 6457
 				if ($currency && $rate != 1) {
6458
-					print ' &nbsp; <span class="opacitymedium">(' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')</span>';
6458
+					print ' &nbsp; <span class="opacitymedium">('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')</span>';
6459 6459
 				}
6460 6460
 			} else {
6461 6461
 				print 1;
@@ -6485,9 +6485,9 @@  discard block
 block discarded – undo
6485 6485
 		// phpcs:enable
6486 6486
 		global $conf, $langs;
6487 6487
 		if ($htmlname != "none") {
6488
-			print '<form method="post" action="' . $page . '">';
6488
+			print '<form method="post" action="'.$page.'">';
6489 6489
 			print '<input type="hidden" name="action" value="setabsolutediscount">';
6490
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6490
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6491 6491
 			print '<div class="inline-block">';
6492 6492
 			if (!empty($discount_type)) {
6493 6493
 				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
@@ -6525,24 +6525,24 @@  discard block
 block discarded – undo
6525 6525
 			print '</div>';
6526 6526
 			if (empty($hidelist)) {
6527 6527
 				print '<div class="inline-block" style="padding-right: 10px">';
6528
-				$newfilter = 'discount_type=' . intval($discount_type);
6528
+				$newfilter = 'discount_type='.intval($discount_type);
6529 6529
 				if (!empty($discount_type)) {
6530 6530
 					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
6531 6531
 				} else {
6532 6532
 					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
6533 6533
 				}
6534 6534
 				if ($filter) {
6535
-					$newfilter .= ' AND (' . $filter . ')';
6535
+					$newfilter .= ' AND ('.$filter.')';
6536 6536
 				}
6537 6537
 				// output the combo of discounts
6538 6538
 				$nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue);
6539 6539
 				if ($nbqualifiedlines > 0) {
6540
-					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"';
6540
+					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
6541 6541
 					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
6542
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6542
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6543 6543
 					}
6544 6544
 					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
6545
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6545
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6546 6546
 					}
6547 6547
 
6548 6548
 					print '>';
@@ -6582,23 +6582,23 @@  discard block
 block discarded – undo
6582 6582
 		global $langs;
6583 6583
 
6584 6584
 		if ($htmlname != "none") {
6585
-			print '<form method="post" action="' . $page . '">';
6585
+			print '<form method="post" action="'.$page.'">';
6586 6586
 			print '<input type="hidden" name="action" value="set_contact">';
6587
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6587
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6588 6588
 			print '<table class="nobordernopadding">';
6589 6589
 			print '<tr><td>';
6590 6590
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
6591 6591
 			$num = $this->num;
6592 6592
 			if ($num == 0) {
6593 6593
 				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
6594
-				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>';
6594
+				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>';
6595 6595
 			}
6596 6596
 			print '</td>';
6597
-			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6597
+			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6598 6598
 			print '</tr></table></form>';
6599 6599
 		} else {
6600 6600
 			if ($selected) {
6601
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
6601
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
6602 6602
 				$contact = new Contact($this->db);
6603 6603
 				$contact->fetch($selected);
6604 6604
 				print $contact->getFullName($langs);
@@ -6633,20 +6633,20 @@  discard block
 block discarded – undo
6633 6633
 
6634 6634
 		$out = '';
6635 6635
 		if ($htmlname != "none") {
6636
-			$out .= '<form method="post" action="' . $page . '">';
6636
+			$out .= '<form method="post" action="'.$page.'">';
6637 6637
 			$out .= '<input type="hidden" name="action" value="set_thirdparty">';
6638
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6638
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6639 6639
 			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);
6640
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6640
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6641 6641
 			$out .= '</form>';
6642 6642
 		} else {
6643 6643
 			if ($selected) {
6644
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
6644
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
6645 6645
 				$soc = new Societe($this->db);
6646 6646
 				$soc->fetch($selected);
6647 6647
 				$out .= $soc->getNomUrl(0, '');
6648 6648
 			} else {
6649
-				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
6649
+				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
6650 6650
 			}
6651 6651
 		}
6652 6652
 
@@ -6696,22 +6696,22 @@  discard block
 block discarded – undo
6696 6696
 			$selected = 'EUR'; // Pour compatibilite
6697 6697
 		}
6698 6698
 
6699
-		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
6699
+		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
6700 6700
 		if ($useempty) {
6701 6701
 			$out .= '<option value="-1" selected></option>';
6702 6702
 		}
6703 6703
 		foreach ($langs->cache_currencies as $code_iso => $currency) {
6704 6704
 			$labeltoshow = $currency['label'];
6705 6705
 			if ($mode == 1) {
6706
-				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>';
6706
+				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>';
6707 6707
 			} else {
6708
-				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>';
6708
+				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>';
6709 6709
 			}
6710 6710
 
6711 6711
 			if ($selected && $selected == $code_iso) {
6712
-				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6712
+				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
6713 6713
 			} else {
6714
-				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6714
+				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
6715 6715
 			}
6716 6716
 			$out .= $labeltoshow;
6717 6717
 			$out .= '</option>';
@@ -6722,7 +6722,7 @@  discard block
 block discarded – undo
6722 6722
 		}
6723 6723
 
6724 6724
 		// Make select dynamic
6725
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6725
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6726 6726
 		$out .= ajax_combobox($htmlname);
6727 6727
 
6728 6728
 		return $out;
@@ -6748,10 +6748,10 @@  discard block
 block discarded – undo
6748 6748
 
6749 6749
 		$TCurrency = array();
6750 6750
 
6751
-		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
6752
-		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
6751
+		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
6752
+		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
6753 6753
 		if ($filter) {
6754
-			$sql .= " AND " . $filter;
6754
+			$sql .= " AND ".$filter;
6755 6755
 		}
6756 6756
 		$resql = $this->db->query($sql);
6757 6757
 		if ($resql) {
@@ -6761,7 +6761,7 @@  discard block
 block discarded – undo
6761 6761
 		}
6762 6762
 
6763 6763
 		$out = '';
6764
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
6764
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
6765 6765
 		if ($useempty) {
6766 6766
 			$out .= '<option value="">&nbsp;</option>';
6767 6767
 		}
@@ -6773,13 +6773,13 @@  discard block
 block discarded – undo
6773 6773
 			foreach ($langs->cache_currencies as $code_iso => $currency) {
6774 6774
 				if (isset($TCurrency[$code_iso])) {
6775 6775
 					if (!empty($selected) && $selected == $code_iso) {
6776
-						$out .= '<option value="' . $code_iso . '" selected="selected">';
6776
+						$out .= '<option value="'.$code_iso.'" selected="selected">';
6777 6777
 					} else {
6778
-						$out .= '<option value="' . $code_iso . '">';
6778
+						$out .= '<option value="'.$code_iso.'">';
6779 6779
 					}
6780 6780
 
6781 6781
 					$out .= $currency['label'];
6782
-					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
6782
+					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
6783 6783
 					$out .= '</option>';
6784 6784
 				}
6785 6785
 			}
@@ -6788,7 +6788,7 @@  discard block
 block discarded – undo
6788 6788
 		$out .= '</select>';
6789 6789
 
6790 6790
 		// Make select dynamic
6791
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6791
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6792 6792
 		$out .= ajax_combobox($htmlname);
6793 6793
 
6794 6794
 		return $out;
@@ -6819,7 +6819,7 @@  discard block
 block discarded – undo
6819 6819
 		$sql .= " WHERE t.fk_pays = c.rowid";
6820 6820
 		$sql .= " AND t.active > 0";
6821 6821
 		$sql .= " AND t.entity IN (".getEntity('c_tva').")";
6822
-		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
6822
+		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
6823 6823
 		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
6824 6824
 
6825 6825
 		$resql = $this->db->query($sql);
@@ -6831,30 +6831,30 @@  discard block
 block discarded – undo
6831 6831
 
6832 6832
 					$tmparray = array();
6833 6833
 					$tmparray['rowid']			= $obj->rowid;
6834
-					$tmparray['type_vat']		= $obj->type_vat;
6835
-					$tmparray['code']			= $obj->code;
6834
+					$tmparray['type_vat'] = $obj->type_vat;
6835
+					$tmparray['code'] = $obj->code;
6836 6836
 					$tmparray['txtva']			= $obj->taux;
6837
-					$tmparray['nprtva']			= $obj->recuperableonly;
6837
+					$tmparray['nprtva'] = $obj->recuperableonly;
6838 6838
 					$tmparray['localtax1']	    = $obj->localtax1;
6839 6839
 					$tmparray['localtax1_type']	= $obj->localtax1_type;
6840 6840
 					$tmparray['localtax2']	    = $obj->localtax2;
6841 6841
 					$tmparray['localtax2_type']	= $obj->localtax1_type;
6842
-					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or *
6843
-					$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
6842
+					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
6843
+					$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
6844 6844
 					$positiverates = '';
6845 6845
 					if ($obj->taux) {
6846
-						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;
6846
+						$positiverates .= ($positiverates ? '/' : '').$obj->taux;
6847 6847
 					}
6848 6848
 					if ($obj->localtax1) {
6849
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
6849
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
6850 6850
 					}
6851 6851
 					if ($obj->localtax2) {
6852
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
6852
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
6853 6853
 					}
6854 6854
 					if (empty($positiverates)) {
6855 6855
 						$positiverates = '0';
6856 6856
 					}
6857
-					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6857
+					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6858 6858
 
6859 6859
 					$this->cache_vatrates[$obj->rowid] = $tmparray;
6860 6860
 				}
@@ -6874,7 +6874,7 @@  discard block
 block discarded – undo
6874 6874
 				return -1;
6875 6875
 			}
6876 6876
 		} else {
6877
-			$this->error = '<span class="error">' . $this->db->error() . '</span>';
6877
+			$this->error = '<span class="error">'.$this->db->error().'</span>';
6878 6878
 			return -2;
6879 6879
 		}
6880 6880
 	}
@@ -6927,9 +6927,9 @@  discard block
 block discarded – undo
6927 6927
 		// Check parameters
6928 6928
 		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
6929 6929
 			if ($societe_vendeuse->id == $mysoc->id) {
6930
-				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>';
6930
+				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
6931 6931
 			} else {
6932
-				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>';
6932
+				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
6933 6933
 			}
6934 6934
 			return $return;
6935 6935
 		}
@@ -6941,12 +6941,12 @@  discard block
 block discarded – undo
6941 6941
 		// Define list of countries to use to search VAT rates to show
6942 6942
 		// First we defined code_country to use to find list
6943 6943
 		if (is_object($societe_vendeuse)) {
6944
-			$code_country = "'" . $societe_vendeuse->country_code . "'";
6944
+			$code_country = "'".$societe_vendeuse->country_code."'";
6945 6945
 		} else {
6946
-			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
6946
+			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
6947 6947
 		}
6948 6948
 		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on
6949
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6949
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6950 6950
 			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
6951 6951
 			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
6952 6952
 			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
@@ -6956,27 +6956,27 @@  discard block
 block discarded – undo
6956 6956
 					if ($type == 1) { // We know product is a service
6957 6957
 						switch ($selectVatComboMode) {
6958 6958
 							case '1':
6959
-								$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6959
+								$code_country .= ",'".$societe_acheteuse->country_code."'";
6960 6960
 								break;
6961 6961
 							case '2':
6962
-								$code_country = "'" . $societe_acheteuse->country_code . "'";
6962
+								$code_country = "'".$societe_acheteuse->country_code."'";
6963 6963
 								break;
6964 6964
 						}
6965 6965
 					}
6966 6966
 				} elseif (!$idprod) {  // We don't know type of product
6967 6967
 					switch ($selectVatComboMode) {
6968 6968
 						case '1':
6969
-							$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6969
+							$code_country .= ",'".$societe_acheteuse->country_code."'";
6970 6970
 							break;
6971 6971
 						case '2':
6972
-							$code_country = "'" . $societe_acheteuse->country_code . "'";
6972
+							$code_country = "'".$societe_acheteuse->country_code."'";
6973 6973
 							break;
6974 6974
 					}
6975 6975
 				} else {
6976 6976
 					$prodstatic = new Product($this->db);
6977 6977
 					$prodstatic->fetch($idprod);
6978 6978
 					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
6979
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6979
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6980 6980
 					}
6981 6981
 				}
6982 6982
 			}
@@ -7038,13 +7038,13 @@  discard block
 block discarded – undo
7038 7038
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
7039 7039
 				// of using supplier invoices (this is a very bad idea !)
7040 7040
 				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) {
7041
-					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
7041
+					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
7042 7042
 					$disabled = true;
7043 7043
 				}
7044 7044
 			}
7045 7045
 
7046 7046
 			if (!$options_only) {
7047
-				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
7047
+				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
7048 7048
 			}
7049 7049
 
7050 7050
 			$selectedfound = false;
@@ -7058,13 +7058,13 @@  discard block
 block discarded – undo
7058 7058
 				$key = $rate['txtva'];
7059 7059
 				$key .= $rate['nprtva'] ? '*' : '';
7060 7060
 				if ($mode > 0 && $rate['code']) {
7061
-					$key .= ' (' . $rate['code'] . ')';
7061
+					$key .= ' ('.$rate['code'].')';
7062 7062
 				}
7063 7063
 				if ($mode < 0) {
7064 7064
 					$key = $rate['rowid'];
7065 7065
 				}
7066 7066
 
7067
-				$return .= '<option value="' . $key . '"';
7067
+				$return .= '<option value="'.$key.'"';
7068 7068
 				if (!$selectedfound) {
7069 7069
 					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
7070 7070
 						if ($defaultcode == $rate['code']) {
@@ -7135,7 +7135,7 @@  discard block
 block discarded – undo
7135 7135
 	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 = '')
7136 7136
 	{
7137 7137
 		// phpcs:enable
7138
-		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
7138
+		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
7139 7139
 		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);
7140 7140
 		if (!empty($nooutput)) {
7141 7141
 			return $retstring;
@@ -7164,11 +7164,11 @@  discard block
 block discarded – undo
7164 7164
 	{
7165 7165
 		global $langs;
7166 7166
 
7167
-		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
7167
+		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
7168 7168
 		if ($forcenewline) {
7169 7169
 			$ret .= '<br>';
7170 7170
 		}
7171
-		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
7171
+		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
7172 7172
 		return $ret;
7173 7173
 	}
7174 7174
 
@@ -7235,7 +7235,7 @@  discard block
 block discarded – undo
7235 7235
 		$orig_set_time = $set_time;
7236 7236
 
7237 7237
 		if ($set_time === '' && $emptydate == 0) {
7238
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7238
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7239 7239
 			if ($gm == 'tzuser' || $gm == 'tzuserrel') {
7240 7240
 				$set_time = dol_now($gm);
7241 7241
 			} else {
@@ -7307,38 +7307,38 @@  discard block
 block discarded – undo
7307 7307
 				// Calendrier popup version eldy
7308 7308
 				if ($usecalendar == "eldy") {
7309 7309
 					// Input area to enter date manually
7310
-					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';
7310
+					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7311 7311
 					$retstring .= ($disabled ? ' disabled' : '');
7312
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7312
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7313 7313
 					$retstring .= ' autocomplete="off">';
7314 7314
 
7315 7315
 					// Icon calendar
7316 7316
 					$retstringbuttom = '';
7317 7317
 					if (!$disabled) {
7318
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
7319
-						$base = DOL_URL_ROOT . '/core/';
7320
-						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
7321
-						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
7318
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
7319
+						$base = DOL_URL_ROOT.'/core/';
7320
+						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
7321
+						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
7322 7322
 					} else {
7323
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7323
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7324 7324
 					}
7325
-					$retstring = $retstringbuttom . $retstring;
7325
+					$retstring = $retstringbuttom.$retstring;
7326 7326
 
7327
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7328
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7329
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7327
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7328
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7329
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7330 7330
 				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') {
7331 7331
 					if (!$disabled && $usecalendar != 'html') {
7332 7332
 						// Output javascript for datepicker
7333 7333
 						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100));
7334 7334
 						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100));
7335 7335
 
7336
-						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';
7337
-						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
7338
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
7336
+						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';
7337
+						$retstring .= "$(function(){ $('#".$prefix."').datepicker({
7338
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
7339 7339
 							autoclose: true,
7340 7340
 							todayHighlight: true,
7341
-							yearRange: '" . $minYear . ":" . $maxYear . "',";
7341
+							yearRange: '" . $minYear.":".$maxYear."',";
7342 7342
 						if (!empty($conf->dol_use_jmobile)) {
7343 7343
 							$retstring .= "
7344 7344
 								beforeShow: function (input, datePicker) {
@@ -7351,10 +7351,10 @@  discard block
 block discarded – undo
7351 7351
 						}
7352 7352
 						// Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php
7353 7353
 						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
7354
-							$buttonImage = $calendarpicto ?: DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png";
7354
+							$buttonImage = $calendarpicto ?: DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png";
7355 7355
 							$retstring .= "
7356 7356
 								showOn: 'button',	/* both has problem with autocompletion */
7357
-								buttonImage: '" . $buttonImage . "',
7357
+								buttonImage: '" . $buttonImage."',
7358 7358
 								buttonImageOnly: true";
7359 7359
 						}
7360 7360
 						$retstring .= "
@@ -7366,46 +7366,46 @@  discard block
 block discarded – undo
7366 7366
 					$retstring .= '<div class="nowraponall inline-block divfordateinput">';
7367 7367
 					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7368 7368
 					$retstring .= ($disabled ? ' disabled' : '');
7369
-					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
7370
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7369
+					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
7370
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7371 7371
 					$retstring .= ' autocomplete="off">';
7372 7372
 
7373 7373
 					// Icone calendrier
7374 7374
 					if ($disabled) {
7375
-						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7376
-						$retstring = $retstringbutton . $retstring;
7375
+						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7376
+						$retstring = $retstringbutton.$retstring;
7377 7377
 					}
7378 7378
 
7379 7379
 					$retstring .= '</div>';
7380
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7381
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7382
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7380
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7381
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7382
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7383 7383
 				} else {
7384 7384
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
7385 7385
 				}
7386 7386
 			} else {
7387 7387
 				// Show date with combo selects
7388 7388
 				// Day
7389
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
7389
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
7390 7390
 
7391 7391
 				if ($emptydate || $set_time == -1) {
7392 7392
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7393 7393
 				}
7394 7394
 
7395 7395
 				for ($day = 1; $day <= 31; $day++) {
7396
-					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
7396
+					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
7397 7397
 				}
7398 7398
 
7399 7399
 				$retstring .= "</select>";
7400 7400
 
7401
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
7401
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
7402 7402
 				if ($emptydate || $set_time == -1) {
7403 7403
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7404 7404
 				}
7405 7405
 
7406 7406
 				// Month
7407 7407
 				for ($month = 1; $month <= 12; $month++) {
7408
-					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
7408
+					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
7409 7409
 					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
7410 7410
 					$retstring .= "</option>";
7411 7411
 				}
@@ -7413,13 +7413,13 @@  discard block
 block discarded – undo
7413 7413
 
7414 7414
 				// Year
7415 7415
 				if ($emptydate || $set_time == -1) {
7416
-					$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 . '">';
7416
+					$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.'">';
7417 7417
 				} else {
7418
-					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
7418
+					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
7419 7419
 
7420 7420
 					$syear = (int) $syear;
7421 7421
 					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) {
7422
-						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
7422
+						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
7423 7423
 					}
7424 7424
 					$retstring .= "</select>\n";
7425 7425
 				}
@@ -7444,15 +7444,15 @@  discard block
 block discarded – undo
7444 7444
 			}
7445 7445
 
7446 7446
 			// Show hour
7447
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
7447
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
7448 7448
 			if ($emptyhours) {
7449 7449
 				$retstring .= '<option value="-1">&nbsp;</option>';
7450 7450
 			}
7451 7451
 			for ($hour = $hourstart; $hour < $hourend; $hour++) {
7452 7452
 				if (strlen($hour) < 2) {
7453
-					$hour = "0" . $hour;
7453
+					$hour = "0".$hour;
7454 7454
 				}
7455
-				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;
7455
+				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
7456 7456
 				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
7457 7457
 				$retstring .= '</option>';
7458 7458
 			}
@@ -7465,17 +7465,17 @@  discard block
 block discarded – undo
7465 7465
 
7466 7466
 		if ($m) {
7467 7467
 			// Show minutes
7468
-			$retstring .= '<select ' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
7468
+			$retstring .= '<select '.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
7469 7469
 			if ($emptyhours) {
7470 7470
 				$retstring .= '<option value="-1">&nbsp;</option>';
7471 7471
 			}
7472 7472
 			for ($min = 0; $min < 60; $min += $stepminutes) {
7473 7473
 				$min_str = sprintf("%02d", $min);
7474
-				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';
7474
+				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';
7475 7475
 			}
7476 7476
 			$retstring .= '</select>';
7477 7477
 
7478
-			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
7478
+			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
7479 7479
 		}
7480 7480
 
7481 7481
 		if ($d && $h) {
@@ -7498,10 +7498,10 @@  discard block
 block discarded – undo
7498 7498
 
7499 7499
 			// Generate the date part, depending on the use or not of the javascript calendar
7500 7500
 			if ($addnowlink == 1) { // server time expressed in user time setup
7501
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7502
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7503
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7504
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7501
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7502
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7503
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7504
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7505 7505
 			} elseif ($addnowlink == 2) {
7506 7506
 				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
7507 7507
 				 * This break application for foreign languages.
@@ -7510,10 +7510,10 @@  discard block
 block discarded – undo
7510 7510
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
7511 7511
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
7512 7512
 				*/
7513
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7514
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7515
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7516
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7513
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7514
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7515
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7516
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7517 7517
 			}
7518 7518
 			/*if ($usecalendar == "eldy")
7519 7519
 			{
@@ -7533,11 +7533,11 @@  discard block
 block discarded – undo
7533 7533
 				}
7534 7534
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
7535 7535
 				if ($addnowlink == 1) {
7536
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7537
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7536
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7537
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7538 7538
 				} elseif ($addnowlink == 2) {
7539
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';
7540
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7539
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
7540
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7541 7541
 				}
7542 7542
 
7543 7543
 				if ($fullday) {
@@ -7551,11 +7551,11 @@  discard block
 block discarded – undo
7551 7551
 				}
7552 7552
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
7553 7553
 				if ($addnowlink == 1) {
7554
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7555
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7554
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7555
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7556 7556
 				} elseif ($addnowlink == 2) {
7557
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';
7558
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7557
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
7558
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7559 7559
 				}
7560 7560
 				if ($fullday) {
7561 7561
 					$reset_scripts .= ' } ';
@@ -7563,7 +7563,7 @@  discard block
 block discarded – undo
7563 7563
 			}
7564 7564
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7565 7565
 			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
7566
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
7566
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
7567 7567
 				$retstring .= $langs->trans("Now");
7568 7568
 				$retstring .= '</button> ';
7569 7569
 			}
@@ -7575,16 +7575,16 @@  discard block
 block discarded – undo
7575 7575
 			$reset_scripts = "";
7576 7576
 
7577 7577
 			// Generate the date part, depending on the use or not of the javascript calendar
7578
-			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';
7579
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7580
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7581
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7578
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
7579
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7580
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7581
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7582 7582
 			// Update the hour part
7583 7583
 			if ($h) {
7584 7584
 				if ($fullday) {
7585 7585
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7586 7586
 				}
7587
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7587
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7588 7588
 				if ($fullday) {
7589 7589
 					$reset_scripts .= ' } ';
7590 7590
 				}
@@ -7594,14 +7594,14 @@  discard block
 block discarded – undo
7594 7594
 				if ($fullday) {
7595 7595
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7596 7596
 				}
7597
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7597
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7598 7598
 				if ($fullday) {
7599 7599
 					$reset_scripts .= ' } ';
7600 7600
 				}
7601 7601
 			}
7602 7602
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7603 7603
 			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
7604
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
7604
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
7605 7605
 				$retstring .= $langs->trans("DateStartPlusOne");
7606 7606
 				$retstring .= '</button> ';
7607 7607
 			}
@@ -7659,17 +7659,17 @@  discard block
 block discarded – undo
7659 7659
 			unset($TDurationTypes[$value]);
7660 7660
 		}
7661 7661
 
7662
-		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';
7662
+		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
7663 7663
 		foreach ($TDurationTypes as $key => $typeduration) {
7664
-			$retstring .= '<option value="' . $key . '"';
7664
+			$retstring .= '<option value="'.$key.'"';
7665 7665
 			if ($key == $selected) {
7666 7666
 				$retstring .= " selected";
7667 7667
 			}
7668
-			$retstring .= ">" . $typeduration . "</option>";
7668
+			$retstring .= ">".$typeduration."</option>";
7669 7669
 		}
7670 7670
 		$retstring .= "</select>";
7671 7671
 
7672
-		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration');
7672
+		$retstring .= ajax_combobox('select_'.$prefix.'type_duration');
7673 7673
 
7674 7674
 		return $retstring;
7675 7675
 	}
@@ -7701,30 +7701,30 @@  discard block
 block discarded – undo
7701 7701
 
7702 7702
 		// Hours
7703 7703
 		if ($iSecond != '') {
7704
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7704
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7705 7705
 
7706 7706
 			$hourSelected = convertSecondToTime($iSecond, 'allhour');
7707 7707
 			$minSelected = convertSecondToTime($iSecond, 'min');
7708 7708
 		}
7709 7709
 
7710 7710
 		if ($typehour == 'select') {
7711
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
7711
+			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
7712 7712
 			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours
7713
-				$retstring .= '<option value="' . $hour . '"';
7713
+				$retstring .= '<option value="'.$hour.'"';
7714 7714
 				if (is_numeric($hourSelected) && $hourSelected == $hour) {
7715 7715
 					$retstring .= " selected";
7716 7716
 				}
7717
-				$retstring .= ">" . $hour . "</option>";
7717
+				$retstring .= ">".$hour."</option>";
7718 7718
 			}
7719 7719
 			$retstring .= "</select>";
7720 7720
 		} elseif ($typehour == 'text' || $typehour == 'textselect') {
7721
-			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
7721
+			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
7722 7722
 		} else {
7723 7723
 			return 'BadValueForParameterTypeHour';
7724 7724
 		}
7725 7725
 
7726 7726
 		if ($typehour != 'text') {
7727
-			$retstring .= ' ' . $langs->trans('HourShort');
7727
+			$retstring .= ' '.$langs->trans('HourShort');
7728 7728
 		} else {
7729 7729
 			$retstring .= '<span class="">:</span>';
7730 7730
 		}
@@ -7739,21 +7739,21 @@  discard block
 block discarded – undo
7739 7739
 		}
7740 7740
 
7741 7741
 		if ($typehour == 'select' || $typehour == 'textselect') {
7742
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
7742
+			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
7743 7743
 			for ($min = 0; $min <= 55; $min += 5) {
7744
-				$retstring .= '<option value="' . $min . '"';
7744
+				$retstring .= '<option value="'.$min.'"';
7745 7745
 				if (is_numeric($minSelected) && $minSelected == $min) {
7746 7746
 					$retstring .= ' selected';
7747 7747
 				}
7748
-				$retstring .= '>' . $min . '</option>';
7748
+				$retstring .= '>'.$min.'</option>';
7749 7749
 			}
7750 7750
 			$retstring .= "</select>";
7751 7751
 		} elseif ($typehour == 'text') {
7752
-			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
7752
+			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
7753 7753
 		}
7754 7754
 
7755 7755
 		if ($typehour != 'text') {
7756
-			$retstring .= ' ' . $langs->trans('MinuteShort');
7756
+			$retstring .= ' '.$langs->trans('MinuteShort');
7757 7757
 		}
7758 7758
 
7759 7759
 		$retstring .= "</span>";
@@ -7801,7 +7801,7 @@  discard block
 block discarded – undo
7801 7801
 			$placeholder = '';
7802 7802
 
7803 7803
 			if ($selected && empty($selected_input_value)) {
7804
-				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7804
+				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7805 7805
 				$tickettmpselect = new Ticket($this->db);
7806 7806
 				$tickettmpselect->fetch($selected);
7807 7807
 				$selected_input_value = $tickettmpselect->ref;
@@ -7809,17 +7809,17 @@  discard block
 block discarded – undo
7809 7809
 			}
7810 7810
 
7811 7811
 			$urloption = '';
7812
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7812
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7813 7813
 
7814 7814
 			if (empty($hidelabel)) {
7815
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7815
+				$out .= $langs->trans("RefOrLabel").' : ';
7816 7816
 			} elseif ($hidelabel > 1) {
7817
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7817
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7818 7818
 				if ($hidelabel == 2) {
7819 7819
 					$out .= img_picto($langs->trans("Search"), 'search');
7820 7820
 				}
7821 7821
 			}
7822
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7822
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7823 7823
 			if ($hidelabel == 3) {
7824 7824
 				$out .= img_picto($langs->trans("Search"), 'search');
7825 7825
 			}
@@ -7863,8 +7863,8 @@  discard block
 block discarded – undo
7863 7863
 
7864 7864
 		$sql = "SELECT ";
7865 7865
 		$sql .= $selectFields;
7866
-		$sql .= " FROM " . $this->db->prefix() . "ticket as p";
7867
-		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')';
7866
+		$sql .= " FROM ".$this->db->prefix()."ticket as p";
7867
+		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
7868 7868
 
7869 7869
 		// Add criteria on ref/label
7870 7870
 		if ($filterkey != '') {
@@ -7880,7 +7880,7 @@  discard block
 block discarded – undo
7880 7880
 				if ($i > 0) {
7881 7881
 					$sql .= " AND ";
7882 7882
 				}
7883
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7883
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7884 7884
 				$sql .= ")";
7885 7885
 				$i++;
7886 7886
 			}
@@ -7893,22 +7893,22 @@  discard block
 block discarded – undo
7893 7893
 		$sql .= $this->db->plimit($limit, 0);
7894 7894
 
7895 7895
 		// Build output string
7896
-		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);
7896
+		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);
7897 7897
 		$result = $this->db->query($sql);
7898 7898
 		if ($result) {
7899
-			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7900
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
7899
+			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7900
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
7901 7901
 
7902 7902
 			$num = $this->db->num_rows($result);
7903 7903
 
7904 7904
 			$events = array();
7905 7905
 
7906 7906
 			if (!$forcecombo) {
7907
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7907
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7908 7908
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT'));
7909 7909
 			}
7910 7910
 
7911
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7911
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7912 7912
 
7913 7913
 			$textifempty = '';
7914 7914
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7925,7 +7925,7 @@  discard block
 block discarded – undo
7925 7925
 				}
7926 7926
 			}
7927 7927
 			if ($showempty) {
7928
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7928
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7929 7929
 			}
7930 7930
 
7931 7931
 			$i = 0;
@@ -7980,13 +7980,13 @@  discard block
 block discarded – undo
7980 7980
 		$outkey = $objp->rowid;
7981 7981
 		$outref = $objp->ref;
7982 7982
 
7983
-		$opt = '<option value="' . $objp->rowid . '"';
7983
+		$opt = '<option value="'.$objp->rowid.'"';
7984 7984
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7985 7985
 		$opt .= '>';
7986 7986
 		$opt .= $objp->ref;
7987 7987
 		$objRef = $objp->ref;
7988 7988
 		if (!empty($filterkey) && $filterkey != '') {
7989
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7989
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7990 7990
 		}
7991 7991
 
7992 7992
 		$opt .= "</option>\n";
@@ -8027,7 +8027,7 @@  discard block
 block discarded – undo
8027 8027
 			$placeholder = '';
8028 8028
 
8029 8029
 			if ($selected && empty($selected_input_value)) {
8030
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
8030
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
8031 8031
 				$projecttmpselect = new Project($this->db);
8032 8032
 				$projecttmpselect->fetch($selected);
8033 8033
 				$selected_input_value = $projecttmpselect->ref;
@@ -8035,17 +8035,17 @@  discard block
 block discarded – undo
8035 8035
 			}
8036 8036
 
8037 8037
 			$urloption = '';
8038
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8038
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8039 8039
 
8040 8040
 			if (empty($hidelabel)) {
8041
-				$out .= $langs->trans("RefOrLabel") . ' : ';
8041
+				$out .= $langs->trans("RefOrLabel").' : ';
8042 8042
 			} elseif ($hidelabel > 1) {
8043
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8043
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8044 8044
 				if ($hidelabel == 2) {
8045 8045
 					$out .= img_picto($langs->trans("Search"), 'search');
8046 8046
 				}
8047 8047
 			}
8048
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8048
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8049 8049
 			if ($hidelabel == 3) {
8050 8050
 				$out .= img_picto($langs->trans("Search"), 'search');
8051 8051
 			}
@@ -8088,8 +8088,8 @@  discard block
 block discarded – undo
8088 8088
 
8089 8089
 		$sql = "SELECT ";
8090 8090
 		$sql .= $selectFields;
8091
-		$sql .= " FROM " . $this->db->prefix() . "projet as p";
8092
-		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')';
8091
+		$sql .= " FROM ".$this->db->prefix()."projet as p";
8092
+		$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
8093 8093
 
8094 8094
 		// Add criteria on ref/label
8095 8095
 		if ($filterkey != '') {
@@ -8105,7 +8105,7 @@  discard block
 block discarded – undo
8105 8105
 				if ($i > 0) {
8106 8106
 					$sql .= " AND ";
8107 8107
 				}
8108
-				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8108
+				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
8109 8109
 				$sql .= "";
8110 8110
 				$i++;
8111 8111
 			}
@@ -8118,22 +8118,22 @@  discard block
 block discarded – undo
8118 8118
 		$sql .= $this->db->plimit($limit, 0);
8119 8119
 
8120 8120
 		// Build output string
8121
-		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);
8121
+		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
8122 8122
 		$result = $this->db->query($sql);
8123 8123
 		if ($result) {
8124
-			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
8125
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
8124
+			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
8125
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
8126 8126
 
8127 8127
 			$num = $this->db->num_rows($result);
8128 8128
 
8129 8129
 			$events = array();
8130 8130
 
8131 8131
 			if (!$forcecombo) {
8132
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8132
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8133 8133
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT'));
8134 8134
 			}
8135 8135
 
8136
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8136
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8137 8137
 
8138 8138
 			$textifempty = '';
8139 8139
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8150,7 +8150,7 @@  discard block
 block discarded – undo
8150 8150
 				}
8151 8151
 			}
8152 8152
 			if ($showempty) {
8153
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
8153
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
8154 8154
 			}
8155 8155
 
8156 8156
 			$i = 0;
@@ -8208,13 +8208,13 @@  discard block
 block discarded – undo
8208 8208
 		$outlabel = $objp->label;
8209 8209
 		$outtype = $objp->fk_product_type;
8210 8210
 
8211
-		$opt = '<option value="' . $objp->rowid . '"';
8211
+		$opt = '<option value="'.$objp->rowid.'"';
8212 8212
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8213 8213
 		$opt .= '>';
8214 8214
 		$opt .= $objp->ref;
8215 8215
 		$objRef = $objp->ref;
8216 8216
 		if (!empty($filterkey) && $filterkey != '') {
8217
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
8217
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
8218 8218
 		}
8219 8219
 
8220 8220
 		$opt .= "</option>\n";
@@ -8256,7 +8256,7 @@  discard block
 block discarded – undo
8256 8256
 			$placeholder = '';
8257 8257
 
8258 8258
 			if ($selected && empty($selected_input_value)) {
8259
-				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8259
+				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8260 8260
 				$adherenttmpselect = new Adherent($this->db);
8261 8261
 				$adherenttmpselect->fetch($selected);
8262 8262
 				$selected_input_value = $adherenttmpselect->ref;
@@ -8265,17 +8265,17 @@  discard block
 block discarded – undo
8265 8265
 
8266 8266
 			$urloption = '';
8267 8267
 
8268
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8268
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8269 8269
 
8270 8270
 			if (empty($hidelabel)) {
8271
-				$out .= $langs->trans("RefOrLabel") . ' : ';
8271
+				$out .= $langs->trans("RefOrLabel").' : ';
8272 8272
 			} elseif ($hidelabel > 1) {
8273
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8273
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8274 8274
 				if ($hidelabel == 2) {
8275 8275
 					$out .= img_picto($langs->trans("Search"), 'search');
8276 8276
 				}
8277 8277
 			}
8278
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8278
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8279 8279
 			if ($hidelabel == 3) {
8280 8280
 				$out .= img_picto($langs->trans("Search"), 'search');
8281 8281
 			}
@@ -8320,8 +8320,8 @@  discard block
 block discarded – undo
8320 8320
 
8321 8321
 		$sql = "SELECT ";
8322 8322
 		$sql .= $selectFields;
8323
-		$sql .= " FROM " . $this->db->prefix() . "adherent as p";
8324
-		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')';
8323
+		$sql .= " FROM ".$this->db->prefix()."adherent as p";
8324
+		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
8325 8325
 
8326 8326
 		// Add criteria on ref/label
8327 8327
 		if ($filterkey != '') {
@@ -8337,8 +8337,8 @@  discard block
 block discarded – undo
8337 8337
 				if ($i > 0) {
8338 8338
 					$sql .= " AND ";
8339 8339
 				}
8340
-				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8341
-				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
8340
+				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
8341
+				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
8342 8342
 				$i++;
8343 8343
 			}
8344 8344
 			if (count($search_crit) > 1) {
@@ -8347,27 +8347,27 @@  discard block
 block discarded – undo
8347 8347
 			$sql .= ')';
8348 8348
 		}
8349 8349
 		if ($status != -1) {
8350
-			$sql .= ' AND statut = ' . ((int) $status);
8350
+			$sql .= ' AND statut = '.((int) $status);
8351 8351
 		}
8352 8352
 		$sql .= $this->db->plimit($limit, 0);
8353 8353
 
8354 8354
 		// Build output string
8355
-		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);
8355
+		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
8356 8356
 		$result = $this->db->query($sql);
8357 8357
 		if ($result) {
8358
-			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8359
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
8358
+			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8359
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
8360 8360
 
8361 8361
 			$num = $this->db->num_rows($result);
8362 8362
 
8363 8363
 			$events = array();
8364 8364
 
8365 8365
 			if (!$forcecombo) {
8366
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8366
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8367 8367
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
8368 8368
 			}
8369 8369
 
8370
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8370
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8371 8371
 
8372 8372
 			$textifempty = '';
8373 8373
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8384,7 +8384,7 @@  discard block
 block discarded – undo
8384 8384
 				}
8385 8385
 			}
8386 8386
 			if ($showempty) {
8387
-				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
8387
+				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
8388 8388
 			}
8389 8389
 
8390 8390
 			$i = 0;
@@ -8440,11 +8440,11 @@  discard block
 block discarded – undo
8440 8440
 		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);
8441 8441
 		$outtype = $objp->fk_adherent_type;
8442 8442
 
8443
-		$opt = '<option value="' . $objp->rowid . '"';
8443
+		$opt = '<option value="'.$objp->rowid.'"';
8444 8444
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8445 8445
 		$opt .= '>';
8446 8446
 		if (!empty($filterkey) && $filterkey != '') {
8447
-			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1);
8447
+			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1);
8448 8448
 		}
8449 8449
 		$opt .= $outlabel;
8450 8450
 		$opt .= "</option>\n";
@@ -8499,8 +8499,8 @@  discard block
 block discarded – undo
8499 8499
 		$objecttmp = null;
8500 8500
 		$InfoFieldList = array();
8501 8501
 		$classname = '';
8502
-		$filter = '';  // Ensure filter has value (for static analysis)
8503
-		$sortfield = '';  // Ensure filter has value (for static analysis)
8502
+		$filter = ''; // Ensure filter has value (for static analysis)
8503
+		$sortfield = ''; // Ensure filter has value (for static analysis)
8504 8504
 
8505 8505
 		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield
8506 8506
 			// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield'
@@ -8544,9 +8544,9 @@  discard block
 block discarded – undo
8544 8544
 			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
8545 8545
 			$reg = array();
8546 8546
 			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
8547
-				$InfoFieldList[4] = $reg[1];    // take the sort field
8547
+				$InfoFieldList[4] = $reg[1]; // take the sort field
8548 8548
 			}
8549
-			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field
8549
+			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
8550 8550
 
8551 8551
 			$classname = $InfoFieldList[0];
8552 8552
 			$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1];
@@ -8577,8 +8577,8 @@  discard block
 block discarded – undo
8577 8577
 		);
8578 8578
 
8579 8579
 		if (!is_object($objecttmp)) {
8580
-			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8581
-			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8580
+			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8581
+			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8582 8582
 		}
8583 8583
 		'@phan-var-force CommonObject $objecttmp';
8584 8584
 		/** @var CommonObject $objecttmp */
@@ -8590,9 +8590,9 @@  discard block
 block discarded – undo
8590 8590
 		if ($prefixforautocompletemode == 'product') {
8591 8591
 			$prefixforautocompletemode = 'produit';
8592 8592
 		}
8593
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8593
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8594 8594
 
8595
-		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
8595
+		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);
8596 8596
 
8597 8597
 		// Generate the combo HTML component
8598 8598
 		$out = '';
@@ -8621,13 +8621,13 @@  discard block
 block discarded – undo
8621 8621
 			}
8622 8622
 
8623 8623
 			// Set url and param to call to get json of the search results
8624
-			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
8625
-			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
8624
+			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
8625
+			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
8626 8626
 
8627 8627
 			// Activate the auto complete using ajax call.
8628 8628
 			$out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0);
8629 8629
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
8630
-			$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) . '"' : '') . ' />';
8630
+			$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).'"' : '').' />';
8631 8631
 		} else {
8632 8632
 			// Immediate load of table record.
8633 8633
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8667,16 +8667,16 @@  discard block
 block discarded – undo
8667 8667
 		if ($prefixforautocompletemode == 'societe') {
8668 8668
 			$prefixforautocompletemode = 'company';
8669 8669
 		}
8670
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8670
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8671 8671
 
8672 8672
 		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...)
8673 8673
 			$tmpfieldstoshow = '';
8674 8674
 			foreach ($objecttmp->fields as $key => $val) {
8675
-				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) {
8675
+				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) {
8676 8676
 					continue;
8677 8677
 				}
8678 8678
 				if (!empty($val['showoncombobox'])) {
8679
-					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
8679
+					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
8680 8680
 				}
8681 8681
 			}
8682 8682
 			if ($tmpfieldstoshow) {
@@ -8713,25 +8713,25 @@  discard block
 block discarded – undo
8713 8713
 		$num = 0;
8714 8714
 
8715 8715
 		// Search data
8716
-		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . " as t";
8716
+		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)." as t";
8717 8717
 		if (!empty($objecttmp->isextrafieldmanaged)) {
8718
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . "_extrafields as e ON t.rowid = e.fk_object";
8718
+			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)."_extrafields as e ON t.rowid = e.fk_object";
8719 8719
 		}
8720 8720
 		if (!empty($objecttmp->parent_element)) {
8721 8721
 			$parent_properties = getElementProperties($objecttmp->parent_element);
8722
-			$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($parent_properties['table_element']) . " as o ON o.rowid = t.".$objecttmp->fk_parent_attribute;
8722
+			$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($parent_properties['table_element'])." as o ON o.rowid = t.".$objecttmp->fk_parent_attribute;
8723 8723
 		}
8724 8724
 		if (in_array($objecttmp->parent_element, ['commande', 'propal', 'facture', 'expedition'])) {
8725
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product as p ON p.rowid = t.fk_product";
8725
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = t.fk_product";
8726 8726
 		}
8727 8727
 		if (isset($objecttmp->ismultientitymanaged)) {
8728 8728
 			if (!is_numeric($objecttmp->ismultientitymanaged)) {
8729 8729
 				$tmparray = explode('@', $objecttmp->ismultientitymanaged);
8730
-				$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($tmparray[1]) . " as parenttable ON parenttable.rowid = t." . $this->db->sanitize($tmparray[0]);
8730
+				$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($tmparray[1])." as parenttable ON parenttable.rowid = t.".$this->db->sanitize($tmparray[0]);
8731 8731
 			}
8732 8732
 			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8733 8733
 				if (!$user->hasRight('societe', 'client', 'voir')) {
8734
-					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
8734
+					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
8735 8735
 				}
8736 8736
 			}
8737 8737
 		}
@@ -8751,21 +8751,21 @@  discard block
 block discarded – undo
8751 8751
 			$sql .= " WHERE 1=1";
8752 8752
 			if (isset($objecttmp->ismultientitymanaged)) {
8753 8753
 				if ($objecttmp->ismultientitymanaged == 1) {
8754
-					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
8754
+					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
8755 8755
 				}
8756 8756
 				if (!is_numeric($objecttmp->ismultientitymanaged)) {
8757
-					$sql .= " AND parenttable.entity = t." . $this->db->sanitize($tmparray[0]);
8757
+					$sql .= " AND parenttable.entity = t.".$this->db->sanitize($tmparray[0]);
8758 8758
 				}
8759 8759
 				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
8760 8760
 					if ($objecttmp->element == 'societe') {
8761
-						$sql .= " AND t.rowid = " . ((int) $user->socid);
8761
+						$sql .= " AND t.rowid = ".((int) $user->socid);
8762 8762
 					} else {
8763
-						$sql .= " AND t.fk_soc = " . ((int) $user->socid);
8763
+						$sql .= " AND t.fk_soc = ".((int) $user->socid);
8764 8764
 					}
8765 8765
 				}
8766 8766
 				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8767 8767
 					if (!$user->hasRight('societe', 'client', 'voir')) {
8768
-						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
8768
+						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
8769 8769
 					}
8770 8770
 				}
8771 8771
 			}
@@ -8783,7 +8783,7 @@  discard block
 block discarded – undo
8783 8783
 				$errormessage = '';
8784 8784
 				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
8785 8785
 				if ($errormessage) {
8786
-					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;
8786
+					return 'Error forging a SQL request from an universal criteria: '.$errormessage;
8787 8787
 				}
8788 8788
 			}
8789 8789
 		}
@@ -8795,7 +8795,7 @@  discard block
 block discarded – undo
8795 8795
 		$resql = $this->db->query($sql);
8796 8796
 		if ($resql) {
8797 8797
 			// Construct $out and $outarray
8798
-			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
8798
+			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
8799 8799
 
8800 8800
 			// 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
8801 8801
 			$textifempty = '&nbsp;';
@@ -8809,7 +8809,7 @@  discard block
 block discarded – undo
8809 8809
 				}
8810 8810
 			}
8811 8811
 			if ($showempty) {
8812
-				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
8812
+				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";
8813 8813
 			}
8814 8814
 
8815 8815
 			$num = $this->db->num_rows($resql);
@@ -8832,9 +8832,9 @@  discard block
 block discarded – undo
8832 8832
 					}
8833 8833
 					if (empty($outputmode)) {
8834 8834
 						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
8835
-							$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>';
8835
+							$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>';
8836 8836
 						} else {
8837
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8837
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8838 8838
 						}
8839 8839
 					} else {
8840 8840
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -8847,10 +8847,10 @@  discard block
 block discarded – undo
8847 8847
 				}
8848 8848
 			}
8849 8849
 
8850
-			$out .= '</select>' . "\n";
8850
+			$out .= '</select>'."\n";
8851 8851
 
8852 8852
 			if (!$forcecombo) {
8853
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8853
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8854 8854
 				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));
8855 8855
 			}
8856 8856
 		} else {
@@ -8914,8 +8914,8 @@  discard block
 block discarded – undo
8914 8914
 			}
8915 8915
 		}
8916 8916
 		$idname = str_replace(array('[', ']'), array('', ''), $htmlname);
8917
-		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"';
8918
-		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
8917
+		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"';
8918
+		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
8919 8919
 		$out .= '>'."\n";
8920 8920
 
8921 8921
 		if ($show_empty) {
@@ -8926,7 +8926,7 @@  discard block
 block discarded – undo
8926 8926
 			if (!is_numeric($show_empty)) {
8927 8927
 				$textforempty = $show_empty;
8928 8928
 			}
8929
-			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
8929
+			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
8930 8930
 		}
8931 8931
 		if (is_array($array)) {
8932 8932
 			// Translate
@@ -8951,7 +8951,7 @@  discard block
 block discarded – undo
8951 8951
 					$value = $tmpvalue['label'];
8952 8952
 					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];
8953 8953
 					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';
8954
-					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';
8954
+					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';
8955 8955
 				} else {
8956 8956
 					$value = $tmpvalue;
8957 8957
 					//$valuehtml = $tmpvalue;
@@ -8967,9 +8967,9 @@  discard block
 block discarded – undo
8967 8967
 				}
8968 8968
 				if ($key_in_label) {
8969 8969
 					if (empty($nohtmlescape)) {
8970
-						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
8970
+						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
8971 8971
 					} else {
8972
-						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
8972
+						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
8973 8973
 					}
8974 8974
 				} else {
8975 8975
 					if (empty($nohtmlescape)) {
@@ -8981,8 +8981,8 @@  discard block
 block discarded – undo
8981 8981
 						$selectOptionValue = '&nbsp;';
8982 8982
 					}
8983 8983
 				}
8984
-				$out .= '<option value="' . $key . '"';
8985
-				$out .= $style . $disabled;
8984
+				$out .= '<option value="'.$key.'"';
8985
+				$out .= $style.$disabled;
8986 8986
 				if (is_array($id)) {
8987 8987
 					if (in_array($key, $id) && !$disabled) {
8988 8988
 						$out .= ' selected'; // To preselect a value
@@ -8994,7 +8994,7 @@  discard block
 block discarded – undo
8994 8994
 					}
8995 8995
 				}
8996 8996
 				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content.
8997
-					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';
8997
+					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
8998 8998
 				}
8999 8999
 
9000 9000
 				if (is_array($tmpvalue)) {
@@ -9017,7 +9017,7 @@  discard block
 block discarded – undo
9017 9017
 		// Add code for jquery to use multiselect
9018 9018
 		if ($addjscombo && $jsbeautify) {
9019 9019
 			// Enhance with select2
9020
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
9020
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
9021 9021
 			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);
9022 9022
 		}
9023 9023
 
@@ -9045,28 +9045,28 @@  discard block
 block discarded – undo
9045 9045
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
9046 9046
 	{
9047 9047
 		global $conf, $langs;
9048
-		global $delayedhtmlcontent;    // Will be used later outside of this function
9048
+		global $delayedhtmlcontent; // Will be used later outside of this function
9049 9049
 
9050 9050
 		// TODO Use an internal dolibarr component instead of select2
9051 9051
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
9052 9052
 			return '';
9053 9053
 		}
9054 9054
 
9055
-		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
9055
+		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
9056 9056
 
9057 9057
 		$outdelayed = '';
9058 9058
 		if (!empty($conf->use_javascript_ajax)) {
9059 9059
 			$tmpplugin = 'select2';
9060
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
9061
-		    	<script nonce="' . getNonce() . '">
9060
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
9061
+		    	<script nonce="' . getNonce().'">
9062 9062
 		    	$(document).ready(function () {
9063 9063
 
9064
-	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
9064
+	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
9065 9065
 
9066
-	                $(".' . $htmlname . '").select2({
9066
+	                $(".' . $htmlname.'").select2({
9067 9067
 				    	ajax: {
9068 9068
 					    	dir: "ltr",
9069
-					    	url: "' . $url . '",
9069
+					    	url: "' . $url.'",
9070 9070
 					    	dataType: \'json\',
9071 9071
 					    	delay: 250,
9072 9072
 					    	data: function (params) {
@@ -9093,9 +9093,9 @@  discard block
 block discarded – undo
9093 9093
 				    	},
9094 9094
 		 				language: select2arrayoflanguage,
9095 9095
 						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
9096
-					    placeholder: "' . dol_escape_js($placeholder) . '",
9096
+					    placeholder: "' . dol_escape_js($placeholder).'",
9097 9097
 				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
9098
-				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',
9098
+				    	minimumInputLength: ' . ((int) $minimumInputLength).',
9099 9099
 				        formatResult: function (result, container, query, escapeMarkup) {
9100 9100
 	                        return escapeMarkup(result.text);
9101 9101
 	                    },
@@ -9103,10 +9103,10 @@  discard block
 block discarded – undo
9103 9103
 
9104 9104
 	                ' . ($callurlonselect ? '
9105 9105
 	                /* Code to execute a GET when we select a value */
9106
-	                $(".' . $htmlname . '").change(function() {
9107
-				    	var selected = $(".' . $htmlname . '").val();
9106
+	                $(".' . $htmlname.'").change(function() {
9107
+				    	var selected = $(".' . $htmlname.'").val();
9108 9108
 	                	console.log("We select in selectArrayAjax the entry "+selected)
9109
-				        $(".' . $htmlname . '").val("");  /* reset visible combo value */
9109
+				        $(".' . $htmlname.'").val("");  /* reset visible combo value */
9110 9110
 	    			    $.each( saveRemoteData, function( key, value ) {
9111 9111
 	    				        if (key == selected)
9112 9112
 	    			            {
@@ -9114,7 +9114,7 @@  discard block
 block discarded – undo
9114 9114
 	    			                 location.assign(value.url);
9115 9115
 	    			            }
9116 9116
 	                    });
9117
-	    			});' : '') . '
9117
+	    			});' : '').'
9118 9118
 
9119 9119
 	    	   });
9120 9120
 		       </script>';
@@ -9150,14 +9150,14 @@  discard block
 block discarded – undo
9150 9150
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
9151 9151
 	{
9152 9152
 		global $conf, $langs;
9153
-		global $delayedhtmlcontent;    // Will be used later outside of this function
9153
+		global $delayedhtmlcontent; // Will be used later outside of this function
9154 9154
 
9155 9155
 		// TODO Use an internal dolibarr component instead of select2
9156 9156
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
9157 9157
 			return '';
9158 9158
 		}
9159 9159
 
9160
-		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
9160
+		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
9161 9161
 
9162 9162
 		$formattedarrayresult = array();
9163 9163
 
@@ -9172,20 +9172,20 @@  discard block
 block discarded – undo
9172 9172
 		$outdelayed = '';
9173 9173
 		if (!empty($conf->use_javascript_ajax)) {
9174 9174
 			$tmpplugin = 'select2';
9175
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
9176
-				<script nonce="' . getNonce() . '">
9175
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
9176
+				<script nonce="' . getNonce().'">
9177 9177
 				$(document).ready(function () {
9178
-					var data = ' . json_encode($formattedarrayresult) . ';
9178
+					var data = ' . json_encode($formattedarrayresult).';
9179 9179
 
9180
-					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
9180
+					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
9181 9181
 
9182
-					$(".' . $htmlname . '").select2({
9182
+					$(".' . $htmlname.'").select2({
9183 9183
 						data: data,
9184 9184
 						language: select2arrayoflanguage,
9185 9185
 						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
9186
-						placeholder: "' . dol_escape_js($placeholder) . '",
9186
+						placeholder: "' . dol_escape_js($placeholder).'",
9187 9187
 						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
9188
-						minimumInputLength: ' . $minimumInputLength . ',
9188
+						minimumInputLength: ' . $minimumInputLength.',
9189 9189
 						formatResult: function (result, container, query, escapeMarkup) {
9190 9190
 							return escapeMarkup(result.text);
9191 9191
 						},
@@ -9224,11 +9224,11 @@  discard block
 block discarded – undo
9224 9224
 
9225 9225
 					' . ($callurlonselect ? '
9226 9226
 					/* Code to execute a GET when we select a value */
9227
-					$(".' . $htmlname . '").change(function() {
9228
-						var selected = $(".' . $htmlname . '").val();
9227
+					$(".' . $htmlname.'").change(function() {
9228
+						var selected = $(".' . $htmlname.'").val();
9229 9229
 						console.log("We select "+selected)
9230 9230
 
9231
-						$(".' . $htmlname . '").val("");  /* reset visible combo value */
9231
+						$(".' . $htmlname.'").val("");  /* reset visible combo value */
9232 9232
 						$.each( saveRemoteData, function( key, value ) {
9233 9233
 							if (key == selected)
9234 9234
 							{
@@ -9236,7 +9236,7 @@  discard block
 block discarded – undo
9236 9236
 								location.assign(value.url);
9237 9237
 							}
9238 9238
 						});
9239
-					});' : '') . '
9239
+					});' : '').'
9240 9240
 
9241 9241
 				});
9242 9242
 				</script>';
@@ -9284,7 +9284,7 @@  discard block
 block discarded – undo
9284 9284
 		$useenhancedmultiselect = 0;
9285 9285
 		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
9286 9286
 			if ($addjscombo) {
9287
-				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0.
9287
+				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.
9288 9288
 			}
9289 9289
 		}
9290 9290
 
@@ -9293,7 +9293,7 @@  discard block
 block discarded – undo
9293 9293
 		// submitted to nothing.
9294 9294
 		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';
9295 9295
 		// Output select component
9296
-		$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";
9296
+		$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";
9297 9297
 		if (is_array($array) && !empty($array)) {
9298 9298
 			if ($value_as_key) {
9299 9299
 				$array = array_combine($array, $array);
@@ -9314,33 +9314,33 @@  discard block
 block discarded – undo
9314 9314
 						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml'];
9315 9315
 					}
9316 9316
 					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
9317
-					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
9317
+					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
9318 9318
 
9319
-					$out .= '<option value="' . $tmpkey . '"';
9319
+					$out .= '<option value="'.$tmpkey.'"';
9320 9320
 					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
9321 9321
 						$out .= ' selected';
9322 9322
 					}
9323 9323
 					if (!empty($tmplabelhtml)) {
9324
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9324
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9325 9325
 					} else {
9326
-						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
9327
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9326
+						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval;
9327
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9328 9328
 					}
9329 9329
 					$out .= '>';
9330 9330
 					$out .= dol_htmlentitiesbr($newval);
9331
-					$out .= '</option>' . "\n";
9331
+					$out .= '</option>'."\n";
9332 9332
 				}
9333 9333
 			}
9334 9334
 		}
9335
-		$out .= '</select>' . "\n";
9335
+		$out .= '</select>'."\n";
9336 9336
 
9337 9337
 		// Add code for jquery to use multiselect
9338 9338
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
9339
-			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
9340
-			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
9339
+			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
9340
+			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";
9341 9341
 			if ($addjscombo == 1) {
9342 9342
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
9343
-				$out .= 'function formatResult(record, container) {' . "\n";
9343
+				$out .= 'function formatResult(record, container) {'."\n";
9344 9344
 				// If property data-html set, we decode html entities and use this.
9345 9345
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
9346 9346
 				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {';
@@ -9348,26 +9348,26 @@  discard block
 block discarded – undo
9348 9348
 				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));';
9349 9349
 				$out .= '	}'."\n";
9350 9350
 				$out .= '	return record.text;';
9351
-				$out .= '}' . "\n";
9352
-				$out .= 'function formatSelection(record) {' . "\n";
9351
+				$out .= '}'."\n";
9352
+				$out .= 'function formatSelection(record) {'."\n";
9353 9353
 				if ($elemtype == 'category') {
9354
-					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9354
+					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9355 9355
 				} else {
9356 9356
 					$out .= 'return record.text;';
9357 9357
 				}
9358
-				$out .= '}' . "\n";
9358
+				$out .= '}'."\n";
9359 9359
 				$out .= '$(document).ready(function () {
9360
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
9360
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({';
9361 9361
 				if ($placeholder) {
9362 9362
 					$out .= '
9363 9363
 								placeholder: {
9364 9364
 								    id: \'-1\',
9365
-								    text: \'' . dol_escape_js($placeholder) . '\'
9365
+								    text: \'' . dol_escape_js($placeholder).'\'
9366 9366
 								  },';
9367 9367
 				}
9368 9368
 				$out .= '		dir: \'ltr\',
9369 9369
 								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
9370
-								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9370
+								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9371 9371
 								// Specify format function for dropdown item
9372 9372
 								formatResult: formatResult,
9373 9373
 							 	templateResult: formatResult,		/* For 4.0 */
@@ -9379,21 +9379,21 @@  discard block
 block discarded – undo
9379 9379
 
9380 9380
 							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
9381 9381
 								 the size only if component is not hidden by default on load */
9382
-							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
9382
+							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');
9383 9383
 						});' . "\n";
9384 9384
 			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
9385 9385
 				// Add other js lib
9386 9386
 				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
9387 9387
 				// ...
9388
-				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
9388
+				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';
9389 9389
 				$out .= '$(document).ready(function () {
9390
-							$(\'#' . $htmlname . '\').multiSelect({
9390
+							$(\'#' . $htmlname.'\').multiSelect({
9391 9391
 								containerHTML: \'<div class="multi-select-container">\',
9392 9392
 								menuHTML: \'<div class="multi-select-menu">\',
9393
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
9393
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
9394 9394
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
9395 9395
 								activeClass: \'multi-select-container--open\',
9396
-								noneText: \'' . $placeholder . '\'
9396
+								noneText: \'' . $placeholder.'\'
9397 9397
 							});
9398 9398
 						})';
9399 9399
 			}
@@ -9426,7 +9426,7 @@  discard block
 block discarded – undo
9426 9426
 			return '';
9427 9427
 		}
9428 9428
 
9429
-		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show
9429
+		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
9430 9430
 
9431 9431
 		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user
9432 9432
 			$tmparray = explode(',', $user->conf->$tmpvar);
@@ -9469,19 +9469,19 @@  discard block
 block discarded – undo
9469 9469
 				}
9470 9470
 
9471 9471
 				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
9472
-				$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>';
9473
-				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
9472
+				$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>';
9473
+				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
9474 9474
 			}
9475 9475
 		}
9476 9476
 
9477
-		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
9477
+		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
9478 9478
 
9479 9479
         <dl class="dropdown">
9480 9480
             <dt>
9481
-            <a href="#' . $htmlname . '">
9482
-              ' . img_picto('', 'list') . '
9481
+            <a href="#' . $htmlname.'">
9482
+              ' . img_picto('', 'list').'
9483 9483
             </a>
9484
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
9484
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
9485 9485
             </dt>
9486 9486
             <dd class="dropdowndd">
9487 9487
                 <div class="multiselectcheckbox'.$htmlname.'">
@@ -9493,19 +9493,19 @@  discard block
 block discarded – undo
9493 9493
             </dd>
9494 9494
         </dl>
9495 9495
 
9496
-        <script nonce="' . getNonce() . '" type="text/javascript">
9496
+        <script nonce="' . getNonce().'" type="text/javascript">
9497 9497
           jQuery(document).ready(function () {
9498
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
9498
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
9499 9499
                   console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
9500 9500
 
9501 9501
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST
9502 9502
 
9503 9503
                   var title = $(this).val() + ",";
9504 9504
                   if ($(this).is(\':checked\')) {
9505
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
9505
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
9506 9506
                   }
9507 9507
                   else {
9508
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
9508
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
9509 9509
                   }
9510 9510
                   // Now, we submit page
9511 9511
                   //$(this).parents(\'form:first\').submit();
@@ -9536,7 +9536,7 @@  discard block
 block discarded – undo
9536 9536
 	 */
9537 9537
 	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
9538 9538
 	{
9539
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
9539
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
9540 9540
 
9541 9541
 		$cat = new Categorie($this->db);
9542 9542
 		$categories = $cat->containing($id, $type);
@@ -9546,13 +9546,13 @@  discard block
 block discarded – undo
9546 9546
 			foreach ($categories as $c) {
9547 9547
 				$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
9548 9548
 				foreach ($ways as $way) {
9549
-					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
9549
+					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
9550 9550
 				}
9551 9551
 			}
9552 9552
 			if (empty($toprint)) {
9553 9553
 				return '';
9554 9554
 			} else {
9555
-				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
9555
+				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
9556 9556
 			}
9557 9557
 		}
9558 9558
 
@@ -9601,15 +9601,15 @@  discard block
 block discarded – undo
9601 9601
 
9602 9602
 
9603 9603
 			print '<div class="div-table-responsive-no-min">';
9604
-			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
9604
+			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
9605 9605
 
9606 9606
 			print '<tr class="liste_titre">';
9607
-			print '<td>' . $langs->trans("Type") . '</td>';
9608
-			print '<td>' . $langs->trans("Ref") . '</td>';
9607
+			print '<td>'.$langs->trans("Type").'</td>';
9608
+			print '<td>'.$langs->trans("Ref").'</td>';
9609 9609
 			print '<td class="center"></td>';
9610
-			print '<td class="center">' . $langs->trans("Date") . '</td>';
9611
-			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9612
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
9610
+			print '<td class="center">'.$langs->trans("Date").'</td>';
9611
+			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9612
+			print '<td class="right">'.$langs->trans("Status").'</td>';
9613 9613
 			print '<td></td>';
9614 9614
 			print '</tr>';
9615 9615
 
@@ -9628,13 +9628,13 @@  discard block
 block discarded – undo
9628 9628
 				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
9629 9629
 					$element = $regs[1];
9630 9630
 					$subelement = $regs[2];
9631
-					$tplpath = $element . '/' . $subelement;
9631
+					$tplpath = $element.'/'.$subelement;
9632 9632
 				}
9633 9633
 				$tplname = 'linkedobjectblock';
9634 9634
 
9635 9635
 				// To work with non standard path
9636 9636
 				if ($objecttype == 'facture') {
9637
-					$tplpath = 'compta/' . $element;
9637
+					$tplpath = 'compta/'.$element;
9638 9638
 					if (!isModEnabled('invoice')) {
9639 9639
 						continue; // Do not show if module disabled
9640 9640
 					}
@@ -9645,7 +9645,7 @@  discard block
 block discarded – undo
9645 9645
 						continue; // Do not show if module disabled
9646 9646
 					}
9647 9647
 				} elseif ($objecttype == 'propal') {
9648
-					$tplpath = 'comm/' . $element;
9648
+					$tplpath = 'comm/'.$element;
9649 9649
 					if (!isModEnabled('propal')) {
9650 9650
 						continue; // Do not show if module disabled
9651 9651
 					}
@@ -9698,7 +9698,7 @@  discard block
 block discarded – undo
9698 9698
 				$linkedObjectBlock = $objects;
9699 9699
 
9700 9700
 				// Output template part (modules that overwrite templates must declare this into descriptor)
9701
-				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
9701
+				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
9702 9702
 				foreach ($dirtpls as $reldir) {
9703 9703
 					$reldir = rtrim($reldir, '/');
9704 9704
 					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
@@ -9706,7 +9706,7 @@  discard block
 block discarded – undo
9706 9706
 						$noMoreLinkedObjectBlockAfter = 1;
9707 9707
 					}
9708 9708
 
9709
-					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
9709
+					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
9710 9710
 					if ($res) {
9711 9711
 						$nboftypesoutput++;
9712 9712
 						break;
@@ -9715,7 +9715,7 @@  discard block
 block discarded – undo
9715 9715
 			}
9716 9716
 
9717 9717
 			if (!$nboftypesoutput) {
9718
-				print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
9718
+				print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
9719 9719
 			}
9720 9720
 
9721 9721
 			print '</table>';
@@ -9763,14 +9763,14 @@  discard block
 block discarded – undo
9763 9763
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
9764 9764
 			$listofidcompanytoscan = (int) $object->thirdparty->id;
9765 9765
 			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) {
9766
-				$listofidcompanytoscan .= ',' . (int) $object->thirdparty->parent;
9766
+				$listofidcompanytoscan .= ','.(int) $object->thirdparty->parent;
9767 9767
 			}
9768 9768
 			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) {
9769
-				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
9769
+				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
9770 9770
 				$tmpproject = new Project($this->db);
9771 9771
 				$tmpproject->fetch($object->fk_project);
9772 9772
 				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
9773
-					$listofidcompanytoscan .= ',' . (int) $tmpproject->socid;
9773
+					$listofidcompanytoscan .= ','.(int) $tmpproject->socid;
9774 9774
 				}
9775 9775
 				unset($tmpproject);
9776 9776
 			}
@@ -9780,75 +9780,75 @@  discard block
 block discarded – undo
9780 9780
 					'enabled' => isModEnabled('propal'),
9781 9781
 					'perms' => 1,
9782 9782
 					'label' => 'LinkToProposal',
9783
-					'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' : ''),
9783
+					'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' : ''),
9784 9784
 				),
9785 9785
 				'shipping' => array(
9786 9786
 					'enabled' => isModEnabled('shipping'),
9787 9787
 					'perms' => 1,
9788 9788
 					'label' => 'LinkToExpedition',
9789
-					'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' : ''),
9789
+					'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' : ''),
9790 9790
 				),
9791 9791
 				'order' => array(
9792 9792
 					'enabled' => isModEnabled('order'),
9793 9793
 					'perms' => 1,
9794 9794
 					'label' => 'LinkToOrder',
9795
-					'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' : ''),
9795
+					'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' : ''),
9796 9796
 					'linkname' => 'commande',
9797 9797
 				),
9798 9798
 				'invoice' => array(
9799 9799
 					'enabled' => isModEnabled('invoice'),
9800 9800
 					'perms' => 1,
9801 9801
 					'label' => 'LinkToInvoice',
9802
-					'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' : ''),
9802
+					'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' : ''),
9803 9803
 					'linkname' => 'facture',
9804 9804
 				),
9805 9805
 				'invoice_template' => array(
9806 9806
 					'enabled' => isModEnabled('invoice'),
9807 9807
 					'perms' => 1,
9808 9808
 					'label' => 'LinkToTemplateInvoice',
9809
-					'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' : ''),
9809
+					'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' : ''),
9810 9810
 				),
9811 9811
 				'contrat' => array(
9812 9812
 					'enabled' => isModEnabled('contract'),
9813 9813
 					'perms' => 1,
9814 9814
 					'label' => 'LinkToContract',
9815 9815
 					'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
9816
-							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',
9816
+							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',
9817 9817
 				),
9818 9818
 				'fichinter' => array(
9819 9819
 					'enabled' => isModEnabled('intervention'),
9820 9820
 					'perms' => 1,
9821 9821
 					'label' => 'LinkToIntervention',
9822
-					'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') . ')',
9822
+					'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').')',
9823 9823
 				),
9824 9824
 				'supplier_proposal' => array(
9825 9825
 					'enabled' => isModEnabled('supplier_proposal'),
9826 9826
 					'perms' => 1,
9827 9827
 					'label' => 'LinkToSupplierProposal',
9828
-					'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' : ''),
9828
+					'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' : ''),
9829 9829
 				),
9830 9830
 				'order_supplier' => array(
9831 9831
 					'enabled' => isModEnabled("supplier_order"),
9832 9832
 					'perms' => 1,
9833 9833
 					'label' => 'LinkToSupplierOrder',
9834
-					'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' : ''),
9834
+					'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' : ''),
9835 9835
 				),
9836 9836
 				'invoice_supplier' => array(
9837 9837
 					'enabled' => isModEnabled("supplier_invoice"),
9838 9838
 					'perms' => 1, 'label' => 'LinkToSupplierInvoice',
9839
-					'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' : ''),
9839
+					'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' : ''),
9840 9840
 				),
9841 9841
 				'ticket' => array(
9842 9842
 					'enabled' => isModEnabled('ticket'),
9843 9843
 					'perms' => 1,
9844 9844
 					'label' => 'LinkToTicket',
9845
-					'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' : ''),
9845
+					'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' : ''),
9846 9846
 				),
9847 9847
 				'mo' => array(
9848 9848
 					'enabled' => isModEnabled('mrp'),
9849 9849
 					'perms' => 1,
9850 9850
 					'label' => 'LinkToMo',
9851
-					'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' : ''),
9851
+					'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' : ''),
9852 9852
 				),
9853 9853
 			);
9854 9854
 		}
@@ -9890,23 +9890,23 @@  discard block
 block discarded – undo
9890 9890
 			}
9891 9891
 
9892 9892
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
9893
-				$htmltoenteralink .= '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
9893
+				$htmltoenteralink .= '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
9894 9894
 
9895 9895
 				// Section for free ref input
9896 9896
 				if (!getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
9897 9897
 					$htmltoenteralink .= '<br>'."\n";
9898 9898
 					$htmltoenteralink .= '<!-- form to add a link from anywhere -->'."\n";
9899
-					$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
9900
-					$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">';
9899
+					$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
9900
+					$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">';
9901 9901
 					$htmltoenteralink .= '<input type="hidden" name="action" value="addlinkbyref">';
9902
-					$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">';
9903
-					$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">';
9902
+					$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">';
9903
+					$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">';
9904 9904
 					$htmltoenteralink .= '<table class="noborder">';
9905 9905
 					$htmltoenteralink .= '<tr class="liste_titre">';
9906 9906
 					//print '<td>' . $langs->trans("Ref") . '</td>';
9907
-					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
9908
-					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
9909
-					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
9907
+					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;';
9908
+					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;';
9909
+					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
9910 9910
 					$htmltoenteralink .= '</tr>';
9911 9911
 					$htmltoenteralink .= '</table>';
9912 9912
 					$htmltoenteralink .= '</form>';
@@ -9925,18 +9925,18 @@  discard block
 block discarded – undo
9925 9925
 							$htmltoenteralink .= '<br>';
9926 9926
 						}
9927 9927
 						$htmltoenteralink .= '<!-- form to add a link from object to same thirdparty -->'."\n";
9928
-						$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
9929
-						$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">';
9928
+						$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
9929
+						$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">';
9930 9930
 						$htmltoenteralink .= '<input type="hidden" name="action" value="addlink">';
9931
-						$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">';
9932
-						$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">';
9931
+						$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">';
9932
+						$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">';
9933 9933
 						$htmltoenteralink .= '<table class="noborder">';
9934 9934
 						$htmltoenteralink .= '<tr class="liste_titre">';
9935 9935
 						$htmltoenteralink .= '<td class="nowrap"></td>';
9936
-						$htmltoenteralink .= '<td>' . $langs->trans("Ref") . '</td>';
9937
-						$htmltoenteralink .= '<td>' . $langs->trans("RefCustomer") . '</td>';
9938
-						$htmltoenteralink .= '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9939
-						$htmltoenteralink .= '<td>' . $langs->trans("Company") . '</td>';
9936
+						$htmltoenteralink .= '<td>'.$langs->trans("Ref").'</td>';
9937
+						$htmltoenteralink .= '<td>'.$langs->trans("RefCustomer").'</td>';
9938
+						$htmltoenteralink .= '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9939
+						$htmltoenteralink .= '<td>'.$langs->trans("Company").'</td>';
9940 9940
 						$htmltoenteralink .= '</tr>';
9941 9941
 						while ($i < $num) {
9942 9942
 							$objp = $this->db->fetch_object($resqllist);
@@ -9951,30 +9951,30 @@  discard block
 block discarded – undo
9951 9951
 							if ($alreadylinked) {
9952 9952
 								$htmltoenteralink .= img_picto('', 'link');
9953 9953
 							} else {
9954
-								$htmltoenteralink .= '<input type="checkbox" name="idtolinkto[' . $key . '_' . $objp->rowid . ']" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';
9954
+								$htmltoenteralink .= '<input type="checkbox" name="idtolinkto['.$key.'_'.$objp->rowid.']" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
9955 9955
 							}
9956 9956
 							$htmltoenteralink .= '</td>';
9957
-							$htmltoenteralink .= '<td><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';
9958
-							$htmltoenteralink .= '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';
9957
+							$htmltoenteralink .= '<td><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
9958
+							$htmltoenteralink .= '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';
9959 9959
 							$htmltoenteralink .= '<td class="right">';
9960 9960
 							if ($possiblelink['label'] == 'LinkToContract') {
9961
-								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' ';
9961
+								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
9962 9962
 							}
9963
-							$htmltoenteralink .= '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';
9963
+							$htmltoenteralink .= '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
9964 9964
 							$htmltoenteralink .= '</td>';
9965
-							$htmltoenteralink .= '<td>' . $objp->name . '</td>';
9965
+							$htmltoenteralink .= '<td>'.$objp->name.'</td>';
9966 9966
 							$htmltoenteralink .= '</tr>';
9967 9967
 							$i++;
9968 9968
 						}
9969 9969
 						$htmltoenteralink .= '</table>';
9970 9970
 						$htmltoenteralink .= '<div class="center">';
9971 9971
 						if ($num) {
9972
-							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="' . $langs->trans('ToLink') . '">';
9972
+							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="'.$langs->trans('ToLink').'">';
9973 9973
 						}
9974 9974
 						if (empty($conf->use_javascript_ajax)) {
9975
-							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9975
+							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9976 9976
 						} else {
9977
-							$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>';
9977
+							$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>';
9978 9978
 						}
9979 9979
 						$htmltoenteralink .= '</form>';
9980 9980
 					}
@@ -9988,10 +9988,10 @@  discard block
 block discarded – undo
9988 9988
 
9989 9989
 				// Complete the list for the combo box
9990 9990
 				if ($num > 0 || !getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
9991
-					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
9991
+					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
9992 9992
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
9993 9993
 				} else {
9994
-					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
9994
+					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
9995 9995
 				}
9996 9996
 			}
9997 9997
 		}
@@ -10001,11 +10001,11 @@  discard block
 block discarded – undo
10001 10001
 			<dl class="dropdown" id="linktoobjectname">
10002 10002
 			';
10003 10003
 			if (!empty($conf->use_javascript_ajax)) {
10004
-				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>';
10004
+				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
10005 10005
 			}
10006 10006
 			$linktoelem .= '<dd>
10007 10007
 			<div class="multiselectlinkto">
10008
-			<ul class="ulselectedfields">' . $linktoelemlist . '
10008
+			<ul class="ulselectedfields">' . $linktoelemlist.'
10009 10009
 			</ul>
10010 10010
 			</div>
10011 10011
 			</dd>
@@ -10016,7 +10016,7 @@  discard block
 block discarded – undo
10016 10016
 
10017 10017
 		if (!empty($conf->use_javascript_ajax)) {
10018 10018
 			print '<!-- Add js to show linkto box -->
10019
-				<script nonce="' . getNonce() . '">
10019
+				<script nonce="' . getNonce().'">
10020 10020
 				jQuery(document).ready(function() {
10021 10021
 					jQuery(".linkto").click(function() {
10022 10022
 						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list");
@@ -10063,19 +10063,19 @@  discard block
 block discarded – undo
10063 10063
 
10064 10064
 		$disabled = ($disabled ? ' disabled' : '');
10065 10065
 
10066
-		$resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
10066
+		$resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
10067 10067
 		if ($useempty) {
10068
-			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10068
+			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
10069 10069
 		}
10070 10070
 		if (("$value" == 'yes') || ($value == 1)) {
10071
-			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";
10072
-			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";
10071
+			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
10072
+			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
10073 10073
 		} else {
10074 10074
 			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
10075
-			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";
10076
-			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";
10075
+			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
10076
+			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
10077 10077
 		}
10078
-		$resultyesno .= '</select>' . "\n";
10078
+		$resultyesno .= '</select>'."\n";
10079 10079
 
10080 10080
 		if ($addjscombo) {
10081 10081
 			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
@@ -10099,12 +10099,12 @@  discard block
 block discarded – undo
10099 10099
 	{
10100 10100
 		// phpcs:enable
10101 10101
 		$sql = "SELECT rowid, label";
10102
-		$sql .= " FROM " . $this->db->prefix() . "export_model";
10103
-		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";
10102
+		$sql .= " FROM ".$this->db->prefix()."export_model";
10103
+		$sql .= " WHERE type = '".$this->db->escape($type)."'";
10104 10104
 		$sql .= " ORDER BY rowid";
10105 10105
 		$result = $this->db->query($sql);
10106 10106
 		if ($result) {
10107
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
10107
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
10108 10108
 			if ($useempty) {
10109 10109
 				print '<option value="-1">&nbsp;</option>';
10110 10110
 			}
@@ -10114,9 +10114,9 @@  discard block
 block discarded – undo
10114 10114
 			while ($i < $num) {
10115 10115
 				$obj = $this->db->fetch_object($result);
10116 10116
 				if ($selected == $obj->rowid) {
10117
-					print '<option value="' . $obj->rowid . '" selected>';
10117
+					print '<option value="'.$obj->rowid.'" selected>';
10118 10118
 				} else {
10119
-					print '<option value="' . $obj->rowid . '">';
10119
+					print '<option value="'.$obj->rowid.'">';
10120 10120
 				}
10121 10121
 				print $obj->label;
10122 10122
 				print '</option>';
@@ -10207,8 +10207,8 @@  discard block
 block discarded – undo
10207 10207
 				$stringforfirstkey .= ' CTL +';
10208 10208
 			}
10209 10209
 
10210
-			$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>';
10211
-			$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>';
10210
+			$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>';
10211
+			$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>';
10212 10212
 		}
10213 10213
 
10214 10214
 		//print "xx".$previous_ref."x".$next_ref;
@@ -10216,18 +10216,18 @@  discard block
 block discarded – undo
10216 10216
 
10217 10217
 		// Right part of banner
10218 10218
 		if ($morehtmlright) {
10219
-			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
10219
+			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
10220 10220
 		}
10221 10221
 
10222 10222
 		if ($previous_ref || $next_ref || $morehtml) {
10223 10223
 			$ret .= '<div class="pagination paginationref"><ul class="right">';
10224 10224
 		}
10225 10225
 		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
10226
-			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
10226
+			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
10227 10227
 		}
10228 10228
 		if ($shownav && ($previous_ref || $next_ref)) {
10229
-			$ret .= '<li class="pagination">' . $previous_ref . '</li>';
10230
-			$ret .= '<li class="pagination">' . $next_ref . '</li>';
10229
+			$ret .= '<li class="pagination">'.$previous_ref.'</li>';
10230
+			$ret .= '<li class="pagination">'.$next_ref.'</li>';
10231 10231
 		}
10232 10232
 		if ($previous_ref || $next_ref || $morehtml) {
10233 10233
 			$ret .= '</ul></div>';
@@ -10242,7 +10242,7 @@  discard block
 block discarded – undo
10242 10242
 			$morehtmlstatus = $hookmanager->resPrint;
10243 10243
 		}
10244 10244
 		if ($morehtmlstatus) {
10245
-			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
10245
+			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
10246 10246
 		}
10247 10247
 
10248 10248
 		$parameters = array();
@@ -10256,14 +10256,14 @@  discard block
 block discarded – undo
10256 10256
 		// Left part of banner
10257 10257
 		if ($morehtmlleft) {
10258 10258
 			if ($conf->browser->layout == 'phone') {
10259
-				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';
10259
+				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';
10260 10260
 			} else {
10261
-				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';
10261
+				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
10262 10262
 			}
10263 10263
 		}
10264 10264
 
10265 10265
 		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
10266
-		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
10266
+		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
10267 10267
 
10268 10268
 		// For thirdparty, contact, user, member, the ref is the id, so we show something else
10269 10269
 		if ($object->element == 'societe') {
@@ -10277,7 +10277,7 @@  discard block
 block discarded – undo
10277 10277
 
10278 10278
 			if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
10279 10279
 				if (!is_object($extralanguages)) {
10280
-					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
10280
+					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
10281 10281
 					$extralanguages = new ExtraLanguages($this->db);
10282 10282
 				}
10283 10283
 				$extralanguages->fetch_name_extralanguages('societe');
@@ -10292,21 +10292,21 @@  discard block
 block discarded – undo
10292 10292
 						if ($object->array_languages['name'][$extralangcode]) {
10293 10293
 							$htmltext .= $object->array_languages['name'][$extralangcode];
10294 10294
 						} else {
10295
-							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>';
10295
+							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>';
10296 10296
 						}
10297 10297
 					}
10298
-					$ret .= '<!-- Show translations of name -->' . "\n";
10298
+					$ret .= '<!-- Show translations of name -->'."\n";
10299 10299
 					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
10300 10300
 				}
10301 10301
 			}
10302 10302
 		} elseif ($object->element == 'member') {
10303 10303
 			'@phan-var-force Adherent $object';
10304
-			$ret .= $object->ref . '<br>';
10304
+			$ret .= $object->ref.'<br>';
10305 10305
 			$fullname = $object->getFullName($langs);
10306 10306
 			if ($object->morphy == 'mor' && $object->societe) {
10307
-				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
10307
+				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
10308 10308
 			} else {
10309
-				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
10309
+				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
10310 10310
 			}
10311 10311
 		} elseif (in_array($object->element, array('contact', 'user'))) {
10312 10312
 			$ret .= '<span class="valignmiddle">'.dol_htmlentities($object->getFullName($langs)).'</span>'.$addgendertxt;
@@ -10314,7 +10314,7 @@  discard block
 block discarded – undo
10314 10314
 			$ret .= dol_htmlentities($object->name);
10315 10315
 		} elseif (in_array($object->element, array('action', 'agenda'))) {
10316 10316
 			'@phan-var-force ActionComm $object';
10317
-			$ret .= $object->ref . '<br>' . $object->label;
10317
+			$ret .= $object->ref.'<br>'.$object->label;
10318 10318
 		} elseif (in_array($object->element, array('adherent_type'))) {
10319 10319
 			$ret .= $object->label;
10320 10320
 		} elseif ($object->element == 'ecm_directories') {
@@ -10367,9 +10367,9 @@  discard block
 block discarded – undo
10367 10367
 		}
10368 10368
 
10369 10369
 		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty
10370
-		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
10371
-		$out = '<!-- url barcode = ' . $url . ' -->';
10372
-		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';
10370
+		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
10371
+		$out = '<!-- url barcode = '.$url.' -->';
10372
+		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';
10373 10373
 
10374 10374
 		return $out;
10375 10375
 	}
@@ -10396,7 +10396,7 @@  discard block
 block discarded – undo
10396 10396
 		global $conf, $langs;
10397 10397
 
10398 10398
 		$entity = (empty($object->entity) ? $conf->entity : $object->entity);
10399
-		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10399
+		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10400 10400
 
10401 10401
 		$dir = '';
10402 10402
 		$file = '';
@@ -10409,28 +10409,28 @@  discard block
 block discarded – undo
10409 10409
 			if (!empty($object->logo)) {
10410 10410
 				if (dolIsAllowedForPreview($object->logo)) {
10411 10411
 					if ((string) $imagesize == 'mini') {
10412
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10412
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10413 10413
 					} elseif ((string) $imagesize == 'small') {
10414
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
10414
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');
10415 10415
 					} else {
10416
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10416
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10417 10417
 					}
10418
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10418
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10419 10419
 				}
10420 10420
 			}
10421 10421
 			$email = $object->email;
10422 10422
 		} elseif ($modulepart == 'contact') {
10423
-			$dir = $conf->societe->multidir_output[$entity] . '/contact';
10423
+			$dir = $conf->societe->multidir_output[$entity].'/contact';
10424 10424
 			if (!empty($object->photo)) {
10425 10425
 				if (dolIsAllowedForPreview($object->photo)) {
10426 10426
 					if ((string) $imagesize == 'mini') {
10427
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10427
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10428 10428
 					} elseif ((string) $imagesize == 'small') {
10429
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10429
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');
10430 10430
 					} else {
10431
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10431
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10432 10432
 					}
10433
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10433
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10434 10434
 				}
10435 10435
 			}
10436 10436
 			$email = $object->email;
@@ -10440,17 +10440,17 @@  discard block
 block discarded – undo
10440 10440
 			if (!empty($object->photo)) {
10441 10441
 				if (dolIsAllowedForPreview($object->photo)) {
10442 10442
 					if ((string) $imagesize == 'mini') {
10443
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10443
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10444 10444
 					} elseif ((string) $imagesize == 'small') {
10445
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10445
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
10446 10446
 					} else {
10447
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10447
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10448 10448
 					}
10449
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10449
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10450 10450
 				}
10451 10451
 			}
10452 10452
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10453
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10453
+				$altfile = $object->id.".jpg"; // For backward compatibility
10454 10454
 			}
10455 10455
 			$email = $object->email;
10456 10456
 			$capture = 'user';
@@ -10459,17 +10459,17 @@  discard block
 block discarded – undo
10459 10459
 			if (!empty($object->photo)) {
10460 10460
 				if (dolIsAllowedForPreview($object->photo)) {
10461 10461
 					if ((string) $imagesize == 'mini') {
10462
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10462
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10463 10463
 					} elseif ((string) $imagesize == 'small') {
10464
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10464
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
10465 10465
 					} else {
10466
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10466
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10467 10467
 					}
10468
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10468
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10469 10469
 				}
10470 10470
 			}
10471 10471
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10472
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10472
+				$altfile = $object->id.".jpg"; // For backward compatibility
10473 10473
 			}
10474 10474
 			$email = $object->email;
10475 10475
 			$capture = 'user';
@@ -10495,35 +10495,35 @@  discard block
 block discarded – undo
10495 10495
 		$ret = '';
10496 10496
 
10497 10497
 		if ($dir) {
10498
-			if ($file && file_exists($dir . "/" . $file)) {
10498
+			if ($file && file_exists($dir."/".$file)) {
10499 10499
 				if ($addlinktofullsize) {
10500
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10500
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10501 10501
 					if ($urladvanced) {
10502
-						$ret .= '<a href="' . $urladvanced . '">';
10502
+						$ret .= '<a href="'.$urladvanced.'">';
10503 10503
 					} else {
10504
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10504
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10505 10505
 					}
10506 10506
 				}
10507
-				$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 . '">';
10507
+				$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.'">';
10508 10508
 				if ($addlinktofullsize) {
10509 10509
 					$ret .= '</a>';
10510 10510
 				}
10511
-			} elseif ($altfile && file_exists($dir . "/" . $altfile)) {
10511
+			} elseif ($altfile && file_exists($dir."/".$altfile)) {
10512 10512
 				if ($addlinktofullsize) {
10513
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10513
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10514 10514
 					if ($urladvanced) {
10515
-						$ret .= '<a href="' . $urladvanced . '">';
10515
+						$ret .= '<a href="'.$urladvanced.'">';
10516 10516
 					} else {
10517
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10517
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10518 10518
 					}
10519 10519
 				}
10520
-				$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 . '">';
10520
+				$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.'">';
10521 10521
 				if ($addlinktofullsize) {
10522 10522
 					$ret .= '</a>';
10523 10523
 				}
10524 10524
 			} else {
10525 10525
 				$nophoto = '/public/theme/common/nophoto.png';
10526
-				$defaultimg = 'identicon';        // For gravatar
10526
+				$defaultimg = 'identicon'; // For gravatar
10527 10527
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found
10528 10528
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) {
10529 10529
 						$nophoto = 'company';
@@ -10541,13 +10541,13 @@  discard block
 block discarded – undo
10541 10541
 				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
10542 10542
 					// see https://gravatar.com/site/implement/images/php/
10543 10543
 					$ret .= '<!-- Put link to gravatar -->';
10544
-					$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
10544
+					$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
10545 10545
 				} else {
10546 10546
 					if ($nophoto == 'company') {
10547
-						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
10547
+						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>';
10548 10548
 						//$ret .= '<div class="difforspanimgright"></div>';
10549 10549
 					} else {
10550
-						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
10550
+						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
10551 10551
 					}
10552 10552
 				}
10553 10553
 			}
@@ -10558,15 +10558,15 @@  discard block
 block discarded – undo
10558 10558
 				}
10559 10559
 				$ret .= '<table class="nobordernopadding centpercent">';
10560 10560
 				if ($object->photo) {
10561
-					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>';
10561
+					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
10562 10562
 				}
10563 10563
 				$ret .= '<tr><td class="tdoverflow">';
10564 10564
 				$maxfilesizearray = getMaxFileSizeArray();
10565 10565
 				$maxmin = $maxfilesizearray['maxmin'];
10566 10566
 				if ($maxmin > 0) {
10567
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
10567
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
10568 10568
 				}
10569
-				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';
10569
+				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
10570 10570
 				$ret .= '</td></tr>';
10571 10571
 				$ret .= '</table>';
10572 10572
 			}
@@ -10620,38 +10620,38 @@  discard block
 block discarded – undo
10620 10620
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10621 10621
 			$sql .= ", e.label";
10622 10622
 		}
10623
-		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";
10623
+		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
10624 10624
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10625
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";
10625
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
10626 10626
 			if ($force_entity) {
10627
-				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";
10627
+				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
10628 10628
 			} else {
10629 10629
 				$sql .= " WHERE ug.entity IS NOT NULL";
10630 10630
 			}
10631 10631
 		} else {
10632
-			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";
10632
+			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";
10633 10633
 		}
10634 10634
 		if (is_array($exclude) && $excludeGroups) {
10635
-			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")";
10635
+			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")";
10636 10636
 		}
10637 10637
 		if (is_array($include) && $includeGroups) {
10638
-			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")";
10638
+			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")";
10639 10639
 		}
10640 10640
 		$sql .= " ORDER BY ug.nom ASC";
10641 10641
 
10642
-		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
10642
+		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
10643 10643
 		$resql = $this->db->query($sql);
10644 10644
 		if ($resql) {
10645 10645
 			// Enhance with select2
10646
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10646
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10647 10647
 
10648
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
10648
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
10649 10649
 
10650 10650
 			$num = $this->db->num_rows($resql);
10651 10651
 			$i = 0;
10652 10652
 			if ($num) {
10653 10653
 				if ($show_empty && !$multiple) {
10654
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10654
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
10655 10655
 				}
10656 10656
 
10657 10657
 				while ($i < $num) {
@@ -10664,11 +10664,11 @@  discard block
 block discarded – undo
10664 10664
 					$label = $obj->name;
10665 10665
 					$labelhtml = $obj->name;
10666 10666
 					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
10667
-						$label .= " (" . $obj->label . ")";
10668
-						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>';
10667
+						$label .= " (".$obj->label.")";
10668
+						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>';
10669 10669
 					}
10670 10670
 
10671
-					$out .= '<option value="' . $obj->rowid . '"';
10671
+					$out .= '<option value="'.$obj->rowid.'"';
10672 10672
 					if ($disableline) {
10673 10673
 						$out .= ' disabled';
10674 10674
 					}
@@ -10684,9 +10684,9 @@  discard block
 block discarded – undo
10684 10684
 				}
10685 10685
 			} else {
10686 10686
 				if ($show_empty) {
10687
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
10687
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
10688 10688
 				}
10689
-				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
10689
+				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
10690 10690
 			}
10691 10691
 			$out .= '</select>';
10692 10692
 
@@ -10730,25 +10730,25 @@  discard block
 block discarded – undo
10730 10730
 		$out = '';
10731 10731
 
10732 10732
 		if (!empty($conf->use_javascript_ajax)) {
10733
-			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';
10733
+			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';
10734 10734
 		}
10735
-		$out .= '<script nonce="' . getNonce() . '">
10735
+		$out .= '<script nonce="'.getNonce().'">
10736 10736
             $(document).ready(function() {
10737
-                $("#' . $cssclass . 's").click(function() {
10737
+                $("#' . $cssclass.'s").click(function() {
10738 10738
                     if($(this).is(\':checked\')){
10739
-                        console.log("We check all ' . $cssclass . ' and trigger the change method");
10740
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
10739
+                        console.log("We check all ' . $cssclass.' and trigger the change method");
10740
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
10741 10741
                     }
10742 10742
                     else
10743 10743
                     {
10744 10744
                         console.log("We uncheck all");
10745
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
10745
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
10746 10746
                     }' . "\n";
10747 10747
 		if ($calljsfunction) {
10748
-			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10748
+			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10749 10749
 		}
10750 10750
 		$out .= '         });
10751
-        	        $(".' . $cssclass . '").change(function() {
10751
+        	        $(".' . $cssclass.'").change(function() {
10752 10752
 					$(this).closest("tr").toggleClass("highlight", this.checked);
10753 10753
 				});
10754 10754
 		 	});
@@ -10793,67 +10793,67 @@  discard block
 block discarded – undo
10793 10793
 		global $langs, $user;
10794 10794
 
10795 10795
 		$out = '';
10796
-		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";
10797
-		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")";
10796
+		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
10797
+		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
10798 10798
 		if (!empty($excludeid)) {
10799
-			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")";
10799
+			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
10800 10800
 		}
10801 10801
 		$sql .= " ORDER BY label";
10802 10802
 
10803 10803
 		$resql = $this->db->query($sql);
10804 10804
 		if ($resql) {
10805
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';
10805
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
10806 10806
 			if ($useempty) {
10807 10807
 				$out .= '<option value="0">&nbsp;</option>';
10808 10808
 			}
10809 10809
 
10810 10810
 			while ($obj = $this->db->fetch_object($resql)) {
10811
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
10811
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
10812 10812
 			}
10813 10813
 			$out .= '</select>';
10814
-			$out .= ajax_combobox('select_' . $htmlname);
10814
+			$out .= ajax_combobox('select_'.$htmlname);
10815 10815
 
10816 10816
 			if (!empty($htmlname) && $user->admin && $info_admin) {
10817
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10817
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10818 10818
 			}
10819 10819
 
10820 10820
 			if (!empty($target)) {
10821
-				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10821
+				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10822 10822
 				$resql = $this->db->query($sql);
10823 10823
 				if ($resql) {
10824 10824
 					if ($this->db->num_rows($resql) > 0) {
10825 10825
 						$obj = $this->db->fetch_object($resql);
10826
-						$out .= '<script nonce="' . getNonce() . '">
10826
+						$out .= '<script nonce="'.getNonce().'">
10827 10827
 							$(function() {
10828
-								$("select[name=' . $target . ']").on("change", function() {
10828
+								$("select[name=' . $target.']").on("change", function() {
10829 10829
 									var current_val = $(this).val();
10830
-									if (current_val == ' . $obj->id . ') {';
10830
+									if (current_val == ' . $obj->id.') {';
10831 10831
 						if (!empty($default_selected) || !empty($selected)) {
10832
-							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
10832
+							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
10833 10833
 						}
10834 10834
 
10835 10835
 						$out .= '
10836
-										$("select[name=' . $htmlname . ']").change();
10836
+										$("select[name=' . $htmlname.']").change();
10837 10837
 									}
10838 10838
 								});
10839 10839
 
10840
-								$("select[name=' . $htmlname . ']").change(function() {
10840
+								$("select[name=' . $htmlname.']").change(function() {
10841 10841
 
10842
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
10842
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
10843 10843
 										// get price of kilometer to fill the unit price
10844 10844
 										$.ajax({
10845 10845
 											method: "POST",
10846 10846
 											dataType: "json",
10847
-											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' },
10848
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '",
10847
+											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' },
10848
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'",
10849 10849
 										}).done(function( data, textStatus, jqXHR ) {
10850 10850
 											console.log(data);
10851 10851
 											if (typeof data.up != "undefined") {
10852 10852
 												$("input[name=value_unit]").val(data.up);
10853
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
10853
+												$("select[name=' . $htmlname.']").attr("title", data.title);
10854 10854
 											} else {
10855 10855
 												$("input[name=value_unit]").val("");
10856
-												$("select[name=' . $htmlname . ']").attr("title", "");
10856
+												$("select[name=' . $htmlname.']").attr("title", "");
10857 10857
 											}
10858 10858
 										});
10859 10859
 									}
@@ -10883,18 +10883,18 @@  discard block
 block discarded – undo
10883 10883
 		global $conf, $langs;
10884 10884
 
10885 10885
 		$out = '';
10886
-		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";
10887
-		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";
10886
+		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
10887
+		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
10888 10888
 
10889 10889
 		$resql = $this->db->query($sql);
10890 10890
 		if ($resql) {
10891
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10891
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10892 10892
 			if ($useempty) {
10893 10893
 				$out .= '<option value="0"></option>';
10894 10894
 			}
10895 10895
 
10896 10896
 			while ($obj = $this->db->fetch_object($resql)) {
10897
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
10897
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
10898 10898
 			}
10899 10899
 			$out .= '</select>';
10900 10900
 		} else {
@@ -10925,12 +10925,12 @@  discard block
 block discarded – undo
10925 10925
 
10926 10926
 		$resql = $this->db->query($sql);
10927 10927
 		if ($resql) {
10928
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10928
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10929 10929
 			if ($useempty) {
10930 10930
 				$out .= '<option value="0"></option>';
10931 10931
 			}
10932 10932
 			if ($allchoice) {
10933
-				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
10933
+				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
10934 10934
 			}
10935 10935
 
10936 10936
 			$field = 'code';
@@ -10940,7 +10940,7 @@  discard block
 block discarded – undo
10940 10940
 
10941 10941
 			while ($obj = $this->db->fetch_object($resql)) {
10942 10942
 				$key = $langs->trans($obj->code);
10943
-				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
10943
+				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
10944 10944
 			}
10945 10945
 			$out .= '</select>';
10946 10946
 
@@ -10974,7 +10974,7 @@  discard block
 block discarded – undo
10974 10974
 	{
10975 10975
 		global $user, $conf, $langs;
10976 10976
 
10977
-		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
10977
+		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
10978 10978
 
10979 10979
 		if (is_null($usertofilter)) {
10980 10980
 			$usertofilter = $user;
@@ -10998,10 +10998,10 @@  discard block
 block discarded – undo
10998 10998
 		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
10999 10999
             p.title, p.fk_soc, p.fk_statut, p.public,";
11000 11000
 		$sql .= ' s.nom as name';
11001
-		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
11002
-		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';
11003
-		$sql .= ' ' . $this->db->prefix() . 'facture as f';
11004
-		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
11001
+		$sql .= ' FROM '.$this->db->prefix().'projet as p';
11002
+		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
11003
+		$sql .= ' '.$this->db->prefix().'facture as f';
11004
+		$sql .= " WHERE p.entity IN (".getEntity('project').")";
11005 11005
 		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
11006 11006
 		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
11007 11007
 		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
@@ -11012,14 +11012,14 @@  discard block
 block discarded – undo
11012 11012
 		if ($resql) {
11013 11013
 			// Use select2 selector
11014 11014
 			if (!empty($conf->use_javascript_ajax)) {
11015
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
11015
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
11016 11016
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
11017 11017
 				$out .= $comboenhancement;
11018 11018
 				$morecss = 'minwidth200imp maxwidth500';
11019 11019
 			}
11020 11020
 
11021 11021
 			if (empty($option_only)) {
11022
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
11022
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
11023 11023
 			}
11024 11024
 			if (!empty($show_empty)) {
11025 11025
 				$out .= '<option value="0" class="optiongrey">';
@@ -11049,33 +11049,33 @@  discard block
 block discarded – undo
11049 11049
 						if ($showproject == 'all') {
11050 11050
 							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
11051 11051
 							if ($obj->name) {
11052
-								$labeltoshow .= ' - ' . $obj->name; // Soc name
11052
+								$labeltoshow .= ' - '.$obj->name; // Soc name
11053 11053
 							}
11054 11054
 
11055 11055
 							$disabled = 0;
11056 11056
 							if ($obj->fk_statut == Project::STATUS_DRAFT) {
11057 11057
 								$disabled = 1;
11058
-								$labeltoshow .= ' - ' . $langs->trans("Draft");
11058
+								$labeltoshow .= ' - '.$langs->trans("Draft");
11059 11059
 							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
11060 11060
 								if ($discard_closed == 2) {
11061 11061
 									$disabled = 1;
11062 11062
 								}
11063
-								$labeltoshow .= ' - ' . $langs->trans("Closed");
11063
+								$labeltoshow .= ' - '.$langs->trans("Closed");
11064 11064
 							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
11065 11065
 								$disabled = 1;
11066
-								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
11066
+								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
11067 11067
 							}
11068 11068
 						}
11069 11069
 
11070 11070
 						if (!empty($selected) && $selected == $obj->rowid) {
11071
-							$out .= '<option value="' . $obj->rowid . '" selected';
11071
+							$out .= '<option value="'.$obj->rowid.'" selected';
11072 11072
 							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
11073
-							$out .= '>' . $labeltoshow . '</option>';
11073
+							$out .= '>'.$labeltoshow.'</option>';
11074 11074
 						} else {
11075 11075
 							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
11076 11076
 								$resultat = '';
11077 11077
 							} else {
11078
-								$resultat = '<option value="' . $obj->rowid . '"';
11078
+								$resultat = '<option value="'.$obj->rowid.'"';
11079 11079
 								if ($disabled) {
11080 11080
 									$resultat .= ' disabled';
11081 11081
 								}
@@ -11127,22 +11127,22 @@  discard block
 block discarded – undo
11127 11127
 
11128 11128
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
11129 11129
 		//$sql.= ', el.fk_source';
11130
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
11131
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
11130
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
11131
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
11132 11132
 		$sql .= " ORDER BY f.titre ASC";
11133 11133
 
11134 11134
 		$resql = $this->db->query($sql);
11135 11135
 		if ($resql) {
11136 11136
 			// Use select2 selector
11137 11137
 			if (!empty($conf->use_javascript_ajax)) {
11138
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
11138
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
11139 11139
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
11140 11140
 				$out .= $comboenhancement;
11141 11141
 				$morecss = 'minwidth200imp maxwidth500';
11142 11142
 			}
11143 11143
 
11144 11144
 			if (empty($option_only)) {
11145
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
11145
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
11146 11146
 			}
11147 11147
 			if (!empty($show_empty)) {
11148 11148
 				$out .= '<option value="0" class="optiongrey">';
@@ -11161,19 +11161,19 @@  discard block
 block discarded – undo
11161 11161
 					$disabled = 0;
11162 11162
 					if (!empty($obj->suspended)) {
11163 11163
 						$disabled = 1;
11164
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
11164
+						$labeltoshow .= ' - '.$langs->trans("Closed");
11165 11165
 					}
11166 11166
 
11167 11167
 
11168 11168
 					if (!empty($selected) && $selected == $obj->rowid) {
11169
-						$out .= '<option value="' . $obj->rowid . '" selected';
11169
+						$out .= '<option value="'.$obj->rowid.'" selected';
11170 11170
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
11171
-						$out .= '>' . $labeltoshow . '</option>';
11171
+						$out .= '>'.$labeltoshow.'</option>';
11172 11172
 					} else {
11173 11173
 						if ($disabled && ($selected != $obj->rowid)) {
11174 11174
 							$resultat = '';
11175 11175
 						} else {
11176
-							$resultat = '<option value="' . $obj->rowid . '"';
11176
+							$resultat = '<option value="'.$obj->rowid.'"';
11177 11177
 							if ($disabled) {
11178 11178
 								$resultat .= ' disabled';
11179 11179
 							}
@@ -11218,14 +11218,14 @@  discard block
 block discarded – undo
11218 11218
 		$formother = new FormOther($this->db);
11219 11219
 
11220 11220
 		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with ()
11221
-			$search_component_params_hidden = '(' . $search_component_params_hidden . ')';
11221
+			$search_component_params_hidden = '('.$search_component_params_hidden.')';
11222 11222
 		}
11223 11223
 
11224 11224
 		$ret = '';
11225 11225
 
11226 11226
 		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';
11227 11227
 		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
11228
-		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
11228
+		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
11229 11229
 		$ret .= '</a>';
11230 11230
 
11231 11231
 		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
@@ -11269,30 +11269,30 @@  discard block
 block discarded – undo
11269 11269
 			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
11270 11270
 		}
11271 11271
 		$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%')) -->";
11272
-		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';
11272
+		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
11273 11273
 		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";
11274 11274
 
11275 11275
 		// TODO : Use $arrayoffiltercriterias instead of $arrayofcriterias
11276 11276
 		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields
11277 11277
 		foreach ($arrayofcriterias as $criteria) {
11278 11278
 			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) {
11279
-				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
11279
+				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
11280 11280
 					continue;
11281 11281
 				}
11282 11282
 				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) {
11283 11283
 					continue;
11284 11284
 				}
11285 11285
 				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
11286
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';
11287
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';
11288
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';
11289
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';
11290
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';
11291
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';
11292
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';
11293
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';
11286
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
11287
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
11288
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
11289
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
11290
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
11291
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
11292
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
11293
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
11294 11294
 				} else {
11295
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';
11295
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
11296 11296
 				}
11297 11297
 			}
11298 11298
 		}
@@ -11300,7 +11300,7 @@  discard block
 block discarded – undo
11300 11300
 		$ret .= '</div>';
11301 11301
 
11302 11302
 		$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";
11303
-		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
11303
+		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
11304 11304
 
11305 11305
 		$ret .= '</div>';
11306 11306
 		$ret .= '</div>';
@@ -11357,7 +11357,7 @@  discard block
 block discarded – undo
11357 11357
 		// Convert $arrayoffiltercriterias into a json object that can be used in jquery to build the search component dynamically
11358 11358
 		$arrayoffiltercriterias_json = json_encode($arrayoffiltercriterias);
11359 11359
 		$ret .= '<script>
11360
-			var arrayoffiltercriterias = ' . $arrayoffiltercriterias_json . ';
11360
+			var arrayoffiltercriterias = ' . $arrayoffiltercriterias_json.';
11361 11361
 		</script>';
11362 11362
 
11363 11363
 
@@ -11371,9 +11371,9 @@  discard block
 block discarded – undo
11371 11371
 		$ret .= '<div class="search-component-assistance">';
11372 11372
 		$ret .= '<div>';
11373 11373
 
11374
-		$ret .= '<p class="assistance-title">' . img_picto('', 'filter') . ' ' . $langs->trans('FilterAssistance') . ' </p>';
11374
+		$ret .= '<p class="assistance-title">'.img_picto('', 'filter').' '.$langs->trans('FilterAssistance').' </p>';
11375 11375
 
11376
-		$ret .= '<p class="assistance-errors error" style="display:none">' . $langs->trans('AllFieldsRequired') . ' </p>';
11376
+		$ret .= '<p class="assistance-errors error" style="display:none">'.$langs->trans('AllFieldsRequired').' </p>';
11377 11377
 
11378 11378
 		$ret .= '<div class="operand">';
11379 11379
 		$ret .= $form->selectarray('search_filter_field', $arrayoffilterfieldslabel, '', $langs->trans("Fields"), 0, 0, '', 0, 0, 0, '', 'width250', 1);
@@ -11387,7 +11387,7 @@  discard block
 block discarded – undo
11387 11387
 		$ret .= '</select>';
11388 11388
 		$ret .= '<script>$(document).ready(function() {';
11389 11389
 		$ret .= '   $(".operator-selector").select2({';
11390
-		$ret .= '       placeholder: \'' . dol_escape_js($langs->trans('Operator')) . '\'';
11390
+		$ret .= '       placeholder: \''.dol_escape_js($langs->trans('Operator')).'\'';
11391 11391
 		$ret .= '   });';
11392 11392
 		$ret .= '});</script>';
11393 11393
 		$ret .= '</div>';
@@ -11396,12 +11396,12 @@  discard block
 block discarded – undo
11396 11396
 
11397 11397
 		$ret .= '<div class="value">';
11398 11398
 		// Input field for entering values
11399
-		$ret .= '<input type="text" class="flat width100 value-input" placeholder="' . dolPrintHTML($langs->trans('Value')) . '">';
11399
+		$ret .= '<input type="text" class="flat width100 value-input" placeholder="'.dolPrintHTML($langs->trans('Value')).'">';
11400 11400
 
11401 11401
 		// Date selector
11402 11402
 		$dateOne = '';
11403 11403
 		$ret .= '<span class="date-one" style="display:none">';
11404
-		$ret .=  $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '');
11404
+		$ret .= $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '');
11405 11405
 		$ret .= '</span>';
11406 11406
 
11407 11407
 		// Value selector (will be populated dynamically) based on search_filter_field value if a selected value has an array of values
@@ -11410,7 +11410,7 @@  discard block
 block discarded – undo
11410 11410
 		$ret .= '<script>
11411 11411
 			$(document).ready(function() {
11412 11412
 				$("#value-selector").select2({
11413
-					placeholder: "' . dol_escape_js($langs->trans('Value')) . '"
11413
+					placeholder: "' . dol_escape_js($langs->trans('Value')).'"
11414 11414
 				});
11415 11415
 				$("#value-selector").hide();
11416 11416
 				$("#value-selector").next(".select2-container").hide();
@@ -11420,7 +11420,7 @@  discard block
 block discarded – undo
11420 11420
 		$ret .= '</div>';
11421 11421
 
11422 11422
 		$ret .= '<div class="btn-div">';
11423
-		$ret .= '<button class="button buttongen button-save add-filter-btn" type="button">' . $langs->trans("addToFilter") . '</button>';
11423
+		$ret .= '<button class="button buttongen button-save add-filter-btn" type="button">'.$langs->trans("addToFilter").'</button>';
11424 11424
 		$ret .= '</div>';
11425 11425
 
11426 11426
 		$ret .= '</div>';
@@ -11586,7 +11586,7 @@  discard block
 block discarded – undo
11586 11586
 
11587 11587
 		$TModels = array();
11588 11588
 
11589
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
11589
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
11590 11590
 		$formmail = new FormMail($this->db);
11591 11591
 		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
11592 11592
 
@@ -11599,20 +11599,20 @@  discard block
 block discarded – undo
11599 11599
 			}
11600 11600
 		}
11601 11601
 
11602
-		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';
11602
+		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
11603 11603
 
11604 11604
 		foreach ($TModels as $id_model => $label_model) {
11605
-			$retstring .= '<option value="' . $id_model . '"';
11605
+			$retstring .= '<option value="'.$id_model.'"';
11606 11606
 			if (!empty($selected) && $selected == $id_model) {
11607 11607
 				$retstring .= "selected";
11608 11608
 			}
11609
-			$retstring .= ">" . $label_model . "</option>";
11609
+			$retstring .= ">".$label_model."</option>";
11610 11610
 		}
11611 11611
 
11612 11612
 		$retstring .= "</select>";
11613 11613
 
11614 11614
 		if ($addjscombo) {
11615
-			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail');
11615
+			$retstring .= ajax_combobox('select_'.$prefix.'model_mail');
11616 11616
 		}
11617 11617
 
11618 11618
 		return $retstring;
@@ -11663,16 +11663,16 @@  discard block
 block discarded – undo
11663 11663
 
11664 11664
 		foreach ($buttons as $button) {
11665 11665
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
11666
-			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->transnoentities($button['label_key'])) . '">';
11666
+			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->transnoentities($button['label_key'])).'">';
11667 11667
 		}
11668 11668
 		$retstring .= $withoutdiv ? '' : '</div>';
11669 11669
 
11670 11670
 		if ($dol_openinpopup) {
11671
-			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n";
11672
-			$retstring .= '<script nonce="' . getNonce() . '">';
11671
+			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n";
11672
+			$retstring .= '<script nonce="'.getNonce().'">';
11673 11673
 			$retstring .= 'jQuery(".button-cancel").click(function(e) {
11674
-				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\');
11675
-				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\');
11674
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\');
11675
+				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\');
11676 11676
 				 });';
11677 11677
 			$retstring .= '</script>';
11678 11678
 		}
@@ -11701,7 +11701,7 @@  discard block
 block discarded – undo
11701 11701
 		dol_syslog(__METHOD__, LOG_DEBUG);
11702 11702
 
11703 11703
 		$sql = "SELECT rowid, code, label as label";
11704
-		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';
11704
+		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';
11705 11705
 		$sql .= " WHERE active = 1";
11706 11706
 
11707 11707
 		$resql = $this->db->query($sql);
@@ -11712,7 +11712,7 @@  discard block
 block discarded – undo
11712 11712
 				$obj = $this->db->fetch_object($resql);
11713 11713
 
11714 11714
 				// If translation exists, we use it, otherwise we take the default wording
11715
-				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11715
+				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11716 11716
 				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;
11717 11717
 				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;
11718 11718
 				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label;
@@ -11744,18 +11744,18 @@  discard block
 block discarded – undo
11744 11744
 		global $langs, $user;
11745 11745
 
11746 11746
 		$out = '';
11747
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
11747
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
11748 11748
 
11749 11749
 		$this->load_cache_invoice_subtype();
11750 11750
 
11751
-		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
11751
+		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
11752 11752
 		if ($addempty) {
11753 11753
 			$out .= '<option value="0">&nbsp;</option>';
11754 11754
 		}
11755 11755
 
11756 11756
 		foreach ($this->cache_invoice_subtype as $rowid => $subtype) {
11757 11757
 			$label = $subtype['label'];
11758
-			$out .= '<option value="' . $subtype['rowid'] . '"';
11758
+			$out .= '<option value="'.$subtype['rowid'].'"';
11759 11759
 			if ($selected == $subtype['rowid']) {
11760 11760
 				$out .= ' selected="selected"';
11761 11761
 			}
Please login to merge, or discard this patch.
htdocs/accountancy/journal/purchasesjournal.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
116 116
 $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
117 117
 
118
-$pastmonth = null;  // Initialise, could be unset
119
-$pastmonthyear = null;  // Initialise, could be unset
118
+$pastmonth = null; // Initialise, could be unset
119
+$pastmonthyear = null; // Initialise, could be unset
120 120
 
121 121
 if (empty($date_startmonth)) {
122 122
 	// Period by default on transfer
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
167 167
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
168 168
 if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
169
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
169
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
170 170
 }
171 171
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
172 172
 $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
173 173
 $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
174 174
 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
175 175
 if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
176
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
176
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity);
177 177
 }
178 178
 $parameters = array();
179 179
 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters); // Note that $action and $object may have been modified by hook
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 $rcctva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT', 'NotDefined');
227 227
 $rcdtva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT', 'NotDefined');
228 228
 $noTaxDispatchingKeepWithLines = getDolGlobalInt('ACCOUNTING_PURCHASES_DO_NOT_DISPATCH_TAXES'); //If enabled, Tax will NOT get split off from the base entry and credited to a separate tax account (good for non-VAT countries like USA)
229
-$country_code_in_EEC = getCountriesInEEC();		// This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
229
+$country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
230 230
 
231 231
 $result = $db->query($sql);
232 232
 if ($result) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			}
250 250
 		}
251 251
 
252
-		$tax_id = $obj->tva_tx . ($obj->vat_src_code ? ' (' . $obj->vat_src_code . ')' : '');
252
+		$tax_id = $obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '');
253 253
 		if (array_key_exists($tax_id, $vatdata_cache)) {
254 254
 			$vatdata = $vatdata_cache[$tax_id];
255 255
 		} else {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
 		// VAT Reverse charge
300 300
 		if (($mysoc->country_code == 'FR' || getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
301
-			$rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0);
301
+			$rcvatdata = getTaxesFromId($obj->product_buy_vat.($obj->product_buy_default_vat_code ? ' ('.$obj->product_buy_default_vat_code.')' : ''), $mysoc, $mysoc, 0);
302 302
 			$rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
303 303
 			$rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
304 304
 			$rcc_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 			$rcc_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
307 307
 			$rcd_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
308 308
 			if (price2num($obj->product_buy_vat) || !empty($obj->product_buy_default_vat_code)) {
309
-				$vat_key = vatrate($obj->product_buy_vat) . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : '');
309
+				$vat_key = vatrate($obj->product_buy_vat).($obj->product_buy_default_vat_code ? ' ('.$obj->product_buy_default_vat_code.')' : '');
310 310
 				$val_value = $vat_key;
311 311
 				$def_tva[$obj->rowid][$rcc_compta_tva][$vat_key] = $val_value;
312 312
 				$def_tva[$obj->rowid][$rcd_compta_tva][$vat_key] = $val_value;
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     	fk_facture_fourn,
408 408
     	COUNT(fd.rowid) as nb
409 409
 	FROM
410
-    	" . MAIN_DB_PREFIX . "facture_fourn_det as fd
410
+    	" . MAIN_DB_PREFIX."facture_fourn_det as fd
411 411
 	WHERE
412 412
     	fd.product_type <= 2
413 413
     	AND fd.fk_code_ventilation <= 0
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 		$totalcredit = 0;
447 447
 		$totaldebit = 0;
448 448
 
449
-		$db->begin();		// We accept transaction into loop, so if we hang, we can continue transfer from the last error
449
+		$db->begin(); // We accept transaction into loop, so if we hang, we can continue transfer from the last error
450 450
 
451 451
 		$companystatic->id = $tabcompany[$key]['id'];
452 452
 		$companystatic->name = $tabcompany[$key]['name'];
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 					}
535 535
 				} else {
536 536
 					if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && getDolGlobalInt('ACCOUNTING_ENABLE_AUTOLETTERING')) {
537
-						require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
537
+						require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
538 538
 						$lettering_static = new Lettering($db);
539 539
 
540 540
 						$nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id));
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 
654 654
 				foreach ($arrayofvat[$key] as $k => $mt) {
655 655
 					if ($mt) {
656
-						$accountingaccount->fetch(0, $k, true);		// TODO Use a cache for label
656
+						$accountingaccount->fetch(0, $k, true); // TODO Use a cache for label
657 657
 						$label_account = $accountingaccount->label;
658 658
 
659 659
 						$bookkeeping = new BookKeeping($db);
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	}
1018 1018
 
1019 1019
 	// Button to write into Ledger
1020
-	$acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['','-1']);
1020
+	$acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['', '-1']);
1021 1021
 	if ($acctSupplierNotConfigured) {
1022 1022
 		print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
1023 1023
 		$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 				print $accountoshow;
1174 1174
 			}
1175 1175
 			print '</td>';
1176
-			print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $langs->trans("SubledgerAccount")) . "</td>";
1176
+			print "<td>".$bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $langs->trans("SubledgerAccount"))."</td>";
1177 1177
 			print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1178 1178
 			print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1179 1179
 			print "</tr>";
@@ -1211,12 +1211,12 @@  discard block
 block discarded – undo
1211 1211
 					print length_accounta($tabcompany[$key]['code_compta_fournisseur']);
1212 1212
 				}
1213 1213
 			} elseif (($accountoshow == "") || $accountoshow == 'NotDefined') {
1214
-				print '<span class="error">' . $langs->trans("ThirdpartyAccountNotDefined") . '</span>';
1214
+				print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
1215 1215
 			}
1216 1216
 			print '</td>';
1217 1217
 			$companystatic->id = $tabcompany[$key]['id'];
1218 1218
 			$companystatic->name = $tabcompany[$key]['name'];
1219
-			print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $accountingaccount->label) . "</td>";
1219
+			print "<td>".$bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $accountingaccount->label)."</td>";
1220 1220
 			print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1221 1221
 			print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1222 1222
 			print "</tr>";
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 					$tmpvatrate = (empty($def_tva[$key][$k]) ? (empty($arrayofvat[$key][$k]) ? '' : $arrayofvat[$key][$k]) : implode(', ', $def_tva[$key][$k]));
1281 1281
 					$labelvatrate = $langs->trans("Taxes").' '.$tmpvatrate.' %';
1282 1282
 					$labelvatrate .= ($numtax ? ' - Localtax '.$numtax : '');
1283
-					print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $labelvatrate) . "</td>";
1283
+					print "<td>".$bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $labelvatrate)."</td>";
1284 1284
 					print "</td>";
1285 1285
 					print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1286 1286
 					print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 					// Subledger account
1312 1312
 					print "<td>";
1313 1313
 					print '</td>';
1314
-					print "<td>" . $bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $langs->trans("VAT")." NPR (counterpart)") . "</td>";
1314
+					print "<td>".$bookkeepingstatic->accountingLabelForOperation($companystatic->getNomUrl(0, 'supplier'), $invoicestatic->ref_supplier, $langs->trans("VAT")." NPR (counterpart)")."</td>";
1315 1315
 					print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
1316 1316
 					print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
1317 1317
 					print "</tr>";
Please login to merge, or discard this patch.
htdocs/comm/action/class/actioncomm.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 		$sql .= "ip";
574 574
 		$sql .= ") VALUES (";
575 575
 		$sql .= "'(PROV)', ";
576
-		$sql .= "'".$this->db->idate($now)."', ";	// date creation
577
-		$sql .= "'".$this->db->idate($this->datep)."', ";	// date start event
576
+		$sql .= "'".$this->db->idate($now)."', "; // date creation
577
+		$sql .= "'".$this->db->idate($this->datep)."', "; // date start event
578 578
 		$sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", ";
579 579
 		$sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated
580 580
 		$sql .= (isset($this->type_id) ? $this->type_id : "null").",";
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 						$resql = $this->db->query($sql);
649 649
 						if (!$resql) {
650 650
 							$error++;
651
-							dol_syslog('Error to process userassigned: ' . $this->db->lasterror(), LOG_ERR);
651
+							dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR);
652 652
 							$this->errors[] = $this->db->lasterror();
653 653
 						} else {
654 654
 							$already_inserted[$val['id']] = true;
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 						$resql = $this->db->query($sql);
674 674
 						if (!$resql) {
675 675
 							$error++;
676
-							dol_syslog('Error to process socpeopleassigned: ' . $this->db->lasterror(), LOG_ERR);
676
+							dol_syslog('Error to process socpeopleassigned: '.$this->db->lasterror(), LOG_ERR);
677 677
 							$this->errors[] = $this->db->lasterror();
678 678
 						} else {
679 679
 							$already_inserted[$id] = true;
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 		$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm";
1186 1186
 		$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
1187 1187
 		$sql .= ", fk_action = ".(int) $this->type_id;
1188
-		$sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null");
1188
+		$sql .= ", code = ".($code ? "'".$this->db->escape($code)."'" : "null");
1189 1189
 		$sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null");
1190 1190
 		$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
1191 1191
 		$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
 		$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
1342 1342
 		// Fields from hook
1343 1343
 		$parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
1344
-		$reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters);    // Note that $action and $object may have been modified by hook
1344
+		$reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook
1345 1345
 		if (!empty($hookmanager->resPrint)) {
1346 1346
 			$sql .= $hookmanager->resPrint;
1347 1347
 		}
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 		}
1371 1371
 		// Fields where hook
1372 1372
 		$parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
1373
-		$reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters);    // Note that $action and $object may have been modified by hook
1373
+		$reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook
1374 1374
 		if (!empty($hookmanager->resPrint)) {
1375 1375
 			$sql .= $hookmanager->resPrint;
1376 1376
 		}
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
 
1448 1448
 		$resql = $this->db->query($sql);
1449 1449
 		if ($resql) {
1450
-			$response = null;  // Ensure the variable is defined
1450
+			$response = null; // Ensure the variable is defined
1451 1451
 			if (empty($load_state_board)) {
1452 1452
 				$agenda_static = new ActionComm($this->db);
1453 1453
 				$response = new WorkboardResponse();
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
 
1662 1662
 		// show categories for this record only in ajax to not overload lists
1663 1663
 		if (isModEnabled('category') && !$nofetch) {
1664
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
1664
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1665 1665
 			if (empty($form)) {
1666 1666
 				include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
1667 1667
 				$form = new Form($this->db);
@@ -1763,8 +1763,8 @@  discard block
 block discarded – undo
1763 1763
 		}
1764 1764
 		if (!empty($this->note_private)) {
1765 1765
 			$tooltip .= '<br><hr>';
1766
-			$texttoshow = dolGetFirstLineOfText($this->note_private, 8);	// Try to limit length of content
1767
-			$tooltip .= '<div class="tenlinesmax">';						// Restrict height of content into the tooltip
1766
+			$texttoshow = dolGetFirstLineOfText($this->note_private, 8); // Try to limit length of content
1767
+			$tooltip .= '<div class="tenlinesmax">'; // Restrict height of content into the tooltip
1768 1768
 			$tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow));
1769 1769
 			$tooltip .= '</div>';
1770 1770
 		}
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
 	 */
2568 2568
 	public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id)
2569 2569
 	{
2570
-		$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'actioncomm SET fk_element = ' . ((int) $dest_id) . ' WHERE elementtype="product" AND fk_element = '.((int) $origin_id);
2570
+		$sql = 'UPDATE '.MAIN_DB_PREFIX.'actioncomm SET fk_element = '.((int) $dest_id).' WHERE elementtype="product" AND fk_element = '.((int) $origin_id);
2571 2571
 		// using $dbs, not $this->db because function is static
2572 2572
 		if (!$dbs->query($sql)) {
2573 2573
 			//$this->errors = $dbs->lasterror();
@@ -2692,7 +2692,7 @@  discard block
 block discarded – undo
2692 2692
 		//Select all action comm reminders
2693 2693
 		$sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."actioncomm_reminder";
2694 2694
 		$sql .= " WHERE typeremind = 'email'";
2695
-		$sql .= " AND status = 0";	// 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors.
2695
+		$sql .= " AND status = 0"; // 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors.
2696 2696
 		$sql .= " AND dateremind <= '".$this->db->idate($now)."'";
2697 2697
 		$sql .= " AND entity IN (".getEntity('actioncomm').")";
2698 2698
 		$sql .= $this->db->order("dateremind", "ASC");
@@ -2701,7 +2701,7 @@  discard block
 block discarded – undo
2701 2701
 		if ($resql) {
2702 2702
 			require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
2703 2703
 			$formmail = new FormMail($this->db);
2704
-			$to = null;  // Ensure 'to' is defined for static analysis
2704
+			$to = null; // Ensure 'to' is defined for static analysis
2705 2705
 
2706 2706
 			while ($obj = $this->db->fetch_object($resql)) {
2707 2707
 				$res = $actionCommReminder->fetch($obj->id);
Please login to merge, or discard this patch.
htdocs/compta/paiement.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -681,15 +681,15 @@  discard block
 block discarded – undo
681 681
 					$multicurrency_alreadypayed = price2num($multicurrency_payment + $multicurrency_creditnotes + $multicurrency_deposits, 'MT');
682 682
 					$multicurrency_remaintopay = price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits, 'MT');
683 683
 					// Multicurrency full amount tooltip
684
-					$tooltiponmulticurrencyfullamount = $langs->trans('AmountHT') . ": " . price($objp->multicurrency_total_ht, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "<br>";
685
-					$tooltiponmulticurrencyfullamount .= $langs->trans('AmountVAT') . ": " . price($objp->multicurrency_total_tva, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "<br>";
686
-					$tooltiponmulticurrencyfullamount .= $langs->trans('AmountTTC') . ": " . price($objp->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $objp->multicurrency_code) . "<br>";
684
+					$tooltiponmulticurrencyfullamount = $langs->trans('AmountHT').": ".price($objp->multicurrency_total_ht, 0, $langs, 0, -1, -1, $objp->multicurrency_code)."<br>";
685
+					$tooltiponmulticurrencyfullamount .= $langs->trans('AmountVAT').": ".price($objp->multicurrency_total_tva, 0, $langs, 0, -1, -1, $objp->multicurrency_code)."<br>";
686
+					$tooltiponmulticurrencyfullamount .= $langs->trans('AmountTTC').": ".price($objp->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $objp->multicurrency_code)."<br>";
687 687
 				}
688 688
 
689 689
 				// Full amount tooltip
690
-				$tooltiponfullamount = $langs->trans('AmountHT') . ": " . price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . "<br>";
691
-				$tooltiponfullamount .= $langs->trans('AmountVAT') . ": " . price($objp->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . "<br>";
692
-				$tooltiponfullamount .= $langs->trans('AmountTTC') . ": " . price($objp->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . "<br>";
690
+				$tooltiponfullamount = $langs->trans('AmountHT').": ".price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency)."<br>";
691
+				$tooltiponfullamount .= $langs->trans('AmountVAT').": ".price($objp->total_tva, 0, $langs, 0, -1, -1, $conf->currency)."<br>";
692
+				$tooltiponfullamount .= $langs->trans('AmountTTC').": ".price($objp->total_ttc, 0, $langs, 0, -1, -1, $conf->currency)."<br>";
693 693
 
694 694
 				print '<tr class="oddeven'.(($invoice->id == $facid) ? ' highlight' : '').'">';
695 695
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 				if (isModEnabled('multicurrency')) {
727 727
 					print '<td class="right">';
728 728
 					if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
729
-						print '<span class="amount classfortooltip" title="'.$tooltiponmulticurrencyfullamount.'">' . price($sign * $objp->multicurrency_total_ttc);
729
+						print '<span class="amount classfortooltip" title="'.$tooltiponmulticurrencyfullamount.'">'.price($sign * $objp->multicurrency_total_ttc);
730 730
 					}
731 731
 					print '</span></td>';
732 732
 
Please login to merge, or discard this patch.
htdocs/webportal/controllers/document.controller.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 * \brief       This file is a controller for documents
24 24
 */
25 25
 
26
-require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
26
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
27 27
 
28 28
 
29 29
 /**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		}
153 153
 
154 154
 		// Security: Delete string ../ or ..\ into $original_file
155
-		$original_file = preg_replace('/\.\.+/', '..', $original_file);    // Replace '... or more' with '..'
155
+		$original_file = preg_replace('/\.\.+/', '..', $original_file); // Replace '... or more' with '..'
156 156
 		$original_file = str_replace('../', '/', $original_file);
157 157
 		$original_file = str_replace('..\\', '/', $original_file);
158 158
 
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
 		// check config access
170 170
 		// and file mime type (only PDF)
171 171
 		// and check login access
172
-		if (getDolGlobalInt('WEBPORTAL_' . $moduleNameUpperEn . '_LIST_ACCESS')
172
+		if (getDolGlobalInt('WEBPORTAL_'.$moduleNameUpperEn.'_LIST_ACCESS')
173 173
 			&& in_array($type, array('application/pdf'))
174 174
 			&& ($context->logged_thirdparty && $context->logged_thirdparty->id > 0)
175 175
 			&& $context->logged_thirdparty->id == $socId
176 176
 		) {
177 177
 			if (isModEnabled($moduleName) && isset($conf->{$moduleName}->multidir_output[$entity])) {
178
-				$original_file = $conf->{$moduleName}->multidir_output[$entity] . '/' . $original_file;
178
+				$original_file = $conf->{$moduleName}->multidir_output[$entity].'/'.$original_file;
179 179
 				$accessallowed = 1;
180 180
 			}
181 181
 		}
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
 		// Security:
191 191
 		// We refuse directory transversal change and pipes in file names
192 192
 		if (preg_match('/\.\./', $fullpath_original_file) || preg_match('/[<>|]/', $fullpath_original_file)) {
193
-			dol_syslog("Refused to deliver file " . $fullpath_original_file);
194
-			print "ErrorFileNameInvalid: " . dol_escape_htmltag($original_file);
193
+			dol_syslog("Refused to deliver file ".$fullpath_original_file);
194
+			print "ErrorFileNameInvalid: ".dol_escape_htmltag($original_file);
195 195
 			exit;
196 196
 		}
197 197
 
198 198
 		// Find the subdirectory name as the reference
199
-		$refname = basename(dirname($original_file) . "/");
199
+		$refname = basename(dirname($original_file)."/");
200 200
 
201 201
 		$filename = basename($fullpath_original_file);
202 202
 		$filename = preg_replace('/\.noexe$/i', '', $filename);
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 
208 208
 		// This test if file exists should be useless. We keep it to find bug more easily
209 209
 		if (!file_exists($fullpath_original_file_osencoded)) {
210
-			dol_syslog("ErrorFileDoesNotExists: " . $fullpath_original_file);
211
-			print "ErrorFileDoesNotExists: " . $original_file;
210
+			dol_syslog("ErrorFileDoesNotExists: ".$fullpath_original_file);
211
+			print "ErrorFileDoesNotExists: ".$original_file;
212 212
 			exit;
213 213
 		}
214 214
 
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
 		$fileSizeMaxDefault = 20 * 1024 * 1024; // 20 Mo by default
217 217
 		$fileSizeMax = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED', $fileSizeMaxDefault);
218 218
 		if ($fileSize > $fileSizeMax) {
219
-			dol_syslog('ErrorFileSizeTooLarge: ' . $fileSize);
220
-			print 'ErrorFileSizeTooLarge: ' . $fileSize . ' (max ' . $fileSizeMax . ')';
219
+			dol_syslog('ErrorFileSizeTooLarge: '.$fileSize);
220
+			print 'ErrorFileSizeTooLarge: '.$fileSize.' (max '.$fileSizeMax.')';
221 221
 			exit;
222 222
 		}
223 223
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 		$object = new stdClass();
230 230
 		$reshook = $hookmanager->executeHooks('downloadDocument', $parameters, $object, $action); // Note that $action and $object may have been
231 231
 		if ($reshook < 0) {
232
-			$errors = $hookmanager->error . (is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '') . implode(', ', $hookmanager->errors) : '');
233
-			dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : " . $errors);
234
-			print "ErrorDownloadDocumentHooks: " . $errors;
232
+			$errors = $hookmanager->error.(is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '').implode(', ', $hookmanager->errors) : '');
233
+			dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : ".$errors);
234
+			print "ErrorDownloadDocumentHooks: ".$errors;
235 235
 			exit;
236 236
 		}
237 237
 
@@ -309,19 +309,19 @@  discard block
 block discarded – undo
309 309
 		top_httphead($type);
310 310
 		header('Content-Description: File Transfer');
311 311
 		if ($encoding) {
312
-			header('Content-Encoding: ' . $encoding);
312
+			header('Content-Encoding: '.$encoding);
313 313
 		}
314 314
 		// Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open)
315 315
 		if ($attachment) {
316
-			header('Content-Disposition: attachment; filename="' . $filename . '"');
316
+			header('Content-Disposition: attachment; filename="'.$filename.'"');
317 317
 		} else {
318
-			header('Content-Disposition: inline; filename="' . $filename . '"');
318
+			header('Content-Disposition: inline; filename="'.$filename.'"');
319 319
 		}
320 320
 		header('Cache-Control: Public, must-revalidate');
321 321
 		header('Pragma: public');
322 322
 
323 323
 		// Send file now
324
-		header('Content-Length: ' . dol_filesize($fullpath_original_file));
324
+		header('Content-Length: '.dol_filesize($fullpath_original_file));
325 325
 		readfileLowMemory($fullpath_original_file_osencoded);
326 326
 	}
327 327
 }
Please login to merge, or discard this patch.