Passed
Push — FUNCTIONS_LIB_REVIEW_240920 ( 00d68f...dbb741 )
by Rafael
51:44
created
public/htdocs/install/step5.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 $login = GETPOST('login', 'alpha') ? GETPOST('login', 'alpha') : (empty($argv[5]) ? '' : $argv[5]);
78 78
 $pass = GETPOST('pass', 'alpha') ? GETPOST('pass', 'alpha') : (empty($argv[6]) ? '' : $argv[6]);
79 79
 $pass_verif = GETPOST('pass_verif', 'alpha') ? GETPOST('pass_verif', 'alpha') : (empty($argv[7]) ? '' : $argv[7]);
80
-$force_install_lockinstall = (int)(!empty($force_install_lockinstall) ? $force_install_lockinstall : (GETPOST('installlock', 'aZ09') ? GETPOST('installlock', 'aZ09') : (empty($argv[8]) ? '' : $argv[8])));
80
+$force_install_lockinstall = (int) (!empty($force_install_lockinstall) ? $force_install_lockinstall : (GETPOST('installlock', 'aZ09') ? GETPOST('installlock', 'aZ09') : (empty($argv[8]) ? '' : $argv[8])));
81 81
 
82 82
 $success = 0;
83 83
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     $conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption) ? $dolibarr_main_db_encryption : 0;
170 170
     $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey) ? $dolibarr_main_db_cryptkey : '';
171 171
 
172
-    $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int)$conf->db->port);
172
+    $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
173 173
 
174 174
     // Create the global $hookmanager object
175 175
     $hookmanager = new HookManager($db);
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
             $newuser->admin = 1;
235 235
             $newuser->entity = 0;
236 236
 
237
-            $conf->global->USER_MAIL_REQUIRED = 0;          // Force global option to be sure to create a new user with no email
238
-            $conf->global->USER_PASSWORD_GENERATED = '';    // To not use any rule for password validation
237
+            $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email
238
+            $conf->global->USER_PASSWORD_GENERATED = ''; // To not use any rule for password validation
239 239
 
240 240
             $result = $newuser->create($createuser, 1);
241 241
             if ($result > 0) {
Please login to merge, or discard this patch.
public/htdocs/install/upgrade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     }
151 151
     $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;
152 152
 
153
-    $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int)$conf->db->port);
153
+    $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
154 154
 
155 155
     // Create the global $hookmanager object
156 156
     $hookmanager = new HookManager($db);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 }
427 427
 dolibarr_install_syslog("Exit " . $ret);
428 428
 
429
-dolibarr_install_syslog("--- upgrade: end " . ((int)(!$ok && !GETPOST("ignoreerrors"))) . " dirmodule=" . $dirmodule);
429
+dolibarr_install_syslog("--- upgrade: end " . ((int) (!$ok && !GETPOST("ignoreerrors"))) . " dirmodule=" . $dirmodule);
430 430
 
431 431
 $nonext = (!$ok && !GETPOST("ignoreerrors")) ? 2 : 0;
432 432
 if ($dirmodule) {
Please login to merge, or discard this patch.
public/htdocs/core/lib/functions.lib.php 1 patch
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 function getDolGlobalString($key, $default = '')
161 161
 {
162 162
     global $conf;
163
-    return (string)(isset($conf->global->$key) ? $conf->global->$key : $default);
163
+    return (string) (isset($conf->global->$key) ? $conf->global->$key : $default);
164 164
 }
165 165
 
166 166
 /**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 function getDolGlobalInt($key, $default = 0)
176 176
 {
177 177
     global $conf;
178
-    return (int)(isset($conf->global->$key) ? $conf->global->$key : $default);
178
+    return (int) (isset($conf->global->$key) ? $conf->global->$key : $default);
179 179
 }
180 180
 
181 181
 /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         $tmpuser = $user;
194 194
     }
195 195
 
196
-    return (string)(empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key);
196
+    return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key);
197 197
 }
198 198
 
199 199
 /**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $tmpuser = $user;
212 212
     }
213 213
 
214
-    return (int)(empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key);
214
+    return (int) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key);
215 215
 }
216 216
 
217 217
 
@@ -228,23 +228,23 @@  discard block
 block discarded – undo
228 228
     'MODULE_MAPPING',
229 229
     array(
230 230
         // Map deprecated names to new names
231
-        'adherent' => 'member',  // Has new directory
232
-        'member_type' => 'adherent_type',   // No directory, but file called adherent_type
233
-        'banque' => 'bank',   // Has new directory
231
+        'adherent' => 'member', // Has new directory
232
+        'member_type' => 'adherent_type', // No directory, but file called adherent_type
233
+        'banque' => 'bank', // Has new directory
234 234
         'contrat' => 'contract', // Has new directory
235
-        'entrepot' => 'stock',   // Has new directory
235
+        'entrepot' => 'stock', // Has new directory
236 236
         'projet' => 'project', // Has new directory
237 237
         'categorie' => 'category', // Has old directory
238
-        'commande' => 'order',    // Has old directory
238
+        'commande' => 'order', // Has old directory
239 239
         'expedition' => 'shipping', // Has old directory
240 240
         'facture' => 'invoice', // Has old directory
241 241
         'fichinter' => 'intervention', // Has old directory
242
-        'ficheinter' => 'intervention',  // Backup for 'fichinter'
242
+        'ficheinter' => 'intervention', // Backup for 'fichinter'
243 243
         'propale' => 'propal', // Has old directory
244 244
         'socpeople' => 'contact', // Has old directory
245
-        'fournisseur' => 'supplier',  // Has old directory
245
+        'fournisseur' => 'supplier', // Has old directory
246 246
 
247
-        'actioncomm' => 'agenda',  // NO module directory (public dir agenda)
247
+        'actioncomm' => 'agenda', // NO module directory (public dir agenda)
248 248
         'product_price' => 'productprice', // NO directory
249 249
         'product_fournisseur_price' => 'productsupplierprice', // NO directory
250 250
     )
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         if (in_array($element, $addzero)) {
382 382
             $out .= '0,';
383 383
         }
384
-        $out .= ((int)$conf->entity);
384
+        $out .= ((int) $conf->entity);
385 385
     }
386 386
 
387 387
     // Manipulate entities to query on the fly
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
     $os = 'unknown';
475 475
     $phone = '';
476 476
 
477
-    $user_agent = substr($user_agent, 0, 512);  // Avoid to process too large user agent
477
+    $user_agent = substr($user_agent, 0, 512); // Avoid to process too large user agent
478 478
 
479 479
     $detectmobile = new Mobile_Detect(null, $user_agent);
480 480
     $tablet = $detectmobile->isTablet();
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
         'browserversion' => $version,
564 564
         'browseros' => $os,
565 565
         'browserua' => $user_agent,
566
-        'layout' => $layout,    // tablet, phone, classic
567
-        'phone' => $phone,      // deprecated
566
+        'layout' => $layout, // tablet, phone, classic
567
+        'phone' => $phone, // deprecated
568 568
         'tablet' => $tablet     // deprecated
569 569
     );
570 570
 }
@@ -980,13 +980,13 @@  discard block
 block discarded – undo
980 980
     // Sanitizing for special parameters.
981 981
     // Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed.
982 982
     if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') {
983
-        $out = str_replace('\\', '/', $out);                                // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements.
984
-        $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out);      // Can be before the loop because only 1 char is replaced. No risk to retrieve it after other replacements.
983
+        $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements.
984
+        $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retrieve it after other replacements.
985 985
         do {
986 986
             $oldstringtoclean = $out;
987 987
             $out = str_ireplace(array('javascript', 'vbscript', '&colon', '&#'), '', $out);
988
-            $out = preg_replace(array('/^[^?]*%/'), '', $out);             // We remove any % chars before the ?. Example in url: '/product/stock/card.php?action=create&backtopage=%2Fdolibarr_dev%2Fhtdocs%2Fpro%25duct%2Fcard.php%3Fid%3Dabc'
989
-            $out = preg_replace(array('/^[a-z]*\/\s*\/+/i'), '', $out);     // We remove schema*// to remove external URL
988
+            $out = preg_replace(array('/^[^?]*%/'), '', $out); // We remove any % chars before the ?. Example in url: '/product/stock/card.php?action=create&backtopage=%2Fdolibarr_dev%2Fhtdocs%2Fpro%25duct%2Fcard.php%3Fid%3Dabc'
989
+            $out = preg_replace(array('/^[a-z]*\/\s*\/+/i'), '', $out); // We remove schema*// to remove external URL
990 990
         } while ($oldstringtoclean != $out);
991 991
     }
992 992
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
  */
1021 1021
 function GETPOSTINT($paramname, $method = 0)
1022 1022
 {
1023
-    return (int)GETPOST($paramname, 'int', $method, null, null, 0);
1023
+    return (int) GETPOST($paramname, 'int', $method, null, null, 0);
1024 1024
 }
1025 1025
 
1026 1026
 
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 function GETPOSTFLOAT($paramname, $rounding = '')
1036 1036
 {
1037 1037
     // price2num() is used to sanitize any valid user input (such as "1 234.5", "1 234,5", "1'234,5", "1·234,5", "1,234.5", etc.)
1038
-    return (float)price2num(GETPOST($paramname), $rounding, 2);
1038
+    return (float) price2num(GETPOST($paramname), $rounding, 2);
1039 1039
 }
1040 1040
 
1041 1041
 
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
         }
1227 1227
 
1228 1228
         // If prefix is for session (no need to have $conf loaded)
1229
-        global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey;   // This is loaded by filefunc.inc.php
1229
+        global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php
1230 1230
         $tmp_instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance
1231 1231
 
1232 1232
         // The recommended value (may be not defined for old versions)
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
         $tmpsavdb = null;
1429 1429
         if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') {
1430 1430
             $tmpsavdb = $object->db;
1431
-            unset($object->db);     // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection')
1431
+            unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection')
1432 1432
         }
1433 1433
 
1434 1434
         $myclone = unserialize(serialize($object)); // serialize then unserialize is a hack to be sure to have a new object for all fields
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
     } elseif ($native == 2) {
1440 1440
         // recommended method to have a full isolated cloned object
1441 1441
         $myclone = new stdClass();
1442
-        $tmparray = get_object_vars($object);   // return only public properties
1442
+        $tmparray = get_object_vars($object); // return only public properties
1443 1443
 
1444 1444
         if (is_array($tmparray)) {
1445 1445
             foreach ($tmparray as $propertykey => $propertyval) {
@@ -1884,9 +1884,9 @@  discard block
 block discarded – undo
1884 1884
 
1885 1885
     // escape quotes and backslashes, newlines, etc.
1886 1886
     if ($escapeonlyhtmltags) {
1887
-        $tmp = htmlspecialchars_decode((string)$stringtoescape, ENT_COMPAT);
1887
+        $tmp = htmlspecialchars_decode((string) $stringtoescape, ENT_COMPAT);
1888 1888
     } else {
1889
-        $tmp = html_entity_decode((string)$stringtoescape, ENT_COMPAT, 'UTF-8');
1889
+        $tmp = html_entity_decode((string) $stringtoescape, ENT_COMPAT, 'UTF-8');
1890 1890
     }
1891 1891
     if (!$keepb) {
1892 1892
         $tmp = strtr($tmp, array("<b>" => '', '</b>' => '', '<strong>' => '', '</strong>' => ''));
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
                 // For case of tag with attribute
1917 1917
                 $reg = array();
1918 1918
                 if (preg_match('/<' . preg_quote($tagtoreplace, '/') . '\s+([^>]+)>/', $tmp, $reg)) {
1919
-                    $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]);   // We must never have [ ] inside the attribute string
1919
+                    $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]); // We must never have [ ] inside the attribute string
1920 1920
                     $tmpattributes = str_ireplace('href="http:', '__HREFHTTPA', $tmpattributes);
1921 1921
                     $tmpattributes = str_ireplace('href="https:', '__HREFHTTPSA', $tmpattributes);
1922 1922
                     $tmpattributes = str_ireplace('src="http:', '__SRCHTTPIMG', $tmpattributes);
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
                     $tmp = preg_replace('/<' . preg_quote($tagtoreplace, '/') . '\s+([^>]+)>/', '__BEGINTAGTOREPLACE' . $tagtoreplace . '[' . $tmpattributes . ']__', $tmp);
1927 1927
                 }
1928 1928
                 if (preg_match('/<' . preg_quote($tagtoreplace, '/') . '\s+([^>]+)> \/>/', $tmp, $reg)) {
1929
-                    $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]);   // We must not have [ ] inside the attribute string
1929
+                    $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]); // We must not have [ ] inside the attribute string
1930 1930
                     $tmpattributes = str_ireplace('"', '__DOUBLEQUOTE', $tmpattributes);
1931 1931
                     $tmpattributes = preg_replace('/[^a-z0-9_\/?;\s=&]/i', '', $tmpattributes);
1932 1932
                     $tmp = preg_replace('/<' . preg_quote($tagtoreplace, '/') . '\s+([^>]+) \/>/', '__BEGINENDTAGTOREPLACE' . $tagtoreplace . '[' . $tmpattributes . ']__', $tmp);
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
                 $to_gmt = false;
2372 2372
                 $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion'
2373 2373
                 // @phan-suppress-next-line PhanPluginRedundantAssignment
2374
-                $offsettz = 0;  // Timezone offset with server timezone (because to_gmt is false), so 0
2374
+                $offsettz = 0; // Timezone offset with server timezone (because to_gmt is false), so 0
2375 2375
                 // @phan-suppress-next-line PhanPluginRedundantAssignment
2376 2376
                 $offsetdst = 0; // Dst offset with server timezone (because to_gmt is false), so 0
2377 2377
             } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') {
@@ -2382,8 +2382,8 @@  discard block
 block discarded – undo
2382 2382
                     $user_date_tz = new DateTimeZone($offsettzstring);
2383 2383
                     $user_dt = new DateTime();
2384 2384
                     $user_dt->setTimezone($user_date_tz);
2385
-                    $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int)$time);
2386
-                    $offsettz = $user_dt->getOffset();  // should include dst ?
2385
+                    $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time);
2386
+                    $offsettz = $user_dt->getOffset(); // should include dst ?
2387 2387
                 } else {    // with old method (The 'tzuser' was processed like the 'tzuserrel')
2388 2388
                     $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
2389 2389
                     $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore
@@ -2400,7 +2400,7 @@  discard block
 block discarded – undo
2400 2400
 
2401 2401
     // Do we have to reduce the length of date (year on 2 chars) to save space.
2402 2402
     // Note: dayinputnoreduce is same than day but no reduction of year length will be done
2403
-    $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour', 'dayhoursec'))) ? 1 : 0;  // Test on original $format param.
2403
+    $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour', 'dayhoursec'))) ? 1 : 0; // Test on original $format param.
2404 2404
     $format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day
2405 2405
     $formatwithoutreduce = preg_replace('/reduceformat/', '', $format);
2406 2406
     if ($formatwithoutreduce != $format) {
@@ -2467,10 +2467,10 @@  discard block
 block discarded – undo
2467 2467
 
2468 2468
     // Analyze date
2469 2469
     $reg = array();
2470
-    if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', (string)$time, $reg)) {  // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
2470
+    if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', (string) $time, $reg)) {  // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
2471 2471
         dol_print_error(null, "Functions.lib::dol_print_date function called with a bad value from page " . (empty($_SERVER["PHP_SELF"]) ? 'unknown' : $_SERVER["PHP_SELF"]));
2472 2472
         return '';
2473
-    } elseif (preg_match('/^([0-9]+)-([0-9]+)-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', (string)$time, $reg)) {    // Still available to solve problems in extrafields of type date
2473
+    } elseif (preg_match('/^([0-9]+)-([0-9]+)-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', (string) $time, $reg)) {    // Still available to solve problems in extrafields of type date
2474 2474
         // This part of code should not be used anymore.
2475 2475
         dol_syslog("Functions.lib::dol_print_date function called with a bad value from page " . (empty($_SERVER["PHP_SELF"]) ? 'unknown' : $_SERVER["PHP_SELF"]), LOG_WARNING);
2476 2476
         //if (function_exists('debug_print_backtrace')) debug_print_backtrace();
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
         if ($to_gmt) {
2488 2488
             $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC
2489 2489
         } else {
2490
-            $tzo = new DateTimeZone(date_default_timezone_get());   // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
2490
+            $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
2491 2491
         }
2492 2492
         $dtts = new DateTime();
2493 2493
         $dtts->setTimestamp($time);
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
             if ($to_gmt) {
2512 2512
                 $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC
2513 2513
             } else {
2514
-                $tzo = new DateTimeZone(date_default_timezone_get());   // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
2514
+                $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
2515 2515
             }
2516 2516
             $dtts = new DateTime();
2517 2517
             $dtts->setTimestamp($timetouse);
@@ -2539,12 +2539,12 @@  discard block
 block discarded – undo
2539 2539
         if ($to_gmt) {
2540 2540
             $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC
2541 2541
         } else {
2542
-            $tzo = new DateTimeZone(date_default_timezone_get());   // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
2542
+            $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server
2543 2543
         }
2544 2544
         $dtts = new DateTime();
2545 2545
         $dtts->setTimestamp($timetouse);
2546 2546
         $dtts->setTimezone($tzo);
2547
-        $month = (int)$dtts->format("m");
2547
+        $month = (int) $dtts->format("m");
2548 2548
         $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
2549 2549
         if ($encodetooutput) {
2550 2550
             $monthtext = $outputlangs->transnoentities('Month' . $month);
@@ -2615,14 +2615,14 @@  discard block
 block discarded – undo
2615 2615
         $datetimeobj->setTimezone(new DateTimeZone($forcetimezone == 'gmt' ? 'UTC' : $forcetimezone)); //  (add timezone relative to the date entered)
2616 2616
     }
2617 2617
     $arrayinfo = array(
2618
-        'year' => ((int)date_format($datetimeobj, 'Y')),
2619
-        'mon' => ((int)date_format($datetimeobj, 'm')),
2620
-        'mday' => ((int)date_format($datetimeobj, 'd')),
2621
-        'wday' => ((int)date_format($datetimeobj, 'w')),
2622
-        'yday' => ((int)date_format($datetimeobj, 'z')),
2623
-        'hours' => ((int)date_format($datetimeobj, 'H')),
2624
-        'minutes' => ((int)date_format($datetimeobj, 'i')),
2625
-        'seconds' => ((int)date_format($datetimeobj, 's')),
2618
+        'year' => ((int) date_format($datetimeobj, 'Y')),
2619
+        'mon' => ((int) date_format($datetimeobj, 'm')),
2620
+        'mday' => ((int) date_format($datetimeobj, 'd')),
2621
+        'wday' => ((int) date_format($datetimeobj, 'w')),
2622
+        'yday' => ((int) date_format($datetimeobj, 'z')),
2623
+        'hours' => ((int) date_format($datetimeobj, 'H')),
2624
+        'minutes' => ((int) date_format($datetimeobj, 'i')),
2625
+        'seconds' => ((int) date_format($datetimeobj, 's')),
2626 2626
         '0' => $timestamp
2627 2627
     );
2628 2628
 
@@ -2720,8 +2720,8 @@  discard block
 block discarded – undo
2720 2720
     //var_dump($localtz);
2721 2721
     //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute);
2722 2722
     $dt = new DateTime('now', $localtz);
2723
-    $dt->setDate((int)$year, (int)$month, (int)$day);
2724
-    $dt->setTime((int)$hour, (int)$minute, (int)$second);
2723
+    $dt->setDate((int) $year, (int) $month, (int) $day);
2724
+    $dt->setTime((int) $hour, (int) $minute, (int) $second);
2725 2725
     $date = $dt->getTimestamp(); // should include daylight saving time
2726 2726
     //var_dump($date);
2727 2727
     return $date;
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
     } elseif ($mode == 'tzserver') {        // Time for now with PHP server timezone added
2752 2752
         require_once constant('DOL_DOCUMENT_ROOT') . '/core/lib/date.lib.php';
2753 2753
         $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time
2754
-        $ret = (int)(dol_now('gmt') + ($tzsecond * 3600));
2754
+        $ret = (int) (dol_now('gmt') + ($tzsecond * 3600));
2755 2755
         //} elseif ($mode == 'tzref') {// Time for now with parent company timezone is added
2756 2756
         //  require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
2757 2757
         //  $tzsecond=getParentCompanyTimeZoneInt();    // Contains tz+dayling saving time
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
         //print 'time: '.time();
2763 2763
         $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60;
2764 2764
         $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60;
2765
-        $ret = (int)(dol_now('gmt') + ($offsettz + $offsetdst));
2765
+        $ret = (int) (dol_now('gmt') + ($offsettz + $offsetdst));
2766 2766
     }
2767 2767
 
2768 2768
     return $ret;
@@ -2937,9 +2937,9 @@  discard block
 block discarded – undo
2937 2937
     if (empty($_SERVER['HTTP_X_FORWARDED_FOR']) || preg_match('/[^0-9.:,\[\]]/', $_SERVER['HTTP_X_FORWARDED_FOR'])) {
2938 2938
         if (empty($_SERVER['HTTP_CLIENT_IP']) || preg_match('/[^0-9.:,\[\]]/', $_SERVER['HTTP_CLIENT_IP'])) {
2939 2939
             if (empty($_SERVER["HTTP_CF_CONNECTING_IP"])) {
2940
-                $ip = (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']);  // value may have been the IP of the proxy and not the client
2940
+                $ip = (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']); // value may have been the IP of the proxy and not the client
2941 2941
             } else {
2942
-                $ip = $_SERVER["HTTP_CF_CONNECTING_IP"];    // value here may have been forged by client
2942
+                $ip = $_SERVER["HTTP_CF_CONNECTING_IP"]; // value here may have been forged by client
2943 2943
             }
2944 2944
         } else {
2945 2945
             $ip = $_SERVER['HTTP_CLIENT_IP']; // value is clean here but may have been forged by proxy
@@ -3139,7 +3139,7 @@  discard block
 block discarded – undo
3139 3139
             if (count($mxhosts) > 1) {
3140 3140
                 return 1;
3141 3141
             }
3142
-            if (count($mxhosts) == 1 && !in_array((string)$mxhosts[0], array('', '.'))) {
3142
+            if (count($mxhosts) == 1 && !in_array((string) $mxhosts[0], array('', '.'))) {
3143 3143
                 return 1;
3144 3144
             }
3145 3145
 
@@ -4165,7 +4165,7 @@  discard block
 block discarded – undo
4165 4165
     }
4166 4166
     // Si on depasse max
4167 4167
     $max_nbdecimal = getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN');
4168
-    if ($trunc && $nbdecimal > (int)$max_nbdecimal) {
4168
+    if ($trunc && $nbdecimal > (int) $max_nbdecimal) {
4169 4169
         $nbdecimal = $max_nbdecimal;
4170 4170
         if (preg_match('/\.\.\./i', $nbdecimal)) {
4171 4171
             // Si un affichage est tronque, on montre des ...
@@ -4174,7 +4174,7 @@  discard block
 block discarded – undo
4174 4174
     }
4175 4175
 
4176 4176
     // If force rounding
4177
-    if ((string)$forcerounding != '-1') {
4177
+    if ((string) $forcerounding != '-1') {
4178 4178
         if ($forcerounding === 'MU') {
4179 4179
             $nbdecimal = getDolGlobalString('MAIN_MAX_DECIMALS_UNIT');
4180 4180
         } elseif ($forcerounding === 'MT') {
@@ -4185,7 +4185,7 @@  discard block
 block discarded – undo
4185 4185
     }
4186 4186
 
4187 4187
     // Format number
4188
-    $output = number_format((float)$amount, $nbdecimal, $dec, $thousand);
4188
+    $output = number_format((float) $amount, $nbdecimal, $dec, $thousand);
4189 4189
     if ($form) {
4190 4190
         $output = preg_replace('/\s/', '&nbsp;', $output);
4191 4191
         $output = preg_replace('/\'/', '&#039;', $output);
@@ -4274,7 +4274,7 @@  discard block
 block discarded – undo
4274 4274
             $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount);
4275 4275
         }
4276 4276
 
4277
-        if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string)$amount)) {    // It means the . is used as a thousand separator and string come from input data, so 1.123 is 1123
4277
+        if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) {    // It means the . is used as a thousand separator and string come from input data, so 1.123 is 1123
4278 4278
             $amount = str_replace($thousand, '', $amount);
4279 4279
         }
4280 4280
 
@@ -4299,7 +4299,7 @@  discard block
 block discarded – undo
4299 4299
         $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
4300 4300
         $amount = str_replace($dec, '.', $amount);
4301 4301
 
4302
-        $amount = preg_replace('/[^0-9\-\.]/', '', $amount);    // Clean non numeric chars (so it clean some UTF8 spaces for example.
4302
+        $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example.
4303 4303
     }
4304 4304
     //print ' XX'.$amount.' '.$rounding;
4305 4305
 
@@ -4315,14 +4315,14 @@  discard block
 block discarded – undo
4315 4315
         } elseif ($rounding == 'CU') {
4316 4316
             $nbofdectoround = max(getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'), 8); // TODO Use param of currency
4317 4317
         } elseif ($rounding == 'CT') {
4318
-            $nbofdectoround = max(getDolGlobalString('MAIN_MAX_DECIMALS_TOT'), 8);      // TODO Use param of currency
4318
+            $nbofdectoround = max(getDolGlobalString('MAIN_MAX_DECIMALS_TOT'), 8); // TODO Use param of currency
4319 4319
         } elseif (is_numeric($rounding)) {
4320
-            $nbofdectoround = (int)$rounding;
4320
+            $nbofdectoround = (int) $rounding;
4321 4321
         }
4322 4322
 
4323 4323
         //print " RR".$amount.' - '.$nbofdectoround.'<br>';
4324 4324
         if (dol_strlen($nbofdectoround)) {
4325
-            $amount = round(is_string($amount) ? (float)$amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
4325
+            $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
4326 4326
         } else {
4327 4327
             return 'ErrorBadParameterProvidedToFunction';
4328 4328
         }
@@ -4349,7 +4349,7 @@  discard block
 block discarded – undo
4349 4349
         $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
4350 4350
         $amount = str_replace($dec, '.', $amount);
4351 4351
 
4352
-        $amount = preg_replace('/[^0-9\-\.]/', '', $amount);    // Clean non numeric chars (so it clean some UTF8 spaces for example.
4352
+        $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example.
4353 4353
     }
4354 4354
 
4355 4355
     return $amount;
@@ -4429,7 +4429,7 @@  discard block
 block discarded – undo
4429 4429
 
4430 4430
     $vatratecleaned = $vatrate;
4431 4431
     $reg = array();
4432
-    if (preg_match('/^(.*)\s*\((.*)\)$/', (string)$vatrate, $reg)) {     // If vat is "xx (yy)"
4432
+    if (preg_match('/^(.*)\s*\((.*)\)$/', (string) $vatrate, $reg)) {     // If vat is "xx (yy)"
4433 4433
         $vatratecleaned = trim($reg[1]);
4434 4434
         $vatratecode = $reg[2];
4435 4435
     }
@@ -4442,7 +4442,7 @@  discard block
 block discarded – undo
4442 4442
     // Some test to guess with no need to make database access
4443 4443
     if ($mysoc->country_code == 'ES') { // For spain localtaxes 1 and 2, tax is qualified if buyer use local tax
4444 4444
         if ($local == 1) {
4445
-            if (!$mysoc->localtax1_assuj || (string)$vatratecleaned == "0") {
4445
+            if (!$mysoc->localtax1_assuj || (string) $vatratecleaned == "0") {
4446 4446
                 return 0;
4447 4447
             }
4448 4448
             if ($thirdparty_seller->id == $mysoc->id) {
@@ -4518,7 +4518,7 @@  discard block
 block discarded – undo
4518 4518
     $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
4519 4519
     $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c";
4520 4520
     $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $db->escape($thirdparty_seller->country_code) . "'";
4521
-    $sql .= " AND t.taux = " . ((float)$vatratecleaned) . " AND t.active = 1";
4521
+    $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1";
4522 4522
     $sql .= " AND t.entity IN (" . getEntity('c_tva') . ")";
4523 4523
     if (!empty($vatratecode)) {
4524 4524
         $sql .= " AND t.code ='" . $db->escape($vatratecode) . "'"; // If we have the code, we use it in priority
@@ -4618,7 +4618,7 @@  discard block
 block discarded – undo
4618 4618
     $sql .= " t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type";
4619 4619
     $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t";
4620 4620
     if ($firstparamisid) {
4621
-        $sql .= " WHERE t.rowid = " . (int)$vatrate;
4621
+        $sql .= " WHERE t.rowid = " . (int) $vatrate;
4622 4622
     } else {
4623 4623
         $vatratecleaned = $vatrate;
4624 4624
         $vatratecode = '';
@@ -4632,7 +4632,7 @@  discard block
 block discarded – undo
4632 4632
         /*if ($mysoc->country_code == 'ES') $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($buyer->country_code)."'";    // vat in spain use the buyer country ??
4633 4633
         else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($seller->country_code)."'";*/
4634 4634
         $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $db->escape($seller->country_code) . "'";
4635
-        $sql .= " AND t.taux = " . ((float)$vatratecleaned) . " AND t.active = 1";
4635
+        $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1";
4636 4636
         $sql .= " AND t.entity IN (" . getEntity('c_tva') . ")";
4637 4637
         if ($vatratecode) {
4638 4638
             $sql .= " AND t.code = '" . $db->escape($vatratecode) . "'";
@@ -4691,7 +4691,7 @@  discard block
 block discarded – undo
4691 4691
     $sql = "SELECT t.taux as rate, t.code, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
4692 4692
     $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t";
4693 4693
     if ($firstparamisid) {
4694
-        $sql .= " WHERE t.rowid = " . (int)$vatrate;
4694
+        $sql .= " WHERE t.rowid = " . (int) $vatrate;
4695 4695
     } else {
4696 4696
         $vatratecleaned = $vatrate;
4697 4697
         $vatratecode = '';
@@ -4709,7 +4709,7 @@  discard block
 block discarded – undo
4709 4709
             $countrycodetouse = ((empty($seller) || empty($seller->country_code)) ? $mysoc->country_code : $seller->country_code);
4710 4710
             $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $db->escape($countrycodetouse) . "'";
4711 4711
         }
4712
-        $sql .= " AND t.taux = " . ((float)$vatratecleaned) . " AND t.active = 1";
4712
+        $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1";
4713 4713
         if ($vatratecode) {
4714 4714
             $sql .= " AND t.code = '" . $db->escape($vatratecode) . "'";
4715 4715
         }
@@ -4775,7 +4775,7 @@  discard block
 block discarded – undo
4775 4775
                 }
4776 4776
             }
4777 4777
             if (!$found) {
4778
-                $ret = $product->tva_tx;    // Default sales vat of product
4778
+                $ret = $product->tva_tx; // Default sales vat of product
4779 4779
                 if ($product->default_vat_code) {
4780 4780
                     $ret .= ' (' . $product->default_vat_code . ')';
4781 4781
                 }
@@ -4926,7 +4926,7 @@  discard block
 block discarded – undo
4926 4926
     $buyer_country_code = $thirdparty_buyer->country_code;
4927 4927
     $buyer_in_cee = isInEEC($thirdparty_buyer);
4928 4928
 
4929
-    dol_syslog("get_default_tva: seller use vat=" . $seller_use_vat . ", seller country=" . $seller_country_code . ", seller in cee=" . ((string)(int)$seller_in_cee) . ", buyer vat number=" . $thirdparty_buyer->tva_intra . " buyer country=" . $buyer_country_code . ", buyer in cee=" . ((string)(int)$buyer_in_cee) . ", idprod=" . $idprod . ", idprodfournprice=" . $idprodfournprice . ", SERVICE_ARE_ECOMMERCE_200238EC=" . (getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : ''));
4929
+    dol_syslog("get_default_tva: seller use vat=" . $seller_use_vat . ", seller country=" . $seller_country_code . ", seller in cee=" . ((string) (int) $seller_in_cee) . ", buyer vat number=" . $thirdparty_buyer->tva_intra . " buyer country=" . $buyer_country_code . ", buyer in cee=" . ((string) (int) $buyer_in_cee) . ", idprod=" . $idprod . ", idprodfournprice=" . $idprodfournprice . ", SERVICE_ARE_ECOMMERCE_200238EC=" . (getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : ''));
4930 4930
 
4931 4931
     // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm)
4932 4932
     // we use the buyer VAT.
@@ -5167,7 +5167,7 @@  discard block
 block discarded – undo
5167 5167
         // In a future, we may distribute directories on several levels depending on setup and object.
5168 5168
         // Here, $object->id, $object->ref and $modulepart are required.
5169 5169
         //var_dump($modulepart);
5170
-        $path = dol_sanitizeFileName(empty($object->ref) ? (string)((is_object($object) && property_exists($object, 'id')) ? $object->id : '') : $object->ref);
5170
+        $path = dol_sanitizeFileName(empty($object->ref) ? (string) ((is_object($object) && property_exists($object, 'id')) ? $object->id : '') : $object->ref);
5171 5171
     }
5172 5172
 
5173 5173
     if (empty($withoutslash) && !empty($path)) {
@@ -5227,7 +5227,7 @@  discard block
 block discarded – undo
5227 5227
                 dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG);
5228 5228
 
5229 5229
                 umask(0);
5230
-                $dirmaskdec = octdec((string)$newmask);
5230
+                $dirmaskdec = octdec((string) $newmask);
5231 5231
                 if (empty($newmask)) {
5232 5232
                     $dirmaskdec = !getDolGlobalString('MAIN_UMASK') ? octdec('0755') : octdec($conf->global->MAIN_UMASK);
5233 5233
                 }
@@ -5446,7 +5446,7 @@  discard block
 block discarded – undo
5446 5446
     }
5447 5447
     $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
5448 5448
 
5449
-    $nblines = (int)floor((count($a) + 1) / 2);
5449
+    $nblines = (int) floor((count($a) + 1) / 2);
5450 5450
     // count possible auto line breaks
5451 5451
     if ($maxlinesize) {
5452 5452
         foreach ($a as $line) {
@@ -5582,26 +5582,26 @@  discard block
 block discarded – undo
5582 5582
         $emailsendersignature = $user->signature; //  dy default, we use the signature of current user. We must complete substitution with signature in c_email_senderprofile of array after calling getCommonSubstitutionArray()
5583 5583
         $usersignature = $user->signature;
5584 5584
         $substitutionarray = array_merge($substitutionarray, array(
5585
-            '__SENDEREMAIL_SIGNATURE__' => (string)((!getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc('SignatureFromTheSelectedSenderProfile', 30) : $emailsendersignature) : ''),
5586
-            '__USER_SIGNATURE__' => (string)(($usersignature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($usersignature), 30) : $usersignature) : '')
5585
+            '__SENDEREMAIL_SIGNATURE__' => (string) ((!getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc('SignatureFromTheSelectedSenderProfile', 30) : $emailsendersignature) : ''),
5586
+            '__USER_SIGNATURE__' => (string) (($usersignature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($usersignature), 30) : $usersignature) : '')
5587 5587
         ));
5588 5588
 
5589 5589
         if (is_object($user) && ($user instanceof User)) {
5590 5590
             $substitutionarray = array_merge($substitutionarray, array(
5591
-                '__USER_ID__' => (string)$user->id,
5592
-                '__USER_LOGIN__' => (string)$user->login,
5593
-                '__USER_EMAIL__' => (string)$user->email,
5594
-                '__USER_PHONE__' => (string)dol_print_phone($user->office_phone, '', 0, 0, '', " ", '', '', -1),
5595
-                '__USER_PHONEPRO__' => (string)dol_print_phone($user->user_mobile, '', 0, 0, '', " ", '', '', -1),
5596
-                '__USER_PHONEMOBILE__' => (string)dol_print_phone($user->personal_mobile, '', 0, 0, '', " ", '', '', -1),
5597
-                '__USER_FAX__' => (string)$user->office_fax,
5598
-                '__USER_LASTNAME__' => (string)$user->lastname,
5599
-                '__USER_FIRSTNAME__' => (string)$user->firstname,
5600
-                '__USER_FULLNAME__' => (string)$user->getFullName($outputlangs),
5601
-                '__USER_SUPERVISOR_ID__' => (string)($user->fk_user ? $user->fk_user : '0'),
5602
-                '__USER_JOB__' => (string)$user->job,
5603
-                '__USER_REMOTE_IP__' => (string)getUserRemoteIP(),
5604
-                '__USER_VCARD_URL__' => (string)$user->getOnlineVirtualCardUrl('', 'external')
5591
+                '__USER_ID__' => (string) $user->id,
5592
+                '__USER_LOGIN__' => (string) $user->login,
5593
+                '__USER_EMAIL__' => (string) $user->email,
5594
+                '__USER_PHONE__' => (string) dol_print_phone($user->office_phone, '', 0, 0, '', " ", '', '', -1),
5595
+                '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile, '', 0, 0, '', " ", '', '', -1),
5596
+                '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile, '', 0, 0, '', " ", '', '', -1),
5597
+                '__USER_FAX__' => (string) $user->office_fax,
5598
+                '__USER_LASTNAME__' => (string) $user->lastname,
5599
+                '__USER_FIRSTNAME__' => (string) $user->firstname,
5600
+                '__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
5601
+                '__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
5602
+                '__USER_JOB__' => (string) $user->job,
5603
+                '__USER_REMOTE_IP__' => (string) getUserRemoteIP(),
5604
+                '__USER_VCARD_URL__' => (string) $user->getOnlineVirtualCardUrl('', 'external')
5605 5605
             ));
5606 5606
         }
5607 5607
     }
@@ -5622,7 +5622,7 @@  discard block
 block discarded – undo
5622 5622
             '__MYCOMPANY_PROFID9__' => $mysoc->idprof9,
5623 5623
             '__MYCOMPANY_PROFID10__' => $mysoc->idprof10,
5624 5624
             '__MYCOMPANY_CAPITAL__' => $mysoc->capital,
5625
-            '__MYCOMPANY_FULLADDRESS__' => (method_exists($mysoc, 'getFullAddress') ? $mysoc->getFullAddress(1, ', ') : ''),    // $mysoc may be stdClass
5625
+            '__MYCOMPANY_FULLADDRESS__' => (method_exists($mysoc, 'getFullAddress') ? $mysoc->getFullAddress(1, ', ') : ''), // $mysoc may be stdClass
5626 5626
             '__MYCOMPANY_ADDRESS__' => $mysoc->address,
5627 5627
             '__MYCOMPANY_ZIP__' => $mysoc->zip,
5628 5628
             '__MYCOMPANY_TOWN__' => $mysoc->town,
@@ -5994,7 +5994,7 @@  discard block
 block discarded – undo
5994 5994
                                 $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = dol_print_phone($object->array_options['options_' . $key]);
5995 5995
                             } elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'price') {
5996 5996
                                 $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
5997
-                                $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_FORMATED__'] = price($object->array_options['options_' . $key]);    // For compatibility
5997
+                                $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_FORMATED__'] = price($object->array_options['options_' . $key]); // For compatibility
5998 5998
                                 $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_FORMATTED__'] = price($object->array_options['options_' . $key]);
5999 5999
                             } elseif ($extrafields->attributes[$object->table_element]['type'][$key] != 'separator') {
6000 6000
                                 $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = !empty($object->array_options['options_' . $key]) ? $object->array_options['options_' . $key] : '';
@@ -6209,26 +6209,26 @@  discard block
 block discarded – undo
6209 6209
         $daytext = $outputlangs->trans('Day' . $tmp['wday']);
6210 6210
 
6211 6211
         $substitutionarray = array_merge($substitutionarray, array(
6212
-            '__NOW_TMS__' => (string)$now,     // Must be the string that represent the int
6212
+            '__NOW_TMS__' => (string) $now, // Must be the string that represent the int
6213 6213
             '__NOW_TMS_YMD__' => dol_print_date($now, 'day', 'auto', $outputlangs),
6214
-            '__DAY__' => (string)$tmp['mday'],
6214
+            '__DAY__' => (string) $tmp['mday'],
6215 6215
             '__DAY_TEXT__' => $daytext, // Monday
6216 6216
             '__DAY_TEXT_SHORT__' => dol_trunc($daytext, 3, 'right', 'UTF-8', 1), // Mon
6217 6217
             '__DAY_TEXT_MIN__' => dol_trunc($daytext, 1, 'right', 'UTF-8', 1), // M
6218
-            '__MONTH__' => (string)$tmp['mon'],
6218
+            '__MONTH__' => (string) $tmp['mon'],
6219 6219
             '__MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp['mon'])),
6220 6220
             '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp['mon'])),
6221 6221
             '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp['mon'])),
6222
-            '__YEAR__' => (string)$tmp['year'],
6223
-            '__PREVIOUS_DAY__' => (string)$tmp2['day'],
6224
-            '__PREVIOUS_MONTH__' => (string)$tmp3['month'],
6225
-            '__PREVIOUS_YEAR__' => (string)($tmp['year'] - 1),
6226
-            '__NEXT_DAY__' => (string)$tmp4['day'],
6227
-            '__NEXT_MONTH__' => (string)$tmp5['month'],
6222
+            '__YEAR__' => (string) $tmp['year'],
6223
+            '__PREVIOUS_DAY__' => (string) $tmp2['day'],
6224
+            '__PREVIOUS_MONTH__' => (string) $tmp3['month'],
6225
+            '__PREVIOUS_YEAR__' => (string) ($tmp['year'] - 1),
6226
+            '__NEXT_DAY__' => (string) $tmp4['day'],
6227
+            '__NEXT_MONTH__' => (string) $tmp5['month'],
6228 6228
             '__NEXT_MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp5['month'])),
6229 6229
             '__NEXT_MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp5['month'])),
6230 6230
             '__NEXT_MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp5['month'])),
6231
-            '__NEXT_YEAR__' => (string)($tmp['year'] + 1),
6231
+            '__NEXT_YEAR__' => (string) ($tmp['year'] + 1),
6232 6232
         ));
6233 6233
     }
6234 6234
 
@@ -6396,7 +6396,7 @@  discard block
 block discarded – undo
6396 6396
                         $path = $param_arr[0];
6397 6397
                         $class = $param_arr[1];
6398 6398
                         $method = $param_arr[2];
6399
-                        $id = (int)$param_arr[3];
6399
+                        $id = (int) $param_arr[3];
6400 6400
 
6401 6401
                         // load class file and init object list in memory
6402 6402
                         if (!isset($memory_object_list[$class])) {
@@ -6458,7 +6458,7 @@  discard block
 block discarded – undo
6458 6458
     // Note: substitution key for each extrafields, using key __EXTRA_XXX__ is already available into the getCommonSubstitutionArray used to build the substitution array.
6459 6459
 
6460 6460
     // Check if there is external substitution to do, requested by plugins
6461
-    $dirsubstitutions = array_merge(array(), (array)$conf->modules_parts['substitutions']);
6461
+    $dirsubstitutions = array_merge(array(), (array) $conf->modules_parts['substitutions']);
6462 6462
 
6463 6463
     foreach ($dirsubstitutions as $reldir) {
6464 6464
         $dir = dol_buildpath($reldir, 0);
@@ -6601,7 +6601,7 @@  discard block
 block discarded – undo
6601 6601
 {
6602 6602
     //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);     This is not deprecated, it is used by setEventMessages function
6603 6603
     if (!is_array($mesgs)) {
6604
-        $mesgs = trim((string)$mesgs);
6604
+        $mesgs = trim((string) $mesgs);
6605 6605
         // If mesgs is a not an empty string
6606 6606
         if ($mesgs) {
6607 6607
             if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) {
@@ -6612,7 +6612,7 @@  discard block
 block discarded – undo
6612 6612
     } else {
6613 6613
         // If mesgs is an array
6614 6614
         foreach ($mesgs as $mesg) {
6615
-            $mesg = trim((string)$mesg);
6615
+            $mesg = trim((string) $mesg);
6616 6616
             if ($mesg) {
6617 6617
                 if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesg, $_SESSION['dol_events'][$style])) {
6618 6618
                     return;
@@ -6646,7 +6646,7 @@  discard block
 block discarded – undo
6646 6646
             $mesg .= '';
6647 6647
         }
6648 6648
         if (empty($messagekey) || empty($_COOKIE["DOLHIDEMESSAGE" . $messagekey])) {
6649
-            if (!in_array((string)$style, array('mesgs', 'warnings', 'errors'))) {
6649
+            if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) {
6650 6650
                 dol_print_error(null, 'Bad parameter style=' . $style . ' for setEventMessages');
6651 6651
             }
6652 6652
             if (empty($mesgs)) {
@@ -6691,7 +6691,7 @@  discard block
 block discarded – undo
6691 6691
                     $temp[$key] = empty($array[$key][$index]) ? 0 : $array[$key][$index];
6692 6692
                 }
6693 6693
                 if ($natsort == -1) {
6694
-                    $temp[$key] = '___' . $temp[$key];        // We add a string at begin of value to force an alpha order when using asort.
6694
+                    $temp[$key] = '___' . $temp[$key]; // We add a string at begin of value to force an alpha order when using asort.
6695 6695
                 }
6696 6696
             }
6697 6697
 
@@ -6734,7 +6734,7 @@  discard block
 block discarded – undo
6734 6734
  */
6735 6735
 function utf8_check($str)
6736 6736
 {
6737
-    $str = (string)$str;   // Sometimes string is an int.
6737
+    $str = (string) $str; // Sometimes string is an int.
6738 6738
 
6739 6739
     // We must use here a binary strlen function (so not dol_strlen)
6740 6740
     $strLength = strlen($str);
@@ -6929,7 +6929,7 @@  discard block
 block discarded – undo
6929 6929
     if (isset($strToEvaluate) && $strToEvaluate !== '') {
6930 6930
         //var_dump($strToEvaluate);
6931 6931
         //$rep = dol_eval($strToEvaluate, 1, 0, '1'); // to show the error
6932
-        $rep = (int)dol_eval($strToEvaluate, 1, 1, $onlysimplestring); // The dol_eval() must contains all the "global $xxx;" for all variables $xxx found into the string condition
6932
+        $rep = (int) dol_eval($strToEvaluate, 1, 1, $onlysimplestring); // The dol_eval() must contains all the "global $xxx;" for all variables $xxx found into the string condition
6933 6933
         $rights = $rep && (!is_string($rep) || strpos($rep, 'Bad string syntax to evaluate') === false);
6934 6934
         //var_dump($rights);
6935 6935
     }
@@ -6953,17 +6953,17 @@  discard block
 block discarded – undo
6953 6953
 function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1')
6954 6954
 {
6955 6955
     // Only this global variables can be read by eval function and returned to caller
6956
-    global $conf;   // Read of const is done with getDolGlobalString() but we need $conf->currency for example
6956
+    global $conf; // Read of const is done with getDolGlobalString() but we need $conf->currency for example
6957 6957
     global $db, $langs, $user, $website, $websitepage;
6958 6958
     global $action, $mainmenu, $leftmenu;
6959 6959
     global $mysoc;
6960
-    global $objectoffield;  // To allow the use of $objectoffield in computed fields
6960
+    global $objectoffield; // To allow the use of $objectoffield in computed fields
6961 6961
 
6962 6962
     // Old variables used
6963 6963
     global $object;
6964 6964
     global $obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object
6965 6965
 
6966
-    $isObBufferActive = false;  // When true, the ObBuffer must be cleaned in the exception handler
6966
+    $isObBufferActive = false; // When true, the ObBuffer must be cleaned in the exception handler
6967 6967
     if (!in_array($onlysimplestring, array('0', '1', '2'))) {
6968 6968
         return "Bad call of dol_eval. Parameter onlysimplestring must be '0' (deprecated), '1' or '2'";
6969 6969
     }
@@ -6994,11 +6994,11 @@  discard block
 block discarded – undo
6994 6994
             while ($scheck && $savescheck != $scheck) {
6995 6995
                 $savescheck = $scheck;
6996 6996
                 $scheck = preg_replace('/->[a-zA-Z0-9_]+\(/', '->__METHOD__', $scheck); // accept parenthesis in '...->method(...'
6997
-                $scheck = preg_replace('/^\(/', '__PARENTHESIS__ ', $scheck);   // accept parenthesis in '(...'. Must replace with __PARENTHESIS__ with a space after to allow following substitutions
6998
-                $scheck = preg_replace('/\s\(/', '__PARENTHESIS__ ', $scheck);  // accept parenthesis in '... ('. Must replace with __PARENTHESIS__ with a space after to allow following substitutions
6997
+                $scheck = preg_replace('/^\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '(...'. Must replace with __PARENTHESIS__ with a space after to allow following substitutions
6998
+                $scheck = preg_replace('/\s\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '... ('. Must replace with __PARENTHESIS__ with a space after to allow following substitutions
6999 6999
                 $scheck = preg_replace('/^!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in 'function(' and '!function('
7000 7000
                 $scheck = preg_replace('/\s!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in '... function(' and '... !function('
7001
-                $scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck);   // To allow preg_match('/^(aaa|bbb)/'...  or  isStringVarMatching('leftmenu', '(aaa|bbb)')
7001
+                $scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'...  or  isStringVarMatching('leftmenu', '(aaa|bbb)')
7002 7002
             }
7003 7003
             //print 'scheck='.$scheck." : ".strpos($scheck, '(')."<br>\n";
7004 7004
             if (strpos($scheck, '(') !== false) {
@@ -7055,7 +7055,7 @@  discard block
 block discarded – undo
7055 7055
         $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities
7056 7056
         $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_decode", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions
7057 7057
 
7058
-        $forbiddenphpmethods = array('invoke', 'invokeArgs');   // Method of ReflectionFunction to execute a function
7058
+        $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function
7059 7059
 
7060 7060
         $forbiddenphpregex = 'global\s+\$|\b(' . implode('|', $forbiddenphpfunctions) . ')\b';
7061 7061
 
@@ -7273,8 +7273,8 @@  discard block
 block discarded – undo
7273 7273
         'en-GB',
7274 7274
         'en-IE',
7275 7275
         'en-IN',
7276
-        'as-IN',    // as-IN must be after en-IN (en in priority if country is IN)
7277
-        'bn-IN',    // bn-IN must be after en-IN (en in priority if country is IN)
7276
+        'as-IN', // as-IN must be after en-IN (en in priority if country is IN)
7277
+        'bn-IN', // bn-IN must be after en-IN (en in priority if country is IN)
7278 7278
         'en-JM',
7279 7279
         'en-MY',
7280 7280
         'en-NZ',
@@ -7476,7 +7476,7 @@  discard block
 block discarded – undo
7476 7476
     if (!function_exists('getmypid')) {
7477 7477
         return mt_rand(99900000, 99965535);
7478 7478
     } else {
7479
-        return getmypid();  // May be a number on 64 bits (depending on OS)
7479
+        return getmypid(); // May be a number on 64 bits (depending on OS)
7480 7480
     }
7481 7481
 }
7482 7482
 
@@ -7523,15 +7523,15 @@  discard block
 block discarded – undo
7523 7523
         $fields = array($fields);
7524 7524
     }
7525 7525
 
7526
-    $i1 = 0;    // count the nb of and criteria added (all fields / criteria)
7526
+    $i1 = 0; // count the nb of and criteria added (all fields / criteria)
7527 7527
     foreach ($crits as $crit) {     // Loop on each AND criteria
7528 7528
         $crit = trim($crit);
7529
-        $i2 = 0;    // count the nb of valid criteria added for this this first criteria
7529
+        $i2 = 0; // count the nb of valid criteria added for this this first criteria
7530 7530
         $newres = '';
7531 7531
         foreach ($fields as $field) {
7532 7532
             if ($mode == 1) {
7533 7533
                 $tmpcrits = explode('|', $crit);
7534
-                $i3 = 0;    // count the nb of valid criteria added for this current field
7534
+                $i3 = 0; // count the nb of valid criteria added for this current field
7535 7535
                 foreach ($tmpcrits as $tmpcrit) {
7536 7536
                     if ($tmpcrit !== '0' && empty($tmpcrit)) {
7537 7537
                         continue;
@@ -7551,7 +7551,7 @@  discard block
 block discarded – undo
7551 7551
                     if ($newcrit != '') {
7552 7552
                         $numnewcrit = price2num($newcrit);
7553 7553
                         if (is_numeric($numnewcrit)) {
7554
-                            $newres .= $field . ' ' . $operator . ' ' . ((float)$numnewcrit); // should be a numeric
7554
+                            $newres .= $field . ' ' . $operator . ' ' . ((float) $numnewcrit); // should be a numeric
7555 7555
                         } else {
7556 7556
                             $newres .= '1 = 2'; // force false, we received a corrupted data
7557 7557
                         }
@@ -7602,7 +7602,7 @@  discard block
 block discarded – undo
7602 7602
                 }
7603 7603
             } else { // $mode=0
7604 7604
                 $tmpcrits = explode('|', $crit);
7605
-                $i3 = 0;    // count the nb of valid criteria added for the current couple criteria/field
7605
+                $i3 = 0; // count the nb of valid criteria added for the current couple criteria/field
7606 7606
                 foreach ($tmpcrits as $tmpcrit) {   // loop on each OR criteria
7607 7607
                     if ($tmpcrit !== '0' && empty($tmpcrit)) {
7608 7608
                         continue;
@@ -7616,7 +7616,7 @@  discard block
 block discarded – undo
7616 7616
                     }
7617 7617
 
7618 7618
                     if (preg_match('/\.(id|rowid)$/', $field)) {    // Special case for rowid that is sometimes a ref so used as a search field
7619
-                        $newres .= $field . " = " . (is_numeric($tmpcrit) ? ((float)$tmpcrit) : '0');
7619
+                        $newres .= $field . " = " . (is_numeric($tmpcrit) ? ((float) $tmpcrit) : '0');
7620 7620
                     } else {
7621 7621
                         $tmpcrit2 = $tmpcrit;
7622 7622
                         $tmpbefore = '%';
@@ -8121,7 +8121,7 @@  discard block
 block discarded – undo
8121 8121
     }
8122 8122
 
8123 8123
     // Return mimetype string
8124
-    switch ((int)$mode) {
8124
+    switch ((int) $mode) {
8125 8125
         case 1:
8126 8126
             $tmp = explode('/', $mime);
8127 8127
             return (!empty($tmp[1]) ? $tmp[1] : $tmp[0]);
@@ -8150,7 +8150,7 @@  discard block
 block discarded – undo
8150 8150
 {
8151 8151
     global $conf, $db;
8152 8152
 
8153
-    $tablename = preg_replace('/^' . preg_quote(MAIN_DB_PREFIX, '/') . '/', '', $tablename);    // Clean name of table for backward compatibility.
8153
+    $tablename = preg_replace('/^' . preg_quote(MAIN_DB_PREFIX, '/') . '/', '', $tablename); // Clean name of table for backward compatibility.
8154 8154
 
8155 8155
     $dictvalues = (isset($conf->cache['dictvalues_' . $tablename]) ? $conf->cache['dictvalues_' . $tablename] : null);
8156 8156
 
@@ -8165,7 +8165,7 @@  discard block
 block discarded – undo
8165 8165
         $resql = $db->query($sql);
8166 8166
         if ($resql) {
8167 8167
             while ($obj = $db->fetch_object($resql)) {
8168
-                $dictvalues[$obj->$rowidfield] = $obj;  // $obj is stdClass
8168
+                $dictvalues[$obj->$rowidfield] = $obj; // $obj is stdClass
8169 8169
             }
8170 8170
         } else {
8171 8171
             dol_print_error($db);
@@ -8269,7 +8269,7 @@  discard block
 block discarded – undo
8269 8269
 function roundUpToNextMultiple($n, $x = 5)
8270 8270
 {
8271 8271
     $result = (ceil($n) % $x === 0) ? ceil($n) : (round(($n + $x / 2) / $x) * $x);
8272
-    return (int)$result;
8272
+    return (int) $result;
8273 8273
 }
8274 8274
 
8275 8275
 /**
@@ -8346,7 +8346,7 @@  discard block
 block discarded – undo
8346 8346
                     return $objecttmp;
8347 8347
                 }
8348 8348
             } else {
8349
-                return $objecttmp;  // returned an object without fetch
8349
+                return $objecttmp; // returned an object without fetch
8350 8350
             }
8351 8351
         } else {
8352 8352
             return -1;
Please login to merge, or discard this patch.
public/htdocs/core/lib/data.lib.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
         if (strtoupper($tmpescaped) == 'NULL') {
214 214
             $tmpescaped = 'NULL';
215 215
         } elseif (is_int($tmpescaped)) {
216
-            $tmpescaped = (int)$tmpescaped;
216
+            $tmpescaped = (int) $tmpescaped;
217 217
         } else {
218
-            $tmpescaped = (float)$tmpescaped;
218
+            $tmpescaped = (float) $tmpescaped;
219 219
         }
220 220
     }
221 221
 
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
         $filter = '(' . $filter . ')';
251 251
     }
252 252
 
253
-    $regexstring = '\(([a-zA-Z0-9_.]+:[<>!=insotlke]+:[^()]+)\)';    // Must be  (aaa:bbb:...) with aaa is a field name (with alias or not) and bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot'
253
+    $regexstring = '\(([a-zA-Z0-9_.]+:[<>!=insotlke]+:[^()]+)\)'; // Must be  (aaa:bbb:...) with aaa is a field name (with alias or not) and bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot'
254 254
     $firstandlastparenthesis = 0;
255 255
 
256 256
     if (!dolCheckFilters($filter, $errorstr, $firstandlastparenthesis)) {
257 257
         if ($noerror) {
258 258
             return '1 = 2';
259 259
         } else {
260
-            return 'Filter syntax error - ' . $errorstr;      // Bad balance of parenthesis, we return an error message or force a SQL not found
260
+            return 'Filter syntax error - ' . $errorstr; // Bad balance of parenthesis, we return an error message or force a SQL not found
261 261
         }
262 262
     }
263 263
 
264 264
     // Test the filter syntax
265 265
     $t = preg_replace_callback('/' . $regexstring . '/i', 'dolForgeDummyCriteriaCallback', $filter);
266
-    $t = str_replace(array('and', 'or', 'AND', 'OR', ' '), '', $t);     // Remove the only strings allowed between each () criteria
266
+    $t = str_replace(array('and', 'or', 'AND', 'OR', ' '), '', $t); // Remove the only strings allowed between each () criteria
267 267
     // If the string result contains something else than '()', the syntax was wrong
268 268
 
269 269
     if (preg_match('/[^()]/', $t)) {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         if ($noerror) {
273 273
             return '1 = 2';
274 274
         } else {
275
-            return 'Filter error - ' . $tmperrorstr;      // Bad syntax of the search string, we return an error message or force a SQL not found
275
+            return 'Filter error - ' . $tmperrorstr; // Bad syntax of the search string, we return an error message or force a SQL not found
276 276
         }
277 277
     }
278 278
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         $ret = str_replace('__NOW__', $db->idate(dol_now()), $ret);
283 283
     }
284 284
     if (is_object($user)) {
285
-        $ret = str_replace('__USER_ID__', (string)$user->id, $ret);
285
+        $ret = str_replace('__USER_ID__', (string) $user->id, $ret);
286 286
     }
287 287
 
288 288
     return $ret;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
         return '';
434 434
     }
435 435
 
436
-    return '()';    // An empty criteria
436
+    return '()'; // An empty criteria
437 437
 }
438 438
 
439 439
 /**
Please login to merge, or discard this patch.