@@ -29,32 +29,32 @@ discard block |
||
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'; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | print "PHP Version: ".phpversion()."\n"; |
71 | -print "Memory limit: ". ini_get('memory_limit')."\n"; |
|
71 | +print "Memory limit: ".ini_get('memory_limit')."\n"; |
|
72 | 72 | |
73 | 73 | |
74 | 74 | /** |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | $result = testSqlAndScriptInject($test, 0); |
207 | 207 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject bbb'); |
208 | 208 | |
209 | - $test='<marquee onbeforeintput="alert(1)">'; |
|
210 | - $result=testSqlAndScriptInject($test, 0); |
|
209 | + $test = '<marquee onbeforeintput="alert(1)">'; |
|
210 | + $result = testSqlAndScriptInject($test, 0); |
|
211 | 211 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject onbeforeintput'); |
212 | - $test='<marquee onbounce="alert(1)">'; |
|
213 | - $result=testSqlAndScriptInject($test, 0); |
|
212 | + $test = '<marquee onbounce="alert(1)">'; |
|
213 | + $result = testSqlAndScriptInject($test, 0); |
|
214 | 214 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject onbounce'); |
215 | 215 | |
216 | 216 | $test = '<SCRIPT SRC=http://xss.rocks/xss.js></SCRIPT>'; |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | $result = testSqlAndScriptInject($test, 0); |
240 | 240 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee'); |
241 | 241 | |
242 | - $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. |
|
243 | - $test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same |
|
242 | + $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. |
|
243 | + $test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same |
|
244 | 244 | |
245 | 245 | $test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>'; |
246 | 246 | $result = testSqlAndScriptInject($test, 0); |
@@ -274,21 +274,21 @@ discard block |
||
274 | 274 | $result = testSqlAndScriptInject($test, 0); |
275 | 275 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll'); |
276 | 276 | |
277 | - $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 |
|
277 | + $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 |
|
278 | 278 | $result = testSqlAndScriptInject($test, 0); |
279 | 279 | //print "test=".$test." result=".$result."\n"; |
280 | 280 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm'); |
281 | 281 | |
282 | 282 | |
283 | 283 | $test = "Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)"; |
284 | - $result = testSqlAndScriptInject($test, 0); // result must be 0 |
|
284 | + $result = testSqlAndScriptInject($test, 0); // result must be 0 |
|
285 | 285 | $this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not'); |
286 | 286 | |
287 | 287 | $test = '<a href="j	a	v	asc
ri	pt:(a	l	e	r	t	(document.cookie))">XSS</a>'; |
288 | 288 | $result = testSqlAndScriptInject($test, 0); |
289 | 289 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not'); |
290 | 290 | |
291 | - $test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable |
|
291 | + $test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable |
|
292 | 292 | $result = testSqlAndScriptInject($test, 2); |
293 | 293 | //print "test=".$test." result=".$result."\n"; |
294 | 294 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char'); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | // Can allow the " in GET parameter value |
305 | 305 | define("SECURITY_WAF_ALLOW_QUOTES_IN_GET", 1); |
306 | 306 | $test = 'aa"bb'; |
307 | - $result = testSqlAndScriptInject($test, 1); // Should return 0 = allowed |
|
307 | + $result = testSqlAndScriptInject($test, 1); // Should return 0 = allowed |
|
308 | 308 | $this->assertEquals(0, $result, 'Error on testSqlAndScriptInject with SECURITY_WAF_ALLOW_QUOTES_IN_GET, should return 0, result='.$result); |
309 | 309 | } |
310 | 310 | |
@@ -406,21 +406,21 @@ discard block |
||
406 | 406 | { |
407 | 407 | global $conf; |
408 | 408 | |
409 | - $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) |
|
409 | + $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) |
|
410 | 410 | print __METHOD__." genpass1=".$genpass1."\n"; |
411 | 411 | $this->assertEquals(strlen($genpass1), 32); |
412 | 412 | |
413 | - $genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) |
|
413 | + $genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) |
|
414 | 414 | print __METHOD__." genpass1=".$genpass1."\n"; |
415 | 415 | $this->assertEquals(strlen($genpass1), 32); |
416 | 416 | |
417 | 417 | $conf->global->USER_PASSWORD_GENERATED = 'None'; |
418 | - $genpass2 = getRandomPassword(false); // Should return an empty string |
|
418 | + $genpass2 = getRandomPassword(false); // Should return an empty string |
|
419 | 419 | print __METHOD__." genpass2=".$genpass2."\n"; |
420 | 420 | $this->assertEquals($genpass2, ''); |
421 | 421 | |
422 | 422 | $conf->global->USER_PASSWORD_GENERATED = 'Standard'; |
423 | - $genpass3 = getRandomPassword(false); // Should return a password of 12 chars |
|
423 | + $genpass3 = getRandomPassword(false); // Should return a password of 12 chars |
|
424 | 424 | print __METHOD__." genpass3=".$genpass3."\n"; |
425 | 425 | $this->assertEquals(strlen($genpass3), 12); |
426 | 426 | |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function testRestrictedArea() |
436 | 436 | { |
437 | - global $conf,$user,$langs,$db; |
|
437 | + global $conf, $user, $langs, $db; |
|
438 | 438 | $conf = $this->savconf; |
439 | 439 | $user = $this->savuser; |
440 | 440 | $langs = $this->savlangs; |
@@ -465,40 +465,40 @@ discard block |
||
465 | 465 | $tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']); |
466 | 466 | $this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should."); |
467 | 467 | |
468 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
469 | - $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow |
|
468 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
469 | + $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow |
|
470 | 470 | print __METHOD__." url=".$url."\n"; |
471 | 471 | $this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response'); |
472 | 472 | |
473 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
474 | - $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 |
|
473 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
474 | + $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 |
|
475 | 475 | print __METHOD__." url=".$url."\n"; |
476 | 476 | $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'])); |
477 | 477 | |
478 | 478 | $url = 'http://localhost'; |
479 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
479 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
480 | 480 | print __METHOD__." url=".$url."\n"; |
481 | - $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 |
|
481 | + $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 |
|
482 | 482 | |
483 | 483 | $url = 'http://127.0.0.1'; |
484 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
484 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
485 | 485 | print __METHOD__." url=".$url."\n"; |
486 | - $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 |
|
486 | + $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 |
|
487 | 487 | |
488 | 488 | $url = 'http://127.0.2.1'; |
489 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
489 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
490 | 490 | print __METHOD__." url=".$url."\n"; |
491 | - $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 |
|
491 | + $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 |
|
492 | 492 | |
493 | 493 | $url = 'https://169.254.0.1'; |
494 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
494 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
495 | 495 | print __METHOD__." url=".$url."\n"; |
496 | - $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 |
|
496 | + $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 |
|
497 | 497 | |
498 | 498 | $url = 'http://[::1]'; |
499 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
499 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
500 | 500 | print __METHOD__." url=".$url."\n"; |
501 | - $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 |
|
501 | + $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 |
|
502 | 502 | |
503 | 503 | /*$url = 'localtest.me'; |
504 | 504 | $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
@@ -507,9 +507,9 @@ discard block |
||
507 | 507 | */ |
508 | 508 | |
509 | 509 | $url = 'http://192.0.0.192'; |
510 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist |
|
510 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist |
|
511 | 511 | print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n"; |
512 | - $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 |
|
512 | + $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 |
|
513 | 513 | |
514 | 514 | return 0; |
515 | 515 | } |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | */ |
522 | 522 | public function testDolSanitizeUrl() |
523 | 523 | { |
524 | - global $conf,$user,$langs,$db; |
|
524 | + global $conf, $user, $langs, $db; |
|
525 | 525 | $conf = $this->savconf; |
526 | 526 | $user = $this->savuser; |
527 | 527 | $langs = $this->savlangs; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | */ |
548 | 548 | public function testDolSanitizeEmail() |
549 | 549 | { |
550 | - global $conf,$user,$langs,$db; |
|
550 | + global $conf, $user, $langs, $db; |
|
551 | 551 | $conf = $this->savconf; |
552 | 552 | $user = $this->savuser; |
553 | 553 | $langs = $this->savlangs; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | */ |
578 | 578 | public function testDolSanitizeFileName() |
579 | 579 | { |
580 | - global $conf,$user,$langs,$db; |
|
580 | + global $conf, $user, $langs, $db; |
|
581 | 581 | $conf = $this->savconf; |
582 | 582 | $user = $this->savuser; |
583 | 583 | $langs = $this->savlangs; |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | */ |
601 | 601 | public function testDolEval() |
602 | 602 | { |
603 | - global $conf,$user,$langs,$db; |
|
603 | + global $conf, $user, $langs, $db; |
|
604 | 604 | $conf = $this->savconf; |
605 | 605 | $user = $this->savuser; |
606 | 606 | $langs = $this->savlangs; |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | print "result4 = ".$result."\n"; |
642 | 642 | $this->assertEquals('Parent project not found', $result, 'Test 4'); |
643 | 643 | |
644 | - $result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char. |
|
644 | + $result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char. |
|
645 | 645 | print "result0 = ".$result."\n"; |
646 | 646 | $this->assertStringContainsString('Bad string syntax to evaluate (found chars that are not chars for a simple one line clean eval string)', $result); |
647 | 647 | |
@@ -660,12 +660,12 @@ discard block |
||
660 | 660 | // Now string not allowed |
661 | 661 | |
662 | 662 | $s = '4 <5'; |
663 | - $result = (string) dol_eval($s, 1, 1, '2'); // in mode 2, char < is allowed only if followed by a space |
|
663 | + $result = (string) dol_eval($s, 1, 1, '2'); // in mode 2, char < is allowed only if followed by a space |
|
664 | 664 | print "result = ".$result."\n"; |
665 | 665 | $this->assertStringContainsString('Bad string syntax to evaluate', $result, 'Test 4 <5 - The string was not detected as evil'); |
666 | 666 | |
667 | 667 | $s = '4 < 5'; |
668 | - $result = (string) dol_eval($s, 1, 1, '1'); // in mode 1, char < is always forbidden |
|
668 | + $result = (string) dol_eval($s, 1, 1, '1'); // in mode 1, char < is always forbidden |
|
669 | 669 | print "result = ".$result."\n"; |
670 | 670 | $this->assertStringContainsString('Bad string syntax to evaluate', $result, 'Test 4 < 5 - The string was not detected as evil'); |
671 | 671 | |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | print "result = ".$result."\n"; |
680 | 680 | $this->assertStringContainsString('Bad string syntax to evaluate', $result, 'The string was not detected as evil'); |
681 | 681 | |
682 | - $result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure |
|
682 | + $result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure |
|
683 | 683 | print "result5 = ".json_encode($result)."\n"; |
684 | 684 | $this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil'); |
685 | 685 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | print "result6 = ".json_encode($result)."\n"; |
688 | 688 | $this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil'); |
689 | 689 | |
690 | - $result = (string) dol_eval('instruction;', 1, 1); // ; is not allowed. |
|
690 | + $result = (string) dol_eval('instruction;', 1, 1); // ; is not allowed. |
|
691 | 691 | print "result7 = ".$result."\n"; |
692 | 692 | $this->assertStringContainsString('Bad string syntax to evaluate (found chars that are not chars for a simple one line clean eval string)', $result, 'The string was not detected as evil'); |
693 | 693 | |
@@ -715,11 +715,11 @@ discard block |
||
715 | 715 | print "result10 = ".$result."\n"; |
716 | 716 | $this->assertStringContainsString('Bad string syntax to evaluate', $result, 'The string was not detected as evil'); |
717 | 717 | |
718 | - $result = (string) dol_eval("('ex'.'ec')('ls')", 1, 0); // This will execute exec of ls |
|
718 | + $result = (string) dol_eval("('ex'.'ec')('ls')", 1, 0); // This will execute exec of ls |
|
719 | 719 | print "result11 = ".$result."\n"; |
720 | 720 | $this->assertStringContainsString('Bad string syntax to evaluate (mode 1, found call of a function or method without using the direct name of the function)', $result, 'The string was not detected as evil'); |
721 | 721 | |
722 | - $result = (string) dol_eval("('ex'.'ec') /* */ (/* */'ls')", 1, 0); // This will execute exec of ls |
|
722 | + $result = (string) dol_eval("('ex'.'ec') /* */ (/* */'ls')", 1, 0); // This will execute exec of ls |
|
723 | 723 | print "result11 = ".$result."\n"; |
724 | 724 | $this->assertStringContainsString('Bad string syntax to evaluate (mode 1, found call of a function or method without using the direct name of the function)', $result, 'The string was not detected as evil'); |
725 | 725 | |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | |
734 | 734 | // Must be allowed |
735 | 735 | |
736 | - global $mainmenu,$leftmenu; // Used into following strings to eval |
|
736 | + global $mainmenu, $leftmenu; // Used into following strings to eval |
|
737 | 737 | |
738 | 738 | $leftmenu = 'AAA'; |
739 | 739 | $result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1'); |
@@ -757,13 +757,13 @@ discard block |
||
757 | 757 | $this->assertFalse($result); |
758 | 758 | |
759 | 759 | $leftmenu = 'XXX'; |
760 | - $conf->global->MAIN_FEATURES_LEVEL = 1; // Force for the case option is -1 |
|
760 | + $conf->global->MAIN_FEATURES_LEVEL = 1; // Force for the case option is -1 |
|
761 | 761 | $string = '(isModEnabled("user") || isModEnabled("resource")) && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 0 && preg_match(\'/^(admintools|all|XXX)/\', $leftmenu)'; |
762 | 762 | $result = dol_eval($string, 1, 1, '1'); |
763 | 763 | print "result17 = ".$result."\n"; |
764 | 764 | $this->assertTrue($result); |
765 | 765 | |
766 | - $result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' |
|
766 | + $result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' |
|
767 | 767 | print "result18 = ".$result."\n"; |
768 | 768 | $this->assertFalse($result); |
769 | 769 | |
@@ -841,11 +841,11 @@ discard block |
||
841 | 841 | $this->assertEquals('a', $result); |
842 | 842 | |
843 | 843 | // Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range |
844 | - $arraytmp = array(0 => '✅', 1 => '9989;'); // Encoded as decimal |
|
844 | + $arraytmp = array(0 => '✅', 1 => '9989;'); // Encoded as decimal |
|
845 | 845 | $result = realCharForNumericEntities($arraytmp); |
846 | 846 | $this->assertEquals('✅', $result); |
847 | 847 | |
848 | - $arraytmp = array(0 => '✅', 1 => 'x2705;'); // Encoded as hexadecimal |
|
848 | + $arraytmp = array(0 => '✅', 1 => 'x2705;'); // Encoded as hexadecimal |
|
849 | 849 | $result = realCharForNumericEntities($arraytmp); |
850 | 850 | $this->assertEquals('✅', $result); |
851 | 851 | |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | global $conf; |
865 | 865 | |
866 | 866 | // Set options for cleaning data |
867 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
867 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
868 | 868 | // Enable option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible |
869 | 869 | if (extension_loaded('tidy') && class_exists("tidy")) { |
870 | 870 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; |
873 | 873 | print "WARNING !!! php-tidy is not available !!!"; |
874 | 874 | } |
875 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions |
|
875 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions |
|
876 | 876 | |
877 | 877 | |
878 | 878 | // dolPrintHTML - With dolPrintHTML(), only content not already in HTML is encoded with HTML. |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | //$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1); |
886 | 886 | $result = dolPrintHTML($stringtotest); |
887 | 887 | print __METHOD__." result=".$result."\n"; |
888 | - $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 1'); // Expected '' because should failed because login 'auto' does not exists |
|
888 | + $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 1'); // Expected '' because should failed because login 'auto' does not exists |
|
889 | 889 | |
890 | 890 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted |
891 | 891 | $stringtotest = "" > < <b>bold</b>"; |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | //$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1); |
897 | 897 | $result = dolPrintHTML($stringtotest); |
898 | 898 | print __METHOD__." result=".$result."\n"; |
899 | - $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 2'); // Expected '' because should failed because login 'auto' does not exists |
|
899 | + $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTML test 2'); // Expected '' because should failed because login 'auto' does not exists |
|
900 | 900 | |
901 | 901 | |
902 | 902 | // dolPrintHTMLForAttribute - With dolPrintHTMLForAttribute(), the content is HTML encode, even if it is already HTML content. |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | //$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1); |
910 | 910 | $result = dolPrintHTMLForAttribute($stringtotest); |
911 | 911 | print __METHOD__." result=".$result."\n"; |
912 | - $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 1'); // Expected '' because should failed because login 'auto' does not exists |
|
912 | + $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 1'); // Expected '' because should failed because login 'auto' does not exists |
|
913 | 913 | |
914 | 914 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted |
915 | 915 | $stringtotest = "" > < <b>bold</b>"; |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | //$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0, array())), 1, 1, 'common', 0, 1); |
921 | 921 | $result = dolPrintHTMLForAttribute($stringtotest); |
922 | 922 | print __METHOD__." result=".$result."\n"; |
923 | - $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 2'); // Expected '' because should failed because login 'auto' does not exists |
|
923 | + $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttribute test 2'); // Expected '' because should failed because login 'auto' does not exists |
|
924 | 924 | |
925 | 925 | |
926 | 926 | // dolPrintHTMLForAttributeUrl - With dolPrintHTMLForAttributeUrl(), the param should already be and HTML URL encoded |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | // $result = dol_escape_htmltag(dol_string_onlythesehtmltags($s, 1, 1, 1, 0, array()), 0, 0, '', $escapeonlyhtmltags, 1); |
931 | 931 | $result = dolPrintHTMLForAttributeUrl($stringtotest); |
932 | 932 | print __METHOD__." result=".$result."\n"; |
933 | - $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttributeUrl test 1'); // Expected '' because should failed because login 'auto' does not exists |
|
933 | + $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttributeUrl test 1'); // Expected '' because should failed because login 'auto' does not exists |
|
934 | 934 | |
935 | 935 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted |
936 | 936 | $stringtotest = "aa & & a=%10"; |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | // $result = dol_escape_htmltag(dol_string_onlythesehtmltags($s, 1, 1, 1, 0, array()), 0, 0, '', $escapeonlyhtmltags, 1); |
939 | 939 | $result = dolPrintHTMLForAttributeUrl($stringtotest); |
940 | 940 | print __METHOD__." result=".$result."\n"; |
941 | - $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttributeUrl test 2'); // Expected '' because should failed because login 'auto' does not exists |
|
941 | + $this->assertEquals($stringfixed, $result, 'Error in dolPrintHTMLForAttributeUrl test 2'); // Expected '' because should failed because login 'auto' does not exists |
|
942 | 942 | |
943 | 943 | |
944 | 944 | // dolPrintHTML |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | global $conf; |
1070 | 1070 | |
1071 | 1071 | // Set options for cleaning data |
1072 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
1072 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
1073 | 1073 | // Enable option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible |
1074 | 1074 | if (extension_loaded('tidy') && class_exists("tidy")) { |
1075 | 1075 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
@@ -1078,22 +1078,22 @@ discard block |
||
1078 | 1078 | print "WARNING !!! php-tidy is not available !!!"; |
1079 | 1079 | } |
1080 | 1080 | |
1081 | - $libXmlIsOkForMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // Ok with 2.9.14, not ok on HTML5 and some libxmlversion like the one of travis |
|
1081 | + $libXmlIsOkForMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // Ok with 2.9.14, not ok on HTML5 and some libxmlversion like the one of travis |
|
1082 | 1082 | |
1083 | 1083 | |
1084 | 1084 | // With no clean option |
1085 | 1085 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1086 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; // |
|
1087 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // 1 = Replaces & alone into & and replaces ' into ' |
|
1086 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; // |
|
1087 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // 1 = Replaces & alone into & and replaces ' into ' |
|
1088 | 1088 | |
1089 | 1089 | // For a string with a simple & inside and already encoded |
1090 | - $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1090 | + $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1091 | 1091 | $expectedresult = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> z'; |
1092 | 1092 | $result = dolPrintHTML($s); |
1093 | 1093 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
1094 | 1094 | |
1095 | 1095 | // For a string that is not an already HTML content |
1096 | - $s = 'List: & é < " \''; // Detected as non already HTML |
|
1096 | + $s = 'List: & é < " \''; // Detected as non already HTML |
|
1097 | 1097 | $expectedresult = 'List: & é < " \''; |
1098 | 1098 | $result = dolPrintHTML($s); |
1099 | 1099 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
@@ -1102,17 +1102,17 @@ discard block |
||
1102 | 1102 | if (extension_loaded('tidy') && class_exists("tidy")) { |
1103 | 1103 | // With clean TIDY only |
1104 | 1104 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1105 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; // |
|
1106 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // 1 = Replaces & alone into & and replaces ' into ' |
|
1105 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; // |
|
1106 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // 1 = Replaces & alone into & and replaces ' into ' |
|
1107 | 1107 | |
1108 | 1108 | // For a string with a simple & inside and already encoded |
1109 | - $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1109 | + $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1110 | 1110 | $expectedresult = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> z'; |
1111 | 1111 | $result = dolPrintHTML($s); |
1112 | 1112 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
1113 | 1113 | |
1114 | 1114 | // For a string that is not an already HTML content |
1115 | - $s = 'List: & é < " \''; // Detected as non already HTML |
|
1115 | + $s = 'List: & é < " \''; // Detected as non already HTML |
|
1116 | 1116 | $expectedresult = 'List: & é < " \''; |
1117 | 1117 | $result = dolPrintHTML($s); |
1118 | 1118 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
@@ -1120,17 +1120,17 @@ discard block |
||
1120 | 1120 | if ($libXmlIsOkForMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) { |
1121 | 1121 | // With clean TIDY and remove Bad attributes option |
1122 | 1122 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1123 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; // |
|
1124 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1; // 1 = Replaces & alone into & and replaces ' into ' |
|
1123 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; // |
|
1124 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1; // 1 = Replaces & alone into & and replaces ' into ' |
|
1125 | 1125 | |
1126 | 1126 | // For a string with a simple & inside and already encoded |
1127 | - $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1127 | + $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1128 | 1128 | $expectedresult = 'List of char+their entities: & & é é < < " " \' \' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> z'; |
1129 | 1129 | $result = dolPrintHTML($s); |
1130 | 1130 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
1131 | 1131 | |
1132 | 1132 | // For a string that is not an already HTML content |
1133 | - $s = 'List: & é < " \''; // Detected as non already HTML |
|
1133 | + $s = 'List: & é < " \''; // Detected as non already HTML |
|
1134 | 1134 | $expectedresult = 'List: & é < " \''; |
1135 | 1135 | $result = dolPrintHTML($s); |
1136 | 1136 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
@@ -1140,17 +1140,17 @@ discard block |
||
1140 | 1140 | if ($libXmlIsOkForMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) { |
1141 | 1141 | // With remove Bad attributes option only |
1142 | 1142 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1143 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; // |
|
1144 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1; // 1 = Replaces & alone into & and replaces ' into ' |
|
1143 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; // |
|
1144 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1; // 1 = Replaces & alone into & and replaces ' into ' |
|
1145 | 1145 | |
1146 | 1146 | // For a string with a simple & inside and already encoded |
1147 | - $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1147 | + $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1148 | 1148 | $expectedresult = 'List of char+their entities: & & é é < < " " \' \' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> z'; |
1149 | 1149 | $result = dolPrintHTML($s); |
1150 | 1150 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
1151 | 1151 | |
1152 | 1152 | // For a string that is not an already HTML content |
1153 | - $s = 'List: & é < " \''; // Detected as non already HTML |
|
1153 | + $s = 'List: & é < " \''; // Detected as non already HTML |
|
1154 | 1154 | $expectedresult = 'List: & é < " \''; |
1155 | 1155 | $result = dolPrintHTML($s); |
1156 | 1156 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | global $conf; |
1172 | 1172 | |
1173 | 1173 | // Set options for cleaning data |
1174 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
1174 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
1175 | 1175 | // Enable option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible |
1176 | 1176 | if (extension_loaded('tidy') && class_exists("tidy")) { |
1177 | 1177 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
@@ -1180,22 +1180,22 @@ discard block |
||
1180 | 1180 | print "WARNING !!! php-tidy is not available !!!"; |
1181 | 1181 | } |
1182 | 1182 | |
1183 | - $libXmlIsOkForMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // Ok with 2.9.14, not ok on HTML5 and some libxmlversion like the one of travis |
|
1183 | + $libXmlIsOkForMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // Ok with 2.9.14, not ok on HTML5 and some libxmlversion like the one of travis |
|
1184 | 1184 | |
1185 | 1185 | |
1186 | 1186 | // With no clean option |
1187 | 1187 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1188 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; // |
|
1189 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // 1 = Replaces & alone into & and replaces ' into ' |
|
1188 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; // |
|
1189 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // 1 = Replaces & alone into & and replaces ' into ' |
|
1190 | 1190 | |
1191 | 1191 | // For a string with a simple & inside and already encoded |
1192 | - $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1192 | + $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1193 | 1193 | $expectedresult = 'List of char+their entities: & &amp; é é < &lt; " &quot; \' &apos; a z'; |
1194 | 1194 | $result = dolPrintHTMLForAttribute($s); |
1195 | 1195 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
1196 | 1196 | |
1197 | 1197 | // For a string that is not an already HTML content |
1198 | - $s = 'List: & é < " \''; // Detected as non already HTML |
|
1198 | + $s = 'List: & é < " \''; // Detected as non already HTML |
|
1199 | 1199 | $expectedresult = 'List: &amp; é &lt; &quot; \''; |
1200 | 1200 | $result = dolPrintHTMLForAttribute($s); |
1201 | 1201 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
@@ -1204,17 +1204,17 @@ discard block |
||
1204 | 1204 | if (extension_loaded('tidy') && class_exists("tidy")) { |
1205 | 1205 | // With clean TIDY only |
1206 | 1206 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1207 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; // |
|
1208 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // 1 = Replaces & alone into & and replaces ' into ' |
|
1207 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; // |
|
1208 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // 1 = Replaces & alone into & and replaces ' into ' |
|
1209 | 1209 | |
1210 | 1210 | // For a string with a simple & inside and already encoded |
1211 | - $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1211 | + $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1212 | 1212 | $expectedresult = 'List of char+their entities: & &amp; é é < &lt; " &quot; \' &apos; a z'; |
1213 | 1213 | $result = dolPrintHTMLForAttribute($s); |
1214 | 1214 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
1215 | 1215 | |
1216 | 1216 | // For a string that is not an already HTML content |
1217 | - $s = 'List: & é < " \''; // Detected as non already HTML |
|
1217 | + $s = 'List: & é < " \''; // Detected as non already HTML |
|
1218 | 1218 | $expectedresult = 'List: &amp; é &lt; &quot; \''; |
1219 | 1219 | $result = dolPrintHTMLForAttribute($s); |
1220 | 1220 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
@@ -1223,17 +1223,17 @@ discard block |
||
1223 | 1223 | if ($libXmlIsOkForMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) { |
1224 | 1224 | // With clean TIDY and remove Bad attributes option |
1225 | 1225 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1226 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; // |
|
1227 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1; // 1 = Replaces & alone into & and replaces ' into ' |
|
1226 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; // |
|
1227 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1; // 1 = Replaces & alone into & and replaces ' into ' |
|
1228 | 1228 | |
1229 | 1229 | // For a string with a simple & inside and already encoded |
1230 | - $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1230 | + $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1231 | 1231 | $expectedresult = 'List of char+their entities: & &amp; é é < &lt; " &quot; \' &apos; a z'; |
1232 | 1232 | $result = dolPrintHTMLForAttribute($s); |
1233 | 1233 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
1234 | 1234 | |
1235 | 1235 | // For a string that is not an already HTML content |
1236 | - $s = 'List: & é < " \''; // Detected as non already HTML |
|
1236 | + $s = 'List: & é < " \''; // Detected as non already HTML |
|
1237 | 1237 | $expectedresult = 'List: &amp; é &lt; &quot; \''; |
1238 | 1238 | $result = dolPrintHTMLForAttribute($s); |
1239 | 1239 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
@@ -1243,17 +1243,17 @@ discard block |
||
1243 | 1243 | if ($libXmlIsOkForMAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) { |
1244 | 1244 | // With remove Bad attributes option only |
1245 | 1245 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1246 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; // |
|
1247 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1; // 1 = Replaces & alone into & and replaces ' into ' |
|
1246 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; // |
|
1247 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1; // 1 = Replaces & alone into & and replaces ' into ' |
|
1248 | 1248 | |
1249 | 1249 | // For a string with a simple & inside and already encoded |
1250 | - $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1250 | + $s = 'List of char+their entities: & & é é < < " " \' ' <a href="aaa?aaa=1&bbb=2&ccc=3">a</a> <zzz>z</zzz>'; // Detected as already HTML |
|
1251 | 1251 | $expectedresult = 'List of char+their entities: & &amp; é é < &lt; " &quot; \' &apos; a z'; |
1252 | 1252 | $result = dolPrintHTMLForAttribute($s); |
1253 | 1253 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
1254 | 1254 | |
1255 | 1255 | // For a string that is not an already HTML content |
1256 | - $s = 'List: & é < " \''; // Detected as non already HTML |
|
1256 | + $s = 'List: & é < " \''; // Detected as non already HTML |
|
1257 | 1257 | $expectedresult = 'List: &amp; é &lt; &quot; \''; |
1258 | 1258 | $result = dolPrintHTMLForAttribute($s); |
1259 | 1259 | $this->assertEquals($expectedresult, $result, 'Error on test dolPrintHTML'); |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | // For a string with js and link with restricthtmlallowlinkscript |
1346 | 1346 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1347 | 1347 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; |
1348 | - $s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
1348 | + $s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
1349 | 1349 | <link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> |
1350 | 1350 | <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
1351 | 1351 | <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>'; |
@@ -1358,7 +1358,7 @@ discard block |
||
1358 | 1358 | // For a string with js and link with restricthtmlallowlinkscript |
1359 | 1359 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
1360 | 1360 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
1361 | - $s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
1361 | + $s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
1362 | 1362 | <link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> |
1363 | 1363 | <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
1364 | 1364 | <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>'; |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | // For a string with js and link with restricthtmlallowlinkscript |
1372 | 1372 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1; |
1373 | 1373 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; |
1374 | - $s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
1374 | + $s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
1375 | 1375 | <link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> |
1376 | 1376 | <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
1377 | 1377 | <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>'; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | $classname = ucfirst($subelement); |
391 | 391 | $srcobject = new $classname($db); |
392 | - '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Maybe other class but CommonObject is too generic |
|
392 | + '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Maybe other class but CommonObject is too generic |
|
393 | 393 | |
394 | 394 | dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); |
395 | 395 | $result = $srcobject->fetch($object->origin_id); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $idprod = GETPOSTINT('idprod'); |
620 | 620 | } |
621 | 621 | |
622 | - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
622 | + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
623 | 623 | |
624 | 624 | $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); |
625 | 625 | $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | // Get vat rate |
740 | 740 | $tva_npr = 0; |
741 | 741 | if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority) |
742 | - $tmpidprodfournprice = GETPOST('idprodfournprice', 'alpha'); // can be an id of price, or -1, -2, -99 or 'idprod_...' |
|
742 | + $tmpidprodfournprice = GETPOST('idprodfournprice', 'alpha'); // can be an id of price, or -1, -2, -99 or 'idprod_...' |
|
743 | 743 | if (is_numeric($tmpidprodfournprice) && (int) $tmpidprodfournprice > 0) { |
744 | 744 | $tmpidprodfournprice = (int) $tmpidprodfournprice; |
745 | 745 | } else { |
@@ -1004,8 +1004,8 @@ discard block |
||
1004 | 1004 | $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU', 2); |
1005 | 1005 | |
1006 | 1006 | // Add buying price |
1007 | - $fournprice = (int) (GETPOST('fournprice') ? GETPOSTINT('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only |
|
1008 | - $buyingprice = price2num((GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''), '', 2); // If buying_price is '0', we must keep this value |
|
1007 | + $fournprice = (int) (GETPOST('fournprice') ? GETPOSTINT('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only |
|
1008 | + $buyingprice = price2num((GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''), '', 2); // If buying_price is '0', we must keep this value |
|
1009 | 1009 | |
1010 | 1010 | // Extrafields Lines |
1011 | 1011 | $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | // Multicurrency rate |
1159 | 1159 | $result = $object->setMulticurrencyRate(GETPOSTFLOAT('multicurrency_tx'), GETPOSTINT('calculation_mode')); |
1160 | 1160 | } elseif ($action == 'update_extras' && $permissiontoeditextra) { |
1161 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1161 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1162 | 1162 | |
1163 | 1163 | $attribute_name = GETPOST('attribute', 'aZ09'); |
1164 | 1164 | |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | |
1240 | 1240 | $classname = ucfirst($subelement); |
1241 | 1241 | $objectsrc = new $classname($db); |
1242 | - '@phan-var-force Commande|Propal|CommandeFournisseur|SupplierProposal $objectsrc'; // Could be other classes, but CommonObject is too generic |
|
1242 | + '@phan-var-force Commande|Propal|CommandeFournisseur|SupplierProposal $objectsrc'; // Could be other classes, but CommonObject is too generic |
|
1243 | 1243 | $objectsrc->fetch($originid); |
1244 | 1244 | if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) { |
1245 | 1245 | $objectsrc->fetch_lines(); |
@@ -1809,40 +1809,40 @@ discard block |
||
1809 | 1809 | |
1810 | 1810 | print '<tr>'; |
1811 | 1811 | // Amount HT |
1812 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; |
|
1813 | - print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
1812 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; |
|
1813 | + print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
1814 | 1814 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
1815 | 1815 | // Multicurrency Amount HT |
1816 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
1816 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
1817 | 1817 | } |
1818 | 1818 | print '</tr>'; |
1819 | 1819 | |
1820 | 1820 | print '<tr>'; |
1821 | 1821 | // Amount VAT |
1822 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>'; |
|
1823 | - print '<td class="nowrap amountcard right">' . price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
1822 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountVAT').'</td>'; |
|
1823 | + print '<td class="nowrap amountcard right">'.price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
1824 | 1824 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
1825 | 1825 | // Multicurrency Amount VAT |
1826 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
1826 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
1827 | 1827 | } |
1828 | 1828 | print '</tr>'; |
1829 | 1829 | |
1830 | 1830 | // Amount Local Taxes |
1831 | 1831 | if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { |
1832 | 1832 | print '<tr>'; |
1833 | - print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
1834 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
1833 | + print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
1834 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
1835 | 1835 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
1836 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
1836 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
1837 | 1837 | } |
1838 | 1838 | print '</tr>'; |
1839 | 1839 | |
1840 | 1840 | if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { |
1841 | 1841 | print '<tr>'; |
1842 | - print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
1843 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
1842 | + print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
1843 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
1844 | 1844 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
1845 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
1845 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
1846 | 1846 | } |
1847 | 1847 | print '</tr>'; |
1848 | 1848 | } |
@@ -1850,11 +1850,11 @@ discard block |
||
1850 | 1850 | |
1851 | 1851 | print '<tr>'; |
1852 | 1852 | // Amount TTC |
1853 | - print '<td>' . $langs->trans('AmountTTC') . '</td>'; |
|
1854 | - print '<td class="nowrap amountcard right">' . price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
1853 | + print '<td>'.$langs->trans('AmountTTC').'</td>'; |
|
1854 | + print '<td class="nowrap amountcard right">'.price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
1855 | 1855 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
1856 | 1856 | // Multicurrency Amount TTC |
1857 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
1857 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
1858 | 1858 | } |
1859 | 1859 | print '</tr>'; |
1860 | 1860 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * Only common components are here. |
34 | 34 | */ |
35 | 35 | |
36 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; |
|
36 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; |
|
37 | 37 | |
38 | 38 | |
39 | 39 | /** |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | $effs = array(); |
58 | 58 | |
59 | 59 | $sql = "SELECT id, code, libelle as label"; |
60 | - $sql .= " FROM " . $this->db->prefix() . "c_typent"; |
|
61 | - $sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = " . (empty($mysoc->country_id) ? '0' : $mysoc->country_id) . ")"; |
|
60 | + $sql .= " FROM ".$this->db->prefix()."c_typent"; |
|
61 | + $sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id) ? '0' : $mysoc->country_id).")"; |
|
62 | 62 | if ($filter) { |
63 | - $sql .= " " . $filter; |
|
63 | + $sql .= " ".$filter; |
|
64 | 64 | } |
65 | 65 | $sql .= " ORDER by position, id"; |
66 | - dol_syslog(get_class($this) . '::typent_array', LOG_DEBUG); |
|
66 | + dol_syslog(get_class($this).'::typent_array', LOG_DEBUG); |
|
67 | 67 | $resql = $this->db->query($sql); |
68 | 68 | if ($resql) { |
69 | 69 | $num = $this->db->num_rows($resql); |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | $effs = array(); |
107 | 107 | |
108 | 108 | $sql = "SELECT id, code, libelle as label"; |
109 | - $sql .= " FROM " . $this->db->prefix() . "c_effectif"; |
|
109 | + $sql .= " FROM ".$this->db->prefix()."c_effectif"; |
|
110 | 110 | $sql .= " WHERE active = 1"; |
111 | 111 | if ($filter) { |
112 | - $sql .= " " . $filter; |
|
112 | + $sql .= " ".$filter; |
|
113 | 113 | } |
114 | 114 | $sql .= " ORDER BY id ASC"; |
115 | - dol_syslog(get_class($this) . '::effectif_array', LOG_DEBUG); |
|
115 | + dol_syslog(get_class($this).'::effectif_array', LOG_DEBUG); |
|
116 | 116 | $resql = $this->db->query($sql); |
117 | 117 | if ($resql) { |
118 | 118 | $num = $this->db->num_rows($resql); |
@@ -153,13 +153,13 @@ discard block |
||
153 | 153 | // phpcs:enable |
154 | 154 | global $user, $langs; |
155 | 155 | |
156 | - print '<form method="post" action="' . $page . '">'; |
|
156 | + print '<form method="post" action="'.$page.'">'; |
|
157 | 157 | print '<input type="hidden" name="action" value="setprospectlevel">'; |
158 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
158 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
159 | 159 | |
160 | - dol_syslog(get_class($this) . '::form_prospect_level', LOG_DEBUG); |
|
160 | + dol_syslog(get_class($this).'::form_prospect_level', LOG_DEBUG); |
|
161 | 161 | $sql = "SELECT code, label"; |
162 | - $sql .= " FROM " . $this->db->prefix() . "c_prospectlevel"; |
|
162 | + $sql .= " FROM ".$this->db->prefix()."c_prospectlevel"; |
|
163 | 163 | $sql .= " WHERE active > 0"; |
164 | 164 | $sql .= " ORDER BY sortorder"; |
165 | 165 | $resql = $this->db->query($sql); |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | dol_print_error($this->db); |
186 | 186 | } |
187 | 187 | if (!empty($htmlname) && $user->admin) { |
188 | - print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
188 | + print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
189 | 189 | } |
190 | - print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">'; |
|
190 | + print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">'; |
|
191 | 191 | print '</form>'; |
192 | 192 | } |
193 | 193 | |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | { |
205 | 205 | global $user, $langs; |
206 | 206 | |
207 | - print '<form method="post" action="' . $page . '">'; |
|
207 | + print '<form method="post" action="'.$page.'">'; |
|
208 | 208 | print '<input type="hidden" name="action" value="setprospectcontactlevel">'; |
209 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
209 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
210 | 210 | |
211 | 211 | dol_syslog(__METHOD__, LOG_DEBUG); |
212 | 212 | $sql = "SELECT code, label"; |
213 | - $sql .= " FROM " . $this->db->prefix() . "c_prospectcontactlevel"; |
|
213 | + $sql .= " FROM ".$this->db->prefix()."c_prospectcontactlevel"; |
|
214 | 214 | $sql .= " WHERE active > 0"; |
215 | 215 | $sql .= " ORDER BY sortorder"; |
216 | 216 | $resql = $this->db->query($sql); |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | dol_print_error($this->db); |
237 | 237 | } |
238 | 238 | if (!empty($htmlname) && $user->admin) { |
239 | - print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
239 | + print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
240 | 240 | } |
241 | - print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">'; |
|
241 | + print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">'; |
|
242 | 242 | print '</form>'; |
243 | 243 | } |
244 | 244 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // phpcs:enable |
280 | 280 | global $conf, $langs, $user; |
281 | 281 | |
282 | - dol_syslog(get_class($this) . "::select_departement selected=" . $selected . ", country_codeid=" . $country_codeid, LOG_DEBUG); |
|
282 | + dol_syslog(get_class($this)."::select_departement selected=".$selected.", country_codeid=".$country_codeid, LOG_DEBUG); |
|
283 | 283 | |
284 | 284 | $langs->load("dict"); |
285 | 285 | |
@@ -287,28 +287,28 @@ discard block |
||
287 | 287 | |
288 | 288 | // Search departements/cantons/province active d'une region et pays actif |
289 | 289 | $sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM"; |
290 | - $sql .= " " . $this->db->prefix() . "c_departements as d, " . $this->db->prefix() . "c_regions as r," . $this->db->prefix() . "c_country as c"; |
|
290 | + $sql .= " ".$this->db->prefix()."c_departements as d, ".$this->db->prefix()."c_regions as r,".$this->db->prefix()."c_country as c"; |
|
291 | 291 | $sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid"; |
292 | 292 | $sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1"; |
293 | 293 | if ($country_codeid && is_numeric($country_codeid)) { |
294 | - $sql .= " AND c.rowid = '" . $this->db->escape($country_codeid) . "'"; |
|
294 | + $sql .= " AND c.rowid = '".$this->db->escape($country_codeid)."'"; |
|
295 | 295 | } |
296 | 296 | if ($country_codeid && !is_numeric($country_codeid)) { |
297 | - $sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'"; |
|
297 | + $sql .= " AND c.code = '".$this->db->escape($country_codeid)."'"; |
|
298 | 298 | } |
299 | 299 | $sql .= " ORDER BY c.code, d.code_departement"; |
300 | 300 | |
301 | 301 | $result = $this->db->query($sql); |
302 | 302 | if ($result) { |
303 | 303 | if (!empty($htmlname)) { |
304 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">'; |
|
304 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">'; |
|
305 | 305 | } |
306 | 306 | if ($country_codeid) { |
307 | 307 | $out .= '<option value="0"> </option>'; |
308 | 308 | } |
309 | 309 | $num = $this->db->num_rows($result); |
310 | 310 | $i = 0; |
311 | - dol_syslog(get_class($this) . "::select_departement num=" . $num, LOG_DEBUG); |
|
311 | + dol_syslog(get_class($this)."::select_departement num=".$num, LOG_DEBUG); |
|
312 | 312 | if ($num) { |
313 | 313 | $country = ''; |
314 | 314 | while ($i < $num) { |
@@ -319,15 +319,15 @@ discard block |
||
319 | 319 | if (!$country || $country != $obj->country) { |
320 | 320 | // Show break if we are in list with multiple countries |
321 | 321 | if (!$country_codeid && $obj->country_code) { |
322 | - $out .= '<option value="-1" disabled data-html="----- ' . $obj->country . ' -----">----- ' . $obj->country . " -----</option>\n"; |
|
322 | + $out .= '<option value="-1" disabled data-html="----- '.$obj->country.' -----">----- '.$obj->country." -----</option>\n"; |
|
323 | 323 | $country = $obj->country; |
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | 327 | if (!empty($selected) && $selected == $obj->rowid) { |
328 | - $out .= '<option value="' . $obj->rowid . '" selected>'; |
|
328 | + $out .= '<option value="'.$obj->rowid.'" selected>'; |
|
329 | 329 | } else { |
330 | - $out .= '<option value="' . $obj->rowid . '">'; |
|
330 | + $out .= '<option value="'.$obj->rowid.'">'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default |
@@ -336,13 +336,13 @@ discard block |
||
336 | 336 | (getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || getDolGlobalString('MAIN_SHOW_STATE_CODE') === 'all') |
337 | 337 | ) { |
338 | 338 | if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) { |
339 | - $out .= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
339 | + $out .= $obj->region_name.' - '.$obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
340 | 340 | } else { |
341 | - $out .= $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
341 | + $out .= $obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
342 | 342 | } |
343 | 343 | } else { |
344 | 344 | if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) { |
345 | - $out .= $obj->region_name . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
345 | + $out .= $obj->region_name.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
|
346 | 346 | } else { |
347 | 347 | $out .= ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : '')); |
348 | 348 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $out .= '</select>'; |
358 | 358 | } |
359 | 359 | if (!empty($htmlname) && $user->admin) { |
360 | - $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
360 | + $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
361 | 361 | } |
362 | 362 | } else { |
363 | 363 | dol_print_error($this->db); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | |
366 | 366 | // Make select dynamic |
367 | 367 | if (!empty($htmlname)) { |
368 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
368 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
369 | 369 | $out .= ajax_combobox($htmlname); |
370 | 370 | } |
371 | 371 | |
@@ -418,14 +418,14 @@ discard block |
||
418 | 418 | $langs->load("dict"); |
419 | 419 | |
420 | 420 | $sql = "SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country"; |
421 | - $sql .= " FROM " . $this->db->prefix() . "c_regions as r, " . $this->db->prefix() . "c_country as c"; |
|
421 | + $sql .= " FROM ".$this->db->prefix()."c_regions as r, ".$this->db->prefix()."c_country as c"; |
|
422 | 422 | $sql .= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1"; |
423 | 423 | $sql .= " ORDER BY c.code, c.label ASC"; |
424 | 424 | |
425 | - dol_syslog(get_class($this) . "::select_region", LOG_DEBUG); |
|
425 | + dol_syslog(get_class($this)."::select_region", LOG_DEBUG); |
|
426 | 426 | $resql = $this->db->query($sql); |
427 | 427 | if ($resql) { |
428 | - print '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">'; |
|
428 | + print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
429 | 429 | $num = $this->db->num_rows($resql); |
430 | 430 | $i = 0; |
431 | 431 | if ($num) { |
@@ -437,16 +437,16 @@ discard block |
||
437 | 437 | } else { |
438 | 438 | if ($country == '' || $country != $obj->country) { |
439 | 439 | // Show break |
440 | - $key = $langs->trans("Country" . strtoupper($obj->country_code)); |
|
441 | - $valuetoshow = ($key != "Country" . strtoupper($obj->country_code)) ? $obj->country_code . " - " . $key : $obj->country; |
|
442 | - print '<option value="-2" disabled>----- ' . $valuetoshow . " -----</option>\n"; |
|
440 | + $key = $langs->trans("Country".strtoupper($obj->country_code)); |
|
441 | + $valuetoshow = ($key != "Country".strtoupper($obj->country_code)) ? $obj->country_code." - ".$key : $obj->country; |
|
442 | + print '<option value="-2" disabled>----- '.$valuetoshow." -----</option>\n"; |
|
443 | 443 | $country = $obj->country; |
444 | 444 | } |
445 | 445 | |
446 | 446 | if ($selected > 0 && $selected == $obj->code) { |
447 | - print '<option value="' . $obj->code . '" selected>' . $obj->label . '</option>'; |
|
447 | + print '<option value="'.$obj->code.'" selected>'.$obj->label.'</option>'; |
|
448 | 448 | } else { |
449 | - print '<option value="' . $obj->code . '">' . $obj->label . '</option>'; |
|
449 | + print '<option value="'.$obj->code.'">'.$obj->label.'</option>'; |
|
450 | 450 | } |
451 | 451 | } |
452 | 452 | $i++; |
@@ -477,13 +477,13 @@ discard block |
||
477 | 477 | |
478 | 478 | $out = ''; |
479 | 479 | |
480 | - $sql = "SELECT rowid, code, label, active FROM " . $this->db->prefix() . "c_civility"; |
|
480 | + $sql = "SELECT rowid, code, label, active FROM ".$this->db->prefix()."c_civility"; |
|
481 | 481 | $sql .= " WHERE active = 1"; |
482 | 482 | |
483 | 483 | dol_syslog("Form::select_civility", LOG_DEBUG); |
484 | 484 | $resql = $this->db->query($sql); |
485 | 485 | if ($resql) { |
486 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
486 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
487 | 487 | $out .= '<option value=""> </option>'; |
488 | 488 | $num = $this->db->num_rows($resql); |
489 | 489 | $i = 0; |
@@ -491,12 +491,12 @@ discard block |
||
491 | 491 | while ($i < $num) { |
492 | 492 | $obj = $this->db->fetch_object($resql); |
493 | 493 | if ($selected == $obj->code) { |
494 | - $out .= '<option value="' . $obj->code . '" selected>'; |
|
494 | + $out .= '<option value="'.$obj->code.'" selected>'; |
|
495 | 495 | } else { |
496 | - $out .= '<option value="' . $obj->code . '">'; |
|
496 | + $out .= '<option value="'.$obj->code.'">'; |
|
497 | 497 | } |
498 | 498 | // If translation exists, we use it, otherwise, we use the hard coded label |
499 | - $out .= ($langs->trans("Civility" . $obj->code) != "Civility" . $obj->code ? $langs->trans("Civility" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
499 | + $out .= ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->label != '-' ? $obj->label : '')); |
|
500 | 500 | $out .= '</option>'; |
501 | 501 | $i++; |
502 | 502 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | if ($addjscombo) { |
510 | 510 | // Enhance with select2 |
511 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
511 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
512 | 512 | $out .= ajax_combobox($htmlname); |
513 | 513 | } |
514 | 514 | } else { |
@@ -558,22 +558,22 @@ discard block |
||
558 | 558 | |
559 | 559 | // Lookup the active juridical types for the active countries |
560 | 560 | $sql = "SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code"; |
561 | - $sql .= " FROM " . $this->db->prefix() . "c_forme_juridique as f, " . $this->db->prefix() . "c_country as c"; |
|
561 | + $sql .= " FROM ".$this->db->prefix()."c_forme_juridique as f, ".$this->db->prefix()."c_country as c"; |
|
562 | 562 | $sql .= " WHERE f.fk_pays=c.rowid"; |
563 | 563 | $sql .= " AND f.active = 1 AND c.active = 1"; |
564 | 564 | if ($country_codeid) { |
565 | - $sql .= " AND c.code = '" . $this->db->escape((string) $country_codeid) . "'"; |
|
565 | + $sql .= " AND c.code = '".$this->db->escape((string) $country_codeid)."'"; |
|
566 | 566 | } |
567 | 567 | if ($filter) { |
568 | - $sql .= " " . $filter; |
|
568 | + $sql .= " ".$filter; |
|
569 | 569 | } |
570 | 570 | $sql .= " ORDER BY c.code"; |
571 | 571 | |
572 | - dol_syslog(get_class($this) . "::select_juridicalstatus", LOG_DEBUG); |
|
572 | + dol_syslog(get_class($this)."::select_juridicalstatus", LOG_DEBUG); |
|
573 | 573 | $resql = $this->db->query($sql); |
574 | 574 | if ($resql) { |
575 | 575 | $out .= '<div id="particulier2" class="visible">'; |
576 | - $out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
576 | + $out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
577 | 577 | if ($country_codeid) { |
578 | 578 | $out .= '<option value="0"> </option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select. |
579 | 579 | } |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | $obj = $this->db->fetch_object($resql); |
588 | 588 | |
589 | 589 | if ($obj->code) { // We exclude empty line, we will add it later |
590 | - $labelcountry = (($langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code) ? $langs->trans("Country" . $obj->country_code) : $obj->country); |
|
591 | - $labeljs = (($langs->trans("JuridicalStatus" . $obj->code) != "JuridicalStatus" . $obj->code) ? $langs->trans("JuridicalStatus" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver) |
|
592 | - $arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry . '_' . $labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry); |
|
590 | + $labelcountry = (($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) ? $langs->trans("Country".$obj->country_code) : $obj->country); |
|
591 | + $labeljs = (($langs->trans("JuridicalStatus".$obj->code) != "JuridicalStatus".$obj->code) ? $langs->trans("JuridicalStatus".$obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver) |
|
592 | + $arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry.'_'.$labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry); |
|
593 | 593 | } |
594 | 594 | $i++; |
595 | 595 | } |
@@ -603,15 +603,15 @@ discard block |
||
603 | 603 | if (!$country || $country != $val['country']) { |
604 | 604 | // Show break when we are in multi country mode |
605 | 605 | if (empty($country_codeid) && $val['country_code']) { |
606 | - $out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- ' . $val['country'] . " -----</option>\n"; |
|
606 | + $out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val['country']." -----</option>\n"; |
|
607 | 607 | $country = $val['country']; |
608 | 608 | } |
609 | 609 | } |
610 | 610 | |
611 | 611 | if ($selected > 0 && $selected == $val['code']) { |
612 | - $out .= '<option value="' . $val['code'] . '" selected>'; |
|
612 | + $out .= '<option value="'.$val['code'].'" selected>'; |
|
613 | 613 | } else { |
614 | - $out .= '<option value="' . $val['code'] . '">'; |
|
614 | + $out .= '<option value="'.$val['code'].'">'; |
|
615 | 615 | } |
616 | 616 | // If translation exists, we use it, otherwise we use default label in database |
617 | 617 | $out .= $val['label']; |
@@ -620,11 +620,11 @@ discard block |
||
620 | 620 | } |
621 | 621 | $out .= '</select>'; |
622 | 622 | if ($user->admin) { |
623 | - $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
623 | + $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | // Make select dynamic |
627 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
627 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
628 | 628 | $out .= ajax_combobox($htmlname); |
629 | 629 | |
630 | 630 | $out .= '</div>'; |
@@ -678,13 +678,13 @@ discard block |
||
678 | 678 | $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); |
679 | 679 | |
680 | 680 | if (count($events)) { // If there is some ajax events to run once selection is done, we add code here to run events |
681 | - print '<script nonce="' . getNonce() . '" type="text/javascript"> |
|
681 | + print '<script nonce="'.getNonce().'" type="text/javascript"> |
|
682 | 682 | jQuery(document).ready(function() { |
683 | - $("#search_' . $htmlname . '").change(function() { |
|
684 | - var obj = ' . json_encode($events) . '; |
|
683 | + $("#search_' . $htmlname.'").change(function() { |
|
684 | + var obj = ' . json_encode($events).'; |
|
685 | 685 | $.each(obj, function(key,values) { |
686 | 686 | if (values.method.length) { |
687 | - runJsCodeForEvent' . $htmlname . '(values); |
|
687 | + runJsCodeForEvent' . $htmlname.'(values); |
|
688 | 688 | } |
689 | 689 | }); |
690 | 690 | |
@@ -692,13 +692,13 @@ discard block |
||
692 | 692 | }); |
693 | 693 | |
694 | 694 | // Function used to execute events when search_htmlname change |
695 | - function runJsCodeForEvent' . $htmlname . '(obj) { |
|
696 | - var id = $("#' . $htmlname . '").val(); |
|
695 | + function runJsCodeForEvent' . $htmlname.'(obj) { |
|
696 | + var id = $("#' . $htmlname.'").val(); |
|
697 | 697 | var method = obj.method; |
698 | 698 | var url = obj.url; |
699 | 699 | var htmlname = obj.htmlname; |
700 | 700 | var showempty = obj.showempty; |
701 | - console.log("Run runJsCodeForEvent-' . $htmlname . ' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname); |
|
701 | + console.log("Run runJsCodeForEvent-' . $htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname); |
|
702 | 702 | $.getJSON(url, |
703 | 703 | { |
704 | 704 | action: method, |
@@ -728,9 +728,9 @@ discard block |
||
728 | 728 | </script>'; |
729 | 729 | } |
730 | 730 | |
731 | - print "\n" . '<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->' . "\n"; |
|
732 | - print '<input type="text" size="30" id="search_' . $htmlname . '" name="search_' . $htmlname . '" value="' . $name . '" />'; |
|
733 | - print ajax_autocompleter((string) ($socid ? $socid : -1), $htmlname, DOL_URL_ROOT . '/societe/ajax/ajaxcompanies.php', '', $minLength, 0); |
|
731 | + print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n"; |
|
732 | + print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$name.'" />'; |
|
733 | + print ajax_autocompleter((string) ($socid ? $socid : -1), $htmlname, DOL_URL_ROOT.'/societe/ajax/ajaxcompanies.php', '', $minLength, 0); |
|
734 | 734 | return $socid; |
735 | 735 | } else { |
736 | 736 | // Search to list thirdparties |
@@ -742,18 +742,18 @@ discard block |
||
742 | 742 | $sql .= ", s.address, s.zip, s.town"; |
743 | 743 | $sql .= ", dictp.code as country_code"; |
744 | 744 | } |
745 | - $sql .= " FROM " . $this->db->prefix() . "societe as s"; |
|
745 | + $sql .= " FROM ".$this->db->prefix()."societe as s"; |
|
746 | 746 | if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { |
747 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
747 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays"; |
|
748 | 748 | } |
749 | - $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; |
|
749 | + $sql .= " WHERE s.entity IN (".getEntity('societe').")"; |
|
750 | 750 | // For ajax search we limit here. For combo list, we limit later |
751 | 751 | if (is_array($limitto) && count($limitto)) { |
752 | - $sql .= " AND s.rowid IN (" . $this->db->sanitize(implode(',', $limitto)) . ")"; |
|
752 | + $sql .= " AND s.rowid IN (".$this->db->sanitize(implode(',', $limitto)).")"; |
|
753 | 753 | } |
754 | 754 | // filter user access |
755 | 755 | if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) { |
756 | - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user = ".(int) $user->id .")"; |
|
756 | + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = s.rowid AND sc.fk_user = ".(int) $user->id.")"; |
|
757 | 757 | } |
758 | 758 | if ($user->socid > 0) { |
759 | 759 | $sql .= " AND s.rowid = ".((int) $user->socid); |
@@ -766,17 +766,17 @@ discard block |
||
766 | 766 | |
767 | 767 | $resql = $this->db->query($sql); |
768 | 768 | if ($resql) { |
769 | - print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"'; |
|
769 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'; |
|
770 | 770 | if ($conf->use_javascript_ajax) { |
771 | - $javaScript = "window.location='" . dol_escape_js($_SERVER['PHP_SELF']) . "?" . $var_id . "=" . ($forceid > 0 ? $forceid : $object->id) . $moreparam . "&" . $htmlname . "=' + form." . $htmlname . ".options[form." . $htmlname . ".selectedIndex].value;"; |
|
772 | - print ' onChange="' . $javaScript . '"'; |
|
771 | + $javaScript = "window.location='".dol_escape_js($_SERVER['PHP_SELF'])."?".$var_id."=".($forceid > 0 ? $forceid : $object->id).$moreparam."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;"; |
|
772 | + print ' onChange="'.$javaScript.'"'; |
|
773 | 773 | } |
774 | 774 | print '>'; |
775 | 775 | print '<option value="-1"> </option>'; |
776 | 776 | |
777 | 777 | $num = $this->db->num_rows($resql); |
778 | 778 | $i = 0; |
779 | - $firstCompany = 0; // For static analysis |
|
779 | + $firstCompany = 0; // For static analysis |
|
780 | 780 | if ($num) { |
781 | 781 | while ($i < $num) { |
782 | 782 | $obj = $this->db->fetch_object($resql); |
@@ -788,18 +788,18 @@ discard block |
||
788 | 788 | $disabled = 1; |
789 | 789 | } |
790 | 790 | if ($selected > 0 && $selected == $obj->rowid) { |
791 | - print '<option value="' . $obj->rowid . '"'; |
|
791 | + print '<option value="'.$obj->rowid.'"'; |
|
792 | 792 | if ($disabled) { |
793 | 793 | print ' disabled'; |
794 | 794 | } |
795 | - print ' selected>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>'; |
|
795 | + print ' selected>'.dol_escape_htmltag($obj->name, 0, 0, '', 0, 1).'</option>'; |
|
796 | 796 | $firstCompany = $obj->rowid; |
797 | 797 | } else { |
798 | - print '<option value="' . $obj->rowid . '"'; |
|
798 | + print '<option value="'.$obj->rowid.'"'; |
|
799 | 799 | if ($disabled) { |
800 | 800 | print ' disabled'; |
801 | 801 | } |
802 | - print '>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>'; |
|
802 | + print '>'.dol_escape_htmltag($obj->name, 0, 0, '', 0, 1).'</option>'; |
|
803 | 803 | } |
804 | 804 | $i++; |
805 | 805 | } |
@@ -834,10 +834,10 @@ discard block |
||
834 | 834 | |
835 | 835 | $out = ''; |
836 | 836 | if (is_object($object) && method_exists($object, 'liste_type_contact')) { |
837 | - '@phan-var-force CommonObject $object'; // CommonObject has the method. |
|
838 | - $lesTypes = $object->liste_type_contact($source, $sortorder, 2, 1); // List of types into c_type_contact for element=$object->element |
|
837 | + '@phan-var-force CommonObject $object'; // CommonObject has the method. |
|
838 | + $lesTypes = $object->liste_type_contact($source, $sortorder, 2, 1); // List of types into c_type_contact for element=$object->element |
|
839 | 839 | |
840 | - $out .= '<select class="flat valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">'; |
|
840 | + $out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
841 | 841 | if ($showempty) { |
842 | 842 | $out .= '<option value="0"> </option>'; |
843 | 843 | } |
@@ -880,9 +880,9 @@ discard block |
||
880 | 880 | if ($rendermode === 'view') { |
881 | 881 | $toprint = array(); |
882 | 882 | foreach ($contact->roles as $key => $val) { |
883 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">' . $val['label'] . '</li>'; |
|
883 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">'.$val['label'].'</li>'; |
|
884 | 884 | } |
885 | - return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="' . $htmlname . '"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
885 | + return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="'.$htmlname.'"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | if ($rendermode === 'edit') { // A multiselect combo list |
@@ -928,14 +928,14 @@ discard block |
||
928 | 928 | |
929 | 929 | $size = ''; |
930 | 930 | if (!empty($fieldsize)) { |
931 | - $size = 'size="' . $fieldsize . '"'; |
|
931 | + $size = 'size="'.$fieldsize.'"'; |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | if ($conf->use_javascript_ajax && empty($disableautocomplete)) { |
935 | - $out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT . '/core/ajax/ziptown.php') . "\n"; |
|
935 | + $out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n"; |
|
936 | 936 | $moreattrib .= ' autocomplete="off"'; |
937 | 937 | } |
938 | - $out .= '<input id="' . $htmlname . '" class="maxwidthonsmartphone' . ($morecss ? ' ' . $morecss : '') . '" type="text"' . ($moreattrib ? ' ' . $moreattrib : '') . ' name="' . $htmlname . '" ' . $size . ' value="' . $selected . '">' . "\n"; |
|
938 | + $out .= '<input id="'.$htmlname.'" class="maxwidthonsmartphone'.($morecss ? ' '.$morecss : '').'" type="text"'.($moreattrib ? ' '.$moreattrib : '').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n"; |
|
939 | 939 | |
940 | 940 | return $out; |
941 | 941 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | $parameters = array('formlength' => $formlength, 'selected' => $preselected, 'idprof' => $idprof, 'htmlname' => $htmlname, 'country_code' => $country_code); |
1013 | 1013 | $reshook = $hookmanager->executeHooks('getInputIdProf', $parameters); |
1014 | 1014 | if (empty($reshook)) { |
1015 | - $out .= '<input type="text" ' . ($morecss ? 'class="' . $morecss . '" ' : '') . 'name="' . $htmlname . '" id="' . $htmlname . '" maxlength="' . $maxlength . '" value="' . $selected . '">'; |
|
1015 | + $out .= '<input type="text" '.($morecss ? 'class="'.$morecss.'" ' : '').'name="'.$htmlname.'" id="'.$htmlname.'" maxlength="'.$maxlength.'" value="'.$selected.'">'; |
|
1016 | 1016 | } |
1017 | 1017 | $out .= $hookmanager->resPrint; |
1018 | 1018 | |
@@ -1043,9 +1043,9 @@ discard block |
||
1043 | 1043 | $i = 0; |
1044 | 1044 | while ($i < $nbvalues) { |
1045 | 1045 | if ($selected == $valors[$i]) { |
1046 | - print '<option value="' . $valors[$i] . '" selected>'; |
|
1046 | + print '<option value="'.$valors[$i].'" selected>'; |
|
1047 | 1047 | } else { |
1048 | - print '<option value="' . $valors[$i] . '">'; |
|
1048 | + print '<option value="'.$valors[$i].'">'; |
|
1049 | 1049 | } |
1050 | 1050 | print $valors[$i]; |
1051 | 1051 | print '</option>'; |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | return ''; |
1075 | 1075 | } |
1076 | 1076 | |
1077 | - $out = '<select class="flat ' . $morecss . '" name="' . $htmlname . '" id="' . $htmlidname . '">'; |
|
1077 | + $out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">'; |
|
1078 | 1078 | if ($typeinput == 'form') { |
1079 | 1079 | if ($allowempty || ($selected == '' || $selected == '-1')) { |
1080 | 1080 | $out .= '<option value="-1">'; |
@@ -1086,33 +1086,33 @@ discard block |
||
1086 | 1086 | $out .= '</option>'; |
1087 | 1087 | } |
1088 | 1088 | if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) { |
1089 | - $out .= '<option value="2"' . ($selected == 2 ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>'; |
|
1089 | + $out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>'; |
|
1090 | 1090 | } |
1091 | 1091 | if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) { |
1092 | - $out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>'; |
|
1092 | + $out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>'; |
|
1093 | 1093 | } |
1094 | 1094 | if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { |
1095 | - $out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>'; |
|
1095 | + $out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>'; |
|
1096 | 1096 | } |
1097 | - $out .= '<option value="0"' . ((string) $selected == '0' ? ' selected' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>'; |
|
1097 | + $out .= '<option value="0"'.((string) $selected == '0' ? ' selected' : '').'>'.$langs->trans('NorProspectNorCustomer').'</option>'; |
|
1098 | 1098 | } elseif ($typeinput == 'list') { |
1099 | - $out .= '<option value="-1"' . (($selected == '' || $selected == '-1') ? ' selected' : '') . '> </option>'; |
|
1099 | + $out .= '<option value="-1"'.(($selected == '' || $selected == '-1') ? ' selected' : '').'> </option>'; |
|
1100 | 1100 | if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) { |
1101 | - $out .= '<option value="2,3"' . ($selected == '2,3' ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>'; |
|
1101 | + $out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>'; |
|
1102 | 1102 | } |
1103 | 1103 | if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { |
1104 | - $out .= '<option value="1,3"' . ($selected == '1,3' ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>'; |
|
1104 | + $out .= '<option value="1,3"'.($selected == '1,3' ? ' selected' : '').'>'.$langs->trans('Customer').'</option>'; |
|
1105 | 1105 | } |
1106 | 1106 | if (isModEnabled("fournisseur")) { |
1107 | - $out .= '<option value="4"' . ($selected == '4' ? ' selected' : '') . '>' . $langs->trans('Supplier') . '</option>'; |
|
1107 | + $out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>'; |
|
1108 | 1108 | } |
1109 | - $out .= '<option value="0"' . ($selected == '0' ? ' selected' : '') . '>' . $langs->trans('Other') . '</option>'; |
|
1109 | + $out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>'; |
|
1110 | 1110 | } elseif ($typeinput == 'admin') { |
1111 | 1111 | if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) { |
1112 | - $out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>'; |
|
1112 | + $out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>'; |
|
1113 | 1113 | } |
1114 | 1114 | if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { |
1115 | - $out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>'; |
|
1115 | + $out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>'; |
|
1116 | 1116 | } |
1117 | 1117 | } |
1118 | 1118 | $out .= '</select>'; |
@@ -1138,12 +1138,12 @@ discard block |
||
1138 | 1138 | |
1139 | 1139 | $out = ''; |
1140 | 1140 | if ($htmlname != "none") { |
1141 | - $out .= '<form method="post" action="' . $page . '">'; |
|
1141 | + $out .= '<form method="post" action="'.$page.'">'; |
|
1142 | 1142 | $out .= '<input type="hidden" name="action" value="set_thirdpartytype">'; |
1143 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
1143 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
1144 | 1144 | $sortparam = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. |
1145 | 1145 | $out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1); |
1146 | - $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
1146 | + $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
1147 | 1147 | $out .= '</form>'; |
1148 | 1148 | } else { |
1149 | 1149 | if ($selected > 0) { |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | |
1183 | 1183 | //print $prospectstatic->LibProspCommStatut($statusprospect, 2, $prospectstatic->cacheprospectstatus[$statusprospect]['label'], $prospectstatic->cacheprospectstatus[$statusprospect]['picto']); |
1184 | 1184 | print img_action('', $actioncode, $actionpicto, 'class="inline-block valignmiddle paddingright pictoprospectstatus"'); |
1185 | - print '<select class="flat selectprospectstatus maxwidth150" id="'. $htmlname.$idprospect .'" data-socid="'.$idprospect.'" name="' . $htmlname .'"'; |
|
1185 | + print '<select class="flat selectprospectstatus maxwidth150" id="'.$htmlname.$idprospect.'" data-socid="'.$idprospect.'" name="'.$htmlname.'"'; |
|
1186 | 1186 | if (!$user->hasRight('societe', 'creer')) { |
1187 | 1187 | print ' disabled'; |
1188 | 1188 | } |
@@ -1212,8 +1212,8 @@ discard block |
||
1212 | 1212 | var image = $(this).prev(".pictoprospectstatus"); |
1213 | 1213 | $.ajax({ |
1214 | 1214 | type: "POST", |
1215 | - url: \'' . DOL_URL_ROOT . '/core/ajax/ajaxstatusprospect.php\', |
|
1216 | - data: { id: statusid, prospectid: prospectid, token: \''. newToken() .'\', action: \'updatestatusprospect\' }, |
|
1215 | + url: \'' . DOL_URL_ROOT.'/core/ajax/ajaxstatusprospect.php\', |
|
1216 | + data: { id: statusid, prospectid: prospectid, token: \''. newToken().'\', action: \'updatestatusprospect\' }, |
|
1217 | 1217 | success: function(response) { |
1218 | 1218 | console.log(response.img); |
1219 | 1219 | image.replaceWith(response.img); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | { |
105 | 105 | global $db, $langs; |
106 | 106 | |
107 | - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php'; |
|
107 | + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; |
|
108 | 108 | |
109 | 109 | $bookkeeping = new BookKeeping($db); |
110 | 110 | $bookkeeping->initAsSpecimen(); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | // Get entities |
142 | 142 | //$entity = getEntity('accountingbookkeeping', 1, $object); |
143 | - $entity = $conf->entity; // In accountancy, we can't share entities |
|
143 | + $entity = $conf->entity; // In accountancy, we can't share entities |
|
144 | 144 | |
145 | 145 | $numFinal = get_next_value($db, $mask, 'accounting_bookkeeping', 'ref', '', '', $object->doc_date, 'next', false, null, (string) $entity, $object); |
146 | 146 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // Get entities |
126 | 126 | //$entity = getEntity('invoicenumber', 1, $object); |
127 | - $entity = $conf->entity; // In accountancy, we never share entities |
|
127 | + $entity = $conf->entity; // In accountancy, we never share entities |
|
128 | 128 | $numFinal = get_next_value($db, $mask, 'accounting_bookkeeping', 'ref', $where, null, $object->doc_date, $mode, false, null, (string) $entity, $object); |
129 | 129 | if (!preg_match('/([0-9])+/', $numFinal)) { |
130 | 130 | $this->error = $numFinal; |
@@ -146,6 +146,6 @@ discard block |
||
146 | 146 | $docYear = (int) dol_print_date($object->doc_date, '%Y'); |
147 | 147 | $docMonth = (int) dol_print_date($object->doc_date, '%m'); |
148 | 148 | $docFiscalYear = $docMonth < $fiscalStartMonth ? ($docYear - 1) : $docYear; |
149 | - return $docFiscalYear . str_pad($object->code_journal, 3, "0", STR_PAD_LEFT); |
|
149 | + return $docFiscalYear.str_pad($object->code_journal, 3, "0", STR_PAD_LEFT); |
|
150 | 150 | } |
151 | 151 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; |
499 | 499 | if ($classinstance->id != '') { // id may be 0, it is a found value |
500 | 500 | $newval = $classinstance->id; |
501 | - } elseif (! $error) { |
|
501 | + } elseif (!$error) { |
|
502 | 502 | if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { |
503 | 503 | $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); |
504 | 504 | } elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) { |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | $classinstance = new $class($this->db); |
673 | 673 | $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, ($key - 1))); |
674 | 674 | if (empty($classinstance->error) && empty($classinstance->errors)) { |
675 | - $newval = $res; // We get new value computed. |
|
675 | + $newval = $res; // We get new value computed. |
|
676 | 676 | } else { |
677 | 677 | $this->errors[$error]['type'] = 'CLASSERROR'; |
678 | 678 | $this->errors[$error]['lib'] = implode( |
@@ -770,12 +770,12 @@ discard block |
||
770 | 770 | if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { |
771 | 771 | if (!in_array("socialnetworks", $listfields)) { |
772 | 772 | $listfields[] = "socialnetworks"; |
773 | - $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array |
|
773 | + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array |
|
774 | 774 | $listvalues[$socialkey] = ''; |
775 | 775 | } |
776 | 776 | //var_dump($newval); var_dump($arrayrecord[($key - 1)]['type']); |
777 | 777 | if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) { |
778 | - $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array |
|
778 | + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array |
|
779 | 779 | //var_dump('sk='.$socialkey); // socialkey=19 |
780 | 780 | $socialnetwork = explode("_", $fieldname)[1]; |
781 | 781 | if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { |
@@ -810,10 +810,10 @@ discard block |
||
810 | 810 | if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { |
811 | 811 | // Loop on each hidden fields to add them into listfields/listvalues |
812 | 812 | foreach ($objimport->array_import_fieldshidden[0] as $tmpkey => $tmpval) { |
813 | - if (!preg_match('/^' . preg_quote($alias, '/') . '\./', $tmpkey)) { |
|
813 | + if (!preg_match('/^'.preg_quote($alias, '/').'\./', $tmpkey)) { |
|
814 | 814 | continue; // Not a field of current table |
815 | 815 | } |
816 | - $keyfield = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $tmpkey); |
|
816 | + $keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $tmpkey); |
|
817 | 817 | |
818 | 818 | if (in_array($keyfield, $listfields)) { // avoid duplicates in insert |
819 | 819 | continue; |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | $type = $objimport->array_import_convertvalue[0][$fieldname]['type']; |
841 | 841 | $resultload = dol_include_once($file); |
842 | 842 | if (empty($resultload)) { |
843 | - dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); |
|
843 | + dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method); |
|
844 | 844 | break; |
845 | 845 | } |
846 | 846 | $classinstance = new $class($this->db); |
@@ -901,8 +901,8 @@ discard block |
||
901 | 901 | if (empty($lastinsertid)) { // No insert done yet for a parent table |
902 | 902 | $sqlSelect = "SELECT ".$fname." FROM ".$tablename; |
903 | 903 | $data = array_combine($listfields, $listvalues); |
904 | - $where = array(); // filters to forge SQL request |
|
905 | - $filters = array(); // filters to forge output error message |
|
904 | + $where = array(); // filters to forge SQL request |
|
905 | + $filters = array(); // filters to forge output error message |
|
906 | 906 | foreach ($updatekeys as $key) { |
907 | 907 | $col = $objimport->array_import_updatekeys[0][$key]; |
908 | 908 | $key = preg_replace('/^.*\./i', '', $key); |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | // We db escape social network field because he isn't in field creation |
993 | 993 | if (in_array("socialnetworks", $listfields)) { |
994 | 994 | $socialkey = array_search("socialnetworks", $listfields); |
995 | - $tmpsql = $listvalues[$socialkey]; |
|
995 | + $tmpsql = $listvalues[$socialkey]; |
|
996 | 996 | $listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'"; |
997 | 997 | } |
998 | 998 | |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | $data = array_combine($listfields, $listvalues); |
1003 | 1003 | $set = array(); |
1004 | 1004 | foreach ($data as $key => $val) { |
1005 | - $set[] = $key." = ".$val; // $val was escaped/sanitized previously |
|
1005 | + $set[] = $key." = ".$val; // $val was escaped/sanitized previously |
|
1006 | 1006 | } |
1007 | 1007 | $sqlstart .= " SET ".implode(', ', $set).", import_key = '".$this->db->escape($importid)."'"; |
1008 | 1008 | if (empty($keyfield)) { |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | |
1014 | 1014 | if ($is_table_category_link) { |
1015 | 1015 | '@phan-var-force string[] $where'; |
1016 | - $sqlend = " WHERE " . implode(' AND ', $where); |
|
1016 | + $sqlend = " WHERE ".implode(' AND ', $where); |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | if (!empty($tablewithentity_cache[$tablename])) { |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | // We db escape social network field because he isn't in field creation |
1042 | 1042 | if (in_array("socialnetworks", $listfields)) { |
1043 | 1043 | $socialkey = array_search("socialnetworks", $listfields); |
1044 | - $tmpsql = $listvalues[$socialkey]; |
|
1044 | + $tmpsql = $listvalues[$socialkey]; |
|
1045 | 1045 | $listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'"; |
1046 | 1046 | } |
1047 | 1047 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | use PhpOffice\PhpSpreadsheet\Style\Alignment; |
33 | 33 | use PhpOffice\PhpSpreadsheet\Shared\Date; |
34 | 34 | |
35 | -require_once DOL_DOCUMENT_ROOT . '/core/modules/import/modules_import.php'; |
|
35 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php'; |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | // phpcs:enable |
176 | 176 | global $user, $conf, $langs, $file; |
177 | 177 | // create a temporary object, the final output will be generated in footer |
178 | - $this->workbook->getProperties()->setCreator($user->getFullName($outputlangs) . ' - Dolibarr ' . DOL_VERSION); |
|
179 | - $this->workbook->getProperties()->setTitle($outputlangs->trans("Import") . ' - ' . $file); |
|
180 | - $this->workbook->getProperties()->setSubject($outputlangs->trans("Import") . ' - ' . $file); |
|
181 | - $this->workbook->getProperties()->setDescription($outputlangs->trans("Import") . ' - ' . $file); |
|
178 | + $this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION); |
|
179 | + $this->workbook->getProperties()->setTitle($outputlangs->trans("Import").' - '.$file); |
|
180 | + $this->workbook->getProperties()->setSubject($outputlangs->trans("Import").' - '.$file); |
|
181 | + $this->workbook->getProperties()->setDescription($outputlangs->trans("Import").' - '.$file); |
|
182 | 182 | |
183 | 183 | $this->workbook->setActiveSheetIndex(0); |
184 | 184 | $this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet")); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | // phpcs:enable |
271 | 271 | $ret = 1; |
272 | 272 | |
273 | - dol_syslog(get_class($this) . "::open_file file=" . $file); |
|
273 | + dol_syslog(get_class($this)."::open_file file=".$file); |
|
274 | 274 | |
275 | 275 | $reader = new Xlsx(); |
276 | 276 | $this->workbook = $reader->load($file); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | |
436 | 436 | // Define $tablewithentity_cache[$tablename] if not already defined |
437 | 437 | if (!isset($tablewithentity_cache[$tablename])) { // keep this test with "isset" |
438 | - dol_syslog("Check if table " . $tablename . " has an entity field"); |
|
438 | + dol_syslog("Check if table ".$tablename." has an entity field"); |
|
439 | 439 | $resql = $this->db->DDLDescTable($tablename, 'entity'); |
440 | 440 | if ($resql) { |
441 | 441 | $obj = $this->db->fetch_object($resql); |
@@ -508,12 +508,12 @@ discard block |
||
508 | 508 | $file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']); |
509 | 509 | $class = $objimport->array_import_convertvalue[0][$val]['class']; |
510 | 510 | $method = $objimport->array_import_convertvalue[0][$val]['method']; |
511 | - if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] != '') { |
|
512 | - $newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval]; |
|
511 | + if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] != '') { |
|
512 | + $newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]; |
|
513 | 513 | } else { |
514 | 514 | $resultload = dol_include_once($file); |
515 | 515 | if (empty($resultload)) { |
516 | - dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); |
|
516 | + dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method); |
|
517 | 517 | break; |
518 | 518 | } |
519 | 519 | $classinstance = new $class($this->db); |
@@ -555,12 +555,12 @@ discard block |
||
555 | 555 | $param_array = array('', '', $newval); |
556 | 556 | call_user_func_array(array($classinstance, $method), $param_array); |
557 | 557 | } |
558 | - $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] = $classinstance->id; |
|
558 | + $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id; |
|
559 | 559 | |
560 | 560 | //print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. '; |
561 | 561 | if ($classinstance->id != '') { // id may be 0, it is a found value |
562 | 562 | $newval = $classinstance->id; |
563 | - } elseif (! $error) { |
|
563 | + } elseif (!$error) { |
|
564 | 564 | if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) { |
565 | 565 | // @phan-suppress-next-line PhanPluginSuspiciousParamPosition |
566 | 566 | $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); |
@@ -589,19 +589,19 @@ discard block |
||
589 | 589 | $method = $objimport->array_import_convertvalue[0][$val]['method']; |
590 | 590 | $codefromfield = $objimport->array_import_convertvalue[0][$val]['codefromfield']; |
591 | 591 | $code = $arrayrecord[$arrayfield[$codefromfield]]['val']; |
592 | - if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] != '') { |
|
593 | - $newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval]; |
|
592 | + if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] != '') { |
|
593 | + $newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval]; |
|
594 | 594 | } else { |
595 | 595 | $resultload = dol_include_once($file); |
596 | 596 | if (empty($resultload)) { |
597 | - dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', code=' . $code); |
|
597 | + dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method.', code='.$code); |
|
598 | 598 | break; |
599 | 599 | } |
600 | 600 | $classinstance = new $class($this->db); |
601 | 601 | // Try the fetch from code and ref |
602 | 602 | $param_array = array('', $newval, $code); |
603 | 603 | call_user_func_array(array($classinstance, $method), $param_array); |
604 | - $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] = $classinstance->id; |
|
604 | + $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] = $classinstance->id; |
|
605 | 605 | if ($classinstance->id > 0) { // we found record |
606 | 606 | $newval = $classinstance->id; |
607 | 607 | } else { |
@@ -626,19 +626,19 @@ discard block |
||
626 | 626 | $class = $objimport->array_import_convertvalue[0][$val]['class']; |
627 | 627 | $method = $objimport->array_import_convertvalue[0][$val]['method']; |
628 | 628 | $units = $objimport->array_import_convertvalue[0][$val]['units']; |
629 | - if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] != '') { |
|
630 | - $newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval]; |
|
629 | + if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] != '') { |
|
630 | + $newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]; |
|
631 | 631 | } else { |
632 | 632 | $resultload = dol_include_once($file); |
633 | 633 | if (empty($resultload)) { |
634 | - dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', units=' . $units); |
|
634 | + dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method.', units='.$units); |
|
635 | 635 | break; |
636 | 636 | } |
637 | 637 | $classinstance = new $class($this->db); |
638 | 638 | // Try the fetch from code or ref |
639 | 639 | call_user_func_array(array($classinstance, $method), array('', '', $newval, $units)); |
640 | 640 | $scaleorid = (($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits') ? $classinstance->id : $classinstance->scale); |
641 | - $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] = $scaleorid; |
|
641 | + $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] = $scaleorid; |
|
642 | 642 | //print 'We have made a '.$class.'->'.$method." to get a value from key '".$newval."' and we got '".$scaleorid."'.";exit; |
643 | 643 | if ($classinstance->id > 0) { // we found record |
644 | 644 | $newval = $scaleorid ? $scaleorid : 0; |
@@ -732,13 +732,13 @@ discard block |
||
732 | 732 | $method = $objimport->array_import_convertvalue[0][$val]['method']; |
733 | 733 | $resultload = dol_include_once($file); |
734 | 734 | if (empty($resultload)) { |
735 | - dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); |
|
735 | + dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method); |
|
736 | 736 | break; |
737 | 737 | } |
738 | 738 | $classinstance = new $class($this->db); |
739 | 739 | $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, $key)); |
740 | 740 | if (empty($classinstance->error) && empty($classinstance->errors)) { |
741 | - $newval = $res; // We get new value computed. |
|
741 | + $newval = $res; // We get new value computed. |
|
742 | 742 | } else { |
743 | 743 | $this->errors[$error]['type'] = 'CLASSERROR'; |
744 | 744 | $this->errors[$error]['lib'] = implode( |
@@ -770,16 +770,16 @@ discard block |
||
770 | 770 | $table = $reg[2]; |
771 | 771 | $filter = !empty($reg[3]) ? substr($reg[3], 1) : ''; |
772 | 772 | |
773 | - $cachekey = $field . '@' . $table; |
|
773 | + $cachekey = $field.'@'.$table; |
|
774 | 774 | if (!empty($filter)) { |
775 | - $cachekey .= ':' . $filter; |
|
775 | + $cachekey .= ':'.$filter; |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | // Load content of field@table into cache array |
779 | 779 | if (!is_array($this->cachefieldtable[$cachekey])) { // If content of field@table not already loaded into cache |
780 | - $sql = "SELECT " . $field . " as aliasfield FROM " . $table; |
|
780 | + $sql = "SELECT ".$field." as aliasfield FROM ".$table; |
|
781 | 781 | if (!empty($filter)) { |
782 | - $sql .= ' WHERE ' . $filter; |
|
782 | + $sql .= ' WHERE '.$filter; |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | $resql = $this->db->query($sql); |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | if (!is_array($this->cachefieldtable[$cachekey]) || !in_array($newval, $this->cachefieldtable[$cachekey])) { |
803 | 803 | $tableforerror = $table; |
804 | 804 | if (!empty($filter)) { |
805 | - $tableforerror .= ':' . $filter; |
|
805 | + $tableforerror .= ':'.$filter; |
|
806 | 806 | } |
807 | 807 | // @phan-suppress-next-line PhanPluginSuspiciousParamPosition |
808 | 808 | $this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror); |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | $errorforthistable++; |
811 | 811 | $error++; |
812 | 812 | } |
813 | - } elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) { |
|
813 | + } elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) { |
|
814 | 814 | // If test is just a static regex |
815 | 815 | //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>"; |
816 | 816 | // @phan-suppress-next-line PhanPluginSuspiciousParamPosition |
@@ -839,11 +839,11 @@ discard block |
||
839 | 839 | if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) { |
840 | 840 | if (!in_array("socialnetworks", $listfields)) { |
841 | 841 | $listfields[] = "socialnetworks"; |
842 | - $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 |
|
842 | + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 |
|
843 | 843 | $listvalues[$socialkey] = ''; |
844 | 844 | } |
845 | 845 | if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) { |
846 | - $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 |
|
846 | + $socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19 |
|
847 | 847 | $socialnetwork = explode("_", $fieldname)[1]; |
848 | 848 | if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") { |
849 | 849 | $json = new stdClass(); |
@@ -878,10 +878,10 @@ discard block |
||
878 | 878 | if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) { |
879 | 879 | // Loop on each hidden fields to add them into listfields/listvalues |
880 | 880 | foreach ($objimport->array_import_fieldshidden[0] as $key => $val) { |
881 | - if (!preg_match('/^' . preg_quote($alias, '/') . '\./', $key)) { |
|
881 | + if (!preg_match('/^'.preg_quote($alias, '/').'\./', $key)) { |
|
882 | 882 | continue; // Not a field of current table |
883 | 883 | } |
884 | - $keyfield = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key); |
|
884 | + $keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); |
|
885 | 885 | |
886 | 886 | if (in_array($keyfield, $listfields)) { // avoid duplicates in insert |
887 | 887 | continue; |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | $type = $objimport->array_import_convertvalue[0][$fieldname]['type']; |
910 | 910 | $resultload = dol_include_once($file); |
911 | 911 | if (empty($resultload)) { |
912 | - dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); |
|
912 | + dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method); |
|
913 | 913 | break; |
914 | 914 | } |
915 | 915 | $classinstance = new $class($this->db); |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | } |
946 | 946 | } |
947 | 947 | } else { |
948 | - $this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden'; |
|
948 | + $this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden'; |
|
949 | 949 | $this->errors[$error]['type'] = 'Import profile setup'; |
950 | 950 | $error++; |
951 | 951 | } |
@@ -972,14 +972,14 @@ discard block |
||
972 | 972 | // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) |
973 | 973 | |
974 | 974 | if (empty($lastinsertid)) { // No insert done yet for a parent table |
975 | - $sqlSelect = "SELECT ".$fname." FROM " . $tablename; |
|
975 | + $sqlSelect = "SELECT ".$fname." FROM ".$tablename; |
|
976 | 976 | |
977 | 977 | $data = array_combine($listfields, $listvalues); |
978 | 978 | |
979 | - $where = array(); // filters to forge SQL request |
|
979 | + $where = array(); // filters to forge SQL request |
|
980 | 980 | // @phpstan-ignore-next-line |
981 | 981 | '@phan-var string[] $where'; |
982 | - $filters = array(); // filters to forge output error message |
|
982 | + $filters = array(); // filters to forge output error message |
|
983 | 983 | foreach ($updatekeys as $key) { |
984 | 984 | $col = $objimport->array_import_updatekeys[0][$key]; |
985 | 985 | $key = preg_replace('/^.*\./i', '', $key); |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | $where[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")"; |
1005 | 1005 | $filters[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")"; |
1006 | 1006 | } |
1007 | - $sqlSelect .= " WHERE " . implode(' AND ', $where); |
|
1007 | + $sqlSelect .= " WHERE ".implode(' AND ', $where); |
|
1008 | 1008 | |
1009 | 1009 | $resql = $this->db->query($sqlSelect); |
1010 | 1010 | if ($resql) { |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | // a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record |
1037 | 1037 | // may already exists. So we rescan the extrafield table to know if record exists or not for the rowid. |
1038 | 1038 | // Note: For extrafield tablename, we have in importfieldshidden_array an entry 'extra.fk_object'=>'lastrowid-tableparent' so $keyfield is 'fk_object' |
1039 | - $sqlSelect = "SELECT rowid FROM " . $tablename; |
|
1039 | + $sqlSelect = "SELECT rowid FROM ".$tablename; |
|
1040 | 1040 | if (empty($keyfield)) { |
1041 | 1041 | $keyfield = 'rowid'; |
1042 | 1042 | } |
@@ -1069,35 +1069,35 @@ discard block |
||
1069 | 1069 | // We db escape social network field because he isn't in field creation |
1070 | 1070 | if (in_array("socialnetworks", $listfields)) { |
1071 | 1071 | $socialkey = array_search("socialnetworks", $listfields); |
1072 | - $tmpsql = $listvalues[$socialkey]; |
|
1072 | + $tmpsql = $listvalues[$socialkey]; |
|
1073 | 1073 | $listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'"; |
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | // Build SQL UPDATE request |
1077 | - $sqlstart = "UPDATE " . $tablename; |
|
1077 | + $sqlstart = "UPDATE ".$tablename; |
|
1078 | 1078 | |
1079 | 1079 | $data = array_combine($listfields, $listvalues); |
1080 | 1080 | $set = array(); |
1081 | 1081 | foreach ($data as $key => $val) { |
1082 | - $set[] = $key." = ".$val; // $val was escaped/sanitized previously |
|
1082 | + $set[] = $key." = ".$val; // $val was escaped/sanitized previously |
|
1083 | 1083 | } |
1084 | - $sqlstart .= " SET " . implode(', ', $set) . ", import_key = '" . $this->db->escape($importid) . "'"; |
|
1084 | + $sqlstart .= " SET ".implode(', ', $set).", import_key = '".$this->db->escape($importid)."'"; |
|
1085 | 1085 | if (empty($keyfield)) { |
1086 | 1086 | $keyfield = 'rowid'; |
1087 | 1087 | } |
1088 | 1088 | |
1089 | - $sqlend = " WHERE " . $keyfield . " = ".((int) $lastinsertid); |
|
1089 | + $sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid); |
|
1090 | 1090 | |
1091 | 1091 | if ($is_table_category_link) { |
1092 | 1092 | '@phan-var-force string[] $where'; |
1093 | - $sqlend = " WHERE " . implode(' AND ', $where); |
|
1093 | + $sqlend = " WHERE ".implode(' AND ', $where); |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | if (!empty($tablewithentity_cache[$tablename])) { |
1097 | 1097 | $sqlend .= " AND entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")"; |
1098 | 1098 | } |
1099 | 1099 | |
1100 | - $sql = $sqlstart . $sqlend; |
|
1100 | + $sql = $sqlstart.$sqlend; |
|
1101 | 1101 | |
1102 | 1102 | // Run update request |
1103 | 1103 | $resql = $this->db->query($sql); |
@@ -1118,22 +1118,22 @@ discard block |
||
1118 | 1118 | // We db escape social network field because he isn't in field creation |
1119 | 1119 | if (in_array("socialnetworks", $listfields)) { |
1120 | 1120 | $socialkey = array_search("socialnetworks", $listfields); |
1121 | - $tmpsql = $listvalues[$socialkey]; |
|
1121 | + $tmpsql = $listvalues[$socialkey]; |
|
1122 | 1122 | $listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'"; |
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | // Build SQL INSERT request |
1126 | - $sqlstart = "INSERT INTO " . $tablename . "(" . implode(", ", $listfields) . ", import_key"; |
|
1127 | - $sqlend = ") VALUES(" . implode(', ', $listvalues) . ", '" . $this->db->escape($importid) . "'"; |
|
1126 | + $sqlstart = "INSERT INTO ".$tablename."(".implode(", ", $listfields).", import_key"; |
|
1127 | + $sqlend = ") VALUES(".implode(', ', $listvalues).", '".$this->db->escape($importid)."'"; |
|
1128 | 1128 | if (!empty($tablewithentity_cache[$tablename])) { |
1129 | 1129 | $sqlstart .= ", entity"; |
1130 | - $sqlend .= ", " . $conf->entity; |
|
1130 | + $sqlend .= ", ".$conf->entity; |
|
1131 | 1131 | } |
1132 | 1132 | if (!empty($objimport->array_import_tables_creator[0][$alias])) { |
1133 | - $sqlstart .= ", " . $objimport->array_import_tables_creator[0][$alias]; |
|
1134 | - $sqlend .= ", " . $user->id; |
|
1133 | + $sqlstart .= ", ".$objimport->array_import_tables_creator[0][$alias]; |
|
1134 | + $sqlend .= ", ".$user->id; |
|
1135 | 1135 | } |
1136 | - $sql = $sqlstart . $sqlend . ")"; |
|
1136 | + $sql = $sqlstart.$sqlend.")"; |
|
1137 | 1137 | //dol_syslog("import_xlsx.modules", LOG_DEBUG); |
1138 | 1138 | |
1139 | 1139 | // Run insert request |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | } |
669 | 669 | $txlocaltax1 = price2num($txlocaltax1); |
670 | 670 | $txlocaltax2 = price2num($txlocaltax2); |
671 | - $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht is empty string |
|
671 | + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht is empty string |
|
672 | 672 | if ($price_base_type == 'HT') { |
673 | 673 | $pu = $pu_ht; |
674 | 674 | } else { |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | } |
917 | 917 | $txlocaltax1 = price2num($txlocaltax1); |
918 | 918 | $txlocaltax2 = price2num($txlocaltax2); |
919 | - $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring |
|
919 | + $pa_ht = price2num($pa_ht); // do not convert to float here, it breaks the functioning of $pa_ht_isemptystring |
|
920 | 920 | if (empty($qty) && empty($special_code)) { |
921 | 921 | $special_code = 3; // Set option tag |
922 | 922 | } |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | if ($objsoc->id > 0 && !empty($object->lines)) { |
1514 | 1514 | if ($update_prices === true && getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { |
1515 | 1515 | // If price per customer |
1516 | - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; |
|
1516 | + require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; |
|
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | foreach ($object->lines as $line) { |
@@ -1546,9 +1546,9 @@ discard block |
||
1546 | 1546 | foreach ($prodcustprice->lines as $k => $custprice_line) { |
1547 | 1547 | if ($custprice_line->date_begin <= $date_now && (empty($custprice_line->date_end) || $date_now <= $custprice_line->date_end)) { |
1548 | 1548 | $pu_ht = price($custprice_line->price); |
1549 | - $tva_tx = ($custprice_line->default_vat_code ? $custprice_line->tva_tx . ' (' . $custprice_line->default_vat_code . ' )' : $custprice_line->tva_tx); |
|
1549 | + $tva_tx = ($custprice_line->default_vat_code ? $custprice_line->tva_tx.' ('.$custprice_line->default_vat_code.' )' : $custprice_line->tva_tx); |
|
1550 | 1550 | if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { |
1551 | - $tva_tx .= ' (' . $custprice_line->default_vat_code . ')'; |
|
1551 | + $tva_tx .= ' ('.$custprice_line->default_vat_code.')'; |
|
1552 | 1552 | } |
1553 | 1553 | $remise_percent = $custprice_line->discount_percent; |
1554 | 1554 | break; |
@@ -1714,7 +1714,7 @@ discard block |
||
1714 | 1714 | $this->ref_customer = $obj->ref_client; |
1715 | 1715 | $this->ref_ext = $obj->ref_ext; |
1716 | 1716 | |
1717 | - $this->total = $obj->total_ttc; // TODO deprecated |
|
1717 | + $this->total = $obj->total_ttc; // TODO deprecated |
|
1718 | 1718 | $this->total_ttc = $obj->total_ttc; |
1719 | 1719 | $this->total_ht = $obj->total_ht; |
1720 | 1720 | $this->total_tva = $obj->total_tva; |
@@ -2634,7 +2634,7 @@ discard block |
||
2634 | 2634 | */ |
2635 | 2635 | public function closeProposal($user, $status, $note_private = '', $notrigger = 0, $note_public = '') |
2636 | 2636 | { |
2637 | - global $langs,$conf; |
|
2637 | + global $langs, $conf; |
|
2638 | 2638 | |
2639 | 2639 | $error = 0; |
2640 | 2640 | $now = dol_now(); |
@@ -2669,10 +2669,10 @@ discard block |
||
2669 | 2669 | if ($resql) { |
2670 | 2670 | // Status self::STATUS_REFUSED by default |
2671 | 2671 | $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED', $this->model_pdf); |
2672 | - $triggerName = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() |
|
2672 | + $triggerName = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() |
|
2673 | 2673 | |
2674 | 2674 | if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED |
2675 | - $triggerName = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger() |
|
2675 | + $triggerName = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger() |
|
2676 | 2676 | $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL', $this->model_pdf); |
2677 | 2677 | |
2678 | 2678 | // The connected company is classified as a client |
@@ -2840,10 +2840,10 @@ discard block |
||
2840 | 2840 | |
2841 | 2841 | $this->db->begin(); |
2842 | 2842 | |
2843 | - $sql = "UPDATE ". MAIN_DB_PREFIX . $this->table_element; |
|
2844 | - $sql .= " SET fk_statut = " . self::STATUS_CANCELED . ","; |
|
2845 | - $sql .= " fk_user_modif = " . ((int) $user->id); |
|
2846 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2843 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
|
2844 | + $sql .= " SET fk_statut = ".self::STATUS_CANCELED.","; |
|
2845 | + $sql .= " fk_user_modif = ".((int) $user->id); |
|
2846 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
2847 | 2847 | |
2848 | 2848 | dol_syslog(get_class($this)."::cancel", LOG_DEBUG); |
2849 | 2849 | if ($this->db->query($sql)) { |
@@ -3206,7 +3206,7 @@ discard block |
||
3206 | 3206 | } |
3207 | 3207 | } |
3208 | 3208 | if (file_exists($dir)) { |
3209 | - $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables |
|
3209 | + $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables |
|
3210 | 3210 | if (!$res) { |
3211 | 3211 | $this->error = 'ErrorFailToDeleteDir'; |
3212 | 3212 | $this->errors[] = $this->error; |
@@ -3610,7 +3610,7 @@ discard block |
||
3610 | 3610 | $this->multicurrency_code = $conf->currency; |
3611 | 3611 | |
3612 | 3612 | // Lines |
3613 | - $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
3613 | + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
3614 | 3614 | $xnbp = 0; |
3615 | 3615 | while ($xnbp < $nbp) { |
3616 | 3616 | $line = new PropaleLigne($this->db); |
@@ -3940,7 +3940,7 @@ discard block |
||
3940 | 3940 | } |
3941 | 3941 | |
3942 | 3942 | global $action; |
3943 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
3943 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
3944 | 3944 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
3945 | 3945 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
3946 | 3946 | if ($reshook > 0) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $object->delivery_date = $date_delivery; |
238 | 238 | foreach ($object->lines as $line) { |
239 | 239 | if (isset($line->date_start)) { |
240 | - $line->date_start += $difference; |
|
240 | + $line->date_start += $difference; |
|
241 | 241 | } |
242 | 242 | if (isset($line->date_end)) { |
243 | 243 | $line->date_end += $difference; |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | |
586 | 586 | $classname = ucfirst($subelement); |
587 | 587 | $srcobject = new $classname($db); |
588 | - '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Can be other class, but CommonObject is too generic |
|
588 | + '@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Can be other class, but CommonObject is too generic |
|
589 | 589 | |
590 | 590 | dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); |
591 | 591 | $result = $srcobject->fetch($object->origin_id); |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | $error++; |
776 | 776 | } else { |
777 | 777 | // Needed if object linked modified by trigger (because linked objects can't be fetched two times : linkedObjectsFullLoaded) |
778 | - $locationTarget = DOL_URL_ROOT . '/comm/propal/card.php?id=' . $object->id; |
|
778 | + $locationTarget = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id; |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | $deposit = null; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | !$error && GETPOSTINT('statut') == $object::STATUS_SIGNED && GETPOST('generate_deposit') == 'on' |
787 | 787 | && !empty($deposit_percent_from_payment_terms) && isModEnabled('invoice') && $user->hasRight('facture', 'creer') |
788 | 788 | ) { |
789 | - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
789 | + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
790 | 790 | |
791 | 791 | $date = dol_mktime(0, 0, 0, GETPOSTINT('datefmonth'), GETPOSTINT('datefday'), GETPOSTINT('datefyear')); |
792 | 792 | $forceFields = array(); |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | |
800 | 800 | if ($deposit) { |
801 | 801 | setEventMessage('DepositGenerated'); |
802 | - $locationTarget = DOL_URL_ROOT . '/compta/facture/card.php?id=' . $deposit->id; |
|
802 | + $locationTarget = DOL_URL_ROOT.'/compta/facture/card.php?id='.$deposit->id; |
|
803 | 803 | } else { |
804 | 804 | $error++; |
805 | 805 | setEventMessages("Failed to create down payment - ".$object->error, $object->errors, 'errors'); |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | } |
828 | 828 | |
829 | 829 | if ($locationTarget) { |
830 | - header('Location: ' . $locationTarget); |
|
830 | + header('Location: '.$locationTarget); |
|
831 | 831 | exit; |
832 | 832 | } |
833 | 833 | } else { |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | // $line->subprice = (float) $subprice; |
1045 | 1045 | // $line->multicurrency_subprice = $multicurrency_subprice; |
1046 | 1046 | } |
1047 | - } elseif ( $action == 'addline' && !GETPOST('submitforalllines', 'alpha') |
|
1047 | + } elseif ($action == 'addline' && !GETPOST('submitforalllines', 'alpha') |
|
1048 | 1048 | && !GETPOST('submitforallmargins', 'alpha') && !GETPOST('markforalllines', 'alpha') |
1049 | 1049 | && $usercancreate) { // Add line |
1050 | 1050 | // Set if we used free entry or predefined product |
@@ -1436,7 +1436,7 @@ discard block |
||
1436 | 1436 | $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); |
1437 | 1437 | |
1438 | 1438 | // Margin |
1439 | - $fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only |
|
1439 | + $fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only |
|
1440 | 1440 | $buyingprice = price2num((GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''), '', 2); // If buying_price is '0', we must keep this value |
1441 | 1441 | |
1442 | 1442 | $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | if ($prod->price_min > $line->subprice) { |
1569 | 1569 | $price_subprice = price($line->subprice, 0, $outlangs, 1, -1, -1, 'auto'); |
1570 | 1570 | $price_price_min = price($prod->price_min, 0, $outlangs, 1, -1, -1, 'auto'); |
1571 | - setEventMessages($prod->ref . ' - ' . $prod->label . ' (' . $price_subprice . ' < ' . $price_price_min . ' ' . strtolower($langs->trans("MinPrice")) . ')' . "\n", null, 'warnings'); |
|
1571 | + setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings'); |
|
1572 | 1572 | } else { |
1573 | 1573 | setEventMessages($prod->error, $prod->errors, 'errors'); |
1574 | 1574 | } |
@@ -1621,7 +1621,7 @@ discard block |
||
1621 | 1621 | $pu_ttc = price2num(GETPOST('price_ttc'), '', 2); |
1622 | 1622 | |
1623 | 1623 | // Add buying price |
1624 | - $fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only |
|
1624 | + $fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only |
|
1625 | 1625 | $buyingprice = price2num((GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''), '', 2); // If buying_price is '0', we must keep this value |
1626 | 1626 | |
1627 | 1627 | $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); |
@@ -1813,8 +1813,8 @@ discard block |
||
1813 | 1813 | } elseif ($action == 'setconditions' && $usercancreate) { |
1814 | 1814 | // Terms of payment |
1815 | 1815 | $sql = "SELECT code "; |
1816 | - $sql .= "FROM " . $db->prefix() . "c_payment_term"; |
|
1817 | - $sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int')); |
|
1816 | + $sql .= "FROM ".$db->prefix()."c_payment_term"; |
|
1817 | + $sql .= " WHERE rowid = ".((int) GETPOST('cond_reglement_id', 'int')); |
|
1818 | 1818 | $result = $db->query($sql); |
1819 | 1819 | if ($result) { |
1820 | 1820 | $obj = $db->fetch_object($result); |
@@ -2000,7 +2000,7 @@ discard block |
||
2000 | 2000 | |
2001 | 2001 | $classname = ucfirst($subelement); |
2002 | 2002 | $objectsrc = new $classname($db); |
2003 | - '@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc'; // Can be other class, but CommonObject is too generic |
|
2003 | + '@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc'; // Can be other class, but CommonObject is too generic |
|
2004 | 2004 | $objectsrc->fetch($originid); |
2005 | 2005 | if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) { |
2006 | 2006 | $objectsrc->fetch_lines(); |
@@ -2014,7 +2014,7 @@ discard block |
||
2014 | 2014 | |
2015 | 2015 | $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); |
2016 | 2016 | $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); |
2017 | - $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); |
|
2017 | + $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); |
|
2018 | 2018 | |
2019 | 2019 | // Replicate extrafields |
2020 | 2020 | $objectsrc->fetch_optionals(); |
@@ -2078,7 +2078,7 @@ discard block |
||
2078 | 2078 | print '<form name="addprop" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
2079 | 2079 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
2080 | 2080 | print '<input type="hidden" name="action" value="add">'; |
2081 | - print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change |
|
2081 | + print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change |
|
2082 | 2082 | print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
2083 | 2083 | if ($origin != 'project' && $originid) { |
2084 | 2084 | print '<input type="hidden" name="origin" value="'.$origin.'">'; |
@@ -2472,7 +2472,7 @@ discard block |
||
2472 | 2472 | if (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')) { |
2473 | 2473 | $formquestion[] = array('type' => 'select', 'name' => 'statut', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))); |
2474 | 2474 | } |
2475 | - $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) |
|
2475 | + $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) |
|
2476 | 2476 | |
2477 | 2477 | if (getDolGlobalInt('PROPOSAL_SUGGEST_DOWN_PAYMENT_INVOICE_CREATION')) { |
2478 | 2478 | // This is a hidden option: |
@@ -2482,7 +2482,7 @@ discard block |
||
2482 | 2482 | $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); |
2483 | 2483 | |
2484 | 2484 | if (!empty($deposit_percent_from_payment_terms) && isModEnabled('invoice') && $user->hasRight('facture', 'creer')) { |
2485 | - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
2485 | + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
2486 | 2486 | |
2487 | 2487 | $object->fetchObjectLinked(); |
2488 | 2488 | |
@@ -2566,7 +2566,7 @@ discard block |
||
2566 | 2566 | 'type' => 'onecolumn', |
2567 | 2567 | 'value' => ' |
2568 | 2568 | <script> |
2569 | - let signedValue = ' . $object::STATUS_SIGNED . '; |
|
2569 | + let signedValue = ' . $object::STATUS_SIGNED.'; |
|
2570 | 2570 | |
2571 | 2571 | $(document).ready(function() { |
2572 | 2572 | $("[name=generate_deposit]").change(function () { |
@@ -2616,7 +2616,7 @@ discard block |
||
2616 | 2616 | if (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')) { |
2617 | 2617 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), '', 'confirm_closeas', $formquestion, '', 1, 250); |
2618 | 2618 | } else { |
2619 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), '', 'confirm_closeas', $formquestion, '', 1, 250); |
|
2619 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?statut=3&id='.$object->id, $langs->trans('Close'), '', 'confirm_closeas', $formquestion, '', 1, 250); |
|
2620 | 2620 | } |
2621 | 2621 | } elseif ($action == 'cancel') { |
2622 | 2622 | // Confirm cancel |
@@ -2658,7 +2658,7 @@ discard block |
||
2658 | 2658 | $nbMandated = 0; |
2659 | 2659 | foreach ($object->lines as $line) { |
2660 | 2660 | $res = $line->fetch_product(); |
2661 | - if ($res > 0) { |
|
2661 | + if ($res > 0) { |
|
2662 | 2662 | if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end))) { |
2663 | 2663 | $nbMandated++; |
2664 | 2664 | break; |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | $morehtmlref = '<div class="refidno">'; |
2700 | 2700 | // Ref customer |
2701 | 2701 | $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); |
2702 | - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
2702 | + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
2703 | 2703 | // Thirdparty |
2704 | 2704 | $morehtmlref .= '<br>'.$soc->getNomUrl(1, 'customer'); |
2705 | 2705 | if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $soc->id > 0) { |
@@ -3041,50 +3041,50 @@ discard block |
||
3041 | 3041 | include DOL_DOCUMENT_ROOT.'/core/tpl/object_currency_amount.tpl.php'; |
3042 | 3042 | |
3043 | 3043 | print '<tr>'; |
3044 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; |
|
3045 | - print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
3044 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; |
|
3045 | + print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
3046 | 3046 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3047 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3047 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
3048 | 3048 | } |
3049 | 3049 | print '</tr>'; |
3050 | 3050 | |
3051 | 3051 | print '<tr>'; |
3052 | - print '<td>' . $langs->trans('AmountVAT') . '</td>'; |
|
3053 | - print '<td class="nowrap amountcard right">' . price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
3052 | + print '<td>'.$langs->trans('AmountVAT').'</td>'; |
|
3053 | + print '<td class="nowrap amountcard right">'.price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
3054 | 3054 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3055 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3055 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
3056 | 3056 | } |
3057 | 3057 | print '</tr>'; |
3058 | 3058 | |
3059 | 3059 | if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { |
3060 | 3060 | print '<tr>'; |
3061 | - print '<td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
3062 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
3061 | + print '<td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
3062 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
3063 | 3063 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3064 | 3064 | $object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); |
3065 | 3065 | |
3066 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3066 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
3067 | 3067 | } |
3068 | 3068 | print '</tr>'; |
3069 | 3069 | } |
3070 | 3070 | |
3071 | 3071 | if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { |
3072 | 3072 | print '<tr>'; |
3073 | - print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
3074 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
3073 | + print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
3074 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
3075 | 3075 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3076 | 3076 | $object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); |
3077 | 3077 | |
3078 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3078 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
3079 | 3079 | } |
3080 | 3080 | print '</tr>'; |
3081 | 3081 | } |
3082 | 3082 | |
3083 | 3083 | print '<tr>'; |
3084 | - print '<td>' . $langs->trans('AmountTTC') . '</td>'; |
|
3085 | - print '<td class="nowrap amountcard right">' . price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
3084 | + print '<td>'.$langs->trans('AmountTTC').'</td>'; |
|
3085 | + print '<td class="nowrap amountcard right">'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
3086 | 3086 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3087 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3087 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, 0, $langs, 1, -1, -1, $object->multicurrency_code).'</td>'; |
|
3088 | 3088 | } |
3089 | 3089 | print '</tr>'; |
3090 | 3090 | |
@@ -3231,7 +3231,7 @@ discard block |
||
3231 | 3231 | 'enabled' => (isModEnabled('order') && $object->status == Propal::STATUS_SIGNED), |
3232 | 3232 | 'perm' => $usercancreateorder, |
3233 | 3233 | 'label' => 'AddOrder', |
3234 | - 'url' => '/commande/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) |
|
3234 | + 'url' => '/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid) |
|
3235 | 3235 | ); |
3236 | 3236 | /*if (isModEnabled('order') && $object->status == Propal::STATUS_SIGNED) { |
3237 | 3237 | if ($usercancreateorder) { |
@@ -3246,7 +3246,7 @@ discard block |
||
3246 | 3246 | 'enabled' => ($object->status == Propal::STATUS_SIGNED && isModEnabled("supplier_order")), |
3247 | 3247 | 'perm' => $usercancreatepurchaseorder, |
3248 | 3248 | 'label' => 'AddPurchaseOrder', |
3249 | - 'url' => '/fourn/commande/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) |
|
3249 | + 'url' => '/fourn/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid) |
|
3250 | 3250 | ); |
3251 | 3251 | /*if ($object->status == Propal::STATUS_SIGNED && isModEnabled("supplier_order")) { |
3252 | 3252 | if ($usercancreatepurchaseorder) { |
@@ -3261,7 +3261,7 @@ discard block |
||
3261 | 3261 | 'enabled' => (isModEnabled("service") && isModEnabled('intervention') && $object->status == Propal::STATUS_SIGNED), |
3262 | 3262 | 'perm' => $usercancreateintervention, |
3263 | 3263 | 'label' => 'AddIntervention', |
3264 | - 'url' => '/fichinter/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) |
|
3264 | + 'url' => '/fichinter/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid) |
|
3265 | 3265 | ); |
3266 | 3266 | /*if (isModEnabled("service") && isModEnabled('intervention') && $object->status == Propal::STATUS_SIGNED) { |
3267 | 3267 | if ($usercancreateintervention) { |
@@ -3276,7 +3276,7 @@ discard block |
||
3276 | 3276 | 'enabled' => (isModEnabled('contract') && $object->status == Propal::STATUS_SIGNED), |
3277 | 3277 | 'perm' => $usercancreatecontract, |
3278 | 3278 | 'label' => 'AddContract', |
3279 | - 'url' => '/contrat/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) |
|
3279 | + 'url' => '/contrat/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid) |
|
3280 | 3280 | ); |
3281 | 3281 | /*if (isModEnabled('contract') && $object->status == Propal::STATUS_SIGNED) { |
3282 | 3282 | $langs->load("contracts"); |
@@ -3302,7 +3302,7 @@ discard block |
||
3302 | 3302 | |
3303 | 3303 | $actionButtonsParameters = [ |
3304 | 3304 | "areDropdownButtons" => !getDolGlobalInt("MAIN_REMOVE_DROPDOWN_CREATE_BUTTONS_ON_ORDER"), |
3305 | - "backtopage" => $_SERVER["PHP_SELF"] . "?id=" . ((int) $id) |
|
3305 | + "backtopage" => $_SERVER["PHP_SELF"]."?id=".((int) $id) |
|
3306 | 3306 | ]; |
3307 | 3307 | |
3308 | 3308 | if ($numlines > 0) { |
@@ -3336,8 +3336,8 @@ discard block |
||
3336 | 3336 | } else { |
3337 | 3337 | // Set not signed (close) |
3338 | 3338 | if ($object->status == Propal::STATUS_DRAFT && $usercanclose) { |
3339 | - print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&token='.newToken().'&action=closeas&token='.newToken() . (!getDolGlobalString('MAIN_JUMP_TAG') ? '' : '#close') . '"'; |
|
3340 | - print '>' . $langs->trans('SetRefusedAndClose') . '</a>'; |
|
3339 | + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&token='.newToken().'&action=closeas&token='.newToken().(!getDolGlobalString('MAIN_JUMP_TAG') ? '' : '#close').'"'; |
|
3340 | + print '>'.$langs->trans('SetRefusedAndClose').'</a>'; |
|
3341 | 3341 | } |
3342 | 3342 | } |
3343 | 3343 |