Passed
Push — master ( fc4753...fa5a21 )
by Alxarafe
23:57
created
dolibarr/htdocs/stripe/config.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,24 +35,24 @@
 block discarded – undo
35 35
 global $stripearrayofkeysbyenv;
36 36
 
37 37
 $stripearrayofkeysbyenv = array(
38
-	0=>array(
39
-		"secret_key"      => $conf->global->STRIPE_TEST_SECRET_KEY,
40
-		"publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
41
-	),
42
-	1=>array(
43
-		"secret_key"      => $conf->global->STRIPE_LIVE_SECRET_KEY,
44
-		"publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY
45
-	)
38
+    0=>array(
39
+        "secret_key"      => $conf->global->STRIPE_TEST_SECRET_KEY,
40
+        "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
41
+    ),
42
+    1=>array(
43
+        "secret_key"      => $conf->global->STRIPE_LIVE_SECRET_KEY,
44
+        "publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY
45
+    )
46 46
 );
47 47
 
48 48
 $stripearrayofkeys = array();
49 49
 if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))
50 50
 {
51
-	$stripearrayofkeys = $stripearrayofkeysbyenv[0];	// Test
51
+    $stripearrayofkeys = $stripearrayofkeysbyenv[0];	// Test
52 52
 }
53 53
 else
54 54
 {
55
-	$stripearrayofkeys = $stripearrayofkeysbyenv[1];	// Live
55
+    $stripearrayofkeys = $stripearrayofkeysbyenv[1];	// Live
56 56
 }
57 57
 
58 58
 \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 *  \brief      Page to move config in api
28 28
 */
29 29
 
30
-require_once BASE_PATH . '/vendor/stripe/stripe-php/init.php';
31
-require_once BASE_PATH . '/vendor/stripe/stripe-php/lib/Stripe.php';
30
+require_once BASE_PATH.'/vendor/stripe/stripe-php/init.php';
31
+require_once BASE_PATH.'/vendor/stripe/stripe-php/lib/Stripe.php';
32 32
 
33 33
 global $stripe;
34 34
 global $conf;
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 );
47 47
 
48 48
 $stripearrayofkeys = array();
49
-if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))
49
+if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))
50 50
 {
51
-	$stripearrayofkeys = $stripearrayofkeysbyenv[0];	// Test
51
+	$stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test
52 52
 }
53 53
 else
54 54
 {
55
-	$stripearrayofkeys = $stripearrayofkeysbyenv[1];	// Live
55
+	$stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live
56 56
 }
57 57
 
58 58
 \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@
 block discarded – undo
49 49
 if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))
50 50
 {
51 51
 	$stripearrayofkeys = $stripearrayofkeysbyenv[0];	// Test
52
-}
53
-else
52
+} else
54 53
 {
55 54
 	$stripearrayofkeys = $stripearrayofkeysbyenv[1];	// Live
56 55
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/functions.lib.php 2 patches
Spacing   +547 added lines, -547 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  * 	\brief			A set of functions for Dolibarr
38 38
  * 					This file contains all frequently used functions.
39 39
  */
40
-include_once DOL_BASE_PATH . '/core/lib/json.lib.php';
40
+include_once DOL_BASE_PATH.'/core/lib/json.lib.php';
41 41
 
42 42
 /**
43 43
  * Function to return value of a static property when class
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function getStaticMember($class, $member)
54 54
 {
55
-    dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
55
+    dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING);
56 56
 
57 57
     // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member
58 58
     /* if (version_compare(phpversion(), '5.3.0', '<'))
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     if (isset($class::$member))
79 79
         return $class::$member;
80
-    dol_print_error('', 'Try to get a static member "' . $member . '" in class "' . $class . '" that does not exists or is not static.');
80
+    dol_print_error('', 'Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.');
81 81
     return null;
82 82
 }
83 83
 
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
96 96
 {
97
-    require_once DOL_BASE_PATH . "/core/db/" . $type . '.class.php';
97
+    require_once DOL_BASE_PATH."/core/db/".$type.'.class.php';
98 98
 
99
-    $class = 'DoliDB' . ucfirst($type);
99
+    $class = 'DoliDB'.ucfirst($type);
100 100
     $dolidb = new $class($type, $host, $user, $pass, $name, $port);
101 101
     return $dolidb;
102 102
 }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
  */
153 153
 function getBrowserInfo($user_agent)
154 154
 {
155
-    include_once BASE_PATH . '/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php';
155
+    include_once BASE_PATH.'/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php';
156 156
 
157 157
     $name = 'unknown';
158 158
     $version = '';
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $depth = $db->transaction_opened;
266 266
         $disconnectdone = $db->close();
267 267
     }
268
-    dol_syslog("--- End access to " . $_SERVER["PHP_SELF"] . (($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was ' . $depth . ')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
268
+    dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
269 269
 }
270 270
 
271 271
 /**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     if (empty($paramname))
311 311
         return 'BadFirstParameterForGETPOST';
312 312
     if (empty($check)) {
313
-        dol_syslog("Deprecated use of GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING);
313
+        dol_syslog("Deprecated use of GETPOST, called with 1st param = ".$paramname." and 2nd param is '', when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING);
314 314
         // Enable this line to know who call the GETPOST with '' $check parameter.
315 315
         //var_dump(debug_backtrace()[0]);
316 316
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         $relativepathstring = $_SERVER["PHP_SELF"];
333 333
         // Clean $relativepathstring
334 334
         if (constant('DOL_URL_ROOT'))
335
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring);
335
+            $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring);
336 336
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
337 337
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
338 338
         //var_dump($relativepathstring);
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
         // Code for search criteria persistence.
341 341
         // Retrieve values if restore_lastsearch_values
342 342
         if (!empty($_GET['restore_lastsearch_values'])) {        // Use $_GET here and not GETPOST
343
-            if (!empty($_SESSION['lastsearch_values_' . $relativepathstring])) { // If there is saved values
344
-                $tmp = json_decode($_SESSION['lastsearch_values_' . $relativepathstring], true);
343
+            if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) { // If there is saved values
344
+                $tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true);
345 345
                 if (is_array($tmp)) {
346 346
                     foreach ($tmp as $key => $val) {
347 347
                         if ($key == $paramname) { // We are on the requested parameter
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
                 }
353 353
             }
354 354
             // If there is saved contextpage, page or limit
355
-            if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_' . $relativepathstring])) {
356
-                $out = $_SESSION['lastsearch_contextpage_' . $relativepathstring];
357
-            } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_' . $relativepathstring])) {
358
-                $out = $_SESSION['lastsearch_page_' . $relativepathstring];
359
-            } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_' . $relativepathstring])) {
360
-                $out = $_SESSION['lastsearch_limit_' . $relativepathstring];
355
+            if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) {
356
+                $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring];
357
+            } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) {
358
+                $out = $_SESSION['lastsearch_page_'.$relativepathstring];
359
+            } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) {
360
+                $out = $_SESSION['lastsearch_limit_'.$relativepathstring];
361 361
             }
362 362
         }
363 363
         // Else, retreive default values if we are not doing a sort
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
                                         $qualified = 1;
426 426
 
427 427
                                     if ($qualified) {
428
-                                        $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
428
+                                        $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
429 429
                                         foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) {
430 430
                                             if ($out)
431 431
                                                 $out .= ', ';
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
                                     if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) {
462 462
                                         // We made a search from quick search menu, do we still use default filter ?
463 463
                                         if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) {
464
-                                            $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
464
+                                            $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
465 465
                                             $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
466 466
                                         }
467 467
                                     } else {
468
-                                        $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
468
+                                        $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
469 469
                                         $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
470 470
                                     }
471 471
                                     break;
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
     // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
484 484
     if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) {
485 485
         $maxloop = 20;
486
-        $loopnb = 0;    // Protection against infinite loop
486
+        $loopnb = 0; // Protection against infinite loop
487 487
         while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) {    // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
488 488
             $loopnb++;
489 489
             $newout = '';
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') {
529 529
                 $newout = $conf->entity;
530 530
             } else
531
-                $newout = '';     // Key not found, we replace with empty string
531
+                $newout = ''; // Key not found, we replace with empty string
532 532
 
533 533
 
534 534
 
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 
551 551
                 
552 552
 //var_dump('__'.$reg[1].'__ -> '.$newout);
553
-            $out = preg_replace('/__' . preg_quote($reg[1], '/') . '__/', $newout, $out);
553
+            $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out);
554 554
         }
555 555
     }
556 556
 
@@ -668,15 +668,15 @@  discard block
 block discarded – undo
668 668
                 else if (isset($_SERVER["SERVER_NAME"]))
669 669
                     return $_SERVER["SERVER_NAME"];
670 670
             }
671
-            return dol_hash(DOL_DOCUMENT_ROOT . DOL_URL_ROOT);
671
+            return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
672 672
         }
673 673
 
674 674
         if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) {
675
-            return dol_hash($_SERVER["SERVER_NAME"] . $_SERVER["DOCUMENT_ROOT"] . DOL_DOCUMENT_ROOT . DOL_URL_ROOT);
675
+            return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
676 676
             // Use this for a "readable" cookie name
677 677
             //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
678 678
         }
679
-        return dol_hash(DOL_DOCUMENT_ROOT . DOL_URL_ROOT);
679
+        return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
680 680
     }
681 681
 }
682 682
 
@@ -692,12 +692,12 @@  discard block
 block discarded – undo
692 692
  */
693 693
 function dol_include_once($relpath, $classname = '')
694 694
 {
695
-    global $conf, $langs, $user, $mysoc;   // Do not remove this. They must be defined for files we include. Other globals var must be retreived with $GLOBALS['var']
695
+    global $conf, $langs, $user, $mysoc; // Do not remove this. They must be defined for files we include. Other globals var must be retreived with $GLOBALS['var']
696 696
 
697 697
     $fullpath = dol_buildpath($relpath);
698 698
 
699 699
     if (!file_exists($fullpath)) {
700
-        dol_syslog('functions::dol_include_once Tried to load unexisting file: ' . $relpath, LOG_ERR);
700
+        dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR);
701 701
         return false;
702 702
     }
703 703
 
@@ -726,14 +726,14 @@  discard block
 block discarded – undo
726 726
 
727 727
     if ($type == 0 /* empty($type) */) { // For a filesystem path
728 728
         //$res = DOL_BASE_PATH . '' . $path;  // Standard default path
729
-        $res = DOL_BASE_PATH . '/' . $path;  // Standard default path
729
+        $res = DOL_BASE_PATH.'/'.$path; // Standard default path
730 730
         if (isset($conf->file->dol_document_root)) {
731 731
             foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
732 732
                 if ($key == 'main') {
733 733
                     continue;
734 734
                 }
735
-                if (file_exists($dirroot . '/' . $path)) {
736
-                    $res = $dirroot . '/' . $path;
735
+                if (file_exists($dirroot.'/'.$path)) {
736
+                    $res = $dirroot.'/'.$path;
737 737
                     return $res;
738 738
                 }
739 739
             }
@@ -750,11 +750,11 @@  discard block
 block discarded – undo
750 750
         // using proxy, rewriting, virtual path, etc...
751 751
         $res = '';
752 752
         if ($type == 1)
753
-            $res = /* DOL_URL_ROOT */ DOL_BASE_URI . '/' . $path;   // Standard value
753
+            $res = /* DOL_URL_ROOT */ DOL_BASE_URI.'/'.$path; // Standard value
754 754
         if ($type == 2)
755
-            $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH . '/' . $path;  // Standard value
755
+            $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH.'/'.$path; // Standard value
756 756
         if ($type == 3)
757
-            $res = DOL_URL_ROOT . '/' . $path;
757
+            $res = DOL_URL_ROOT.'/'.$path;
758 758
 
759 759
         foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
760 760
             if ($key == 'main') {
@@ -762,33 +762,33 @@  discard block
 block discarded – undo
762 762
                     global $dolibarr_main_url_root;
763 763
 
764 764
                     // Define $urlwithroot
765
-                    $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
766
-                    $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT;  // This is to use external domain name found into config file
765
+                    $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
766
+                    $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
767 767
                     //$urlwithroot=DOL_MAIN_URL_ROOT;					// This is to use same domain name than current
768 768
 
769
-                    $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . '/' . $path;     // Test on start with http is for old conf syntax
769
+                    $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot).'/'.$path; // Test on start with http is for old conf syntax
770 770
                 }
771 771
                 continue;
772 772
             }
773
-            preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs);    // Take part before '?'
773
+            preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?'
774 774
             if (!empty($regs[1])) {
775 775
                 //print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'<br>'."\n";
776
-                if (file_exists($dirroot . '/' . $regs[1])) {
776
+                if (file_exists($dirroot.'/'.$regs[1])) {
777 777
                     if ($type == 1) {
778
-                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_URL_ROOT) . $conf->file->dol_url_root[$key] . '/' . $path;
778
+                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
779 779
                     }
780 780
                     if ($type == 2) {
781
-                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT) . $conf->file->dol_url_root[$key] . '/' . $path;
781
+                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
782 782
                     }
783 783
                     if ($type == 3) {
784 784
                         global $dolibarr_main_url_root;
785 785
 
786 786
                         // Define $urlwithroot
787
-                        $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
788
-                        $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT;  // This is to use external domain name found into config file
787
+                        $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
788
+                        $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
789 789
                         //$urlwithroot=DOL_MAIN_URL_ROOT;					// This is to use same domain name than current
790 790
 
791
-                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . $conf->file->dol_url_root[$key] . '/' . $path;     // Test on start with http is for old conf syntax
791
+                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax
792 792
                     }
793 793
                     break;
794 794
                 }
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
     if (empty($native)) {
817 817
         $myclone = unserialize(serialize($object));
818 818
     } else {
819
-        $myclone = clone $object;     // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable)
819
+        $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable)
820 820
     }
821 821
 
822 822
     return $myclone;
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
  */
938 938
 function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '')
939 939
 {
940
-    $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°');  // more complete than dol_sanitizeFileName
940
+    $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName
941 941
     $forbidden_chars_to_remove = array();
942 942
     if (is_array($badcharstoreplace))
943 943
         $forbidden_chars_to_replace = $badcharstoreplace;
@@ -1000,12 +1000,12 @@  discard block
 block discarded – undo
1000 1000
 function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0)
1001 1001
 {
1002 1002
     // escape quotes and backslashes, newlines, etc.
1003
-    $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8');  // TODO Use htmlspecialchars_decode instead, that make only required change for html tags
1003
+    $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags
1004 1004
     if (!$keepb)
1005 1005
         $tmp = strtr($tmp, array("<b>" => '', '</b>' => ''));
1006 1006
     if (!$keepn)
1007 1007
         $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n'));
1008
-    return htmlentities($tmp, ENT_COMPAT, 'UTF-8');      // TODO Use htmlspecialchars instead, that make only required change for html tags
1008
+    return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags
1009 1009
 }
1010 1010
 
1011 1011
 /**
@@ -1076,14 +1076,14 @@  discard block
 block discarded – undo
1076 1076
         $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log
1077 1077
         // If adding log inside HTML page is required
1078 1078
         if (!empty($_REQUEST['logtohtml']) && (!empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || !empty($conf->global->MAIN_LOGTOHTML))) {   // MAIN_LOGTOHTML kept for backward compatibility
1079
-            $conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S") . " " . $message;
1079
+            $conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$message;
1080 1080
         }
1081 1081
 
1082 1082
         //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output
1083 1083
         // If html log tag enabled and url parameter log defined, we show output log on HTML comments
1084 1084
         if (!empty($conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && !empty($_GET["log"])) {
1085 1085
             print "\n\n<!-- Log start\n";
1086
-            print $message . "\n";
1086
+            print $message."\n";
1087 1087
             print "Log end -->\n";
1088 1088
         }
1089 1089
 
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 
1098 1098
         // This is when server run behind a reverse proxy
1099 1099
         if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
1100
-            $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']);
1100
+            $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].(empty($_SERVER["REMOTE_ADDR"]) ? '' : '->'.$_SERVER['REMOTE_ADDR']);
1101 1101
         // This is when server run normally on a server
1102 1102
         else if (!empty($_SERVER["REMOTE_ADDR"]))
1103 1103
             $data['ip'] = $_SERVER['REMOTE_ADDR'];
@@ -1106,10 +1106,10 @@  discard block
 block discarded – undo
1106 1106
             $data['ip'] = $_SERVER['SERVER_ADDR'];
1107 1107
         // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it).
1108 1108
         else if (!empty($_SERVER['COMPUTERNAME']))
1109
-            $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']);
1109
+            $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME']) ? '' : '@'.$_SERVER['USERNAME']);
1110 1110
         // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
1111 1111
         else if (!empty($_SERVER['LOGNAME']))
1112
-            $data['ip'] = '[email protected]' . $_SERVER['LOGNAME'];
1112
+            $data['ip'] = '[email protected]'.$_SERVER['LOGNAME'];
1113 1113
         // Loop on each log handler and send output
1114 1114
         foreach ($conf->loghandlers as $loghandlerinstance) {
1115 1115
             if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler)
@@ -1161,10 +1161,10 @@  discard block
 block discarded – undo
1161 1161
 {
1162 1162
     global $conf, $langs, $hookmanager;
1163 1163
 
1164
-    $out = "\n" . '<div class="tabs" data-role="controlgroup" data-type="horizontal">' . "\n";
1164
+    $out = "\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
1165 1165
 
1166 1166
     if ($morehtmlright) {
1167
-        $out .= '<div class="inline-block floatright tabsElem">' . $morehtmlright . '</div>'; // Output right area first so when space is missing, text is in front of tabs and not under.
1167
+        $out .= '<div class="inline-block floatright tabsElem">'.$morehtmlright.'</div>'; // Output right area first so when space is missing, text is in front of tabs and not under.
1168 1168
     }
1169 1169
 
1170 1170
     // Show title
@@ -1175,8 +1175,8 @@  discard block
 block discarded – undo
1175 1175
         $limittitle = 30;
1176 1176
         $out .= '<a class="tabTitle">';
1177 1177
         if ($picto)
1178
-            $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' ';
1179
-        $out .= '<span class="tabTitleText">' . dol_trunc($title, $limittitle) . '</span>';
1178
+            $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath).' ';
1179
+        $out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>';
1180 1180
         $out .= '</a>';
1181 1181
     }
1182 1182
 
@@ -1216,23 +1216,23 @@  discard block
 block discarded – undo
1216 1216
         }
1217 1217
 
1218 1218
         if ($i < $limittoshow || $isactive) {
1219
-            $out .= '<div class="inline-block tabsElem' . ($isactive ? ' tabsElemActive' : '') . ((!$isactive && !empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '') . '"><!-- id tab = ' . (empty($links[$i][2]) ? '' : $links[$i][2]) . ' -->';
1219
+            $out .= '<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((!$isactive && !empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '').'"><!-- id tab = '.(empty($links[$i][2]) ? '' : $links[$i][2]).' -->';
1220 1220
             if (isset($links[$i][2]) && $links[$i][2] == 'image') {
1221 1221
                 if (!empty($links[$i][0])) {
1222
-                    $out .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n";
1222
+                    $out .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
1223 1223
                 } else {
1224
-                    $out .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n";
1224
+                    $out .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n";
1225 1225
                 }
1226 1226
             } else if (!empty($links[$i][1])) {
1227 1227
                 //print "x $i $active ".$links[$i][2]." z";
1228 1228
                 if ($isactive) {
1229
-                    $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">';
1229
+                    $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">';
1230 1230
                     $out .= $links[$i][1];
1231
-                    $out .= '</a>' . "\n";
1231
+                    $out .= '</a>'."\n";
1232 1232
                 } else {
1233
-                    $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabunactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">';
1233
+                    $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabunactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">';
1234 1234
                     $out .= $links[$i][1];
1235
-                    $out .= '</a>' . "\n";
1235
+                    $out .= '</a>'."\n";
1236 1236
                 }
1237 1237
             }
1238 1238
             $out .= '</div>';
@@ -1245,14 +1245,14 @@  discard block
 block discarded – undo
1245 1245
             $outmore .= '<div class="popuptab wordwrap" style="display:inherit;">';
1246 1246
             if (isset($links[$i][2]) && $links[$i][2] == 'image') {
1247 1247
                 if (!empty($links[$i][0]))
1248
-                    $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n";
1248
+                    $outmore .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
1249 1249
                 else
1250
-                    $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n";
1250
+                    $outmore .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n";
1251 1251
             }
1252 1252
             else if (!empty($links[$i][1])) {
1253
-                $outmore .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="wordwrap inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">';
1253
+                $outmore .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="wordwrap inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">';
1254 1254
                 $outmore .= preg_replace('/([a-z])\/([a-z])/i', '\\1 / \\2', $links[$i][1]); // Replace x/y with x / y to allow wrap on long composed texts.
1255
-                $outmore .= '</a>' . "\n";
1255
+                $outmore .= '</a>'."\n";
1256 1256
             }
1257 1257
             $outmore .= '</div>';
1258 1258
 
@@ -1268,24 +1268,24 @@  discard block
 block discarded – undo
1268 1268
         $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
1269 1269
 
1270 1270
         $tabsname = str_replace("@", "", $picto);
1271
-        $out .= '<div id="moretabs' . $tabsname . '" class="inline-block tabsElem">';
1272
-        $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">' . $langs->trans("More") . '... (' . $nbintab . ')</a>';
1273
-        $out .= '<div id="moretabsList' . $tabsname . '" style="position: absolute; ' . $left . ': -999em; text-align: ' . $left . '; margin:0px; padding:2px">';
1271
+        $out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">';
1272
+        $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">'.$langs->trans("More").'... ('.$nbintab.')</a>';
1273
+        $out .= '<div id="moretabsList'.$tabsname.'" style="position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px">';
1274 1274
         $out .= $outmore;
1275 1275
         $out .= '</div>';
1276 1276
         $out .= '<div></div>';
1277 1277
         $out .= "</div>\n";
1278 1278
 
1279 1279
         $out .= "<script>";
1280
-        $out .= "$('#moretabs" . $tabsname . "').mouseenter( function() { console.log('mouseenter " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','auto');});";
1281
-        $out .= "$('#moretabs" . $tabsname . "').mouseleave( function() { console.log('mouseleave " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','-999em');});";
1280
+        $out .= "$('#moretabs".$tabsname."').mouseenter( function() { console.log('mouseenter ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','auto');});";
1281
+        $out .= "$('#moretabs".$tabsname."').mouseleave( function() { console.log('mouseleave ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','-999em');});";
1282 1282
         $out .= "</script>";
1283 1283
     }
1284 1284
 
1285 1285
     $out .= "</div>\n";
1286 1286
 
1287 1287
     if (!$notab || $notab == -1)
1288
-        $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n";
1288
+        $out .= "\n".'<div class="tabBar'.($notab == -1 ? '' : ' tabBarWithBottom').'">'."\n";
1289 1289
 
1290 1290
     $parameters = array('tabname' => $active, 'out' => $out);
1291 1291
     $reshook = $hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead"
@@ -1394,7 +1394,7 @@  discard block
 block discarded – undo
1394 1394
         if ($conf->browser->layout == 'phone')
1395 1395
             $maxvisiblephotos = 1;
1396 1396
         if ($showimage)
1397
-            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>';
1397
+            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
1398 1398
         else {
1399 1399
             if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
1400 1400
                 $nophoto = '';
@@ -1403,18 +1403,18 @@  discard block
 block discarded – undo
1403 1403
             //elseif ($conf->browser->layout != 'phone') {    // Show no photo link
1404 1404
             $nophoto = '/public/theme/common/nophoto.png';
1405 1405
             // $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '"></div>';
1406
-            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>';
1406
+            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'"></div>';
1407 1407
             //}
1408 1408
         }
1409 1409
     } elseif ($object->element == 'ticket') {
1410 1410
         $width = 80;
1411 1411
         $cssclass = 'photoref';
1412
-        $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity] . '/' . $object->track_id);
1412
+        $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->track_id);
1413 1413
         $maxvisiblephotos = (isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO) ? $conf->global->TICKETSUP_MAX_VISIBLE_PHOTO : 2);
1414 1414
         if ($conf->browser->layout == 'phone')
1415 1415
             $maxvisiblephotos = 1;
1416 1416
         if ($showimage)
1417
-            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('ticket', $conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>';
1417
+            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticket', $conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
1418 1418
         else {
1419 1419
             if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) {
1420 1420
                 $nophoto = '';
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
             //elseif ($conf->browser->layout != 'phone') {    // Show no photo link
1424 1424
             $nophoto = '/public/theme/common/nophoto.png';
1425 1425
             //$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '"></div>';
1426
-            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>';
1426
+            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'"></div>';
1427 1427
             //}
1428 1428
         }
1429 1429
     } else {
@@ -1433,25 +1433,25 @@  discard block
 block discarded – undo
1433 1433
                 // Check if a preview file is available
1434 1434
                 if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick")) {
1435 1435
                     $objectref = dol_sanitizeFileName($object->ref);
1436
-                    $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity]) . "/";
1436
+                    $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity])."/";
1437 1437
                     if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) {
1438 1438
                         $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart);
1439
-                        $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '') . $objectref;  // the objectref dir is not included into get_exdir when used with level=2, so we add it at end
1439
+                        $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '').$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end
1440 1440
                     } else {
1441 1441
                         $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart);
1442 1442
                     }
1443 1443
                     if (empty($subdir))
1444 1444
                         $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path
1445 1445
 
1446
-                    $filepath = $dir_output . $subdir . "/";
1446
+                    $filepath = $dir_output.$subdir."/";
1447 1447
 
1448
-                    $file = $filepath . $objectref . ".pdf";
1449
-                    $relativepath = $subdir . '/' . $objectref . '.pdf';
1448
+                    $file = $filepath.$objectref.".pdf";
1449
+                    $relativepath = $subdir.'/'.$objectref.'.pdf';
1450 1450
 
1451 1451
                     // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
1452
-                    $fileimage = $file . '_preview.png';              // If PDF has 1 page
1453
-                    $fileimagebis = $file . '_preview-0.png';         // If PDF has more than one page
1454
-                    $relativepathimage = $relativepath . '_preview.png';
1452
+                    $fileimage = $file.'_preview.png'; // If PDF has 1 page
1453
+                    $fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page
1454
+                    $relativepathimage = $relativepath.'_preview.png';
1455 1455
 
1456 1456
                     // Si fichier PDF existe
1457 1457
                     if (file_exists($file)) {
@@ -1460,7 +1460,7 @@  discard block
 block discarded – undo
1460 1460
                         if ((!file_exists($fileimage) || (filemtime($fileimage) < filemtime($file))) && (!file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file)))
1461 1461
                         ) {
1462 1462
                             if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) {  // If you experienc trouble with pdf thumb generation and imagick, you can disable here.
1463
-                                include_once DOL_BASE_PATH . '/core/lib/files.lib.php';
1463
+                                include_once DOL_BASE_PATH.'/core/lib/files.lib.php';
1464 1464
                                 $ret = dol_convert_file($file, 'png', $fileimage);
1465 1465
                                 if ($ret < 0)
1466 1466
                                     $error++;
@@ -1473,14 +1473,14 @@  discard block
 block discarded – undo
1473 1473
                         // Si fichier png PDF d'1 page trouve
1474 1474
                         if (file_exists($fileimage)) {
1475 1475
                             $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
1476
-                            $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=apercu' . $modulepart . '&amp;file=' . urlencode($relativepathimage) . '">';
1476
+                            $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
1477 1477
                             $phototoshow .= '</div></div>';
1478 1478
                         }
1479 1479
                         // Si fichier png PDF de plus d'1 page trouve
1480 1480
                         elseif (file_exists($fileimagebis)) {
1481
-                            $preview = preg_replace('/\.png/', '', $relativepathimage) . "-0.png";
1481
+                            $preview = preg_replace('/\.png/', '', $relativepathimage)."-0.png";
1482 1482
                             $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
1483
-                            $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=apercu' . $modulepart . '&amp;file=' . urlencode($preview) . '"><p>';
1483
+                            $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($preview).'"><p>';
1484 1484
                             $phototoshow .= '</div></div>';
1485 1485
                         }
1486 1486
                     }
@@ -1507,10 +1507,10 @@  discard block
 block discarded – undo
1507 1507
                     $picto = $object->picto;
1508 1508
                     if ($object->element == 'project' && !$object->public)
1509 1509
                         $picto = 'project'; // instead of projectpub
1510
-                    $nophoto = img_picto('', 'object_' . $picto, '', false, 1);
1510
+                    $nophoto = img_picto('', 'object_'.$picto, '', false, 1);
1511 1511
                 }
1512 1512
                 $morehtmlleft .= '<!-- No photo to show -->';
1513
-                $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . $nophoto . '"></div></div>';
1513
+                $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.$nophoto.'"></div></div>';
1514 1514
 
1515 1515
                 $morehtmlleft .= '</div>';
1516 1516
             }
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
     }
1519 1519
 
1520 1520
     if ($showbarcode)
1521
-        $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>';
1521
+        $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
1522 1522
 
1523 1523
     if ($object->element == 'societe') {
1524 1524
         if (!empty($conf->use_javascript_ajax) && $user->rights->societe->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
@@ -1531,14 +1531,14 @@  discard block
 block discarded – undo
1531 1531
         if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
1532 1532
             $morehtmlstatus .= ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
1533 1533
         } else {
1534
-            $morehtmlstatus .= '<span class="statusrefsell">' . $object->getLibStatut(5, 0) . '</span>';
1534
+            $morehtmlstatus .= '<span class="statusrefsell">'.$object->getLibStatut(5, 0).'</span>';
1535 1535
         }
1536 1536
         $morehtmlstatus .= ' &nbsp; ';
1537 1537
         //$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Buy").') ';
1538 1538
         if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
1539 1539
             $morehtmlstatus .= ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
1540 1540
         } else {
1541
-            $morehtmlstatus .= '<span class="statusrefbuy">' . $object->getLibStatut(5, 1) . '</span>';
1541
+            $morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(5, 1).'</span>';
1542 1542
         }
1543 1543
     } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) {
1544 1544
         $tmptxt = $object->getLibStatut(6, $object->totalpaye);
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
1565 1565
         if ($object->progress >= 100)
1566 1566
             $object->fk_statut = 3;
1567 1567
         $tmptxt = $object->getLibStatut(5);
1568
-        $morehtmlstatus .= $tmptxt;  // No status on task
1568
+        $morehtmlstatus .= $tmptxt; // No status on task
1569 1569
     }
1570 1570
     else { // Generic case
1571 1571
         $tmptxt = $object->getLibStatut(6);
@@ -1579,18 +1579,18 @@  discard block
 block discarded – undo
1579 1579
         if (method_exists($object, 'getVentilExportCompta')) {
1580 1580
             $accounted = $object->getVentilExportCompta();
1581 1581
             $langs->load("accountancy");
1582
-            $morehtmlstatus .= '</div><div class="statusref statusrefbis">' . ($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted"));
1582
+            $morehtmlstatus .= '</div><div class="statusref statusrefbis">'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted"));
1583 1583
         }
1584 1584
     }
1585 1585
 
1586 1586
     // Add alias for thirdparty
1587 1587
     if (!empty($object->name_alias))
1588
-        $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>';
1588
+        $morehtmlref .= '<div class="refidno">'.$object->name_alias.'</div>';
1589 1589
 
1590 1590
     // Add label
1591 1591
     if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task') {
1592 1592
         if (!empty($object->label))
1593
-            $morehtmlref .= '<div class="refidno">' . $object->label . '</div>';
1593
+            $morehtmlref .= '<div class="refidno">'.$object->label.'</div>';
1594 1594
     }
1595 1595
 
1596 1596
     if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') {
@@ -1600,11 +1600,11 @@  discard block
 block discarded – undo
1600 1600
     }
1601 1601
     if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product'))) {
1602 1602
         $morehtmlref .= '<div style="clear: both;"></div><div class="refidno">';
1603
-        $morehtmlref .= $langs->trans("TechnicalID") . ': ' . $object->id;
1603
+        $morehtmlref .= $langs->trans("TechnicalID").': '.$object->id;
1604 1604
         $morehtmlref .= '</div>';
1605 1605
     }
1606 1606
 
1607
-    print '<div class="' . ($onlybanner ? 'arearefnobottom ' : 'arearef ') . 'heightref valignmiddle" width="100%">';
1607
+    print '<div class="'.($onlybanner ? 'arearefnobottom ' : 'arearef ').'heightref valignmiddle" width="100%">';
1608 1608
     print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
1609 1609
     print '</div>';
1610 1610
     print '<div class="underrefbanner clearboth"></div>';
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
     if ($fieldrequired)
1627 1627
         $ret .= '<span class="fieldrequired">';
1628 1628
     if (($conf->dol_use_jmobile != 4))
1629
-        $ret .= '<label for="' . $fieldkey . '">';
1629
+        $ret .= '<label for="'.$fieldkey.'">';
1630 1630
     $ret .= $langs->trans($langkey);
1631 1631
     if (($conf->dol_use_jmobile != 4))
1632 1632
         $ret .= '</label>';
@@ -1645,9 +1645,9 @@  discard block
 block discarded – undo
1645 1645
 function dol_bc($var, $moreclass = '')
1646 1646
 {
1647 1647
     global $bc;
1648
-    $ret = ' ' . $bc[$var];
1648
+    $ret = ' '.$bc[$var];
1649 1649
     if ($moreclass)
1650
-        $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret);
1650
+        $ret = preg_replace('/class=\"/', 'class="'.$moreclass.' ', $ret);
1651 1651
     return $ret;
1652 1652
 }
1653 1653
 
@@ -1667,50 +1667,50 @@  discard block
 block discarded – undo
1667 1667
     global $conf, $langs;
1668 1668
 
1669 1669
     $ret = '';
1670
-    $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR');    // See also MAIN_FORCE_STATE_INTO_ADDRESS
1670
+    $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
1671 1671
     // Address
1672 1672
     if (empty($mode)) {
1673 1673
         $ret .= $object->address;
1674 1674
     }
1675 1675
     // Zip/Town/State
1676 1676
     if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) {    // US: title firstname name \n address lines \n town, state, zip \n country
1677
-        $ret .= ($ret ? $sep : '' ) . $object->town;
1677
+        $ret .= ($ret ? $sep : '').$object->town;
1678 1678
         if ($object->state) {
1679
-            $ret .= ($ret ? ", " : '') . $object->state;
1679
+            $ret .= ($ret ? ", " : '').$object->state;
1680 1680
         }
1681 1681
         if ($object->zip)
1682
-            $ret .= ($ret ? ", " : '') . $object->zip;
1682
+            $ret .= ($ret ? ", " : '').$object->zip;
1683 1683
     }
1684 1684
     else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country
1685
-        $ret .= ($ret ? $sep : '' ) . $object->town;
1685
+        $ret .= ($ret ? $sep : '').$object->town;
1686 1686
         if ($object->state) {
1687
-            $ret .= ($ret ? ", " : '') . $object->state;
1687
+            $ret .= ($ret ? ", " : '').$object->state;
1688 1688
         }
1689 1689
         if ($object->zip)
1690
-            $ret .= ($ret ? $sep : '' ) . $object->zip;
1690
+            $ret .= ($ret ? $sep : '').$object->zip;
1691 1691
     }
1692 1692
     else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country
1693
-        $ret .= ($ret ? $sep : '' ) . $object->zip;
1694
-        $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : '');
1693
+        $ret .= ($ret ? $sep : '').$object->zip;
1694
+        $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : '');
1695 1695
         if ($object->state) {
1696
-            $ret .= "\n" . $object->state;
1696
+            $ret .= "\n".$object->state;
1697 1697
         }
1698 1698
     } else if (in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
1699
-        $ret .= ($ret ? $sep : '' ) . $object->zip;
1700
-        $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : '');
1701
-        $ret .= ($object->departement_id ? (' (' . ($object->departement_id) . ')') : '');
1699
+        $ret .= ($ret ? $sep : '').$object->zip;
1700
+        $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : '');
1701
+        $ret .= ($object->departement_id ? (' ('.($object->departement_id).')') : '');
1702 1702
     } else {                                          // Other: title firstname name \n address lines \n zip town \n country
1703
-        $ret .= $object->zip ? (($ret ? $sep : '' ) . $object->zip) : '';
1704
-        $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '' )) . $object->town) : '');
1703
+        $ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : '';
1704
+        $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$object->town) : '');
1705 1705
         if ($object->state && in_array($object->country_code, $countriesusingstate)) {
1706
-            $ret .= ($ret ? ", " : '') . $object->state;
1706
+            $ret .= ($ret ? ", " : '').$object->state;
1707 1707
         }
1708 1708
     }
1709 1709
     if (!is_object($outputlangs))
1710 1710
         $outputlangs = $langs;
1711 1711
     if ($withcountry) {
1712 1712
         $langs->load("dict");
1713
-        $ret .= ($object->country_code ? ($ret ? $sep : '') . $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country" . $object->country_code)) : '');
1713
+        $ret .= ($object->country_code ? ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)) : '');
1714 1714
     }
1715 1715
 
1716 1716
     return $ret;
@@ -1765,13 +1765,13 @@  discard block
 block discarded – undo
1765 1765
         if (is_string($tzoutput)) {
1766 1766
             if ($tzoutput == 'tzserver') {