Passed
Push — master ( 3cffbe...0f9140 )
by Alxarafe
23:50
created
Base/AlixarView.php 2 patches
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 // html header
126 126
         $this->top_htmlhead(/* $this->head, $this->title, $this->disablejs, $this->disablehead, $this->arrayofjs, $this->arrayofcss */);
127 127
 
128
-        print '<body id="mainbody"' . ($this->morecssonbody ? ' class="' . $this->morecssonbody . '"' : '') . '>' . "\n";
128
+        print '<body id="mainbody"'.($this->morecssonbody ? ' class="'.$this->morecssonbody.'"' : '').'>'."\n";
129 129
 
130 130
 // top menu and left menu area
131 131
         if (empty(Globals::$conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) {
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
         if (empty(Globals::$conf->dol_hide_leftmenu)) {
136 136
             //$this->left_menu('', $this->help_url, '', '', 1, $this->title, 1);  // $menumanager is retreived with a global $menumanager inside this function
137
-            $this->left_menu('', /* $this->help_url, */ '', '', 1, /* $this->title, */ 1);  // $menumanager is retreived with a global $menumanager inside this function
137
+            $this->left_menu('', /* $this->help_url, */ '', '', 1, /* $this->title, */ 1); // $menumanager is retreived with a global $menumanager inside this function
138 138
         }
139 139
 
140 140
 // main area
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
          * Top menu
186 186
          */
187 187
         if ((empty(Globals::$conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
188
-            print "\n" . '<!-- Start top horizontal -->' . "\n";
188
+            print "\n".'<!-- Start top horizontal -->'."\n";
189 189
 
190
-            print '<div class="side-nav-vert' . (AlDolUtils::GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '') . '"><div id="id-top">';  // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
190
+            print '<div class="side-nav-vert'.(AlDolUtils::GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '').'"><div id="id-top">'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
191 191
 // Show menu entries
192
-            print '<div id="tmenu_tooltip' . (empty(Globals::$conf->global->MAIN_MENU_INVERT) ? '' : 'invert') . '" class="tmenu">' . "\n";
192
+            print '<div id="tmenu_tooltip'.(empty(Globals::$conf->global->MAIN_MENU_INVERT) ? '' : 'invert').'" class="tmenu">'."\n";
193 193
             Globals::$menuManager->atarget = $this->target;
194
-            Globals::$menuManager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks));      // This contains a \n
194
+            Globals::$menuManager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n
195 195
             print "</div>\n";
196 196
 
197 197
 // Define link to login card
@@ -199,36 +199,36 @@  discard block
 block discarded – undo
199 199
             if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) {
200 200
                 $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE;
201 201
                 if (preg_match('/\d\.\d/', $appli)) {
202
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
203
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
202
+                    if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
203
+                        $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
204 204
                 } else
205
-                    $appli .= " " . DOL_VERSION;
205
+                    $appli .= " ".DOL_VERSION;
206 206
             } else
207
-                $appli .= " " . DOL_VERSION;
207
+                $appli .= " ".DOL_VERSION;
208 208
 
209 209
             if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL))
210
-                $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL;
210
+                $appli .= "<br>".Globals::$langs->trans("LevelOfFeature").': '.Globals::$conf->global->MAIN_FEATURES_LEVEL;
211 211
 
212 212
             $logouttext = '';
213 213
             if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
214 214
 //$logouthtmltext=$appli.'<br>';
215 215
                 $logouthtmltext = '';
216 216
                 if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { {
217
-                        $logouthtmltext .= Globals::$langs->trans("Logout") . '<br>';
217
+                        $logouthtmltext .= Globals::$langs->trans("Logout").'<br>';
218 218
                     }
219 219
 
220 220
 //$logouttext .='<a accesskey="l" href="'.DOL_BASE_URI.'/user/logout.php">';
221
-                    $logouttext .= '<a accesskey="l" href="' . BASE_URI . '?controller=user&method=logout">';
221
+                    $logouttext .= '<a accesskey="l" href="'.BASE_URI.'?controller=user&method=logout">';
222 222
 //$logouttext .= img_picto(Globals::$langs->trans('Logout').":".Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
223 223
                     $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
224 224
                     $logouttext .= '</a>';
225 225
                 } else {
226 226
                     $logouthtmltext .= Globals::$langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
227
-                    $logouttext .= img_picto(Globals::$langs->trans('Logout') . ":" . Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
227
+                    $logouttext .= img_picto(Globals::$langs->trans('Logout').":".Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
228 228
                 }
229 229
             }
230 230
 
231
-            print '<div class="login_block">' . "\n";
231
+            print '<div class="login_block">'."\n";
232 232
 
233 233
 // Add login user link
234 234
             $toprightmenu .= '<div class="login_block_user">';
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
             $toprightmenu .= Globals::$user->getNomUrl($mode, '', 1, 0, 11, 0, (Globals::$user->firstname ? 'firstname' : -1), 'atoplogin');
240 240
             $toprightmenu .= '</div></div>';
241 241
 
242
-            $toprightmenu .= '</div>' . "\n";
242
+            $toprightmenu .= '</div>'."\n";
243 243
 
244 244
             $toprightmenu .= '<div class="login_block_other">';
245 245
 
246 246
 // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
247 247
             $parameters = array();
248
-            $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
248
+            $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
249 249
             if (is_numeric($result)) {
250 250
                 if ($result == 0)
251
-                    $toprightmenu .= Globals::$hookManager->resPrint;  // add
251
+                    $toprightmenu .= Globals::$hookManager->resPrint; // add
252 252
                 else
253
-                    $toprightmenu = Globals::$hookManager->resPrint;      // replace
253
+                    $toprightmenu = Globals::$hookManager->resPrint; // replace
254 254
             }
255 255
             else {
256 256
                 $toprightmenu .= $result; // For backward compatibility
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 // Link to module builder
260 260
             if (!empty(Globals::$conf->modulebuilder->enabled)) {
261 261
 //$text = '<a href="' . DOL_BASE_URI . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
262
-                $text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
262
+                $text = '<a href="'.BASE_URI.'?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
263 263
 //$text.= img_picto(":".Globals::$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
264 264
                 $text .= '<span class="fa fa-bug atoplogin"></span>';
265 265
                 $text .= '</a>';
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
                 if (is_array($_POST)) {
274 274
                     foreach ($_POST as $key => $value) {
275 275
                         if ($key !== 'action' && $key !== 'password' && !is_array($value)) {
276
-                            $qs .= '&' . $key . '=' . urlencode($value);
276
+                            $qs .= '&'.$key.'='.urlencode($value);
277 277
                         }
278 278
                     }
279 279
                 }
280
-                $qs .= (($qs && $this->morequerystring) ? '&' : '') . $this->morequerystring;
281
-                $text = '<a href="' . AlDolUtils::dol_escape_htmltag($_SERVER["PHP_SELF"]) . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">';
280
+                $qs .= (($qs && $this->morequerystring) ? '&' : '').$this->morequerystring;
281
+                $text = '<a href="'.AlDolUtils::dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs ? '&' : '').'optioncss=print" target="_blank">';
282 282
 //$text.= img_picto(":".Globals::$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
283 283
                 $text .= '<span class="fa fa-print atoplogin"></span>';
284 284
                 $text .= '</a>';
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
                     $text = '';
308 308
                     if (!empty(Globals::$conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
309 309
                         Globals::$langs->load('admin');
310
-                        $appli .= '<br>' . Globals::$langs->trans("Database") . ': ' . $db->database_name;
310
+                        $appli .= '<br>'.Globals::$langs->trans("Database").': '.$db->database_name;
311 311
                     }
312
-                    $this->title = $appli . '<br>';
312
+                    $this->title = $appli.'<br>';
313 313
                     $this->title .= Globals::$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage');
314 314
                     if ($mode == 'wiki') {
315
-                        $this->title .= ' - ' . Globals::$langs->trans("PageWiki") . ' &quot;' . AlDolUtils::dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
315
+                        $this->title .= ' - '.Globals::$langs->trans("PageWiki").' &quot;'.AlDolUtils::dol_escape_htmltag(strtr($helppage, '_', ' ')).'&quot;';
316 316
                     }
317 317
                     $text .= '<a class="help" target="_blank" rel="noopener" href="';
318 318
                     if ($mode == 'wiki') {
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 
339 339
             print $toprightmenu;
340 340
 
341
-            print "</div>\n";  // end div class="login_block"
341
+            print "</div>\n"; // end div class="login_block"
342 342
 
343 343
             print '</div></div>';
344 344
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         }
348 348
 
349 349
         if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) {
350
-            print '<!-- Begin div id-container --><div id="id-container" class="id-container' . (isset($morecss) && $morecss ? ' ' . $morecss : '') . '">';
350
+            print '<!-- Begin div id-container --><div id="id-container" class="id-container'.(isset($morecss) && $morecss ? ' '.$morecss : '').'">';
351 351
         }
352 352
     }
353 353
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
             // Instantiate hooks of thirdparty module
381 381
             Globals::$hookManager->initHooks(array('searchform', 'leftblock'));
382 382
 
383
-            print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
383
+            print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
384 384
 
385 385
             if (Globals::$conf->browser->layout == 'phone') {
386 386
                 Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 // Execute hook printSearchForm
410 410
             $parameters = array('searchform' => $searchform);
411 411
 
412
-            $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
412
+            $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
413 413
             if (empty($reshook)) {
414 414
                 $searchform .= Globals::$hookManager->resPrint;
415 415
             } else
@@ -417,10 +417,10 @@  discard block
 block discarded – undo
417 417
 
418 418
 // Force special value for $searchform
419 419
             if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty(Globals::$conf->use_javascript_ajax)) {
420
-                $urltosearch = DOL_BASE_URI . '/core/search_page.php?showtitlebefore=1';
421
-                $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" alt="' . AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")) . '">' . Globals::$langs->trans("Search") . '...</a></div></div>';
420
+                $urltosearch = DOL_BASE_URI.'/core/search_page.php?showtitlebefore=1';
421
+                $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" alt="'.AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")).'">'.Globals::$langs->trans("Search").'...</a></div></div>';
422 422
             } elseif (Globals::$conf->use_javascript_ajax && !empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
423
-                $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="' . AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")) . '">' . Globals::$langs->trans("Search") . '...</a></div><div id="divsearchforms2" style="display: none">' . $searchform . '</div>';
423
+                $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="'.AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")).'">'.Globals::$langs->trans("Search").'...</a></div><div id="divsearchforms2" style="display: none">'.$searchform.'</div>';
424 424
                 $searchform .= '<script type="text/javascript">
425 425
             	jQuery(document).ready(function () {
426 426
             		jQuery("#divsearchforms1").click(function(){
@@ -433,16 +433,16 @@  discard block
 block discarded – undo
433 433
 
434 434
 // Define $bookmarks
435 435
             if (!empty(Globals::$conf->bookmark->enabled) && Globals::$user->rights->bookmark->lire) {
436
-                include_once DOL_BASE_PATH . '/bookmarks/bookmarks.lib.php';
436
+                include_once DOL_BASE_PATH.'/bookmarks/bookmarks.lib.php';
437 437
                 Globals::$langs->load("bookmarks");
438 438
 
439 439
                 $bookmarks = printBookmarksList($db, Globals::$langs);
440 440
             }
441 441
 
442 442
 // Left column
443
-            print '<!-- Begin left menu -->' . "\n";
443
+            print '<!-- Begin left menu -->'."\n";
444 444
 
445
-            print '<div class="vmenu"' . (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"') . '>' . "\n\n";
445
+            print '<div class="vmenu"'.(empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"').'>'."\n\n";
446 446
 
447 447
 // Show left menu with other forms
448 448
             Globals::$menuManager->menu_array = $menu_array_before;
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 // Dolibarr version + help + bug report link
452 452
             print "\n";
453 453
             print "<!-- Begin Help Block-->\n";
454
-            print '<div id="blockvmenuhelp" class="blockvmenuhelp">' . "\n";
454
+            print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n";
455 455
 
456 456
 // Version
457 457
             if (empty(Globals::$conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
@@ -478,18 +478,18 @@  discard block
 block discarded – undo
478 478
                     $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE;
479 479
                     $doliurl = '';
480 480
                     if (preg_match('/\d\.\d/', $appli)) {
481
-                        if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
482
-                            $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
481
+                        if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
482
+                            $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
483 483
                         }
484 484
                     } else {
485
-                        $appli .= " " . DOL_VERSION;
485
+                        $appli .= " ".DOL_VERSION;
486 486
                     }
487 487
                 } else {
488
-                    $appli .= " " . DOL_VERSION;
488
+                    $appli .= " ".DOL_VERSION;
489 489
                 }
490 490
                 print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
491 491
                 if ($doliurl) {
492
-                    print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
492
+                    print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">';
493 493
                 } else {
494 494
                     print '<span class="help">';
495 495
                 }
@@ -499,12 +499,12 @@  discard block
 block discarded – undo
499 499
                 } else {
500 500
                     print '</span>';
501 501
                 }
502
-                print '</div>' . "\n";
502
+                print '</div>'."\n";
503 503
             }
504 504
 
505 505
 // Link to bugtrack
506 506
             if (!empty(Globals::$conf->global->MAIN_BUGTRACK_ENABLELINK)) {
507
-                require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php';
507
+                require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php';
508 508
 
509 509
                 $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new';
510 510
                 $bugbaseurl .= '?title=';
@@ -513,16 +513,16 @@  discard block
 block discarded – undo
513 513
                 $bugbaseurl .= urlencode("# Bug\n");
514 514
                 $bugbaseurl .= urlencode("\n");
515 515
                 $bugbaseurl .= urlencode("## Environment\n");
516
-                $bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n");
517
-                $bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n");
518
-                $bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n");
519
-                $bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n");
520
-                $bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n");
521
-                $bugbaseurl .= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n");
516
+                $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n");
517
+                $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n");
518
+                $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n");
519
+                $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n");
520
+                $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n");
521
+                $bugbaseurl .= urlencode("- **URL**: ".$_SERVER["REQUEST_URI"]."\n");
522 522
                 $bugbaseurl .= urlencode("\n");
523 523
                 $bugbaseurl .= urlencode("## Report\n");
524 524
                 print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
525
-                print '<a class="help" target="_blank" rel="noopener" href="' . $bugbaseurl . '">' . Globals::$langs->trans("FindBug") . '</a>';
525
+                print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.Globals::$langs->trans("FindBug").'</a>';
526 526
                 print '</div>';
527 527
             }
528 528
 
@@ -536,14 +536,14 @@  discard block
 block discarded – undo
536 536
 
537 537
 // Execute hook printLeftBlock
538 538
             $parameters = array();
539
-            $reshook = Globals::$hookManager->executeHooks('printLeftBlock', $parameters);    // Note that $action and $object may have been modified by some hooks
539
+            $reshook = Globals::$hookManager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks
540 540
             print Globals::$hookManager->resPrint;
541 541
 
542 542
             print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left"
543 543
         }
544 544
 
545 545
         print "\n";
546
-        print '<!-- Begin right area -->' . "\n";
546
+        print '<!-- Begin right area -->'."\n";
547 547
 
548 548
         if (empty($leftmenuwithoutmainarea)) {
549 549
             main_area($this->title);
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 
567 567
         print "\n";
568 568
 
569
-        print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
569
+        print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n";
570 570
 
571 571
         if (!empty(Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
572 572
             print info_admin(Globals::$langs->trans("WarningYouAreInMaintenanceMode", Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED));
@@ -633,18 +633,18 @@  discard block
 block discarded – undo
633 633
 // global Globals::$conf, Globals::$langs, Globals::$user;
634 634
 
635 635
         $ret = '';
636
-        $ret .= '<form action="' . $urlaction . '" method="post" class="searchform">';
637
-        $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
636
+        $ret .= '<form action="'.$urlaction.'" method="post" class="searchform">';
637
+        $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
638 638
         $ret .= '<input type="hidden" name="mode" value="search">';
639
-        $ret .= '<input type="hidden" name="savelogin" value="' . AlDolUtils::dol_escape_htmltag(Globals::$user->login) . '">';
639
+        $ret .= '<input type="hidden" name="savelogin" value="'.AlDolUtils::dol_escape_htmltag(Globals::$user->login).'">';
640 640
         if ($showtitlebefore) {
641
-            $ret .= $this->title . ' ';
641
+            $ret .= $this->title.' ';
642 642
         }
643
-        $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
644
-        $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
645
-        $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
646
-        $ret .= ' placeholder="' . strip_tags($this->title) . '"';
647
-        $ret .= ' name="' . $htmlinputname . '" id="' . $prefhtmlinputname . $htmlinputname . '" />';
643
+        $ret .= '<input type="text" class="flat '.$htmlmorecss.'"';
644
+        $ret .= ' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"';
645
+        $ret .= ($accesskey ? ' accesskey="'.$accesskey.'"' : '');
646
+        $ret .= ' placeholder="'.strip_tags($this->title).'"';
647
+        $ret .= ' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />';
648 648
         //$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.Globals::$langs->trans("Go").'">';
649 649
         $ret .= '<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
650 650
         $ret .= '<span class="fa fa-search"></span>';
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 // global $delayedhtmlcontent;
670 670
 // global $contextpage, $page, $limit;
671 671
 
672
-        $ext = 'layout=' . Globals::$conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
672
+        $ext = 'layout='.Globals::$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
673 673
 
674 674
 // Global html output events ($mesgs, $errors, $warnings)
675 675
         AlDolUtils::dol_htmloutput_events($disabledoutputofmessages);
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
         if (is_object(Globals::$user) && !empty(Globals::$user->lastsearch_values_tmp) && is_array(Globals::$user->lastsearch_values_tmp)) {
680 680
 // Clean and save data
681 681
             foreach (Globals::$user->lastsearch_values_tmp as $key => $val) {
682
-                unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
682
+                unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after
683 683
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
684 684
                     if (empty($val['sortfield'])) {
685 685
                         unset($val['sortfield']);
@@ -687,9 +687,9 @@  discard block
 block discarded – undo
687 687
                     if (empty($val['sortorder'])) {
688 688
                         unset($val['sortorder']);
689 689
                     }
690
-                    dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
691
-                    $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
692
-                    unset($_SESSION['lastsearch_values_' . $key]);
690
+                    dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)");
691
+                    $_SESSION['lastsearch_values_tmp_'.$key] = json_encode($val);
692
+                    unset($_SESSION['lastsearch_values_'.$key]);
693 693
                 }
694 694
             }
695 695
         }
@@ -698,37 +698,37 @@  discard block
 block discarded – undo
698 698
         $relativepathstring = $_SERVER["PHP_SELF"];
699 699
 // Clean $relativepathstring
700 700
         if (constant('DOL_BASE_URI'))
701
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
701
+            $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
702 702
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
703 703
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
704 704
         if (preg_match('/list\.php$/', $relativepathstring)) {
705
-            unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]);
706
-            unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
707
-            unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
705
+            unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
706
+            unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
707
+            unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
708 708
 
709 709
             if (!empty($contextpage))
710
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
710
+                $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
711 711
             if (!empty($page) && $page > 1)
712
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
712
+                $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page;
713 713
             if (!empty($limit) && $limit != Globals::$conf->limit)
714
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
714
+                $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit;
715 715
 
716
-            unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
717
-            unset($_SESSION['lastsearch_page_' . $relativepathstring]);
718
-            unset($_SESSION['lastsearch_limit_' . $relativepathstring]);
716
+            unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
717
+            unset($_SESSION['lastsearch_page_'.$relativepathstring]);
718
+            unset($_SESSION['lastsearch_limit_'.$relativepathstring]);
719 719
         }
720 720
 
721 721
 // Core error message
722 722
         if (!empty(Globals::$conf->global->MAIN_CORE_ERROR)) {
723 723
 // Ajax version
724 724
             if (Globals::$conf->use_javascript_ajax) {
725
-                $this->title = img_warning() . ' ' . Globals::$langs->trans('CoreErrorTitle');
725
+                $this->title = img_warning().' '.Globals::$langs->trans('CoreErrorTitle');
726 726
                 print ajax_dialog($this->title, Globals::$langs->trans('CoreErrorMessage'));
727 727
             }
728 728
 // html version
729 729
             else {
730
-                $msg = img_warning() . ' ' . Globals::$langs->trans('CoreErrorMessage');
731
-                print '<div class="error">' . $msg . '</div>';
730
+                $msg = img_warning().' '.Globals::$langs->trans('CoreErrorMessage');
731
+                print '<div class="error">'.$msg.'</div>';
732 732
             }
733 733
 
734 734
 //define("MAIN_CORE_ERROR",0);      // Constant was defined and we can't change value of a constant
@@ -736,17 +736,17 @@  discard block
 block discarded – undo
736 736
 
737 737
         print "\n\n";
738 738
 
739
-        print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
739
+        print '</div> <!-- End div class="fiche" -->'."\n"; // End div fiche
740 740
 
741 741
         if (empty(Globals::$conf->dol_hide_leftmenu))
742
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
742
+            print '</div> <!-- End div id-right -->'."\n"; // End div id-right
743 743
 
744 744
         if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile))
745
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
745
+            print '</div> <!-- End div id-container -->'."\n"; // End div container
746 746
 
747 747
         print "\n";
748 748
         if ($comment)
749
-            print '<!-- ' . $comment . ' -->' . "\n";
749
+            print '<!-- '.$comment.' -->'."\n";
750 750
 
751 751
         AlDolUtils::printCommonFooter($zone);
752 752
 
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
             print $delayedhtmlcontent;
755 755
 
756 756
         if (!empty(Globals::$conf->use_javascript_ajax)) {
757
-            print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
758
-            print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_foot.js&lang=' . Globals::$langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
757
+            print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
758
+            print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_foot.js&lang='.Globals::$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
759 759
         }
760 760
 
761 761
 // Wrapper to add log when clicking on download or preview
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
                 <script type="text/javascript">
768 768
                     jQuery(document).ready(function () {
769 769
                         $('a.documentpreview').click(function () {
770
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
770
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
771 771
                                     , {
772 772
                                         id:<?php echo $object->id; ?>
773 773
                                         , element: '<?php echo $object->element ?>'
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
                             );
777 777
                         });
778 778
                         $('a.documentdownload').click(function () {
779
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
779
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
780 780
                                     , {
781 781
                                         id:<?php echo $object->id; ?>
782 782
                                         , element: '<?php echo $object->element ?>'
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 
793 793
 // A div for the address popup
794 794
         print "\n<!-- A div to allow dialog popup -->\n";
795
-        print '<div id="dialogforpopup" style="display: none;"></div>' . "\n";
795
+        print '<div id="dialogforpopup" style="display: none;"></div>'."\n";
796 796
 
797 797
         print "</body>\n";
798 798
 
Please login to merge, or discard this patch.
Braces   +60 added lines, -38 removed lines patch added patch discarded remove patch
@@ -199,15 +199,20 @@  discard block
 block discarded – undo
199 199
             if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) {
200 200
                 $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE;
201 201
                 if (preg_match('/\d\.\d/', $appli)) {
202
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
203
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
204
-                } else
205
-                    $appli .= " " . DOL_VERSION;
206
-            } else
207
-                $appli .= " " . DOL_VERSION;
202
+                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
203
+                                            $appli .= " (" . DOL_VERSION . ")";
204
+                    }
205
+                    // If new title contains a version that is different than core
206
+                } else {
207
+                                    $appli .= " " . DOL_VERSION;
208
+                }
209
+            } else {
210
+                            $appli .= " " . DOL_VERSION;
211
+            }
208 212
 
209
-            if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL))
210
-                $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL;
213
+            if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL)) {
214
+                            $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL;
215
+            }
211 216
 
212 217
             $logouttext = '';
213 218
             if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
@@ -247,12 +252,15 @@  discard block
 block discarded – undo
247 252
             $parameters = array();
248 253
             $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
249 254
             if (is_numeric($result)) {
250
-                if ($result == 0)
251
-                    $toprightmenu .= Globals::$hookManager->resPrint;  // add
252
-                else
253
-                    $toprightmenu = Globals::$hookManager->resPrint;      // replace
254
-            }
255
-            else {
255
+                if ($result == 0) {
256
+                                    $toprightmenu .= Globals::$hookManager->resPrint;
257
+                }
258
+                // add
259
+                else {
260
+                                    $toprightmenu = Globals::$hookManager->resPrint;
261
+                }
262
+                // replace
263
+            } else {
256 264
                 $toprightmenu .= $result; // For backward compatibility
257 265
             }
258 266
 
@@ -412,8 +420,9 @@  discard block
 block discarded – undo
412 420
             $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
413 421
             if (empty($reshook)) {
414 422
                 $searchform .= Globals::$hookManager->resPrint;
415
-            } else
416
-                $searchform = Globals::$hookManager->resPrint;
423
+            } else {
424
+                            $searchform = Globals::$hookManager->resPrint;
425
+            }
417 426
 
418 427
 // Force special value for $searchform
419 428
             if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty(Globals::$conf->use_javascript_ajax)) {
@@ -595,18 +604,21 @@  discard block
 block discarded – undo
595 604
 // If WIKI URL
596 605
             if (preg_match('/^es/i', Globals::$langs->defaultlang)) {
597 606
                 $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
598
-                if (preg_match('/ES:([^|]+)/i', $helppagename, $reg))
599
-                    $helppage = $reg[1];
607
+                if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) {
608
+                                    $helppage = $reg[1];
609
+                }
600 610
             }
601 611
             if (preg_match('/^fr/i', Globals::$langs->defaultlang)) {
602 612
                 $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
603
-                if (preg_match('/FR:([^|]+)/i', $helppagename, $reg))
604
-                    $helppage = $reg[1];
613
+                if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) {
614
+                                    $helppage = $reg[1];
615
+                }
605 616
             }
606 617
             if (empty($helppage)) { // If help page not already found
607 618
                 $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
608
-                if (preg_match('/EN:([^|]+)/i', $helppagename, $reg))
609
-                    $helppage = $reg[1];
619
+                if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) {
620
+                                    $helppage = $reg[1];
621
+                }
610 622
             }
611 623
             $mode = 'wiki';
612 624
         }
@@ -697,8 +709,9 @@  discard block
 block discarded – undo
697 709
 
698 710
         $relativepathstring = $_SERVER["PHP_SELF"];
699 711
 // Clean $relativepathstring
700
-        if (constant('DOL_BASE_URI'))
701
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
712
+        if (constant('DOL_BASE_URI')) {
713
+                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
714
+        }
702 715
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
703 716
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
704 717
         if (preg_match('/list\.php$/', $relativepathstring)) {
@@ -706,12 +719,15 @@  discard block
 block discarded – undo
706 719
             unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
707 720
             unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
708 721
 
709
-            if (!empty($contextpage))
710
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
711
-            if (!empty($page) && $page > 1)
712
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
713
-            if (!empty($limit) && $limit != Globals::$conf->limit)
714
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
722
+            if (!empty($contextpage)) {
723
+                            $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
724
+            }
725
+            if (!empty($page) && $page > 1) {
726
+                            $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
727
+            }
728
+            if (!empty($limit) && $limit != Globals::$conf->limit) {
729
+                            $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
730
+            }
715 731
 
716 732
             unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
717 733
             unset($_SESSION['lastsearch_page_' . $relativepathstring]);
@@ -738,20 +754,26 @@  discard block
 block discarded – undo
738 754
 
739 755
         print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
740 756
 
741
-        if (empty(Globals::$conf->dol_hide_leftmenu))
742
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
757
+        if (empty(Globals::$conf->dol_hide_leftmenu)) {
758
+                    print '</div> <!-- End div id-right -->' . "\n";
759
+        }
760
+        // End div id-right
743 761
 
744
-        if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile))
745
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
762
+        if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) {
763
+                    print '</div> <!-- End div id-container -->' . "\n";
764
+        }
765
+        // End div container
746 766
 
747 767
         print "\n";
748
-        if ($comment)
749
-            print '<!-- ' . $comment . ' -->' . "\n";
768
+        if ($comment) {
769
+                    print '<!-- ' . $comment . ' -->' . "\n";
770
+        }
750 771
 
751 772
         AlDolUtils::printCommonFooter($zone);
752 773
 
753
-        if (!empty($delayedhtmlcontent))
754
-            print $delayedhtmlcontent;
774
+        if (!empty($delayedhtmlcontent)) {
775
+                    print $delayedhtmlcontent;
776
+        }
755 777
 
756 778
         if (!empty(Globals::$conf->use_javascript_ajax)) {
757 779
             print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
Please login to merge, or discard this patch.
Base/AlForm.php 2 patches
Spacing   +898 added lines, -898 removed lines patch added patch discarded remove patch
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
         if (!empty(Globals::$conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;/', $typeofdata)) {
113 113
             if (!empty($perm)) {
114 114
                 $tmp = explode(':', $typeofdata);
115
-                $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
115
+                $ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
116 116
                 if ($fieldrequired)
117 117
                     $ret .= '<span class="fieldrequired">';
118 118
                 $ret .= $langs->trans($text);
119 119
                 if ($fieldrequired)
120 120
                     $ret .= '</span>';
121
-                $ret .= '</div>' . "\n";
121
+                $ret .= '</div>'."\n";
122 122
             }
123 123
             else {
124 124
                 if ($fieldrequired)
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             }
130 130
         }
131 131
         else {
132
-            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
132
+            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
133 133
                 $ret .= '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
134 134
             }
135 135
             if ($fieldrequired) {
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
             if (!empty($notabletag)) {
143 143
                 $ret .= ' ';
144 144
             }
145
-            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
145
+            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
146 146
                 $ret .= '</td>';
147 147
             }
148
-            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
148
+            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
149 149
                 $ret .= '<td align="right">';
150 150
             }
151
-            if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
152
-                $ret .= '<a href="' . $_SERVER["PHP_SELF"] . '?action=edit' . $htmlname . '&amp;' . $paramid . '=' . $object->id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '</a>';
151
+            if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
152
+                $ret .= '<a href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&amp;'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>';
153 153
             }
154 154
             if (!empty($notabletag) && $notabletag == 1) {
155 155
                 $ret .= ' : ';
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
             if (!empty($notabletag) && $notabletag == 3) {
158 158
                 $ret .= ' ';
159 159
             }
160
-            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
160
+            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
161 161
                 $ret .= '</td>';
162 162
             }
163
-            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
163
+            if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
164 164
                 $ret .= '</tr></table>';
165 165
             }
166 166
         }
@@ -200,41 +200,41 @@  discard block
 block discarded – undo
200 200
         if (!empty(Globals::$conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker
201 201
             $ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg);
202 202
         } else {
203
-            if (GETPOST('action', 'aZ09') == 'edit' . $htmlname) {
203
+            if (GETPOST('action', 'aZ09') == 'edit'.$htmlname) {
204 204
                 $ret .= "\n";
205
-                $ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';
206
-                $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
207
-                $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
208
-                $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
205
+                $ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
206
+                $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
207
+                $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
208
+                $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
209 209
                 if (empty($notabletag))
210 210
                     $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
211 211
                 if (empty($notabletag))
212 212
                     $ret .= '<tr><td>';
213 213
                 if (preg_match('/^(string|email)/', $typeofdata)) {
214 214
                     $tmp = explode(':', $typeofdata);
215
-                    $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . ($tmp[1] ? ' size="' . $tmp[1] . '"' : '') . '>';
215
+                    $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>';
216 216
                 } else if (preg_match('/^(numeric|amount)/', $typeofdata)) {
217 217
                     $tmp = explode(':', $typeofdata);
218 218
                     $valuetoshow = price2num($editvalue ? $editvalue : $value);
219
-                    $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . ($tmp[1] ? ' size="' . $tmp[1] . '"' : '') . '>';
219
+                    $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>';
220 220
                 } else if (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
221 221
                     $tmp = explode(':', $typeofdata);
222 222
                     $cols = $tmp[2];
223 223
                     $morealt = '';
224 224
                     if (preg_match('/%/', $cols)) {
225
-                        $morealt = ' style="width: ' . $cols . '"';
225
+                        $morealt = ' style="width: '.$cols.'"';
226 226
                         $cols = '';
227 227
                     }
228 228
 
229 229
                     $valuetoshow = ($editvalue ? $editvalue : $value);
230 230
 
231
-                    $ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . ($tmp[1] ? $tmp[1] : '20') . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '">';
231
+                    $ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1] ? $tmp[1] : '20').'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'">';
232 232
                     $ret .= dol_string_neverthesehtmltags($valuetoshow, array('textarea'));
233 233
                     $ret .= '</textarea>';
234 234
                 } else if ($typeofdata == 'day' || $typeofdata == 'datepicker') {
235
-                    $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, 0);
235
+                    $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, 0);
236 236
                 } else if ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
237
-                    $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, 0);
237
+                    $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, 0);
238 238
                 } else if (preg_match('/^select;/', $typeofdata)) {
239 239
                     $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
240 240
                     foreach ($arraydata as $val) {
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
                     }
244 244
                     $ret .= $this->selectarray($htmlname, $arraylist, $value);
245 245
                 } else if (preg_match('/^ckeditor/', $typeofdata)) {
246
-                    $tmp = explode(':', $typeofdata);  // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols
247
-                    require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
246
+                    $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols
247
+                    require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
248 248
                     $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), ($tmp[2] ? $tmp[2] : ''), ($tmp[3] ? $tmp[3] : '100'), ($tmp[1] ? $tmp[1] : 'dolibarr_notes'), 'In', ($tmp[5] ? $tmp[5] : 0), true, true, ($tmp[6] ? $tmp[6] : '20'), ($tmp[7] ? $tmp[7] : '100'));
249 249
                     $ret .= $doleditor->Create(1);
250 250
                 }
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
                 if (empty($notabletag))
255 255
                     $ret .= '<td align="left">';
256 256
                 //else $ret.='<div class="clearboth"></div>';
257
-                $ret .= '<input type="submit" class="button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
257
+                $ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
258 258
                 if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag))
259
-                    $ret .= '<br>' . "\n";
260
-                $ret .= '<input type="submit" class="button' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
259
+                    $ret .= '<br>'."\n";
260
+                $ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
261 261
                 if (empty($notabletag))
262 262
                     $ret .= '</td>';
263 263
 
264 264
                 if (empty($notabletag))
265
-                    $ret .= '</tr></table>' . "\n";
266
-                $ret .= '</form>' . "\n";
265
+                    $ret .= '</tr></table>'."\n";
266
+                $ret .= '</form>'."\n";
267 267
             }
268 268
             else {
269 269
                 if (preg_match('/^(email)/', $typeofdata))
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                     if (!empty(Globals::$conf->global->MAIN_DISABLE_NOTES_TAB)) {
289 289
                         $firstline = preg_replace('/<br>.*/', '', $tmpcontent);
290 290
                         $firstline = preg_replace('/[\n\r].*/', '', $firstline);
291
-                        $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
291
+                        $tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
292 292
                     }
293 293
                     $ret .= $tmpcontent;
294 294
                 } else
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
                     $inputOption = $tmp[1];
357 357
                 if (!empty($tmp[2]))
358 358
                     $savemethod = $tmp[2];
359
-                $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
359
+                $out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
360 360
             }
361 361
             else if ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
362 362
                 $tmp = explode(':', $inputType);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 if (!empty($tmp[2]))
367 367
                     $savemethod = $tmp[2];
368 368
 
369
-                $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
369
+                $out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
370 370
             }
371 371
             else if (preg_match('/^(select|autocomplete)/', $inputType)) {
372 372
                 $tmp = explode(':', $inputType);
@@ -394,35 +394,35 @@  discard block
 block discarded – undo
394 394
                     $savemethod = $tmp[4];
395 395
 
396 396
                 if (!empty(Globals::$conf->fckeditor->enabled)) {
397
-                    $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
397
+                    $out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";
398 398
                 } else {
399 399
                     $inputType = 'textarea';
400 400
                 }
401 401
             }
402 402
 
403
-            $out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";
404
-            $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
405
-            $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
406
-            $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
403
+            $out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";
404
+            $out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";
405
+            $out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";
406
+            $out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
407 407
             if (!empty($savemethod))
408
-                $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
408
+                $out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
409 409
             if (!empty($ext_element))
410
-                $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
410
+                $out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
411 411
             if (!empty($custommsg)) {
412 412
                 if (is_array($custommsg)) {
413 413
                     if (!empty($custommsg['success']))
414
-                        $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
414
+                        $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
415 415
                     if (!empty($custommsg['error']))
416
-                        $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
416
+                        $out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
417 417
                 } else
418
-                    $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
418
+                    $out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
419 419
             }
420 420
             if ($inputType == 'textarea') {
421
-                $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
422
-                $out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";
421
+                $out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
422
+                $out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
423 423
             }
424
-            $out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";
425
-            $out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";
424
+            $out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
425
+            $out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";
426 426
         } else {
427 427
             $out = $value;
428 428
         }
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
         global $conf;
455 455
 
456 456
         if ($incbefore) {
457
-            $text = $incbefore . $text;
457
+            $text = $incbefore.$text;
458 458
         }
459 459
         if (!$htmltext) {
460 460
             return $text;
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 
475 475
         $extrastyle = '';
476 476
         if ($direction < 0) {
477
-            $extracss = ($extracss ? $extracss . ' ' : '') . 'inline-block';
477
+            $extracss = ($extracss ? $extracss.' ' : '').'inline-block';
478 478
             $extrastyle = 'padding: 0px; padding-left: 3px !important;';
479 479
         }
480 480
         if ($direction > 0) {
481
-            $extracss = ($extracss ? $extracss . ' ' : '') . 'inline-block';
481
+            $extracss = ($extracss ? $extracss.' ' : '').'inline-block';
482 482
             $extrastyle = 'padding: 0px; padding-right: 3px !important;';
483 483
         }
484 484
 
@@ -491,53 +491,53 @@  discard block
 block discarded – undo
491 491
             $htmltext = str_replace('"', "&quot;", $htmltext);
492 492
         } else {
493 493
             $classfortooltip = 'classfortooltiponclick';
494
-            $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';
494
+            $textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
495 495
         }
496 496
         if ($tooltipon == 2 || $tooltipon == 3) {
497
-            $paramfortooltipimg = ' class="' . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
497
+            $paramfortooltipimg = ' class="'.$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
498 498
             if ($tooltiptrigger == '') {
499
-                $paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : AlDolUtils::dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on img tag to store tooltip
499
+                $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : AlDolUtils::dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on img tag to store tooltip
500 500
             } else {
501
-                $paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
501
+                $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
502 502
             }
503 503
         } else {
504
-            $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag
504
+            $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag
505 505
         }
506 506
         if ($tooltipon == 1 || $tooltipon == 3) {
507
-            $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
507
+            $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
508 508
             if ($tooltiptrigger == '') {
509
-                $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : AlDolUtils::dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on td tag to store tooltip
509
+                $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : AlDolUtils::dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on td tag to store tooltip
510 510
             } else {
511
-                $paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
511
+                $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
512 512
             }
513 513
         } else {
514
-            $paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag
514
+            $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag
515 515
         }
516 516
         if (empty($notabs)) {
517 517
             $s .= '<table class="nobordernopadding" summary=""><tr style="height: auto;">';
518 518
         } elseif ($notabs == 2) {
519
-            $s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';
519
+            $s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';
520 520
         }
521 521
         // Define value if value is before
522 522
         if ($direction < 0) {
523
-            $s .= '<' . $tag . $paramfortooltipimg;
523
+            $s .= '<'.$tag.$paramfortooltipimg;
524 524
             if ($tag == 'td') {
525 525
                 $s .= ' valign="top" width="14"';
526 526
             }
527
-            $s .= '>' . $textfordialog . $img . '</' . $tag . '>';
527
+            $s .= '>'.$textfordialog.$img.'</'.$tag.'>';
528 528
         }
529 529
         // Use another method to help avoid having a space in value in order to use this value with jquery
530 530
         // Define label
531 531
         if ((string) $text != '') {
532
-            $s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
532
+            $s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
533 533
         }
534 534
         // Define value if value is after
535 535
         if ($direction > 0) {
536
-            $s .= '<' . $tag . $paramfortooltipimg;
536
+            $s .= '<'.$tag.$paramfortooltipimg;
537 537
             if ($tag == 'td') {
538 538
                 $s .= ' valign="middle" width="14"';
539 539
             }
540
-            $s .= '>' . $textfordialog . $img . '</' . $tag . '>';
540
+            $s .= '>'.$textfordialog.$img.'</'.$tag.'>';
541 541
         }
542 542
         if (empty($notabs)) {
543 543
             $s .= '</tr></table>';
@@ -630,15 +630,15 @@  discard block
 block discarded – undo
630 630
 
631 631
         $disabled = 0;
632 632
         $ret = '<div class="centpercent center">';
633
-        $ret .= '<select class="flat' . (empty(Globals::$conf->use_javascript_ajax) ? '' : ' hideobject') . ' massaction massactionselect" name="massaction"' . ($disabled ? ' disabled="disabled"' : '') . '>';
633
+        $ret .= '<select class="flat'.(empty(Globals::$conf->use_javascript_ajax) ? '' : ' hideobject').' massaction massactionselect" name="massaction"'.($disabled ? ' disabled="disabled"' : '').'>';
634 634
 
635 635
         // Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.
636 636
         $parameters = array();
637
-        $reshook = $hookmanager->executeHooks('addMoreMassActions', $parameters);    // Note that $action and $object may have been modified by hook
637
+        $reshook = $hookmanager->executeHooks('addMoreMassActions', $parameters); // Note that $action and $object may have been modified by hook
638 638
         if (empty($reshook)) {
639
-            $ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>';
639
+            $ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';
640 640
             foreach ($arrayofaction as $code => $label) {
641
-                $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . '>' . $label . '</option>';
641
+                $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').'>'.$label.'</option>';
642 642
             }
643 643
         }
644 644
         $ret .= $hookmanager->resPrint;
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
         $ret .= '</select>';
647 647
         // Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
648 648
         $ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
649
-        $ret .= '<input type="submit" disabled name="confirmmassaction" class="button' . (empty(Globals::$conf->use_javascript_ajax) ? '' : ' hideobject') . ' massaction massactionconfirmed" value="' . AlDolUtils::dol_escape_htmltag($langs->trans("Confirm")) . '">';
649
+        $ret .= '<input type="submit" disabled name="confirmmassaction" class="button'.(empty(Globals::$conf->use_javascript_ajax) ? '' : ' hideobject').' massaction massactionconfirmed" value="'.AlDolUtils::dol_escape_htmltag($langs->trans("Confirm")).'">';
650 650
         $ret .= '</div>';
651 651
 
652 652
         if (!empty(Globals::$conf->use_javascript_ajax)) {
@@ -660,11 +660,11 @@  discard block
 block discarded – undo
660 660
     	  				if ($(this).is(\':checked\')) atleastoneselected++;
661 661
     	  			});
662 662
 					console.log("initCheckForSelect mode="+mode+" atleastoneselected="+atleastoneselected);
663
-    	  			if (atleastoneselected || ' . $alwaysvisible . ')
663
+    	  			if (atleastoneselected || ' . $alwaysvisible.')
664 664
     	  			{
665 665
     	  				jQuery(".massaction").show();
666
-        			    ' . ($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("' . $selected . '"); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '') . '
667
-        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0"); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '') . '
666
+        			    ' . ($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'"); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').'
667
+        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0"); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').'
668 668
     	  			}
669 669
     	  			else
670 670
     	  			{
@@ -733,14 +733,14 @@  discard block
 block discarded – undo
733 733
         $atleastonefavorite = 0;
734 734
 
735 735
         $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
736
-        $sql .= " FROM " . MAIN_DB_PREFIX . "c_country";
736
+        $sql .= " FROM ".MAIN_DB_PREFIX."c_country";
737 737
         $sql .= " WHERE active > 0";
738 738
         //$sql.= " ORDER BY code ASC";
739 739
 
740
-        dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);
740
+        dol_syslog(get_class($this)."::select_country", LOG_DEBUG);
741 741
         $resql = $this->db->query($sql);
742 742
         if ($resql) {
743
-            $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';
743
+            $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';
744 744
             $num = $this->db->num_rows($resql);
745 745
             $i = 0;
746 746
             if ($num) {
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
                     $countryArray[$i]['rowid'] = $obj->rowid;
752 752
                     $countryArray[$i]['code_iso'] = $obj->code_iso;
753 753
                     $countryArray[$i]['code_iso3'] = $obj->code_iso3;
754
-                    $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
754
+                    $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
755 755
                     $countryArray[$i]['favorite'] = $obj->favorite;
756 756
                     $favorite[$i] = $obj->favorite;
757 757
                     $label[$i] = dol_string_unaccent($countryArray[$i]['label']);
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
                     $countryArray = dol_sort_array($countryArray, 'label');
765 765
 
766 766
                 if ($showempty) {
767
-                    $out .= '<option value="">&nbsp;</option>' . "\n";
767
+                    $out .= '<option value="">&nbsp;</option>'."\n";
768 768
                 }
769 769
 
770 770
                 if ($addspecialentries) { // Add dedicated entries for groups of countries
771 771
                     //if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
772
-                    $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
773
-                    $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>';
772
+                    $out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
773
+                    $out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>';
774 774
                     if ($mysoc->isInEEC())
775
-                        $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
776
-                    $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>';
775
+                        $out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
776
+                    $out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>';
777 777
                     $out .= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
778 778
                 }
779 779
 
@@ -791,16 +791,16 @@  discard block
 block discarded – undo
791 791
                     }
792 792
                     if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
793 793
                         $foundselected = true;
794
-                        $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected>';
794
+                        $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected>';
795 795
                     } else {
796
-                        $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '">';
796
+                        $out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'">';
797 797
                     }
798 798
                     if ($row['label'])
799 799
                         $out .= dol_trunc($row['label'], $maxlength, 'middle');
800 800
                     else
801 801
                         $out .= '&nbsp;';
802 802
                     if ($row['code_iso'])
803
-                        $out .= ' (' . $row['code_iso'] . ')';
803
+                        $out .= ' ('.$row['code_iso'].')';
804 804
                     $out .= '</option>';
805 805
                 }
806 806
             }
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
         }
812 812
 
813 813
         // Make select dynamic
814
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
815
-        $out .= ajax_combobox('select' . $htmlname);
814
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
815
+        $out .= ajax_combobox('select'.$htmlname);
816 816
 
817 817
         return $out;
818 818
     }
@@ -841,25 +841,25 @@  discard block
 block discarded – undo
841 841
         $incotermArray = array();
842 842
 
843 843
         $sql = "SELECT rowid, code";
844
-        $sql .= " FROM " . MAIN_DB_PREFIX . "c_incoterms";
844
+        $sql .= " FROM ".MAIN_DB_PREFIX."c_incoterms";
845 845
         $sql .= " WHERE active > 0";
846 846
         $sql .= " ORDER BY code ASC";
847 847
 
848
-        dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);
848
+        dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
849 849
         $resql = $this->db->query($sql);
850 850
         if ($resql) {
851 851
             if (Globals::$conf->use_javascript_ajax && !$forcecombo) {
852
-                include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
852
+                include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
853 853
                 $out .= ajax_combobox($htmlname, $events);
854 854
             }
855 855
 
856 856
             if (!empty($page)) {
857
-                $out .= '<form method="post" action="' . $page . '">';
857
+                $out .= '<form method="post" action="'.$page.'">';
858 858
                 $out .= '<input type="hidden" name="action" value="set_incoterms">';
859
-                $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
859
+                $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
860 860
             }
861 861
 
862
-            $out .= '<select id="' . $htmlname . '" class="flat selectincoterm minwidth100imp noenlargeonsmartphone" name="' . $htmlname . '" ' . $htmloption . '>';
862
+            $out .= '<select id="'.$htmlname.'" class="flat selectincoterm minwidth100imp noenlargeonsmartphone" name="'.$htmlname.'" '.$htmloption.'>';
863 863
             $out .= '<option value="0">&nbsp;</option>';
864 864
             $num = $this->db->num_rows($resql);
865 865
             $i = 0;
@@ -875,9 +875,9 @@  discard block
 block discarded – undo
875 875
 
876 876
                 foreach ($incotermArray as $row) {
877 877
                     if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) {
878
-                        $out .= '<option value="' . $row['rowid'] . '" selected>';
878
+                        $out .= '<option value="'.$row['rowid'].'" selected>';
879 879
                     } else {
880
-                        $out .= '<option value="' . $row['rowid'] . '">';
880
+                        $out .= '<option value="'.$row['rowid'].'">';
881 881
                     }
882 882
 
883 883
                     if ($row['code'])
@@ -888,10 +888,10 @@  discard block
 block discarded – undo
888 888
             }
889 889
             $out .= '</select>';
890 890
 
891
-            $out .= '<input id="location_incoterms" class="maxwidth100onsmartphone" name="location_incoterms" value="' . $location_incoterms . '">';
891
+            $out .= '<input id="location_incoterms" class="maxwidth100onsmartphone" name="location_incoterms" value="'.$location_incoterms.'">';
892 892
 
893 893
             if (!empty($page)) {
894
-                $out .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '"></form>';
894
+                $out .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'"></form>';
895 895
             }
896 896
         } else {
897 897
             AlDolUtils::dol_print_error($this->db);
@@ -920,8 +920,8 @@  discard block
 block discarded – undo
920 920
         // If product & services are enabled or both disabled.
921 921
         if ($forceall == 1 || (empty($forceall) && !empty(Globals::$conf->product->enabled) && !empty(Globals::$conf->service->enabled)) || (empty($forceall) && empty(Globals::$conf->product->enabled) && empty(Globals::$conf->service->enabled))) {
922 922
             if (empty($hidetext))
923
-                print $langs->trans("Type") . ': ';
924
-            print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
923
+                print $langs->trans("Type").': ';
924
+            print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
925 925
             if ($showempty) {
926 926
                 print '<option value="-1"';
927 927
                 if ($selected == -1)
@@ -932,26 +932,26 @@  discard block
 block discarded – undo
932 932
             print '<option value="0"';
933 933
             if (0 == $selected)
934 934
                 print ' selected';
935
-            print '>' . $langs->trans("Product");
935
+            print '>'.$langs->trans("Product");
936 936
 
937 937
             print '<option value="1"';
938 938
             if (1 == $selected)
939 939
                 print ' selected';
940
-            print '>' . $langs->trans("Service");
940
+            print '>'.$langs->trans("Service");
941 941
 
942 942
             print '</select>';
943 943
             //if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
944 944
         }
945 945
         if ((empty($forceall) && empty(Globals::$conf->product->enabled) && !empty(Globals::$conf->service->enabled)) || $forceall == 3) {
946 946
             print $langs->trans("Service");
947
-            print '<input type="hidden" name="' . $htmlname . '" value="1">';
947
+            print '<input type="hidden" name="'.$htmlname.'" value="1">';
948 948
         }
949 949
         if ((empty($forceall) && !empty(Globals::$conf->product->enabled) && empty(Globals::$conf->service->enabled)) || $forceall == 2) {
950 950
             print $langs->trans("Product");
951
-            print '<input type="hidden" name="' . $htmlname . '" value="0">';
951
+            print '<input type="hidden" name="'.$htmlname.'" value="0">';
952 952
         }
953 953
         if ($forceall < 0) { // This should happened only for contracts when both predefined product and service are disabled.
954
-            print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
954
+            print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
955 955
         }
956 956
     }
957 957
 
@@ -968,14 +968,14 @@  discard block
 block discarded – undo
968 968
 
969 969
         $num = count($this->cache_types_fees);
970 970
         if ($num > 0)
971
-            return 0;    // Cache already loaded
971
+            return 0; // Cache already loaded
972 972
 
973 973
         dol_syslog(__METHOD__, LOG_DEBUG);
974 974
 
975 975
         $langs->load("trips");
976 976
 
977 977
         $sql = "SELECT c.code, c.label";
978
-        $sql .= " FROM " . MAIN_DB_PREFIX . "c_type_fees as c";
978
+        $sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees as c";
979 979
         $sql .= " WHERE active > 0";
980 980
 
981 981
         $resql = $this->db->query($sql);
@@ -1015,11 +1015,11 @@  discard block
 block discarded – undo
1015 1015
         // phpcs:enable
1016 1016
         global $user, $langs;
1017 1017
 
1018
-        dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
1018
+        dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
1019 1019
 
1020 1020
         $this->load_cache_types_fees();
1021 1021
 
1022
-        print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1022
+        print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';
1023 1023
         if ($showempty) {
1024 1024
             print '<option value="-1"';
1025 1025
             if ($selected == -1)
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
         }
1029 1029
 
1030 1030
         foreach ($this->cache_types_fees as $key => $value) {
1031
-            print '<option value="' . $key . '"';
1031
+            print '<option value="'.$key.'"';
1032 1032
             if ($key == $selected)
1033 1033
                 print ' selected';
1034 1034
             print '>';
@@ -1091,25 +1091,25 @@  discard block
 block discarded – undo
1091 1091
             // No immediate load of all database
1092 1092
             $placeholder = '';
1093 1093
             if ($selected && empty($selected_input_value)) {
1094
-                require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1094
+                require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1095 1095
                 $societetmp = new Societe($this->db);
1096 1096
                 $societetmp->fetch($selected);
1097 1097
                 $selected_input_value = $societetmp->name;
1098 1098
                 unset($societetmp);
1099 1099
             }
1100 1100
             // mode 1
1101
-            $urloption = 'htmlname=' . $htmlname . '&outjson=1&filter=' . $filter . ($showtype ? '&showtype=' . $showtype : '');
1102
-            $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1101
+            $urloption = 'htmlname='.$htmlname.'&outjson=1&filter='.$filter.($showtype ? '&showtype='.$showtype : '');
1102
+            $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1103 1103
             $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
1104 1104
             if (empty($hidelabel))
1105
-                print $langs->trans("RefOrLabel") . ' : ';
1105
+                print $langs->trans("RefOrLabel").' : ';
1106 1106
             else if ($hidelabel > 1) {
1107
-                $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
1107
+                $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
1108 1108
                 if ($hidelabel == 2) {
1109 1109
                     $out .= img_picto($langs->trans("Search"), 'search');
1110 1110
                 }
1111 1111
             }
1112
-            $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty(Globals::$conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
1112
+            $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty(Globals::$conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
1113 1113
             if ($hidelabel == 3) {
1114 1114
                 $out .= img_picto($langs->trans("Search"), 'search');
1115 1115
             }
@@ -1170,20 +1170,20 @@  discard block
 block discarded – undo
1170 1170
             $sql .= " , dictp.code as country_code";
1171 1171
         }
1172 1172
 
1173
-        $sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s";
1173
+        $sql .= " FROM (".MAIN_DB_PREFIX."societe as s";
1174 1174
         if (!$user->rights->societe->client->voir && !$user->socid)
1175
-            $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
1175
+            $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
1176 1176
         $sql .= " )";
1177 1177
         if (Globals::$conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
1178
-            $sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "c_country as dictp ON dictp.rowid=s.fk_pays";
1178
+            $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid=s.fk_pays";
1179 1179
         }
1180
-        $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1180
+        $sql .= " WHERE s.entity IN (".getEntity('societe').")";
1181 1181
         if (!empty($user->socid))
1182
-            $sql .= " AND s.rowid = " . $user->socid;
1182
+            $sql .= " AND s.rowid = ".$user->socid;
1183 1183
         if ($filter)
1184
-            $sql .= " AND (" . $filter . ")";
1184
+            $sql .= " AND (".$filter.")";
1185 1185
         if (!$user->rights->societe->client->voir && !$user->socid)
1186
-            $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
1186
+            $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
1187 1187
         if (!empty(Globals::$conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX))
1188 1188
             $sql .= " AND s.status <> 0";
1189 1189
         // Add criteria
@@ -1198,31 +1198,31 @@  discard block
 block discarded – undo
1198 1198
             foreach ($scrit as $crit) {
1199 1199
                 if ($i > 0)
1200 1200
                     $sql .= " AND ";
1201
-                $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1201
+                $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
1202 1202
                 $i++;
1203 1203
             }
1204 1204
             if (count($scrit) > 1)
1205 1205
                 $sql .= ")";
1206 1206
             if (!empty(Globals::$conf->barcode->enabled)) {
1207
-                $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1207
+                $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1208 1208
             }
1209
-            $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1209
+            $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1210 1210
             $sql .= ")";
1211 1211
         }
1212 1212
         $sql .= $this->db->order("nom", "ASC");
1213 1213
         $sql .= $this->db->plimit($limit, 0);
1214 1214
 
1215 1215
         // Build output string
1216
-        dol_syslog(get_class($this) . "::select_thirdparty_list", LOG_DEBUG);
1216
+        dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG);
1217 1217
         $resql = $this->db->query($sql);
1218 1218
         if ($resql) {
1219 1219
             if (!$forcecombo) {
1220
-                include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1220
+                include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1221 1221
                 $out .= ajax_combobox($htmlname, $events, Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT);
1222 1222
             }
1223 1223
 
1224 1224
             // Construct $out and $outarray
1225
-            $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
1225
+            $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
1226 1226
 
1227 1227
             $textifempty = '';
1228 1228
             // Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
                     $textifempty .= $langs->trans("All");
1235 1235
             }
1236 1236
             if ($showempty)
1237
-                $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
1237
+                $out .= '<option value="-1">'.$textifempty.'</option>'."\n";
1238 1238
 
1239 1239
             $num = $this->db->num_rows($resql);
1240 1240
             $i = 0;
@@ -1244,18 +1244,18 @@  discard block
 block discarded – undo
1244 1244
                     $label = '';
1245 1245
                     if (Globals::$conf->global->SOCIETE_ADD_REF_IN_LIST) {
1246 1246
                         if (($obj->client) && (!empty($obj->code_client))) {
1247
-                            $label = $obj->code_client . ' - ';
1247
+                            $label = $obj->code_client.' - ';
1248 1248
                         }
1249 1249
                         if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
1250
-                            $label .= $obj->code_fournisseur . ' - ';
1250
+                            $label .= $obj->code_fournisseur.' - ';
1251 1251
                         }
1252
-                        $label .= ' ' . $obj->name;
1252
+                        $label .= ' '.$obj->name;
1253 1253
                     } else {
1254 1254
                         $label = $obj->name;
1255 1255
                     }
1256 1256
 
1257 1257
                     if (!empty($obj->name_alias)) {
1258
-                        $label .= ' (' . $obj->name_alias . ')';
1258
+                        $label .= ' ('.$obj->name_alias.')';
1259 1259
                     }
1260 1260
 
1261 1261
                     if ($showtype) {
@@ -1264,25 +1264,25 @@  discard block
 block discarded – undo
1264 1264
                         if ($obj->client == 1 || $obj->client == 3)
1265 1265
                             $label .= $langs->trans("Customer");
1266 1266
                         if ($obj->client == 2 || $obj->client == 3)
1267
-                            $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1267
+                            $label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect");
1268 1268
                         if ($obj->fournisseur)
1269
-                            $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1269
+                            $label .= ($obj->client ? ', ' : '').$langs->trans("Supplier");
1270 1270
                         if ($obj->client || $obj->fournisseur)
1271 1271
                             $label .= ')';
1272 1272
                     }
1273 1273
 
1274 1274
                     if (Globals::$conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
1275
-                        $label .= '-' . $obj->address . '-' . $obj->zip . ' ' . $obj->town;
1275
+                        $label .= '-'.$obj->address.'-'.$obj->zip.' '.$obj->town;
1276 1276
                         if (!empty($obj->country_code)) {
1277
-                            $label .= ' ' . $langs->trans('Country' . $obj->country_code);
1277
+                            $label .= ' '.$langs->trans('Country'.$obj->country_code);
1278 1278
                         }
1279 1279
                     }
1280 1280
 
1281 1281
                     if (empty($outputmode)) {
1282 1282
                         if (in_array($obj->rowid, $selected)) {
1283
-                            $out .= '<option value="' . $obj->rowid . '" selected>' . $label . '</option>';
1283
+                            $out .= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>';
1284 1284
                         } else {
1285
-                            $out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
1285
+                            $out .= '<option value="'.$obj->rowid.'">'.$label.'</option>';
1286 1286
                         }
1287 1287
                     } else {
1288 1288
                         array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -1293,7 +1293,7 @@  discard block
 block discarded – undo
1293 1293
                         $out .= "\n";
1294 1294
                 }
1295 1295
             }
1296
-            $out .= '</select>' . "\n";
1296
+            $out .= '</select>'."\n";
1297 1297
         }
1298 1298
         else {
1299 1299
             AlDolUtils::dol_print_error($this->db);
@@ -1325,17 +1325,17 @@  discard block
 block discarded – undo
1325 1325
         // On recherche les remises
1326 1326
         $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
1327 1327
         $sql .= " re.description, re.fk_facture_source";
1328
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
1329
-        $sql .= " WHERE re.fk_soc = " . (int) $socid;
1330
-        $sql .= " AND re.entity = " . Globals::$conf->entity;
1328
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re";
1329
+        $sql .= " WHERE re.fk_soc = ".(int) $socid;
1330
+        $sql .= " AND re.entity = ".Globals::$conf->entity;
1331 1331
         if ($filter)
1332
-            $sql .= " AND " . $filter;
1332
+            $sql .= " AND ".$filter;
1333 1333
         $sql .= " ORDER BY re.description ASC";
1334 1334
 
1335
-        dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
1335
+        dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
1336 1336
         $resql = $this->db->query($sql);
1337 1337
         if ($resql) {
1338
-            print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';
1338
+            print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
1339 1339
             $num = $this->db->num_rows($resql);
1340 1340
 
1341 1341
             $qualifiedlines = $num;
@@ -1368,10 +1368,10 @@  discard block
 block discarded – undo
1368 1368
                     if (!empty(Globals::$conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST) && !empty($obj->fk_facture_source)) {
1369 1369
                         $tmpfac = new Facture($this->db);
1370 1370
                         if ($tmpfac->fetch($obj->fk_facture_source) > 0)
1371
-                            $desc = $desc . ' - ' . $tmpfac->ref;
1371
+                            $desc = $desc.' - '.$tmpfac->ref;
1372 1372
                     }
1373 1373
 
1374
-                    print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
1374
+                    print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
1375 1375
                     $i++;
1376 1376
                 }
1377 1377
             }
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
         $out = '';
1452 1452
 
1453 1453
         if (!is_object($hookmanager)) {
1454
-            include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1454
+            include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1455 1455
             $hookmanager = new HookManager($this->db);
1456 1456
         }
1457 1457
 
@@ -1459,36 +1459,36 @@  discard block
 block discarded – undo
1459 1459
         $sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste";
1460 1460
         if ($showsoc > 0)
1461 1461
             $sql .= " , s.nom as company";
1462
-        $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as sp";
1462
+        $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
1463 1463
         if ($showsoc > 0)
1464
-            $sql .= " LEFT OUTER JOIN  " . MAIN_DB_PREFIX . "societe as s ON s.rowid=sp.fk_soc";
1465
-        $sql .= " WHERE sp.entity IN (" . getEntity('socpeople') . ")";
1464
+            $sql .= " LEFT OUTER JOIN  ".MAIN_DB_PREFIX."societe as s ON s.rowid=sp.fk_soc";
1465
+        $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
1466 1466
         if ($socid > 0 || $socid == -1)
1467
-            $sql .= " AND sp.fk_soc=" . $socid;
1467
+            $sql .= " AND sp.fk_soc=".$socid;
1468 1468
         if (!empty(Globals::$conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX))
1469 1469
             $sql .= " AND sp.statut <> 0";
1470 1470
         $sql .= " ORDER BY sp.lastname ASC";
1471 1471
 
1472
-        dol_syslog(get_class($this) . "::select_contacts", LOG_DEBUG);
1472
+        dol_syslog(get_class($this)."::select_contacts", LOG_DEBUG);
1473 1473
         $resql = $this->db->query($sql);
1474 1474
         if ($resql) {
1475 1475
             $num = $this->db->num_rows($resql);
1476 1476
 
1477 1477
             if (Globals::$conf->use_javascript_ajax && !$forcecombo && !$options_only) {
1478
-                include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1478
+                include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1479 1479
                 $out .= ajax_combobox($htmlid, $events, Globals::$conf->global->CONTACT_USE_SEARCH_TO_SELECT);
1480 1480
             }
1481 1481
 
1482 1482
             if ($htmlname != 'none' || $options_only)
1483
-                $out .= '<select class="flat' . ($moreclass ? ' ' . $moreclass : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1483
+                $out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1484 1484
             if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple)
1485
-                $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1485
+                $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1486 1486
             if ($showempty == 2)
1487
-                $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>' . $langs->trans("Internal") . '</option>';
1487
+                $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>'.$langs->trans("Internal").'</option>';
1488 1488
             $num = $this->db->num_rows($resql);
1489 1489
             $i = 0;
1490 1490
             if ($num) {
1491
-                include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1491
+                include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1492 1492
                 $contactstatic = new Contact($this->db);
1493 1493
 
1494 1494
                 while ($i < $num) {
@@ -1505,27 +1505,27 @@  discard block
 block discarded – undo
1505 1505
                             if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto))
1506 1506
                                 $disabled = 1;
1507 1507
                             if (!empty($selected) && in_array($obj->rowid, $selected)) {
1508
-                                $out .= '<option value="' . $obj->rowid . '"';
1508
+                                $out .= '<option value="'.$obj->rowid.'"';
1509 1509
                                 if ($disabled)
1510 1510
                                     $out .= ' disabled';
1511 1511
                                 $out .= ' selected>';
1512 1512
                                 $out .= $contactstatic->getFullName($langs);
1513 1513
                                 if ($showfunction && $obj->poste)
1514
-                                    $out .= ' (' . $obj->poste . ')';
1514
+                                    $out .= ' ('.$obj->poste.')';
1515 1515
                                 if (($showsoc > 0) && $obj->company)
1516
-                                    $out .= ' - (' . $obj->company . ')';
1516
+                                    $out .= ' - ('.$obj->company.')';
1517 1517
                                 $out .= '</option>';
1518 1518
                             }
1519 1519
                             else {
1520
-                                $out .= '<option value="' . $obj->rowid . '"';
1520
+                                $out .= '<option value="'.$obj->rowid.'"';
1521 1521
                                 if ($disabled)
1522 1522
                                     $out .= ' disabled';
1523 1523
                                 $out .= '>';
1524 1524
                                 $out .= $contactstatic->getFullName($langs);
1525 1525
                                 if ($showfunction && $obj->poste)
1526
-                                    $out .= ' (' . $obj->poste . ')';
1526
+                                    $out .= ' ('.$obj->poste.')';
1527 1527
                                 if (($showsoc > 0) && $obj->company)
1528
-                                    $out .= ' - (' . $obj->company . ')';
1528
+                                    $out .= ' - ('.$obj->company.')';
1529 1529
                                 $out .= '</option>';
1530 1530
                             }
1531 1531
                         }
@@ -1533,9 +1533,9 @@  discard block
 block discarded – undo
1533 1533
                             if (in_array($obj->rowid, $selected)) {
1534 1534
                                 $out .= $contactstatic->getFullName($langs);
1535 1535
                                 if ($showfunction && $obj->poste)
1536
-                                    $out .= ' (' . $obj->poste . ')';
1536
+                                    $out .= ' ('.$obj->poste.')';
1537 1537
                                 if (($showsoc > 0) && $obj->company)
1538
-                                    $out .= ' - (' . $obj->company . ')';
1538
+                                    $out .= ' - ('.$obj->company.')';
1539 1539
                             }
1540 1540
                         }
1541 1541
                     }
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
                 }
1544 1544
             }
1545 1545
             else {
1546
-                $out .= '<option value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled>';
1546
+                $out .= '<option value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled>';
1547 1547
                 $out .= ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1548 1548
                 $out .= '</option>';
1549 1549
             }
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
                 'showsoc' => $showsoc,
1558 1558
             );
1559 1559
 
1560
-            $reshook = $hookmanager->executeHooks('afterSelectContactOptions', $parameters, $this, $action);    // Note that $action and $object may have been modified by some hooks
1560
+            $reshook = $hookmanager->executeHooks('afterSelectContactOptions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1561 1561
 
1562 1562
             if ($htmlname != 'none' || $options_only) {
1563 1563
                 $out .= '</select>';
@@ -1656,33 +1656,33 @@  discard block
 block discarded – undo
1656 1656
         if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) {
1657 1657
             $sql .= ", e.label";
1658 1658
         }
1659
-        $sql .= " FROM " . MAIN_DB_PREFIX . "user as u";
1659
+        $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
1660 1660
         if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) {
1661
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=u.entity";
1661
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid=u.entity";
1662 1662
             if ($force_entity)
1663
-                $sql .= " WHERE u.entity IN (0," . $force_entity . ")";
1663
+                $sql .= " WHERE u.entity IN (0,".$force_entity.")";
1664 1664
             else
1665 1665
                 $sql .= " WHERE u.entity IS NOT NULL";
1666 1666
         }
1667 1667
         else {
1668 1668
             if (!empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
1669
-                $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ug";
1669
+                $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug";
1670 1670
                 $sql .= " ON ug.fk_user = u.rowid";
1671
-                $sql .= " WHERE ug.entity = " . Globals::$conf->entity;
1671
+                $sql .= " WHERE ug.entity = ".Globals::$conf->entity;
1672 1672
             } else {
1673
-                $sql .= " WHERE u.entity IN (0," . Globals::$conf->entity . ")";
1673
+                $sql .= " WHERE u.entity IN (0,".Globals::$conf->entity.")";
1674 1674
             }
1675 1675
         }
1676 1676
         if (!empty($user->societe_id))
1677
-            $sql .= " AND u.fk_soc = " . $user->societe_id;
1677
+            $sql .= " AND u.fk_soc = ".$user->societe_id;
1678 1678
         if (is_array($exclude) && $excludeUsers)
1679
-            $sql .= " AND u.rowid NOT IN (" . $excludeUsers . ")";
1679
+            $sql .= " AND u.rowid NOT IN (".$excludeUsers.")";
1680 1680
         if ($includeUsers)
1681
-            $sql .= " AND u.rowid IN (" . $includeUsers . ")";
1681
+            $sql .= " AND u.rowid IN (".$includeUsers.")";
1682 1682
         if (!empty(Globals::$conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive)
1683 1683
             $sql .= " AND u.statut <> 0";
1684 1684
         if (!empty($morefilter))
1685
-            $sql .= " " . $morefilter;
1685
+            $sql .= " ".$morefilter;
1686 1686
 
1687 1687
         if (empty(Globals::$conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
1688 1688
             $sql .= " ORDER BY u.firstname ASC";
@@ -1690,22 +1690,22 @@  discard block
 block discarded – undo
1690 1690
             $sql .= " ORDER BY u.lastname ASC";
1691 1691
         }
1692 1692
 
1693
-        dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);
1693
+        dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
1694 1694
         $resql = $this->db->query($sql);
1695 1695
         if ($resql) {
1696 1696
             $num = $this->db->num_rows($resql);
1697 1697
             $i = 0;
1698 1698
             if ($num) {
1699 1699
                 // Enhance with select2
1700
-                include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1700
+                include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1701 1701
                 $out .= ajax_combobox($htmlname);
1702 1702
 
1703 1703
                 // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
1704
-                $out .= '<select class="flat' . ($morecss ? ' minwidth100 ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
1704
+                $out .= '<select class="flat'.($morecss ? ' minwidth100 '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
1705 1705
                 if ($show_empty && !$multiple)
1706
-                    $out .= '<option value="-1"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
1706
+                    $out .= '<option value="-1"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>&nbsp;</option>'."\n";
1707 1707
                 if ($show_every)
1708
-                    $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
1708
+                    $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
1709 1709
 
1710 1710
                 $userstatic = new User($this->db);
1711 1711
 
@@ -1720,14 +1720,14 @@  discard block
 block discarded – undo
1720 1720
                     if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly))
1721 1721
                         $disableline = ($enableonlytext ? $enableonlytext : '1');
1722 1722
 
1723
-                    if ((is_object($selected) && $selected->id == $obj->rowid) || (!is_object($selected) && in_array($obj->rowid, $selected) )) {
1724
-                        $out .= '<option value="' . $obj->rowid . '"';
1723
+                    if ((is_object($selected) && $selected->id == $obj->rowid) || (!is_object($selected) && in_array($obj->rowid, $selected))) {
1724
+                        $out .= '<option value="'.$obj->rowid.'"';
1725 1725
                         if ($disableline)
1726 1726
                             $out .= ' disabled';
1727 1727
                         $out .= ' selected>';
1728 1728
                     }
1729 1729
                     else {
1730
-                        $out .= '<option value="' . $obj->rowid . '"';
1730
+                        $out .= '<option value="'.$obj->rowid.'"';
1731 1731
                         if ($disableline)
1732 1732
                             $out .= ' disabled';
1733 1733
                         $out .= '>';
@@ -1743,31 +1743,31 @@  discard block
 block discarded – undo
1743 1743
                     // Complete name with more info
1744 1744
                     $moreinfo = 0;
1745 1745
                     if (!empty(Globals::$conf->global->MAIN_SHOW_LOGIN)) {
1746
-                        $out .= ($moreinfo ? ' - ' : ' (') . $obj->login;
1746
+                        $out .= ($moreinfo ? ' - ' : ' (').$obj->login;
1747 1747
                         $moreinfo++;
1748 1748
                     }
1749 1749
                     if ($showstatus >= 0) {
1750 1750
                         if ($obj->statut == 1 && $showstatus == 1) {
1751
-                            $out .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
1751
+                            $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
1752 1752
                             $moreinfo++;
1753 1753
                         }
1754 1754
                         if ($obj->statut == 0) {
1755
-                            $out .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
1755
+                            $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
1756 1756
                             $moreinfo++;
1757 1757
                         }
1758 1758
                     }
1759 1759
                     if (!empty(Globals::$conf->multicompany->enabled) && empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) {
1760 1760
                         if (!$obj->entity) {
1761
-                            $out .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
1761
+                            $out .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
1762 1762
                             $moreinfo++;
1763 1763
                         } else {
1764
-                            $out .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
1764
+                            $out .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
1765 1765
                             $moreinfo++;
1766 1766
                         }
1767 1767
                     }
1768 1768
                     $out .= ($moreinfo ? ')' : '');
1769 1769
                     if ($disableline && $disableline != '1') {
1770
-                        $out .= ' - ' . $disableline; // This is text from $enableonlytext parameter
1770
+                        $out .= ' - '.$disableline; // This is text from $enableonlytext parameter
1771 1771
                     }
1772 1772
                     $out .= '</option>';
1773 1773
                     $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
@@ -1775,8 +1775,8 @@  discard block
 block discarded – undo
1775 1775
                     $i++;
1776 1776
                 }
1777 1777
             } else {
1778
-                $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
1779
-                $out .= '<option value="">' . $langs->trans("None") . '</option>';
1778
+                $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
1779
+                $out .= '<option value="">'.$langs->trans("None").'</option>';
1780 1780
             }
1781 1781
             $out .= '</select>';
1782 1782
         } else {
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
             $out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
1828 1828
             $out .= '<script type="text/javascript" language="javascript">jQuery(document).ready(function () {    jQuery(".removedassigned").click(function() {        jQuery(".removedassignedhidden").val(jQuery(this).val());    });})</script>';
1829 1829
             $out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
1830
-            $out .= ' <input type="submit" class="button valignmiddle" name="' . $action . 'assignedtouser" value="' . AlDolUtils::dol_escape_htmltag($langs->trans("Add")) . '">';
1830
+            $out .= ' <input type="submit" class="button valignmiddle" name="'.$action.'assignedtouser" value="'.AlDolUtils::dol_escape_htmltag($langs->trans("Add")).'">';
1831 1831
             $out .= '<br>';
1832 1832
         }
1833 1833
         $assignedtouser = array();
@@ -1851,16 +1851,16 @@  discard block
 block discarded – undo
1851 1851
             $out .= $userstatic->getNomUrl(-1);
1852 1852
             if ($i == 0) {
1853 1853
                 $ownerid = $value['id'];
1854
-                $out .= ' (' . $langs->trans("Owner") . ')';
1854
+                $out .= ' ('.$langs->trans("Owner").')';
1855 1855
             }
1856 1856
             if ($nbassignetouser > 1 && $action != 'view') {
1857
-                $out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">';
1857
+                $out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
1858 1858
             }
1859 1859
             // Show my availability
1860 1860
             if ($showproperties) {
1861 1861
                 if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
1862 1862
                     $out .= '<div class="myavailability inline-block">';
1863
-                    $out .= '&nbsp;-&nbsp;<span class="opacitymedium">' . $langs->trans("Availability") . ':</span>  <input id="transparency" class="marginleftonly marginrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofuserid[$ownerid]['transparency'] ? ' checked' : '') . '>' . $langs->trans("Busy");
1863
+                    $out .= '&nbsp;-&nbsp;<span class="opacitymedium">'.$langs->trans("Availability").':</span>  <input id="transparency" class="marginleftonly marginrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'>'.$langs->trans("Busy");
1864 1864
                     $out .= '</div>';
1865 1865
                 }
1866 1866
             }
@@ -1914,19 +1914,19 @@  discard block
 block discarded – undo
1914 1914
             $placeholder = '';
1915 1915
 
1916 1916
             if ($selected && empty($selected_input_value)) {
1917
-                require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
1917
+                require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
1918 1918
                 $producttmpselect = new Product($this->db);
1919 1919
                 $producttmpselect->fetch($selected);
1920 1920
                 $selected_input_value = $producttmpselect->ref;
1921 1921
                 unset($producttmpselect);
1922 1922
             }
1923 1923
             // mode=1 means customers products
1924
-            $urloption = 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=1&status=' . $status . '&finished=' . $finished . '&hidepriceinlabel=' . $hidepriceinlabel . '&warehousestatus=' . $warehouseStatus;
1924
+            $urloption = 'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
1925 1925
             //Price by customer
1926 1926
             if (!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
1927
-                $urloption .= '&socid=' . $socid;
1927
+                $urloption .= '&socid='.$socid;
1928 1928
             }
1929
-            print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1929
+            print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1930 1930
 
1931 1931
             if (!empty(Globals::$conf->variants->enabled)) {
1932 1932
 
@@ -2003,14 +2003,14 @@  discard block
 block discarded – undo
2003 2003
                                 <?php
2004 2004
                             }
2005 2005
                             if (empty($hidelabel))
2006
-                                print $langs->trans("RefOrLabel") . ' : ';
2006
+                                print $langs->trans("RefOrLabel").' : ';
2007 2007
                             else if ($hidelabel > 1) {
2008
-                                $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
2008
+                                $placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
2009 2009
                                 if ($hidelabel == 2) {
2010 2010
                                     print img_picto($langs->trans("Search"), 'search');
2011 2011
                                 }
2012 2012
                             }
2013
-                            print '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty(Globals::$conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
2013
+                            print '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty(Globals::$conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
2014 2014
                             if ($hidelabel == 3) {
2015 2015
                                 print img_picto($langs->trans("Search"), 'search');
2016 2016
                             }
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
 
2054 2054
         $warehouseStatusArray = array();
2055 2055
         if (!empty($warehouseStatus)) {
2056
-            require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2056
+            require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2057 2057
             if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2058 2058
                 $warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2059 2059
             }
@@ -2069,13 +2069,13 @@  discard block
 block discarded – undo
2069 2069
         (count($warehouseStatusArray)) ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock";
2070 2070
 
2071 2071
         $sql = "SELECT ";
2072
-        $sql .= $selectFields . $selectFieldsGrouped;
2072
+        $sql .= $selectFields.$selectFieldsGrouped;
2073 2073
 
2074 2074
         if (!empty(Globals::$conf->global->PRODUCT_SORT_BY_CATEGORY)) {
2075 2075
             //Product category
2076
-            $sql .= ", (SELECT " . MAIN_DB_PREFIX . "categorie_product.fk_categorie
2077
-						FROM " . MAIN_DB_PREFIX . "categorie_product
2078
-						WHERE " . MAIN_DB_PREFIX . "categorie_product.fk_product=p.rowid
2076
+            $sql .= ", (SELECT ".MAIN_DB_PREFIX."categorie_product.fk_categorie
2077
+						FROM " . MAIN_DB_PREFIX."categorie_product
2078
+						WHERE " . MAIN_DB_PREFIX."categorie_product.fk_product=p.rowid
2079 2079
 						LIMIT 1
2080 2080
 				) AS categorie_product_id ";
2081 2081
         }
@@ -2094,45 +2094,45 @@  discard block
 block discarded – undo
2094 2094
         }
2095 2095
         // Price by quantity
2096 2096
         if (!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
2097
-            $sql .= ", (SELECT pp.rowid FROM " . MAIN_DB_PREFIX . "product_price as pp WHERE pp.fk_product = p.rowid";
2097
+            $sql .= ", (SELECT pp.rowid FROM ".MAIN_DB_PREFIX."product_price as pp WHERE pp.fk_product = p.rowid";
2098 2098
             if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
2099
-                $sql .= " AND price_level=" . $price_level;
2099
+                $sql .= " AND price_level=".$price_level;
2100 2100
             $sql .= " ORDER BY date_price";
2101 2101
             $sql .= " DESC LIMIT 1) as price_rowid";
2102
-            $sql .= ", (SELECT pp.price_by_qty FROM " . MAIN_DB_PREFIX . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2102
+            $sql .= ", (SELECT pp.price_by_qty FROM ".MAIN_DB_PREFIX."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2103 2103
             if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
2104
-                $sql .= " AND price_level=" . $price_level;
2104
+                $sql .= " AND price_level=".$price_level;
2105 2105
             $sql .= " ORDER BY date_price";
2106 2106
             $sql .= " DESC LIMIT 1) as price_by_qty";
2107 2107
             $selectFields .= ", price_rowid, price_by_qty";
2108 2108
         }
2109
-        $sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
2109
+        $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
2110 2110
         if (count($warehouseStatusArray)) {
2111
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_stock as ps on ps.fk_product = p.rowid";
2112
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e on ps.fk_entrepot = e.rowid";
2111
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid";
2112
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid";
2113 2113
         }
2114 2114
 
2115 2115
         // include search in supplier ref
2116 2116
         if (!empty(Globals::$conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
2117
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2117
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2118 2118
         }
2119 2119
 
2120 2120
         //Price by customer
2121 2121
         if (!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
2122
-            $sql .= " LEFT JOIN  " . MAIN_DB_PREFIX . "product_customer_price as pcp ON pcp.fk_soc=" . $socid . " AND pcp.fk_product=p.rowid";
2122
+            $sql .= " LEFT JOIN  ".MAIN_DB_PREFIX."product_customer_price as pcp ON pcp.fk_soc=".$socid." AND pcp.fk_product=p.rowid";
2123 2123
         }
2124 2124
         // Multilang : we add translation
2125 2125
         if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) {
2126
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='" . $langs->getDefaultLang() . "'";
2126
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='".$langs->getDefaultLang()."'";
2127 2127
         }
2128 2128
 
2129 2129
         if (!empty(Globals::$conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
2130
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
2130
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
2131 2131
         }
2132 2132
 
2133
-        $sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
2133
+        $sql .= ' WHERE p.entity IN ('.getEntity('product').')';
2134 2134
         if (count($warehouseStatusArray)) {
2135
-            $sql .= ' AND (p.fk_product_type = 1 OR e.statut IN (' . $this->db->escape(implode(',', $warehouseStatusArray)) . '))';
2135
+            $sql .= ' AND (p.fk_product_type = 1 OR e.statut IN ('.$this->db->escape(implode(',', $warehouseStatusArray)).'))';
2136 2136
         }
2137 2137
 
2138 2138
         if (!empty(Globals::$conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
@@ -2140,17 +2140,17 @@  discard block
 block discarded – undo
2140 2140
         }
2141 2141
 
2142 2142
         if ($finished == 0) {
2143
-            $sql .= " AND p.finished = " . $finished;
2143
+            $sql .= " AND p.finished = ".$finished;
2144 2144
         } elseif ($finished == 1) {
2145
-            $sql .= " AND p.finished = " . $finished;
2145
+            $sql .= " AND p.finished = ".$finished;
2146 2146
             if ($status >= 0)
2147
-                $sql .= " AND p.tosell = " . $status;
2147
+                $sql .= " AND p.tosell = ".$status;
2148 2148
         }
2149 2149
         elseif ($status >= 0) {
2150
-            $sql .= " AND p.tosell = " . $status;
2150
+            $sql .= " AND p.tosell = ".$status;
2151 2151
         }
2152 2152
         if (strval($filtertype) != '')
2153
-            $sql .= " AND p.fk_product_type=" . $filtertype;
2153
+            $sql .= " AND p.fk_product_type=".$filtertype;
2154 2154
         // Add criteria on ref/label
2155 2155
         if ($filterkey != '') {
2156 2156
             $sql .= ' AND (';
@@ -2163,27 +2163,27 @@  discard block
 block discarded – undo
2163 2163
             foreach ($scrit as $crit) {
2164 2164
                 if ($i > 0)
2165 2165
                     $sql .= " AND ";
2166
-                $sql .= "(p.ref LIKE '" . $db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $db->escape($prefix . $crit) . "%'";
2166
+                $sql .= "(p.ref LIKE '".$db->escape($prefix.$crit)."%' OR p.label LIKE '".$db->escape($prefix.$crit)."%'";
2167 2167
                 if (!empty(Globals::$conf->global->MAIN_MULTILANGS))
2168
-                    $sql .= " OR pl.label LIKE '" . $db->escape($prefix . $crit) . "%'";
2168
+                    $sql .= " OR pl.label LIKE '".$db->escape($prefix.$crit)."%'";
2169 2169
                 if (!empty(Globals::$conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION)) {
2170
-                    $sql .= " OR p.description LIKE '" . $db->escape($prefix . $crit) . "%'";
2170
+                    $sql .= " OR p.description LIKE '".$db->escape($prefix.$crit)."%'";
2171 2171
                     if (!empty(Globals::$conf->global->MAIN_MULTILANGS))
2172
-                        $sql .= " OR pl.description LIKE '" . $db->escape($prefix . $crit) . "%'";
2172
+                        $sql .= " OR pl.description LIKE '".$db->escape($prefix.$crit)."%'";
2173 2173
                 }
2174 2174
                 if (!empty(Globals::$conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF))
2175
-                    $sql .= " OR pfp.ref_fourn LIKE '" . $db->escape($prefix . $crit) . "%'";
2175
+                    $sql .= " OR pfp.ref_fourn LIKE '".$db->escape($prefix.$crit)."%'";
2176 2176
                 $sql .= ")";
2177 2177
                 $i++;
2178 2178
             }
2179 2179
             if (count($scrit) > 1)
2180 2180
                 $sql .= ")";
2181 2181
             if (!empty(Globals::$conf->barcode->enabled))
2182
-                $sql .= " OR p.barcode LIKE '" . $db->escape($prefix . $filterkey) . "%'";
2182
+                $sql .= " OR p.barcode LIKE '".$db->escape($prefix.$filterkey)."%'";
2183 2183
             $sql .= ')';
2184 2184
         }
2185 2185
         if (count($warehouseStatusArray)) {
2186
-            $sql .= ' GROUP BY' . $selectFields;
2186
+            $sql .= ' GROUP BY'.$selectFields;
2187 2187
         }
2188 2188
 
2189 2189
         //Sort by category
@@ -2198,21 +2198,21 @@  discard block
 block discarded – undo
2198 2198
         $sql .= $db->plimit($limit, 0);
2199 2199
 
2200 2200
         // Build output string
2201
-        dol_syslog(get_class($this) . "::select_produits_list search product", LOG_DEBUG);
2201
+        dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG);
2202 2202
         $result = $this->db->query($sql);
2203 2203
         if ($result) {
2204
-            require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2205
-            require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
2204
+            require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2205
+            require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
2206 2206
             $num = $this->db->num_rows($result);
2207 2207
 
2208 2208
             $events = null;
2209 2209
 
2210 2210
             if (!$forcecombo) {
2211
-                include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2211
+                include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2212 2212
                 $out .= ajax_combobox($htmlname, $events, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT);
2213 2213
             }
2214 2214
 
2215
-            $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2215
+            $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2216 2216
 
2217 2217
             $textifempty = '';
2218 2218
             // Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -2224,7 +2224,7 @@  discard block
 block discarded – undo
2224 2224
                     $textifempty .= $langs->trans("All");
2225 2225
             }
2226 2226
             if ($showempty)
2227
-                $out .= '<option value="0" selected>' . $textifempty . '</option>';
2227
+                $out .= '<option value="0" selected>'.$textifempty.'</option>';
2228 2228
 
2229 2229
             $i = 0;
2230 2230
             while ($num && $i < $num) {
@@ -2234,11 +2234,11 @@  discard block
 block discarded – undo
2234 2234
 
2235 2235
                 if ((!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
2236 2236
                     $sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
2237
-                    $sql .= " FROM " . MAIN_DB_PREFIX . "product_price_by_qty";
2238
-                    $sql .= " WHERE fk_product_price=" . $objp->price_rowid;
2237
+                    $sql .= " FROM ".MAIN_DB_PREFIX."product_price_by_qty";
2238
+                    $sql .= " WHERE fk_product_price=".$objp->price_rowid;
2239 2239
                     $sql .= " ORDER BY quantity ASC";
2240 2240
 
2241
-                    dol_syslog(get_class($this) . "::select_produits_list search price by qty", LOG_DEBUG);
2241
+                    dol_syslog(get_class($this)."::select_produits_list search price by qty", LOG_DEBUG);
2242 2242
                     $result2 = $this->db->query($sql);
2243 2243
                     if ($result2) {
2244 2244
                         $nb_prices = $this->db->num_rows($result2);
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
         if (!empty($objp->label_translated))
2343 2343
             $label = $objp->label_translated;
2344 2344
         if (!empty($filterkey) && $filterkey != '')
2345
-            $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1);
2345
+            $label = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $label, 1);
2346 2346
 
2347 2347
         $outkey = $objp->rowid;
2348 2348
         $outref = $objp->ref;
@@ -2354,10 +2354,10 @@  discard block
 block discarded – undo
2354 2354
         $outdurationvalue = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
2355 2355
         $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
2356 2356
 
2357
-        $opt = '<option value="' . $objp->rowid . '"';
2357
+        $opt = '<option value="'.$objp->rowid.'"';
2358 2358
         $opt .= ($objp->rowid == $selected) ? ' selected' : '';
2359 2359
         if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
2360
-            $opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"';
2360
+            $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"';
2361 2361
         }
2362 2362
         if (!empty(Globals::$conf->stock->enabled) && $objp->fk_product_type == 0 && isset($objp->stock)) {
2363 2363
             if ($objp->stock > 0)
@@ -2368,16 +2368,16 @@  discard block
 block discarded – undo
2368 2368
         $opt .= '>';
2369 2369
         $opt .= $objp->ref;
2370 2370
         if ($outbarcode)
2371
-            $opt .= ' (' . $outbarcode . ')';
2372
-        $opt .= ' - ' . dol_trunc($label, $maxlengtharticle);
2371
+            $opt .= ' ('.$outbarcode.')';
2372
+        $opt .= ' - '.dol_trunc($label, $maxlengtharticle);
2373 2373
 
2374 2374
         $objRef = $objp->ref;
2375 2375
         if (!empty($filterkey) && $filterkey != '')
2376
-            $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1);
2376
+            $objRef = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1);
2377 2377
         $outval .= $objRef;
2378 2378
         if ($outbarcode)
2379
-            $outval .= ' (' . $outbarcode . ')';
2380
-        $outval .= ' - ' . dol_trunc($label, $maxlengtharticle);
2379
+            $outval .= ' ('.$outbarcode.')';
2380
+        $outval .= ' - '.dol_trunc($label, $maxlengtharticle);
2381 2381
 
2382 2382
         $found = 0;
2383 2383
 
@@ -2385,25 +2385,25 @@  discard block
 block discarded – undo
2385 2385
         // If we need a particular price level (from 1 to 6)
2386 2386
         if (empty($hidepriceinlabel) && $price_level >= 1 && (!empty(Globals::$conf->global->PRODUIT_MULTIPRICES) || !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
2387 2387
             $sql = "SELECT price, price_ttc, price_base_type, tva_tx";
2388
-            $sql .= " FROM " . MAIN_DB_PREFIX . "product_price";
2389
-            $sql .= " WHERE fk_product='" . $objp->rowid . "'";
2390
-            $sql .= " AND entity IN (" . getEntity('productprice') . ")";
2391
-            $sql .= " AND price_level=" . $price_level;
2388
+            $sql .= " FROM ".MAIN_DB_PREFIX."product_price";
2389
+            $sql .= " WHERE fk_product='".$objp->rowid."'";
2390
+            $sql .= " AND entity IN (".getEntity('productprice').")";
2391
+            $sql .= " AND price_level=".$price_level;
2392 2392
             $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
2393 2393
             $sql .= " LIMIT 1";
2394 2394
 
2395
-            dol_syslog(get_class($this) . '::constructProductListOption search price for level ' . $price_level . '', LOG_DEBUG);
2395
+            dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
2396 2396
             $result2 = $this->db->query($sql);
2397 2397
             if ($result2) {
2398 2398
                 $objp2 = $this->db->fetch_object($result2);
2399 2399
                 if ($objp2) {
2400 2400
                     $found = 1;
2401 2401
                     if ($objp2->price_base_type == 'HT') {
2402
-                        $opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("HT");
2403
-                        $outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("HT");
2402
+                        $opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("HT");
2403
+                        $outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("HT");
2404 2404
                     } else {
2405
-                        $opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("TTC");
2406
-                        $outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("TTC");
2405
+                        $opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("TTC");
2406
+                        $outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("TTC");
2407 2407
                     }
2408 2408
                     $outprice_ht = price($objp2->price);
2409 2409
                     $outprice_ttc = price($objp2->price_ttc);
@@ -2421,13 +2421,13 @@  discard block
 block discarded – undo
2421 2421
             $outqty = $objp->quantity;
2422 2422
             $outdiscount = $objp->remise_percent;
2423 2423
             if ($objp->quantity == 1) {
2424
-                $opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/";
2425
-                $outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/";
2424
+                $opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/";
2425
+                $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/";
2426 2426
                 $opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
2427 2427
                 $outval .= $langs->transnoentities("Unit");
2428 2428
             } else {
2429
-                $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $objp->quantity;
2430
-                $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $objp->quantity;
2429
+                $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$objp->quantity;
2430
+                $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/".$objp->quantity;
2431 2431
                 $opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
2432 2432
                 $outval .= $langs->transnoentities("Units");
2433 2433
             }
@@ -2438,12 +2438,12 @@  discard block
 block discarded – undo
2438 2438
             $outtva_tx = $objp->tva_tx;
2439 2439
         }
2440 2440
         if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
2441
-            $opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
2442
-            $outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
2441
+            $opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
2442
+            $outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
2443 2443
         }
2444 2444
         if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
2445
-            $opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
2446
-            $outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
2445
+            $opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
2446
+            $outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
2447 2447
         }
2448 2448
 
2449 2449
         // Price by customer
@@ -2452,11 +2452,11 @@  discard block
 block discarded – undo
2452 2452
                 $found = 1;
2453 2453
 
2454 2454
                 if ($objp->custprice_base_type == 'HT') {
2455
-                    $opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("HT");
2456
-                    $outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("HT");
2455
+                    $opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("HT");
2456
+                    $outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("HT");
2457 2457
                 } else {
2458
-                    $opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("TTC");
2459
-                    $outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("TTC");
2458
+                    $opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("TTC");
2459
+                    $outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("TTC");
2460 2460
                 }
2461 2461
 
2462 2462
                 $outprice_ht = price($objp->custprice);
@@ -2469,11 +2469,11 @@  discard block
 block discarded – undo
2469 2469
         // If level no defined or multiprice not found, we used the default price
2470 2470
         if (empty($hidepriceinlabel) && !$found) {
2471 2471
             if ($objp->price_base_type == 'HT') {
2472
-                $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("HT");
2473
-                $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("HT");
2472
+                $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("HT");
2473
+                $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("HT");
2474 2474
             } else {
2475
-                $opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->trans("TTC");
2476
-                $outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency) . ' ' . $langs->transnoentities("TTC");
2475
+                $opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->trans("TTC");
2476
+                $outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, Globals::$conf->currency).' '.$langs->transnoentities("TTC");
2477 2477
             }
2478 2478
             $outprice_ht = price($objp->price);
2479 2479
             $outprice_ttc = price($objp->price_ttc);
@@ -2482,21 +2482,21 @@  discard block
 block discarded – undo
2482 2482
         }
2483 2483
 
2484 2484
         if (!empty(Globals::$conf->stock->enabled) && isset($objp->stock) && $objp->fk_product_type == 0) {
2485
-            $opt .= ' - ' . $langs->trans("Stock") . ':' . $objp->stock;
2485
+            $opt .= ' - '.$langs->trans("Stock").':'.$objp->stock;
2486 2486
 
2487 2487
             if ($objp->stock > 0) {
2488
-                $outval .= ' - <span class="product_line_stock_ok">' . $langs->transnoentities("Stock") . ':' . $objp->stock . '</span>';
2488
+                $outval .= ' - <span class="product_line_stock_ok">'.$langs->transnoentities("Stock").':'.$objp->stock.'</span>';
2489 2489
             } elseif ($objp->stock <= 0) {
2490
-                $outval .= ' - <span class="product_line_stock_too_low">' . $langs->transnoentities("Stock") . ':' . $objp->stock . '</span>';
2490
+                $outval .= ' - <span class="product_line_stock_too_low">'.$langs->transnoentities("Stock").':'.$objp->stock.'</span>';
2491 2491
             }
2492 2492
         }
2493 2493
 
2494 2494
         if ($outdurationvalue && $outdurationunit) {
2495 2495
             $da = array("h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year"));
2496 2496
             if (isset($da[$outdurationunit])) {
2497
-                $key = $da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : '');
2498
-                $opt .= ' - ' . $outdurationvalue . ' ' . $langs->trans($key);
2499
-                $outval .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($key);
2497
+                $key = $da[$outdurationunit].($outdurationvalue > 1 ? 's' : '');
2498
+                $opt .= ' - '.$outdurationvalue.' '.$langs->trans($key);
2499
+                $outval .= ' - '.$outdurationvalue.' '.$langs->transnoentities($key);
2500 2500
             }
2501 2501
         }
2502 2502
 
@@ -2527,7 +2527,7 @@  discard block
 block discarded – undo
2527 2527
         $selected_input_value = '';
2528 2528
         if (!empty(Globals::$conf->use_javascript_ajax) && !empty(Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) {
2529 2529
             if ($selected > 0) {
2530
-                require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2530
+                require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2531 2531
                 $producttmpselect = new Product($this->db);
2532 2532
                 $producttmpselect->fetch($selected);
2533 2533
                 $selected_input_value = $producttmpselect->ref;
@@ -2535,9 +2535,9 @@  discard block
 block discarded – undo
2535 2535
             }
2536 2536
 
2537 2537
             // mode=2 means suppliers products
2538
-            $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
2539
-            print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
2540
-            print ($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" size="20" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '">';
2538
+            $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
2539
+            print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
2540
+            print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'">';
2541 2541
         } else {
2542 2542
             print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', -1, 0, 0, $alsoproductwithnosupplierprice);
2543 2543
         }
@@ -2573,17 +2573,17 @@  discard block
 block discarded – undo
2573 2573
         $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
2574 2574
         $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.fk_soc, s.nom as name,";
2575 2575
         $sql .= " pfp.supplier_reputation";
2576
-        $sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
2577
-        $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2576
+        $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
2577
+        $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2578 2578
         if ($socid)
2579
-            $sql .= " AND pfp.fk_soc = " . $socid;
2580
-        $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON pfp.fk_soc = s.rowid";
2581
-        $sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
2579
+            $sql .= " AND pfp.fk_soc = ".$socid;
2580
+        $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
2581
+        $sql .= " WHERE p.entity IN (".getEntity('product').")";
2582 2582
         $sql .= " AND p.tobuy = 1";
2583 2583
         if (strval($filtertype) != '')
2584
-            $sql .= " AND p.fk_product_type=" . $this->db->escape($filtertype);
2584
+            $sql .= " AND p.fk_product_type=".$this->db->escape($filtertype);
2585 2585
         if (!empty($filtre))
2586
-            $sql .= " " . $filtre;
2586
+            $sql .= " ".$filtre;
2587 2587
         // Add criteria on ref/label
2588 2588
         if ($filterkey != '') {
2589 2589
             $sql .= ' AND (';
@@ -2596,13 +2596,13 @@  discard block
 block discarded – undo
2596 2596
             foreach ($scrit as $crit) {
2597 2597
                 if ($i > 0)
2598 2598
                     $sql .= " AND ";
2599
-                $sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%')";
2599
+                $sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%')";
2600 2600
                 $i++;
2601 2601
             }
2602 2602
             if (count($scrit) > 1)
2603 2603
                 $sql .= ")";
2604 2604
             if (!empty(Globals::$conf->barcode->enabled))
2605
-                $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
2605
+                $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
2606 2606
             $sql .= ')';
2607 2607
         }
2608 2608
         $sql .= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
@@ -2610,15 +2610,15 @@  discard block
 block discarded – undo
2610 2610
 
2611 2611
         // Build output string
2612 2612
 
2613
-        dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
2613
+        dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
2614 2614
         $result = $this->db->query($sql);
2615 2615
         if ($result) {
2616
-            require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
2616
+            require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
2617 2617
 
2618 2618
             $num = $this->db->num_rows($result);
2619 2619
 
2620 2620
             //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
2621
-            $out .= '<select class="flat maxwidthonsmartphone" id="' . $htmlname . '" name="' . $htmlname . '">';
2621
+            $out .= '<select class="flat maxwidthonsmartphone" id="'.$htmlname.'" name="'.$htmlname.'">';
2622 2622
             if (!$selected)
2623 2623
                 $out .= '<option value="0" selected>&nbsp;</option>';
2624 2624
             else
@@ -2628,9 +2628,9 @@  discard block
 block discarded – undo
2628 2628
             while ($i < $num) {
2629 2629
                 $objp = $this->db->fetch_object($result);
2630 2630
 
2631
-                $outkey = $objp->idprodfournprice;                                                    // id in table of price
2631
+                $outkey = $objp->idprodfournprice; // id in table of price
2632 2632
                 if (!$outkey && $alsoproductwithnosupplierprice)
2633
-                    $outkey = 'idprod_' . $objp->rowid;   // id of product
2633
+                    $outkey = 'idprod_'.$objp->rowid; // id of product
2634 2634
 
2635 2635
                 $outref = $objp->ref;
2636 2636
                 $outval = '';
@@ -2640,36 +2640,36 @@  discard block
 block discarded – undo
2640 2640
                 $outdurationvalue = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
2641 2641
                 $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
2642 2642
 
2643
-                $opt = '<option value="' . $outkey . '"';
2643
+                $opt = '<option value="'.$outkey.'"';
2644 2644
                 if ($selected && $selected == $objp->idprodfournprice)
2645 2645
                     $opt .= ' selected';
2646 2646
                 if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice))
2647 2647
                     $opt .= ' disabled';
2648 2648
                 if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
2649
-                    $opt .= ' pbq="' . $objp->idprodfournprice . '" data-pbq="' . $objp->idprodfournprice . '" data-pbqqty="' . $objp->quantity . '" data-pbqpercent="' . $objp->remise_percent . '"';
2649
+                    $opt .= ' pbq="'.$objp->idprodfournprice.'" data-pbq="'.$objp->idprodfournprice.'" data-pbqqty="'.$objp->quantity.'" data-pbqpercent="'.$objp->remise_percent.'"';
2650 2650
                 }
2651 2651
                 $opt .= '>';
2652 2652
 
2653 2653
                 $objRef = $objp->ref;
2654 2654
                 if ($filterkey && $filterkey != '')
2655
-                    $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1);
2655
+                    $objRef = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRef, 1);
2656 2656
                 $objRefFourn = $objp->ref_fourn;
2657 2657
                 if ($filterkey && $filterkey != '')
2658
-                    $objRefFourn = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
2658
+                    $objRefFourn = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $objRefFourn, 1);
2659 2659
                 $label = $objp->label;
2660 2660
                 if ($filterkey && $filterkey != '')
2661
-                    $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1);
2661
+                    $label = preg_replace('/('.preg_quote($filterkey).')/i', '<strong>$1</strong>', $label, 1);
2662 2662
 
2663 2663
                 $opt .= $objp->ref;
2664 2664
                 if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
2665
-                    $opt .= ' (' . $objp->ref_fourn . ')';
2665
+                    $opt .= ' ('.$objp->ref_fourn.')';
2666 2666
                 $opt .= ' - ';
2667 2667
                 $outval .= $objRef;
2668 2668
                 if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
2669
-                    $outval .= ' (' . $objRefFourn . ')';
2669
+                    $outval .= ' ('.$objRefFourn.')';
2670 2670
                 $outval .= ' - ';
2671
-                $opt .= dol_trunc($label, 72) . ' - ';
2672
-                $outval .= dol_trunc($label, 72) . ' - ';
2671
+                $opt .= dol_trunc($label, 72).' - ';
2672
+                $outval .= dol_trunc($label, 72).' - ';
2673 2673
 
2674 2674
                 if (!empty($objp->idprodfournprice)) {
2675 2675
                     $outqty = $objp->quantity;
@@ -2691,39 +2691,39 @@  discard block
 block discarded – undo
2691 2691
                         }
2692 2692
                     }
2693 2693
                     if ($objp->quantity == 1) {
2694
-                        $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/";
2695
-                        $outval .= price($objp->fprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/";
2694
+                        $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/";
2695
+                        $outval .= price($objp->fprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/";
2696 2696
                         $opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
2697 2697
                         $outval .= $langs->transnoentities("Unit");
2698 2698
                     } else {
2699
-                        $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $objp->quantity;
2700
-                        $outval .= price($objp->fprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $objp->quantity;
2701
-                        $opt .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
2702
-                        $outval .= ' ' . $langs->transnoentities("Units");
2699
+                        $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$objp->quantity;
2700
+                        $outval .= price($objp->fprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/".$objp->quantity;
2701
+                        $opt .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
2702
+                        $outval .= ' '.$langs->transnoentities("Units");
2703 2703
                     }
2704 2704
 
2705 2705
                     if ($objp->quantity >= 1) {
2706
-                        $opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
2707
-                        $outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
2706
+                        $opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
2707
+                        $outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
2708 2708
                     }
2709 2709
                     if ($objp->remise_percent >= 1) {
2710
-                        $opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
2711
-                        $outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
2710
+                        $opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
2711
+                        $outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
2712 2712
                     }
2713 2713
                     if ($objp->duration) {
2714
-                        $opt .= " - " . $objp->duration;
2715
-                        $outval .= " - " . $objp->duration;
2714
+                        $opt .= " - ".$objp->duration;
2715
+                        $outval .= " - ".$objp->duration;
2716 2716
                     }
2717 2717
                     if (!$socid) {
2718
-                        $opt .= " - " . dol_trunc($objp->name, 8);
2719
-                        $outval .= " - " . dol_trunc($objp->name, 8);
2718
+                        $opt .= " - ".dol_trunc($objp->name, 8);
2719
+                        $outval .= " - ".dol_trunc($objp->name, 8);
2720 2720
                     }
2721 2721
                     if ($objp->supplier_reputation) {
2722 2722
                         //TODO dictionary
2723 2723
                         $reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
2724 2724
 
2725
-                        $opt .= " - " . $reputations[$objp->supplier_reputation];
2726
-                        $outval .= " - " . $reputations[$objp->supplier_reputation];
2725
+                        $opt .= " - ".$reputations[$objp->supplier_reputation];
2726
+                        $outval .= " - ".$reputations[$objp->supplier_reputation];
2727 2727
                     }
2728 2728
                 } else {
2729 2729
                     if (empty($alsoproductwithnosupplierprice)) {     // No supplier price defined for couple product/supplier
@@ -2757,7 +2757,7 @@  discard block
 block discarded – undo
2757 2757
 
2758 2758
             $this->db->free($result);
2759 2759
 
2760
-            include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2760
+            include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2761 2761
             $out .= ajax_combobox($htmlname);
2762 2762
 
2763 2763
             if (empty($outputmode))
@@ -2788,39 +2788,39 @@  discard block
 block discarded – undo
2788 2788
         $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, pfp.fk_soc,";
2789 2789
         $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
2790 2790
         $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
2791
-        $sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
2792
-        $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2793
-        $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON pfp.fk_soc = s.rowid";
2794
-        $sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
2791
+        $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
2792
+        $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2793
+        $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
2794
+        $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
2795 2795
         $sql .= " AND p.tobuy = 1";
2796 2796
         $sql .= " AND s.fournisseur = 1";
2797
-        $sql .= " AND p.rowid = " . $productid;
2797
+        $sql .= " AND p.rowid = ".$productid;
2798 2798
         $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
2799 2799
 
2800
-        dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
2800
+        dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
2801 2801
         $result = $this->db->query($sql);
2802 2802
 
2803 2803
         if ($result) {
2804 2804
             $num = $this->db->num_rows($result);
2805 2805
 
2806
-            $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
2806
+            $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
2807 2807
 
2808 2808
             if (!$num) {
2809
-                $form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
2809
+                $form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
2810 2810
             } else {
2811
-                require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
2811
+                require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
2812 2812
                 $form .= '<option value="0">&nbsp;</option>';
2813 2813
 
2814 2814
                 $i = 0;
2815 2815
                 while ($i < $num) {
2816 2816
                     $objp = $this->db->fetch_object($result);
2817 2817
 
2818
-                    $opt = '<option value="' . $objp->idprodfournprice . '"';
2818
+                    $opt = '<option value="'.$objp->idprodfournprice.'"';
2819 2819
                     //if there is only one supplier, preselect it
2820 2820
                     if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier)) {
2821 2821
                         $opt .= ' selected';
2822 2822
                     }
2823
-                    $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
2823
+                    $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
2824 2824
 
2825 2825
                     if (!empty(Globals::$conf->dynamicprices->enabled) && !empty($objp->fk_supplier_price_expression)) {
2826 2826
                         $prod_supplier = new ProductFournisseur($this->db);
@@ -2839,10 +2839,10 @@  discard block
 block discarded – undo
2839 2839
                         }
2840 2840
                     }
2841 2841
                     if ($objp->quantity == 1) {
2842
-                        $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/";
2842
+                        $opt .= price($objp->fprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/";
2843 2843
                     }
2844 2844
 
2845
-                    $opt .= $objp->quantity . ' ';
2845
+                    $opt .= $objp->quantity.' ';
2846 2846
 
2847 2847
                     if ($objp->quantity == 1) {
2848 2848
                         $opt .= $langs->trans("Unit");
@@ -2851,10 +2851,10 @@  discard block
 block discarded – undo
2851 2851
                     }
2852 2852
                     if ($objp->quantity > 1) {
2853 2853
                         $opt .= " - ";
2854
-                        $opt .= price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->trans("Unit");
2854
+                        $opt .= price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency)."/".$langs->trans("Unit");
2855 2855
                     }
2856 2856
                     if ($objp->duration)
2857
-                        $opt .= " - " . $objp->duration;
2857
+                        $opt .= " - ".$objp->duration;
2858 2858
                     $opt .= "</option>\n";
2859 2859
 
2860 2860
                     $form .= $opt;
@@ -2886,14 +2886,14 @@  discard block
 block discarded – undo
2886 2886
         // phpcs:enable
2887 2887
         // looking for users
2888 2888
         $sql = "SELECT a.rowid, a.label";
2889
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe_address as a";
2890
-        $sql .= " WHERE a.fk_soc = " . $socid;
2889
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe_address as a";
2890
+        $sql .= " WHERE a.fk_soc = ".$socid;
2891 2891
         $sql .= " ORDER BY a.label ASC";
2892 2892
 
2893
-        dol_syslog(get_class($this) . "::select_address", LOG_DEBUG);
2893
+        dol_syslog(get_class($this)."::select_address", LOG_DEBUG);
2894 2894
         $resql = $this->db->query($sql);
2895 2895
         if ($resql) {
2896
-            print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
2896
+            print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
2897 2897
             if ($showempty)
2898 2898
                 print '<option value="0">&nbsp;</option>';
2899 2899
             $num = $this->db->num_rows($resql);
@@ -2903,9 +2903,9 @@  discard block
 block discarded – undo
2903 2903
                     $obj = $this->db->fetch_object($resql);
2904 2904
 
2905 2905
                     if ($selected && $selected == $obj->rowid) {
2906
-                        print '<option value="' . $obj->rowid . '" selected>' . $obj->label . '</option>';
2906
+                        print '<option value="'.$obj->rowid.'" selected>'.$obj->label.'</option>';
2907 2907
                     } else {
2908
-                        print '<option value="' . $obj->rowid . '">' . $obj->label . '</option>';
2908
+                        print '<option value="'.$obj->rowid.'">'.$obj->label.'</option>';
2909 2909
                     }
2910 2910
                     $i++;
2911 2911
                 }
@@ -2930,13 +2930,13 @@  discard block
 block discarded – undo
2930 2930
 
2931 2931
         $num = count($this->cache_conditions_paiements);
2932 2932
         if ($num > 0)
2933
-            return 0;    // Cache already loaded
2933
+            return 0; // Cache already loaded
2934 2934
 
2935 2935
         dol_syslog(__METHOD__, LOG_DEBUG);
2936 2936
 
2937 2937
         $sql = "SELECT rowid, code, libelle as label";
2938
-        $sql .= " FROM " . MAIN_DB_PREFIX . 'c_payment_term';
2939
-        $sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
2938
+        $sql .= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
2939
+        $sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
2940 2940
         $sql .= " AND active > 0";
2941 2941
         $sql .= " ORDER BY sortorder";
2942 2942
 
@@ -2948,7 +2948,7 @@  discard block
 block discarded – undo
2948 2948
                 $obj = $this->db->fetch_object($resql);
2949 2949
 
2950 2950
                 // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
2951
-                $label = ($langs->trans("PaymentConditionShort" . $obj->code) != ("PaymentConditionShort" . $obj->code) ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
2951
+                $label = ($langs->trans("PaymentConditionShort".$obj->code) != ("PaymentConditionShort".$obj->code) ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
2952 2952
                 $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
2953 2953
                 $this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
2954 2954
                 $i++;
@@ -2976,14 +2976,14 @@  discard block
 block discarded – undo
2976 2976
 
2977 2977
         $num = count($this->cache_availability);
2978 2978
         if ($num > 0)
2979
-            return 0;    // Cache already loaded
2979
+            return 0; // Cache already loaded
2980 2980
 
2981 2981
         dol_syslog(__METHOD__, LOG_DEBUG);
2982 2982
 
2983 2983
         $langs->load('propal');
2984 2984
 
2985 2985
         $sql = "SELECT rowid, code, label";
2986
-        $sql .= " FROM " . MAIN_DB_PREFIX . 'c_availability';
2986
+        $sql .= " FROM ".MAIN_DB_PREFIX.'c_availability';
2987 2987
         $sql .= " WHERE active > 0";
2988 2988
 
2989 2989
         $resql = $this->db->query($sql);
@@ -2994,7 +2994,7 @@  discard block
 block discarded – undo
2994 2994
                 $obj = $this->db->fetch_object($resql);
2995 2995
 
2996 2996
                 // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
2997
-                $label = ($langs->trans("AvailabilityType" . $obj->code) != ("AvailabilityType" . $obj->code) ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
2997
+                $label = ($langs->trans("AvailabilityType".$obj->code) != ("AvailabilityType".$obj->code) ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
2998 2998
                 $this->cache_availability[$obj->rowid]['code'] = $obj->code;
2999 2999
                 $this->cache_availability[$obj->rowid]['label'] = $label;
3000 3000
                 $i++;
@@ -3024,16 +3024,16 @@  discard block
 block discarded – undo
3024 3024
 
3025 3025
         $this->load_cache_availability();
3026 3026
 
3027
-        dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
3027
+        dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
3028 3028
 
3029
-        print '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
3029
+        print '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">';
3030 3030
         if ($addempty)
3031 3031
             print '<option value="0">&nbsp;</option>';
3032 3032
         foreach ($this->cache_availability as $id => $arrayavailability) {
3033 3033
             if ($selected == $id) {
3034
-                print '<option value="' . $id . '" selected>';
3034
+                print '<option value="'.$id.'" selected>';
3035 3035
             } else {
3036
-                print '<option value="' . $id . '">';
3036
+                print '<option value="'.$id.'">';
3037 3037
             }
3038 3038
             print $arrayavailability['label'];
3039 3039
             print '</option>';
@@ -3054,10 +3054,10 @@  discard block
 block discarded – undo
3054 3054
 
3055 3055
         $num = count($this->cache_demand_reason);
3056 3056
         if ($num > 0)
3057
-            return 0;    // Cache already loaded
3057
+            return 0; // Cache already loaded
3058 3058
 
3059 3059
         $sql = "SELECT rowid, code, label";
3060
-        $sql .= " FROM " . MAIN_DB_PREFIX . 'c_input_reason';
3060
+        $sql .= " FROM ".MAIN_DB_PREFIX.'c_input_reason';
3061 3061
         $sql .= " WHERE active > 0";
3062 3062
 
3063 3063
         $resql = $this->db->query($sql);
@@ -3070,10 +3070,10 @@  discard block
 block discarded – undo
3070 3070
 
3071 3071
                 // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
3072 3072
                 $label = ($obj->label != '-' ? $obj->label : '');
3073
-                if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code))
3074
-                    $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
3073
+                if ($langs->trans("DemandReasonType".$obj->code) != ("DemandReasonType".$obj->code))
3074
+                    $label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
3075 3075
                 if ($langs->trans($obj->code) != $obj->code)
3076
-                    $label = $langs->trans($obj->code);                // So translation key SRC_XXX will work
3076
+                    $label = $langs->trans($obj->code); // So translation key SRC_XXX will work
3077 3077
 
3078 3078
                 $tmparray[$obj->rowid]['id'] = $obj->rowid;
3079 3079
                 $tmparray[$obj->rowid]['code'] = $obj->code;
@@ -3108,17 +3108,17 @@  discard block
 block discarded – undo
3108 3108
 
3109 3109
         $this->loadCacheInputReason();
3110 3110
 
3111
-        print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
3111
+        print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
3112 3112
         if ($addempty)
3113
-            print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
3113
+            print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
3114 3114
         foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
3115 3115
             if ($arraydemandreason['code'] == $exclude)
3116 3116
                 continue;
3117 3117
 
3118 3118
             if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
3119
-                print '<option value="' . $arraydemandreason['id'] . '" selected>';
3119
+                print '<option value="'.$arraydemandreason['id'].'" selected>';
3120 3120
             } else {
3121
-                print '<option value="' . $arraydemandreason['id'] . '">';
3121
+                print '<option value="'.$arraydemandreason['id'].'">';
3122 3122
             }
3123 3123
             $label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
3124 3124
             print $langs->trans($label);
@@ -3142,15 +3142,15 @@  discard block
 block discarded – undo
3142 3142
 
3143 3143
         $num = count($this->cache_types_paiements);
3144 3144
         if ($num > 0)
3145
-            return $num;    // Cache already loaded
3145
+            return $num; // Cache already loaded
3146 3146
 
3147 3147
         dol_syslog(__METHOD__, LOG_DEBUG);
3148 3148
 
3149 3149
         $this->cache_types_paiements = array();
3150 3150
 
3151 3151
         $sql = "SELECT id, code, libelle as label, type, active";
3152
-        $sql .= " FROM " . MAIN_DB_PREFIX . "c_paiement";
3153
-        $sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
3152
+        $sql .= " FROM ".MAIN_DB_PREFIX."c_paiement";
3153
+        $sql .= " WHERE entity IN (".getEntity('c_paiement').")";
3154 3154
         //if ($active >= 0) $sql.= " AND active = ".$active;
3155 3155
 
3156 3156
         $resql = $this->db->query($sql);
@@ -3161,7 +3161,7 @@  discard block
 block discarded – undo
3161 3161
                 $obj = $this->db->fetch_object($resql);
3162 3162
 
3163 3163
                 // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
3164
-                $label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != ("PaymentTypeShort" . $obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
3164
+                $label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != ("PaymentTypeShort".$obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
3165 3165
                 $this->cache_types_paiements[$obj->id]['id'] = $obj->id;
3166 3166
                 $this->cache_types_paiements[$obj->id]['code'] = $obj->code;
3167 3167
                 $this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -3198,7 +3198,7 @@  discard block
 block discarded – undo
3198 3198
         // phpcs:enable
3199 3199
         global $langs, $user, $conf;
3200 3200
 
3201
-        dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
3201
+        dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
3202 3202
 
3203 3203
         $this->load_cache_conditions_paiements();
3204 3204
 
@@ -3206,14 +3206,14 @@  discard block
 block discarded – undo
3206 3206
         if (empty($selected) && !empty(Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID))
3207 3207
             $selected = Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID;
3208 3208
 
3209
-        print '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
3209
+        print '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
3210 3210
         if ($addempty)
3211 3211
             print '<option value="0">&nbsp;</option>';
3212 3212
         foreach ($this->cache_conditions_paiements as $id => $arrayconditions) {
3213 3213
             if ($selected == $id) {
3214
-                print '<option value="' . $id . '" selected>';
3214
+                print '<option value="'.$id.'" selected>';
3215 3215
             } else {
3216
-                print '<option value="' . $id . '">';
3216
+                print '<option value="'.$id.'">';
3217 3217
             }
3218 3218
             print $arrayconditions['label'];
3219 3219
             print '</option>';
@@ -3243,7 +3243,7 @@  discard block
 block discarded – undo
3243 3243
         // phpcs:enable
3244 3244
         global $langs, $user;
3245 3245
 
3246
-        dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
3246
+        dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
3247 3247
 
3248 3248
         $filterarray = array();
3249 3249
         if ($filtertype == 'CRDT')
@@ -3255,7 +3255,7 @@  discard block
 block discarded – undo
3255 3255
 
3256 3256
         $this->load_cache_types_paiements();
3257 3257
 
3258
-        print '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
3258
+        print '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
3259 3259
         if ($empty)
3260 3260
             print '<option value="">&nbsp;</option>';
3261 3261
         foreach ($this->cache_types_paiements as $id => $arraytypes) {
@@ -3272,13 +3272,13 @@  discard block
 block discarded – undo
3272 3272
                 continue;
3273 3273
 
3274 3274
             if ($format == 0)
3275
-                print '<option value="' . $id . '"';
3275
+                print '<option value="'.$id.'"';
3276 3276
             elseif ($format == 1)
3277
-                print '<option value="' . $arraytypes['code'] . '"';
3277
+                print '<option value="'.$arraytypes['code'].'"';
3278 3278
             elseif ($format == 2)
3279
-                print '<option value="' . $arraytypes['code'] . '"';
3279
+                print '<option value="'.$arraytypes['code'].'"';
3280 3280
             elseif ($format == 3)
3281
-                print '<option value="' . $id . '"';
3281
+                print '<option value="'.$id.'"';
3282 3282
             // Si selected est text, on compare avec code, sinon avec id
3283 3283
             if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code'])
3284 3284
                 print ' selected';
@@ -3314,16 +3314,16 @@  discard block
 block discarded – undo
3314 3314
 
3315 3315
         $return = '';
3316 3316
 
3317
-        $return .= '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
3317
+        $return .= '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
3318 3318
         $options = array(
3319 3319
             'HT' => $langs->trans("HT"),
3320 3320
             'TTC' => $langs->trans("TTC")
3321 3321
         );
3322 3322
         foreach ($options as $id => $value) {
3323 3323
             if ($selected == $id) {
3324
-                $return .= '<option value="' . $id . '" selected>' . $value;
3324
+                $return .= '<option value="'.$id.'" selected>'.$value;
3325 3325
             } else {
3326
-                $return .= '<option value="' . $id . '">' . $value;
3326
+                $return .= '<option value="'.$id.'">'.$value;
3327 3327
             }
3328 3328
             $return .= '</option>';
3329 3329
         }
@@ -3350,30 +3350,30 @@  discard block
 block discarded – undo
3350 3350
         $langs->load("deliveries");
3351 3351
 
3352 3352
         $sql = "SELECT rowid, code, libelle as label";
3353
-        $sql .= " FROM " . MAIN_DB_PREFIX . "c_shipment_mode";
3353
+        $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode";
3354 3354
         $sql .= " WHERE active > 0";
3355 3355
         if ($filtre)
3356
-            $sql .= " AND " . $filtre;
3356
+            $sql .= " AND ".$filtre;
3357 3357
         $sql .= " ORDER BY libelle ASC";
3358 3358
 
3359
-        dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
3359
+        dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
3360 3360
         $result = $this->db->query($sql);
3361 3361
         if ($result) {
3362 3362
             $num = $this->db->num_rows($result);
3363 3363
             $i = 0;
3364 3364
             if ($num) {
3365
-                print '<select id="select' . $htmlname . '" class="flat selectshippingmethod" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
3365
+                print '<select id="select'.$htmlname.'" class="flat selectshippingmethod" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
3366 3366
                 if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
3367 3367
                     print '<option value="-1">&nbsp;</option>';
3368 3368
                 }
3369 3369
                 while ($i < $num) {
3370 3370
                     $obj = $this->db->fetch_object($result);
3371 3371
                     if ($selected == $obj->rowid) {
3372
-                        print '<option value="' . $obj->rowid . '" selected>';
3372
+                        print '<option value="'.$obj->rowid.'" selected>';
3373 3373
                     } else {
3374
-                        print '<option value="' . $obj->rowid . '">';
3374
+                        print '<option value="'.$obj->rowid.'">';
3375 3375
                     }
3376
-                    print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
3376
+                    print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
3377 3377
                     print '</option>';
3378 3378
                     $i++;
3379 3379
                 }
@@ -3404,16 +3404,16 @@  discard block
 block discarded – undo
3404 3404
         $langs->load("deliveries");
3405 3405
 
3406 3406
         if ($htmlname != "none") {
3407
-            print '<form method="POST" action="' . $page . '">';
3407
+            print '<form method="POST" action="'.$page.'">';
3408 3408
             print '<input type="hidden" name="action" value="setshippingmethod">';
3409
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
3409
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
3410 3410
             $this->selectShippingMethod($selected, $htmlname, '', $addempty);
3411
-            print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
3411
+            print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
3412 3412
             print '</form>';
3413 3413
         } else {
3414 3414
             if ($selected) {
3415 3415
                 $code = $langs->getLabelFromKey($db, $selected, 'c_shipment_mode', 'rowid', 'code');
3416
-                print $langs->trans("SendingMethod" . strtoupper($code));
3416
+                print $langs->trans("SendingMethod".strtoupper($code));
3417 3417
             } else {
3418 3418
                 print "&nbsp;";
3419 3419
             }
@@ -3435,7 +3435,7 @@  discard block
 block discarded – undo
3435 3435
         $langs->load('bills');
3436 3436
 
3437 3437
         $opt = '<option value ="" selected></option>';
3438
-        $sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_counter>=1';
3438
+        $sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM '.MAIN_DB_PREFIX.'facture WHERE situation_counter>=1';
3439 3439
         $sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
3440 3440
         $resql = $this->db->query($sql);
3441 3441
         if ($resql && $this->db->num_rows($resql) > 0) {
@@ -3453,9 +3453,9 @@  discard block
 block discarded – undo
3453 3453
                             //Not prov?
3454 3454
                             if (substr($obj->ref, 1, 4) != 'PROV') {
3455 3455
                                 if ($selected == $obj->rowid) {
3456
-                                    $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
3456
+                                    $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
3457 3457
                                 } else {
3458
-                                    $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
3458
+                                    $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
3459 3459
                                 }
3460 3460
                             }
3461 3461
                         }
@@ -3463,10 +3463,10 @@  discard block
 block discarded – undo
3463 3463
                 }
3464 3464
             }
3465 3465
         } else {
3466
-            dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
3466
+            dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
3467 3467
         }
3468 3468
         if ($opt == '<option value ="" selected></option>') {
3469
-            $opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
3469
+            $opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
3470 3470
         }
3471 3471
         return $opt;
3472 3472
     }
@@ -3485,9 +3485,9 @@  discard block
 block discarded – undo
3485 3485
 
3486 3486
         $langs->load('products');
3487 3487
 
3488
-        $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
3488
+        $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
3489 3489
 
3490
-        $sql = 'SELECT rowid, label, code from ' . MAIN_DB_PREFIX . 'c_units';
3490
+        $sql = 'SELECT rowid, label, code from '.MAIN_DB_PREFIX.'c_units';
3491 3491
         $sql .= ' WHERE active > 0';
3492 3492
 
3493 3493
         $resql = $this->db->query($sql);
@@ -3497,14 +3497,14 @@  discard block
 block discarded – undo
3497 3497
 
3498 3498
             while ($res = $this->db->fetch_object($resql)) {
3499 3499
                 $unitLabel = $res->label;
3500
-                if (!empty($langs->tab_translate['unit' . $res->code])) { // check if Translation is available before
3501
-                    $unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
3500
+                if (!empty($langs->tab_translate['unit'.$res->code])) { // check if Translation is available before
3501
+                    $unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
3502 3502
                 }
3503 3503
 
3504 3504
                 if ($selected == $res->rowid) {
3505
-                    $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
3505
+                    $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
3506 3506
                 } else {
3507
-                    $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
3507
+                    $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
3508 3508
                 }
3509 3509
             }
3510 3510
             $return .= '</select>';
@@ -3534,21 +3534,21 @@  discard block
 block discarded – undo
3534 3534
         $num = 0;
3535 3535
 
3536 3536
         $sql = "SELECT rowid, label, bank, clos as status, currency_code";
3537
-        $sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
3538
-        $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
3537
+        $sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
3538
+        $sql .= " WHERE entity IN (".getEntity('bank_account').")";
3539 3539
         if ($statut != 2)
3540
-            $sql .= " AND clos = '" . $statut . "'";
3540
+            $sql .= " AND clos = '".$statut."'";
3541 3541
         if ($filtre)
3542
-            $sql .= " AND " . $filtre;
3542
+            $sql .= " AND ".$filtre;
3543 3543
         $sql .= " ORDER BY label";
3544 3544
 
3545
-        dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
3545
+        dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
3546 3546
         $result = $this->db->query($sql);
3547 3547
         if ($result) {
3548 3548
             $num = $this->db->num_rows($result);
3549 3549
             $i = 0;
3550 3550
             if ($num) {
3551
-                print '<select id="select' . $htmlname . '" class="flat selectbankaccount" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
3551
+                print '<select id="select'.$htmlname.'" class="flat selectbankaccount" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
3552 3552
                 if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
3553 3553
                     print '<option value="-1">&nbsp;</option>';
3554 3554
                 }
@@ -3556,15 +3556,15 @@  discard block
 block discarded – undo
3556 3556
                 while ($i < $num) {
3557 3557
                     $obj = $this->db->fetch_object($result);
3558 3558
                     if ($selected == $obj->rowid) {
3559
-                        print '<option value="' . $obj->rowid . '" selected>';
3559
+                        print '<option value="'.$obj->rowid.'" selected>';
3560 3560
                     } else {
3561
-                        print '<option value="' . $obj->rowid . '">';
3561
+                        print '<option value="'.$obj->rowid.'">';
3562 3562
                     }
3563 3563
                     print trim($obj->label);
3564 3564
                     if ($showcurrency)
3565
-                        print ' (' . $obj->currency_code . ')';
3565
+                        print ' ('.$obj->currency_code.')';
3566 3566
                     if ($statut == 2 && $obj->status == 1)
3567
-                        print ' (' . $langs->trans("Closed") . ')';
3567
+                        print ' ('.$langs->trans("Closed").')';
3568 3568
                     print '</option>';
3569 3569
                     $i++;
3570 3570
                 }
@@ -3572,9 +3572,9 @@  discard block
 block discarded – undo
3572 3572
             }
3573 3573
             else {
3574 3574
                 if ($statut == 0)
3575
-                    print '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
3575
+                    print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
3576 3576
                 else
3577
-                    print '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>';
3577
+                    print '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
3578 3578
             }
3579 3579
         }
3580 3580
         else {
@@ -3597,19 +3597,19 @@  discard block
 block discarded – undo
3597 3597
     {
3598 3598
         global $langs;
3599 3599
         if ($htmlname != "none") {
3600
-            print '<form method="POST" action="' . $page . '">';
3600
+            print '<form method="POST" action="'.$page.'">';
3601 3601
             print '<input type="hidden" name="action" value="setbankaccount">';
3602
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
3602
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
3603 3603
             $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
3604 3604
             if ($nbaccountfound > 0)
3605
-                print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
3605
+                print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
3606 3606
             print '</form>';
3607 3607
         } else {
3608 3608
 
3609 3609
             $langs->load('banks');
3610 3610
 
3611 3611
             if ($selected) {
3612
-                require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
3612
+                require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
3613 3613
                 $bankstatic = new Account($this->db);
3614 3614
                 $result = $bankstatic->fetch($selected);
3615 3615
                 if ($result)
@@ -3639,19 +3639,19 @@  discard block
 block discarded – undo
3639 3639
         global $conf, $langs;
3640 3640
         $langs->load("categories");
3641 3641
 
3642
-        include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
3642
+        include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
3643 3643
 
3644 3644
         // For backward compatibility
3645 3645
         if (is_numeric($type)) {
3646
-            dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
3646
+            dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
3647 3647
         }
3648 3648
 
3649 3649
         if ($type === Categorie::TYPE_BANK_LINE) {
3650 3650
             // TODO Move this into common category feature
3651 3651
             $categids = array();
3652 3652
             $sql = "SELECT c.label, c.rowid";
3653
-            $sql .= " FROM " . MAIN_DB_PREFIX . "bank_categ as c";
3654
-            $sql .= " WHERE entity = " . Globals::$conf->entity;
3653
+            $sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as c";
3654
+            $sql .= " WHERE entity = ".Globals::$conf->entity;
3655 3655
             $sql .= " ORDER BY c.label";
3656 3656
             $result = $this->db->query($sql);
3657 3657
             if ($result) {
@@ -3672,11 +3672,11 @@  discard block
 block discarded – undo
3672 3672
             $cate_arbo = $cat->get_full_arbo($type, $excludeafterid);
3673 3673
         }
3674 3674
 
3675
-        $output = '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">';
3675
+        $output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
3676 3676
         $outarray = array();
3677 3677
         if (is_array($cate_arbo)) {
3678 3678
             if (!count($cate_arbo))
3679
-                $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
3679
+                $output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
3680 3680
             else {
3681 3681
                 $output .= '<option value="-1">&nbsp;</option>';
3682 3682
                 foreach ($cate_arbo as $key => $value) {
@@ -3685,7 +3685,7 @@  discard block
 block discarded – undo
3685 3685
                     } else {
3686 3686
                         $add = '';
3687 3687
                     }
3688
-                    $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '">' . dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle') . '</option>';
3688
+                    $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'">'.dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle').'</option>';
3689 3689
 
3690 3690
                     $outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
3691 3691
                 }
@@ -3719,7 +3719,7 @@  discard block
 block discarded – undo
3719 3719
     function form_confirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
3720 3720
     {
3721 3721
         // phpcs:enable
3722
-        dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
3722
+        dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
3723 3723
         print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
3724 3724
     }
3725 3725
 
@@ -3767,36 +3767,36 @@  discard block
 block discarded – undo
3767 3767
             foreach ($formquestion as $key => $input) {
3768 3768
                 if (is_array($input) && !empty($input)) {
3769 3769
                     if ($input['type'] == 'hidden') {
3770
-                        $more .= '<input type="hidden" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . AlDolUtils::dol_escape_htmltag($input['value']) . '">' . "\n";
3770
+                        $more .= '<input type="hidden" id="'.$input['name'].'" name="'.$input['name'].'" value="'.AlDolUtils::dol_escape_htmltag($input['value']).'">'."\n";
3771 3771
                     }
3772 3772
                 }
3773 3773
             }
3774 3774
 
3775 3775
             // Now add questions
3776
-            $more .= '<table class="paddingtopbottomonly" width="100%">' . "\n";
3776
+            $more .= '<table class="paddingtopbottomonly" width="100%">'."\n";
3777 3777
             if (!empty($formquestion['text']))
3778
-                $more .= '<tr><td colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
3778
+                $more .= '<tr><td colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
3779 3779
             foreach ($formquestion as $key => $input) {
3780 3780
                 if (is_array($input) && !empty($input)) {
3781
-                    $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');
3782
-                    $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
3783
-                    $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
3781
+                    $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : '');
3782
+                    $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
3783
+                    $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
3784 3784
 
3785 3785
                     if ($input['type'] == 'text') {
3786
-                        $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td><td align="left"><input type="text" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $size . ' value="' . $input['value'] . '"' . $moreattr . ' /></td></tr>' . "\n";
3786
+                        $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
3787 3787
                     } elseif ($input['type'] == 'password') {
3788
-                        $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td><td align="left"><input type="password" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $size . ' value="' . $input['value'] . '"' . $moreattr . ' /></td></tr>' . "\n";
3788
+                        $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td><td align="left"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
3789 3789
                     } elseif ($input['type'] == 'select') {
3790
-                        $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>';
3790
+                        $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>';
3791 3791
                         if (!empty($input['label']))
3792
-                            $more .= $input['label'] . '</td><td class="tdtop" align="left">';
3792
+                            $more .= $input['label'].'</td><td class="tdtop" align="left">';
3793 3793
                         $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss);
3794
-                        $more .= '</td></tr>' . "\n";
3794
+                        $more .= '</td></tr>'."\n";
3795 3795
                     }
3796 3796
                     elseif ($input['type'] == 'checkbox') {
3797 3797
                         $more .= '<tr>';
3798
-                        $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . ' </td><td align="left">';
3799
-                        $more .= '<input type="checkbox" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $moreattr;
3798
+                        $more .= '<td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'.$input['label'].' </td><td align="left">';
3799
+                        $more .= '<input type="checkbox" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$moreattr;
3800 3800
                         if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0')
3801 3801
                             $more .= ' checked';
3802 3802
                         if (is_bool($input['value']) && $input['value'])
@@ -3804,51 +3804,51 @@  discard block
 block discarded – undo
3804 3804
                         if (isset($input['disabled']))
3805 3805
                             $more .= ' disabled';
3806 3806
                         $more .= ' /></td>';
3807
-                        $more .= '</tr>' . "\n";
3807
+                        $more .= '</tr>'."\n";
3808 3808
                     }
3809 3809
                     elseif ($input['type'] == 'radio') {
3810 3810
                         $i = 0;
3811 3811
                         foreach ($input['values'] as $selkey => $selval) {
3812 3812
                             $more .= '<tr>';
3813 3813
                             if ($i == 0)
3814
-                                $more .= '<td' . (empty($input['tdclass']) ? ' class="tdtop"' : (' class="tdtop ' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>';
3814
+                                $more .= '<td'.(empty($input['tdclass']) ? ' class="tdtop"' : (' class="tdtop '.$input['tdclass'].'"')).'>'.$input['label'].'</td>';
3815 3815
                             else
3816
-                                $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>&nbsp;</td>';
3817
-                            $more .= '<td><input type="radio" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . $selkey . '"' . $moreattr;
3816
+                                $more .= '<td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>&nbsp;</td>';
3817
+                            $more .= '<td><input type="radio" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"'.$moreattr;
3818 3818
                             if ($input['disabled'])
3819 3819
                                 $more .= ' disabled';
3820 3820
                             $more .= ' /> ';
3821 3821
                             $more .= $selval;
3822
-                            $more .= '</td></tr>' . "\n";
3822
+                            $more .= '</td></tr>'."\n";
3823 3823
                             $i++;
3824 3824
                         }
3825 3825
                     }
3826 3826
                     elseif ($input['type'] == 'date') {
3827
-                        $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>';
3827
+                        $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>'.$input['label'].'</td>';
3828 3828
                         $more .= '<td align="left">';
3829 3829
                         $more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, 0);
3830
-                        $more .= '</td></tr>' . "\n";
3831
-                        $formquestion[] = array('name' => $input['name'] . 'day');
3832
-                        $formquestion[] = array('name' => $input['name'] . 'month');
3833
-                        $formquestion[] = array('name' => $input['name'] . 'year');
3834
-                        $formquestion[] = array('name' => $input['name'] . 'hour');
3835
-                        $formquestion[] = array('name' => $input['name'] . 'min');
3830
+                        $more .= '</td></tr>'."\n";
3831
+                        $formquestion[] = array('name' => $input['name'].'day');
3832
+                        $formquestion[] = array('name' => $input['name'].'month');
3833
+                        $formquestion[] = array('name' => $input['name'].'year');
3834
+                        $formquestion[] = array('name' => $input['name'].'hour');
3835
+                        $formquestion[] = array('name' => $input['name'].'min');
3836 3836
                     } elseif ($input['type'] == 'other') {
3837
-                        $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>';
3837
+                        $more .= '<tr><td'.(empty($input['tdclass']) ? '' : (' class="'.$input['tdclass'].'"')).'>';
3838 3838
                         if (!empty($input['label']))
3839
-                            $more .= $input['label'] . '</td><td align="left">';
3839
+                            $more .= $input['label'].'</td><td align="left">';
3840 3840
                         $more .= $input['value'];
3841
-                        $more .= '</td></tr>' . "\n";
3841
+                        $more .= '</td></tr>'."\n";
3842 3842
                     }
3843 3843
 
3844 3844
                     elseif ($input['type'] == 'onecolumn') {
3845 3845
                         $more .= '<tr><td colspan="2" align="left">';
3846 3846
                         $more .= $input['value'];
3847
-                        $more .= '</td></tr>' . "\n";
3847
+                        $more .= '</td></tr>'."\n";
3848 3848
                     }
3849 3849
                 }
3850 3850
             }
3851
-            $more .= '</table>' . "\n";
3851
+            $more .= '</table>'."\n";
3852 3852
         }
3853 3853
 
3854 3854
         // JQUI method dialog is broken with jmobile, we use standard HTML.
@@ -3867,10 +3867,10 @@  discard block
 block discarded – undo
3867 3867
                 $button = $useajax;
3868 3868
                 $useajax = 1;
3869 3869
                 $autoOpen = false;
3870
-                $dialogconfirm .= '-' . $button;
3870
+                $dialogconfirm .= '-'.$button;
3871 3871
             }
3872
-            $pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . $action . '&confirm=yes';
3873
-            $pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'confirm=no' : '');
3872
+            $pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.$action.'&confirm=yes';
3873
+            $pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'confirm=no' : '');
3874 3874
             // Add input fields into list of fields to read during submit (inputok and inputko)
3875 3875
             if (is_array($formquestion)) {
3876 3876
                 foreach ($formquestion as $key => $input) {
@@ -3882,20 +3882,20 @@  discard block
 block discarded – undo
3882 3882
                 }
3883 3883
             }
3884 3884
             // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template
3885
-            $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . AlDolUtils::dol_escape_htmltag($title) . '" style="display: none;">';
3885
+            $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.AlDolUtils::dol_escape_htmltag($title).'" style="display: none;">';
3886 3886
             if (!empty($more)) {
3887
-                $formconfirm .= '<div class="confirmquestions">' . $more . '</div>';
3887
+                $formconfirm .= '<div class="confirmquestions">'.$more.'</div>';
3888 3888
             }
3889
-            $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help('', '') . ' ' . $question . '</div>' : '');
3890
-            $formconfirm .= '</div>' . "\n";
3889
+            $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help('', '').' '.$question.'</div>' : '');
3890
+            $formconfirm .= '</div>'."\n";
3891 3891
 
3892
-            $formconfirm .= "\n<!-- begin ajax formconfirm page=" . $page . " -->\n";
3893
-            $formconfirm .= '<script type="text/javascript">' . "\n";
3892
+            $formconfirm .= "\n<!-- begin ajax formconfirm page=".$page." -->\n";
3893
+            $formconfirm .= '<script type="text/javascript">'."\n";
3894 3894
             $formconfirm .= 'jQuery(document).ready(function() {
3895 3895
             $(function() {
3896
-            	$( "#' . $dialogconfirm . '" ).dialog(
3896
+            	$( "#' . $dialogconfirm.'" ).dialog(
3897 3897
             	{
3898
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
3898
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
3899 3899
             if ($newselectedchoice == 'no') {
3900 3900
                 $formconfirm .= '
3901 3901
 						open: function() {
@@ -3904,15 +3904,15 @@  discard block
 block discarded – undo
3904 3904
             }
3905 3905
             $formconfirm .= '
3906 3906
                     resizable: false,
3907
-                    height: "' . $height . '",
3908
-                    width: "' . $width . '",
3907
+                    height: "' . $height.'",
3908
+                    width: "' . $width.'",
3909 3909
                     modal: true,
3910 3910
                     closeOnEscape: false,
3911 3911
                     buttons: {
3912
-                        "' . dol_escape_js($langs->transnoentities("Yes")) . '": function() {
3912
+                        "' . dol_escape_js($langs->transnoentities("Yes")).'": function() {
3913 3913
                         	var options="";
3914
-                        	var inputok = ' . json_encode($inputok) . ';
3915
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
3914
+                        	var inputok = ' . json_encode($inputok).';
3915
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
3916 3916
                          	if (inputok.length>0) {
3917 3917
                          		$.each(inputok, function(i, inputname) {
3918 3918
                          			var more = "";
@@ -3928,10 +3928,10 @@  discard block
 block discarded – undo
3928 3928
             				if (pageyes.length > 0) { location.href = urljump; }
3929 3929
                             $(this).dialog("close");
3930 3930
                         },
3931
-                        "' . dol_escape_js($langs->transnoentities("No")) . '": function() {
3931
+                        "' . dol_escape_js($langs->transnoentities("No")).'": function() {
3932 3932
                         	var options = "";
3933
-                         	var inputko = ' . json_encode($inputko) . ';
3934
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
3933
+                         	var inputko = ' . json_encode($inputko).';
3934
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
3935 3935
                          	if (inputko.length>0) {
3936 3936
                          		$.each(inputko, function(i, inputname) {
3937 3937
                          			var more = "";
@@ -3950,10 +3950,10 @@  discard block
 block discarded – undo
3950 3950
                 }
3951 3951
                 );
3952 3952
 
3953
-            	var button = "' . $button . '";
3953
+            	var button = "' . $button.'";
3954 3954
             	if (button.length > 0) {
3955 3955
                 	$( "#" + button ).click(function() {
3956
-                		$("#' . $dialogconfirm . '").dialog("open");
3956
+                		$("#' . $dialogconfirm.'").dialog("open");
3957 3957
         			});
3958 3958
                 }
3959 3959
             });
@@ -3961,37 +3961,37 @@  discard block
 block discarded – undo
3961 3961
             </script>';
3962 3962
             $formconfirm .= "<!-- end ajax formconfirm -->\n";
3963 3963
         } else {
3964
-            $formconfirm .= "\n<!-- begin formconfirm page=" . $page . " -->\n";
3964
+            $formconfirm .= "\n<!-- begin formconfirm page=".$page." -->\n";
3965 3965
 
3966 3966
             if (empty($disableformtag))
3967
-                $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
3967
+                $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
3968 3968
 
3969
-            $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
3969
+            $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
3970 3970
             if (empty($disableformtag))
3971
-                $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
3971
+                $formconfirm .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
3972 3972
 
3973
-            $formconfirm .= '<table width="100%" class="valid">' . "\n";
3973
+            $formconfirm .= '<table width="100%" class="valid">'."\n";
3974 3974
 
3975 3975
             // Line title
3976
-            $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">' . img_picto('', 'recent') . ' ' . $title . '</td></tr>' . "\n";
3976
+            $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('', 'recent').' '.$title.'</td></tr>'."\n";
3977 3977
 
3978 3978
             // Line form fields
3979 3979
             if ($more) {
3980
-                $formconfirm .= '<tr class="valid"><td class="valid" colspan="3">' . "\n";
3980
+                $formconfirm .= '<tr class="valid"><td class="valid" colspan="3">'."\n";
3981 3981
                 $formconfirm .= $more;
3982
-                $formconfirm .= '</td></tr>' . "\n";
3982
+                $formconfirm .= '</td></tr>'."\n";
3983 3983
             }
3984 3984
 
3985 3985
             // Line with question
3986 3986
             $formconfirm .= '<tr class="valid">';
3987
-            $formconfirm .= '<td class="valid">' . $question . '</td>';
3987
+            $formconfirm .= '<td class="valid">'.$question.'</td>';
3988 3988
             $formconfirm .= '<td class="valid">';
3989 3989
             $formconfirm .= $this->selectyesno("confirm", $newselectedchoice);
3990 3990
             $formconfirm .= '</td>';
3991
-            $formconfirm .= '<td class="valid" align="center"><input class="button valignmiddle" type="submit" value="' . $langs->trans("Validate") . '"></td>';
3992
-            $formconfirm .= '</tr>' . "\n";
3991
+            $formconfirm .= '<td class="valid" align="center"><input class="button valignmiddle" type="submit" value="'.$langs->trans("Validate").'"></td>';
3992
+            $formconfirm .= '</tr>'."\n";
3993 3993
 
3994
-            $formconfirm .= '</table>' . "\n";
3994
+            $formconfirm .= '</table>'."\n";
3995 3995
 
3996 3996
             if (empty($disableformtag))
3997 3997
                 $formconfirm .= "</form>\n";
@@ -4022,8 +4022,8 @@  discard block
 block discarded – undo
4022 4022
         // phpcs:enable
4023 4023
         global $langs;
4024 4024
 
4025
-        require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
4026
-        require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
4025
+        require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
4026
+        require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
4027 4027
 
4028 4028
         $out = '';
4029 4029
 
@@ -4032,11 +4032,11 @@  discard block
 block discarded – undo
4032 4032
         $langs->load("project");
4033 4033
         if ($htmlname != "none") {
4034 4034
             $out .= "\n";
4035
-            $out .= '<form method="post" action="' . $page . '">';
4035
+            $out .= '<form method="post" action="'.$page.'">';
4036 4036
             $out .= '<input type="hidden" name="action" value="classin">';
4037
-            $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4037
+            $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4038 4038
             $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1);
4039
-            $out .= '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
4039
+            $out .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
4040 4040
             $out .= '</form>';
4041 4041
         } else {
4042 4042
             if ($selected) {
@@ -4071,11 +4071,11 @@  discard block
 block discarded – undo
4071 4071
         // phpcs:enable
4072 4072
         global $langs;
4073 4073
         if ($htmlname != "none") {
4074
-            print '<form method="post" action="' . $page . '">';
4074
+            print '<form method="post" action="'.$page.'">';
4075 4075
             print '<input type="hidden" name="action" value="setconditions">';
4076
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4076
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4077 4077
             $this->select_conditions_paiements($selected, $htmlname, -1, $addempty);
4078
-            print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4078
+            print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4079 4079
             print '</form>';
4080 4080
         } else {
4081 4081
             if ($selected) {
@@ -4102,11 +4102,11 @@  discard block
 block discarded – undo
4102 4102
         // phpcs:enable
4103 4103
         global $langs;
4104 4104
         if ($htmlname != "none") {
4105
-            print '<form method="post" action="' . $page . '">';
4105
+            print '<form method="post" action="'.$page.'">';
4106 4106
             print '<input type="hidden" name="action" value="setavailability">';
4107
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4107
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4108 4108
             $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);
4109
-            print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
4109
+            print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
4110 4110
             print '</form>';
4111 4111
         } else {
4112 4112
             if ($selected) {
@@ -4132,11 +4132,11 @@  discard block
 block discarded – undo
4132 4132
     {
4133 4133
         global $langs;
4134 4134
         if ($htmlname != "none") {
4135
-            print '<form method="post" action="' . $page . '">';
4135
+            print '<form method="post" action="'.$page.'">';
4136 4136
             print '<input type="hidden" name="action" value="setdemandreason">';
4137
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4137
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4138 4138
             $this->selectInputReason($selected, $htmlname, -1, $addempty);
4139
-            print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
4139
+            print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
4140 4140
             print '</form>';
4141 4141
         } else {
4142 4142
             if ($selected) {
@@ -4174,14 +4174,14 @@  discard block
 block discarded – undo
4174 4174
         $ret = '';
4175 4175
 
4176 4176
         if ($htmlname != "none") {
4177
-            $ret .= '<form method="post" action="' . $page . '" name="form' . $htmlname . '">';
4178
-            $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
4179
-            $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4177
+            $ret .= '<form method="post" action="'.$page.'" name="form'.$htmlname.'">';
4178
+            $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
4179
+            $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4180 4180
             $ret .= '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
4181 4181
             $ret .= '<tr><td>';
4182
-            $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
4182
+            $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
4183 4183
             $ret .= '</td>';
4184
-            $ret .= '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>';
4184
+            $ret .= '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
4185 4185
             $ret .= '</tr></table></form>';
4186 4186
         } else {
4187 4187
             if ($displayhour)
@@ -4212,15 +4212,15 @@  discard block
 block discarded – undo
4212 4212
         global $langs;
4213 4213
 
4214 4214
         if ($htmlname != "none") {
4215
-            print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
4216
-            print '<input type="hidden" name="action" value="set' . $htmlname . '">';
4217
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4215
+            print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
4216
+            print '<input type="hidden" name="action" value="set'.$htmlname.'">';
4217
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4218 4218
             print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
4219
-            print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4219
+            print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4220 4220
             print '</form>';
4221 4221
         } else {
4222 4222
             if ($selected) {
4223
-                require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
4223
+                require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
4224 4224
                 $theuser = new User($this->db);
4225 4225
                 $theuser->fetch($selected);
4226 4226
                 print $theuser->getNomUrl(1);
@@ -4246,11 +4246,11 @@  discard block
 block discarded – undo
4246 4246
         // phpcs:enable
4247 4247
         global $langs;
4248 4248
         if ($htmlname != "none") {
4249
-            print '<form method="POST" action="' . $page . '">';
4249
+            print '<form method="POST" action="'.$page.'">';
4250 4250
             print '<input type="hidden" name="action" value="setmode">';
4251
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4251
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4252 4252
             $this->select_types_paiements($selected, $htmlname, $filtertype, 0, 0, 0, 0, $active);
4253
-            print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4253
+            print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4254 4254
             print '</form>';
4255 4255
         } else {
4256 4256
             if ($selected) {
@@ -4276,11 +4276,11 @@  discard block
 block discarded – undo
4276 4276
         // phpcs:enable
4277 4277
         global $langs;
4278 4278
         if ($htmlname != "none") {
4279
-            print '<form method="POST" action="' . $page . '">';
4279
+            print '<form method="POST" action="'.$page.'">';
4280 4280
             print '<input type="hidden" name="action" value="setmulticurrencycode">';
4281
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4281
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4282 4282
             print $this->selectMultiCurrency($selected, $htmlname, 0);
4283
-            print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4283
+            print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4284 4284
             print '</form>';
4285 4285
         } else {
4286 4286
             dol_include_once('/core/lib/company.lib.php');
@@ -4304,21 +4304,21 @@  discard block
 block discarded – undo
4304 4304
         global $langs, $mysoc, $conf;
4305 4305
 
4306 4306
         if ($htmlname != "none") {
4307
-            print '<form method="POST" action="' . $page . '">';
4307
+            print '<form method="POST" action="'.$page.'">';
4308 4308
             print '<input type="hidden" name="action" value="setmulticurrencyrate">';
4309
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4310
-            print '<input type="text" name="' . $htmlname . '" value="' . (!empty($rate) ? price($rate) : 1) . '" size="10" /> ';
4309
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4310
+            print '<input type="text" name="'.$htmlname.'" value="'.(!empty($rate) ? price($rate) : 1).'" size="10" /> ';
4311 4311
             print '<select name="calculation_mode">';
4312
-            print '<option value="1">' . $currency . ' > ' . Globals::$conf->currency . '</option>';
4313
-            print '<option value="2">' . Globals::$conf->currency . ' > ' . $currency . '</option>';
4312
+            print '<option value="1">'.$currency.' > '.Globals::$conf->currency.'</option>';
4313
+            print '<option value="2">'.Globals::$conf->currency.' > '.$currency.'</option>';
4314 4314
             print '</select> ';
4315
-            print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4315
+            print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4316 4316
             print '</form>';
4317 4317
         } else {
4318 4318
             if (!empty($rate)) {
4319 4319
                 print price($rate, 1, $langs, 1, 0);
4320 4320
                 if ($currency && $rate != 1)
4321
-                    print ' &nbsp; (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . Globals::$conf->currency . ')';
4321
+                    print ' &nbsp; ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.Globals::$conf->currency.')';
4322 4322
             }
4323 4323
             else {
4324 4324
                 print 1;
@@ -4347,14 +4347,14 @@  discard block
 block discarded – undo
4347 4347
         // phpcs:enable
4348 4348
         global $conf, $langs;
4349 4349
         if ($htmlname != "none") {
4350
-            print '<form method="post" action="' . $page . '">';
4350
+            print '<form method="post" action="'.$page.'">';
4351 4351
             print '<input type="hidden" name="action" value="setabsolutediscount">';
4352
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4352
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4353 4353
             print '<div class="inline-block">';
4354 4354
             if (!empty($discount_type)) {
4355 4355
                 if (!empty(Globals::$conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
4356 4356
                     if (!$filter || $filter == "fk_invoice_supplier_source IS NULL")
4357
-                        $translationKey = 'HasAbsoluteDiscountFromSupplier';    // If we want deposit to be substracted to payments only and not to total of final invoice
4357
+                        $translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice
4358 4358
                     else
4359 4359
                         $translationKey = 'HasCreditNoteFromSupplier';
4360 4360
                 }
@@ -4367,7 +4367,7 @@  discard block
 block discarded – undo
4367 4367
             } else {
4368 4368
                 if (!empty(Globals::$conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
4369 4369
                     if (!$filter || $filter == "fk_facture_source IS NULL")
4370
-                        $translationKey = 'CompanyHasAbsoluteDiscount';    // If we want deposit to be substracted to payments only and not to total of final invoice
4370
+                        $translationKey = 'CompanyHasAbsoluteDiscount'; // If we want deposit to be substracted to payments only and not to total of final invoice
4371 4371
                     else
4372 4372
                         $translationKey = 'CompanyHasCreditNote';
4373 4373
                 }
@@ -4384,21 +4384,21 @@  discard block
 block discarded – undo
4384 4384
             print '</div>';
4385 4385
             if (empty($hidelist)) {
4386 4386
                 print '<div class="inline-block" style="padding-right: 10px">';
4387
-                $newfilter = 'discount_type=' . intval($discount_type);
4387
+                $newfilter = 'discount_type='.intval($discount_type);
4388 4388
                 if (!empty($discount_type)) {
4389 4389
                     $newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
4390 4390
                 } else {
4391 4391
                     $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
4392 4392
                 }
4393 4393
                 if ($filter)
4394
-                    $newfilter .= ' AND (' . $filter . ')';
4394
+                    $newfilter .= ' AND ('.$filter.')';
4395 4395
                 $nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);
4396 4396
                 if ($nbqualifiedlines > 0) {
4397
-                    print ' &nbsp; <input type="submit" class="button" value="' . AlDolUtils::dol_escape_htmltag($langs->trans("UseLine")) . '"';
4397
+                    print ' &nbsp; <input type="submit" class="button" value="'.AlDolUtils::dol_escape_htmltag($langs->trans("UseLine")).'"';
4398 4398
                     if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')")
4399
-                        print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
4399
+                        print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
4400 4400
                     if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')")
4401
-                        print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
4401
+                        print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
4402 4402
 
4403 4403
                     print '>';
4404 4404
                 }
@@ -4435,22 +4435,22 @@  discard block
 block discarded – undo
4435 4435
         global $langs, $conf;
4436 4436
 
4437 4437
         if ($htmlname != "none") {
4438
-            print '<form method="post" action="' . $page . '">';
4438
+            print '<form method="post" action="'.$page.'">';
4439 4439
             print '<input type="hidden" name="action" value="set_contact">';
4440
-            print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4440
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4441 4441
             print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
4442 4442
             print '<tr><td>';
4443 4443
             $num = $this->select_contacts($societe->id, $selected, $htmlname);
4444 4444
             if ($num == 0) {
4445 4445
                 $addcontact = (!empty(Globals::$conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
4446
-                print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
4446
+                print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$addcontact.'</a>';
4447 4447
             }
4448 4448
             print '</td>';
4449
-            print '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>';
4449
+            print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
4450 4450
             print '</tr></table></form>';
4451 4451
         } else {
4452 4452
             if ($selected) {
4453
-                require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
4453
+                require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
4454 4454
                 $contact = new Contact($this->db);
4455 4455
                 $contact->fetch($selected);
4456 4456
                 print $contact->getFullName($langs);
@@ -4482,15 +4482,15 @@  discard block
 block discarded – undo
4482 4482
 
4483 4483
         $out = '';
4484 4484
         if ($htmlname != "none") {
4485
-            $out .= '<form method="post" action="' . $page . '">';
4485
+            $out .= '<form method="post" action="'.$page.'">';
4486 4486
             $out .= '<input type="hidden" name="action" value="set_thirdparty">';
4487
-            $out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
4487
+            $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
4488 4488
             $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events);
4489
-            $out .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4489
+            $out .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4490 4490
             $out .= '</form>';
4491 4491
         } else {
4492 4492
             if ($selected) {
4493
-                require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
4493
+                require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
4494 4494
                 $soc = new Societe($this->db);
4495 4495
                 $soc->fetch($selected);
4496 4496
                 $out .= $soc->getNomUrl($langs);
@@ -4536,17 +4536,17 @@  discard block
 block discarded – undo
4536 4536
         $out = '';
4537 4537
 
4538 4538
         if ($selected == 'euro' || $selected == 'euros')
4539
-            $selected = 'EUR';   // Pour compatibilite
4539
+            $selected = 'EUR'; // Pour compatibilite
4540 4540
 
4541
-        $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
4541
+        $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
4542 4542
         foreach ($langs->cache_currencies as $code_iso => $currency) {
4543 4543
             if ($selected && $selected == $code_iso) {
4544
-                $out .= '<option value="' . $code_iso . '" selected>';
4544
+                $out .= '<option value="'.$code_iso.'" selected>';
4545 4545
             } else {
4546
-                $out .= '<option value="' . $code_iso . '">';
4546
+                $out .= '<option value="'.$code_iso.'">';
4547 4547
             }
4548 4548
             $out .= $currency['label'];
4549
-            $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
4549
+            $out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
4550 4550
             $out .= '</option>';
4551 4551
         }
4552 4552
         $out .= '</select>';
@@ -4554,7 +4554,7 @@  discard block
 block discarded – undo
4554 4554
             $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4555 4555
 
4556 4556
         // Make select dynamic
4557
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
4557
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
4558 4558
         $out .= ajax_combobox($htmlname);
4559 4559
 
4560 4560
         return $out;
@@ -4572,12 +4572,12 @@  discard block
 block discarded – undo
4572 4572
     {
4573 4573
         global $db, $conf, $langs, $user;
4574 4574
 
4575
-        $langs->loadCacheCurrencies('');        // Load ->cache_currencies
4575
+        $langs->loadCacheCurrencies(''); // Load ->cache_currencies
4576 4576
 
4577 4577
         $TCurrency = array();
4578 4578
 
4579
-        $sql = 'SELECT code FROM ' . MAIN_DB_PREFIX . 'multicurrency';
4580
-        $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
4579
+        $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
4580
+        $sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
4581 4581
         $resql = $db->query($sql);
4582 4582
         if ($resql) {
4583 4583
             while ($obj = $db->fetch_object($resql))
@@ -4585,7 +4585,7 @@  discard block
 block discarded – undo
4585 4585
         }
4586 4586
 
4587 4587
         $out = '';
4588
-        $out .= '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">';
4588
+        $out .= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
4589 4589
         if ($useempty)
4590 4590
             $out .= '<option value=""></option>';
4591 4591
         // If company current currency not in table, we add it into list. Should always be available.
@@ -4596,12 +4596,12 @@  discard block
 block discarded – undo
4596 4596
             foreach ($langs->cache_currencies as $code_iso => $currency) {
4597 4597
                 if (isset($TCurrency[$code_iso])) {
4598 4598
                     if (!empty($selected) && $selected == $code_iso)
4599
-                        $out .= '<option value="' . $code_iso . '" selected="selected">';
4599
+                        $out .= '<option value="'.$code_iso.'" selected="selected">';
4600 4600
                     else
4601
-                        $out .= '<option value="' . $code_iso . '">';
4601
+                        $out .= '<option value="'.$code_iso.'">';
4602 4602
 
4603 4603
                     $out .= $currency['label'];
4604
-                    $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
4604
+                    $out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
4605 4605
                     $out .= '</option>';
4606 4606
                 }
4607 4607
             }
@@ -4609,7 +4609,7 @@  discard block
 block discarded – undo
4609 4609
 
4610 4610
         $out .= '</select>';
4611 4611
         // Make select dynamic
4612
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
4612
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
4613 4613
         $out .= ajax_combobox($htmlname);
4614 4614
 
4615 4615
         return $out;
@@ -4629,15 +4629,15 @@  discard block
 block discarded – undo
4629 4629
 
4630 4630
         $num = count($this->cache_vatrates);
4631 4631
         if ($num > 0)
4632
-            return $num;    // Cache already loaded
4632
+            return $num; // Cache already loaded
4633 4633
 
4634 4634
         dol_syslog(__METHOD__, LOG_DEBUG);
4635 4635
 
4636 4636
         $sql = "SELECT DISTINCT t.rowid, t.code, t.taux, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.recuperableonly";
4637
-        $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c";
4637
+        $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
4638 4638
         $sql .= " WHERE t.fk_pays = c.rowid";
4639 4639
         $sql .= " AND t.active > 0";
4640
-        $sql .= " AND c.code IN (" . $country_code . ")";
4640
+        $sql .= " AND c.code IN (".$country_code.")";
4641 4641
         $sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
4642 4642
 
4643 4643
         $resql = $this->db->query($sql);
@@ -4655,28 +4655,28 @@  discard block
 block discarded – undo
4655 4655
                     $this->cache_vatrates[$i]['localtax2'] = $obj->localtax2;
4656 4656
                     $this->cache_vatrates[$i]['localtax2_type'] = $obj->localtax1_type;
4657 4657
 
4658
-                    $this->cache_vatrates[$i]['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : '');   // Label must contains only 0-9 , . % or *
4659
-                    $this->cache_vatrates[$i]['labelallrates'] = $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
4658
+                    $this->cache_vatrates[$i]['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
4659
+                    $this->cache_vatrates[$i]['labelallrates'] = $obj->taux.'/'.($obj->localtax1 ? $obj->localtax1 : '0').'/'.($obj->localtax2 ? $obj->localtax2 : '0').($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
4660 4660
                     $positiverates = '';
4661 4661
                     if ($obj->taux)
4662
-                        $positiverates .= ($positiverates ? '/' : '') . $obj->taux;
4662
+                        $positiverates .= ($positiverates ? '/' : '').$obj->taux;
4663 4663
                     if ($obj->localtax1)
4664
-                        $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
4664
+                        $positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
4665 4665
                     if ($obj->localtax2)
4666
-                        $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
4666
+                        $positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
4667 4667
                     if (empty($positiverates))
4668 4668
                         $positiverates = '0';
4669
-                    $this->cache_vatrates[$i]['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
4669
+                    $this->cache_vatrates[$i]['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
4670 4670
                 }
4671 4671
 
4672 4672
                 return $num;
4673 4673
             }
4674 4674
             else {
4675
-                $this->error = '<font class="error">' . $langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code) . '</font>';
4675
+                $this->error = '<font class="error">'.$langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code).'</font>';
4676 4676
                 return -1;
4677 4677
             }
4678 4678
         } else {
4679
-            $this->error = '<font class="error">' . $this->db->error() . '</font>';
4679
+            $this->error = '<font class="error">'.$this->db->error().'</font>';
4680 4680
             return -2;
4681 4681
         }
4682 4682
     }
@@ -4725,9 +4725,9 @@  discard block
 block discarded – undo
4725 4725
         // Check parameters
4726 4726
         if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
4727 4727
             if ($societe_vendeuse->id == $mysoc->id) {
4728
-                $return .= '<font class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</div>';
4728
+                $return .= '<font class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</div>';
4729 4729
             } else {
4730
-                $return .= '<font class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</div>';
4730
+                $return .= '<font class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</div>';
4731 4731
             }
4732 4732
             return $return;
4733 4733
         }
@@ -4738,32 +4738,32 @@  discard block
 block discarded – undo
4738 4738
         // Define list of countries to use to search VAT rates to show
4739 4739
         // First we defined code_country to use to find list
4740 4740
         if (is_object($societe_vendeuse)) {
4741
-            $code_country = "'" . $societe_vendeuse->country_code . "'";
4741
+            $code_country = "'".$societe_vendeuse->country_code."'";
4742 4742
         } else {
4743
-            $code_country = "'" . $mysoc->country_code . "'";   // Pour compatibilite ascendente
4743
+            $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
4744 4744
         }
4745 4745
         if (!empty(Globals::$conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) {    // If option to have vat for end customer for services is on
4746
-            require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
4746
+            require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
4747 4747
             if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) {
4748 4748
                 // We also add the buyer
4749 4749
                 if (is_numeric($type)) {
4750 4750
                     if ($type == 1) { // We know product is a service
4751
-                        $code_country .= ",'" . $societe_acheteuse->country_code . "'";
4751
+                        $code_country .= ",'".$societe_acheteuse->country_code."'";
4752 4752
                     }
4753 4753
                 } else if (!$idprod) {  // We don't know type of product
4754
-                    $code_country .= ",'" . $societe_acheteuse->country_code . "'";
4754
+                    $code_country .= ",'".$societe_acheteuse->country_code."'";
4755 4755
                 } else {
4756 4756
                     $prodstatic = new Product($this->db);
4757 4757
                     $prodstatic->fetch($idprod);
4758 4758
                     if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
4759
-                        $code_country .= ",'" . $societe_acheteuse->country_code . "'";
4759
+                        $code_country .= ",'".$societe_acheteuse->country_code."'";
4760 4760
                     }
4761 4761
                 }
4762 4762
             }
4763 4763
         }
4764 4764
 
4765 4765
         // Now we get list
4766
-        $num = $this->load_cache_vatrates($code_country);   // If no vat defined, return -1 with message into this->error
4766
+        $num = $this->load_cache_vatrates($code_country); // If no vat defined, return -1 with message into this->error
4767 4767
 
4768 4768
         if ($num > 0) {
4769 4769
             // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
@@ -4796,13 +4796,13 @@  discard block
 block discarded – undo
4796 4796
             if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") {
4797 4797
                 // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses
4798 4798
                 if (empty(Globals::$conf->global->OVERRIDE_VAT_FOR_EXPENSE_REPORT)) {
4799
-                    $title = ' title="' . $langs->trans('VATIsNotUsed') . '"';
4799
+                    $title = ' title="'.$langs->trans('VATIsNotUsed').'"';
4800 4800
                     $disabled = true;
4801 4801
                 }
4802 4802
             }
4803 4803
 
4804 4804
             if (!$options_only) {
4805
-                $return .= '<select class="flat minwidth75imp" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
4805
+                $return .= '<select class="flat minwidth75imp" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
4806 4806
             }
4807 4807
 
4808 4808
             $selectedfound = false;
@@ -4815,11 +4815,11 @@  discard block
 block discarded – undo
4815 4815
                 $key = $rate['txtva'];
4816 4816
                 $key .= $rate['nprtva'] ? '*' : '';
4817 4817
                 if ($mode > 0 && $rate['code'])
4818
-                    $key .= ' (' . $rate['code'] . ')';
4818
+                    $key .= ' ('.$rate['code'].')';
4819 4819
                 if ($mode < 0)
4820 4820
                     $key = $rate['rowid'];
4821 4821
 
4822
-                $return .= '<option value="' . $key . '"';
4822
+                $return .= '<option value="'.$key.'"';
4823 4823
                 if (!$selectedfound) {
4824 4824
                     if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
4825 4825
                         if ($defaultcode == $rate['code']) {
@@ -4839,7 +4839,7 @@  discard block
 block discarded – undo
4839 4839
                     $return .= vatrate($rate['label']);
4840 4840
                 }
4841 4841
                 //$return.=($rate['code']?' '.$rate['code']:'');
4842
-                $return .= (empty($rate['code']) && $rate['nprtva']) ? ' *' : '';         // We show the *  (old behaviour only if new vat code is not used)
4842
+                $return .= (empty($rate['code']) && $rate['nprtva']) ? ' *' : ''; // We show the *  (old behaviour only if new vat code is not used)
4843 4843
 
4844 4844
                 $return .= '</option>';
4845 4845
             }
@@ -4938,7 +4938,7 @@  discard block
 block discarded – undo
4938 4938
         $orig_set_time = $set_time;
4939 4939
 
4940 4940
         if ($set_time === '' && $emptydate == 0) {
4941
-            include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
4941
+            include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
4942 4942
             $set_time = dol_now('tzuser') - (getServerTimeZoneInt('now') * 3600); // set_time must be relative to PHP server timezone
4943 4943
         }
4944 4944
 
@@ -4991,36 +4991,36 @@  discard block
 block discarded – undo
4991 4991
                 //print "e".$set_time." t ".Globals::$conf->format_date_short;
4992 4992
                 if (strval($set_time) != '' && $set_time != -1) {
4993 4993
                     //$formated_date=DolUtils::dol_print_date($set_time,Globals::$conf->format_date_short);
4994
-                    $formated_date = AlDolUtils::dol_print_date($set_time, $langs->trans("FormatDateShortInput"));  // FormatDateShortInput for AlDolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript
4994
+                    $formated_date = AlDolUtils::dol_print_date($set_time, $langs->trans("FormatDateShortInput")); // FormatDateShortInput for AlDolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript
4995 4995
                 }
4996 4996
 
4997 4997
                 // Calendrier popup version eldy
4998 4998
                 if ($usecalendar == "eldy") {
4999 4999
                     // Zone de saisie manuelle de la date
5000
-                    $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidth75" maxlength="11" value="' . $formated_date . '"';
5000
+                    $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"';
5001 5001
                     $retstring .= ($disabled ? ' disabled' : '');
5002
-                    $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "';  // FormatDateShortInput for AlDolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript
5002
+                    $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for AlDolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript
5003 5003
                     $retstring .= '>';
5004 5004
 
5005 5005
                     // Icone calendrier
5006 5006
                     if (!$disabled) {
5007
-                        $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
5008
-                        $base = DOL_URL_ROOT . '/core/';
5009
-                        $retstring .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
5010
-                        $retstring .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
5007
+                        $retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
5008
+                        $base = DOL_URL_ROOT.'/core/';
5009
+                        $retstring .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
5010
+                        $retstring .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
5011 5011
                     } else
5012
-                        $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
5012
+                        $retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
5013 5013
 
5014
-                    $retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
5015
-                    $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
5016
-                    $retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
5014
+                    $retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
5015
+                    $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
5016
+                    $retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
5017 5017
                 }
5018 5018
                 elseif ($usecalendar == 'jquery') {
5019 5019
                     if (!$disabled) {
5020 5020
                         // Output javascript for datepicker
5021 5021
                         $retstring .= "<script type='text/javascript'>";
5022
-                        $retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
5023
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
5022
+                        $retstring .= "$(function(){ $('#".$prefix."').datepicker({
5023
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
5024 5024
 							autoclose: true,
5025 5025
 							todayHighlight: true,";
5026 5026
                         if (!empty(Globals::$conf->dol_use_jmobile)) {
@@ -5043,7 +5043,7 @@  discard block
 block discarded – undo
5043 5043
                              */
5044 5044
                             $retstring .= "
5045 5045
 								showOn: 'button',
5046
-								buttonImage: '" . DOL_BASE_URI . "/theme/" . Globals::$conf->theme . "/img/object_calendarday.png',
5046
+								buttonImage: '" . DOL_BASE_URI."/theme/".Globals::$conf->theme."/img/object_calendarday.png',
5047 5047
 								buttonImageOnly: true";
5048 5048
                         }
5049 5049
                         $retstring .= "
@@ -5053,9 +5053,9 @@  discard block
 block discarded – undo
5053 5053
 
5054 5054
                     // Zone de saisie manuelle de la date
5055 5055
                     $retstring .= '<div class="nowrap inline-block">';
5056
-                    $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidth75" maxlength="11" value="' . $formated_date . '"';
5056
+                    $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"';
5057 5057
                     $retstring .= ($disabled ? ' disabled' : '');
5058
-                    $retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "';  // FormatDateShortInput for AlDolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript
5058
+                    $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for AlDolUtils::dol_print_date / FormatDateShortJavaInput that is same for javascript
5059 5059
                     $retstring .= '>';
5060 5060
 
5061 5061
                     // Icone calendrier
@@ -5070,13 +5070,13 @@  discard block
 block discarded – undo
5070 5070
                           $retstring.='});';
5071 5071
                           $retstring.="</script>"; */
5072 5072
                     } else {
5073
-                        $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
5073
+                        $retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
5074 5074
                     }
5075 5075
 
5076 5076
                     $retstring .= '</div>';
5077
-                    $retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
5078
-                    $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
5079
-                    $retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
5077
+                    $retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
5078
+                    $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
5079
+                    $retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
5080 5080
                 } else {
5081 5081
                     $retstring .= "Bad value of MAIN_POPUP_CALENDAR";
5082 5082
                 }
@@ -5085,26 +5085,26 @@  discard block
 block discarded – undo
5085 5085
             else {
5086 5086
                 //$retstring.='<div class="inline-block">';
5087 5087
                 // Day
5088
-                $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
5088
+                $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
5089 5089
 
5090 5090
                 if ($emptydate || $set_time == -1) {
5091 5091
                     $retstring .= '<option value="0" selected>&nbsp;</option>';
5092 5092
                 }
5093 5093
 
5094 5094
                 for ($day = 1; $day <= 31; $day++) {
5095
-                    $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
5095
+                    $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
5096 5096
                 }
5097 5097
 
5098 5098
                 $retstring .= "</select>";
5099 5099
 
5100
-                $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
5100
+                $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
5101 5101
                 if ($emptydate || $set_time == -1) {
5102 5102
                     $retstring .= '<option value="0" selected>&nbsp;</option>';
5103 5103
                 }
5104 5104
 
5105 5105
                 // Month
5106 5106
                 for ($month = 1; $month <= 12; $month++) {
5107
-                    $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
5107
+                    $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
5108 5108
                     $retstring .= AlDolUtils::dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
5109 5109
                     $retstring .= "</option>";
5110 5110
                 }
@@ -5112,12 +5112,12 @@  discard block
 block discarded – undo
5112 5112
 
5113 5113
                 // Year
5114 5114
                 if ($emptydate || $set_time == -1) {
5115
-                    $retstring .= '<input' . ($disabled ? ' disabled' : '') . ' placeholder="' . AlDolUtils::dol_escape_htmltag($langs->trans("Year")) . '" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">';
5115
+                    $retstring .= '<input'.($disabled ? ' disabled' : '').' placeholder="'.AlDolUtils::dol_escape_htmltag($langs->trans("Year")).'" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">';
5116 5116
                 } else {
5117
-                    $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
5117
+                    $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
5118 5118
 
5119 5119
                     for ($year = $syear - 10; $year < $syear + 10; $year++) {
5120
-                        $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
5120
+                        $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
5121 5121
                     }
5122 5122
                     $retstring .= "</select>\n";
5123 5123
                 }
@@ -5130,13 +5130,13 @@  discard block
 block discarded – undo
5130 5130
 
5131 5131
         if ($h) {
5132 5132
             // Show hour
5133
-            $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
5133
+            $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
5134 5134
             if ($emptyhours)
5135 5135
                 $retstring .= '<option value="-1">&nbsp;</option>';
5136 5136
             for ($hour = 0; $hour < 24; $hour++) {
5137 5137
                 if (strlen($hour) < 2)
5138
-                    $hour = "0" . $hour;
5139
-                $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour . (empty(Globals::$conf->dol_optimize_smallscreen) ? '' : 'H') . '</option>';
5138
+                    $hour = "0".$hour;
5139
+                $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour.(empty(Globals::$conf->dol_optimize_smallscreen) ? '' : 'H').'</option>';
5140 5140
             }
5141 5141
             $retstring .= '</select>';
5142 5142
             if ($m && empty(Globals::$conf->dol_optimize_smallscreen))
@@ -5145,17 +5145,17 @@  discard block
 block discarded – undo
5145 5145
 
5146 5146
         if ($m) {
5147 5147
             // Show minutes
5148
-            $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
5148
+            $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
5149 5149
             if ($emptyhours)
5150 5150
                 $retstring .= '<option value="-1">&nbsp;</option>';
5151 5151
             for ($min = 0; $min < 60; $min++) {
5152 5152
                 if (strlen($min) < 2)
5153
-                    $min = "0" . $min;
5154
-                $retstring .= '<option value="' . $min . '"' . (($min == $smin) ? ' selected' : '') . '>' . $min . (empty(Globals::$conf->dol_optimize_smallscreen) ? '' : '') . '</option>';
5153
+                    $min = "0".$min;
5154
+                $retstring .= '<option value="'.$min.'"'.(($min == $smin) ? ' selected' : '').'>'.$min.(empty(Globals::$conf->dol_optimize_smallscreen) ? '' : '').'</option>';
5155 5155
             }
5156 5156
             $retstring .= '</select>';
5157 5157
 
5158
-            $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
5158
+            $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
5159 5159
         }
5160 5160
 
5161 5161
         // Add a "Now" link
@@ -5164,10 +5164,10 @@  discard block
 block discarded – undo
5164 5164
             $reset_scripts = "";
5165 5165
 
5166 5166
             // Generate the date part, depending on the use or not of the javascript calendar
5167
-            $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . AlDolUtils::dol_print_date(dol_now(), 'day') . '\');';
5168
-            $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%d') . '\');';
5169
-            $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%m') . '\');';
5170
-            $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%Y') . '\');';
5167
+            $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.AlDolUtils::dol_print_date(dol_now(), 'day').'\');';
5168
+            $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%d').'\');';
5169
+            $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%m').'\');';
5170
+            $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%Y').'\');';
5171 5171
             /* if ($usecalendar == "eldy")
5172 5172
               {
5173 5173
               $base=DOL_URL_ROOT.'/core/';
@@ -5184,7 +5184,7 @@  discard block
 block discarded – undo
5184 5184
                 if ($fullday)
5185 5185
                     $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5186 5186
                 //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
5187
-                $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%H') . '\');';
5187
+                $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%H').'\');';
5188 5188
                 if ($fullday)
5189 5189
                     $reset_scripts .= ' } ';
5190 5190
             }
@@ -5193,13 +5193,13 @@  discard block
 block discarded – undo
5193 5193
                 if ($fullday)
5194 5194
                     $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5195 5195
                 //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
5196
-                $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%M') . '\');';
5196
+                $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%M').'\');';
5197 5197
                 if ($fullday)
5198 5198
                     $reset_scripts .= ' } ';
5199 5199
             }
5200 5200
             // If reset_scripts is not empty, print the link with the reset_scripts in the onClick
5201 5201
             if ($reset_scripts && empty(Globals::$conf->dol_optimize_smallscreen)) {
5202
-                $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
5202
+                $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
5203 5203
                 $retstring .= $langs->trans("Now");
5204 5204
                 $retstring .= '</button> ';
5205 5205
             }
@@ -5211,15 +5211,15 @@  discard block
 block discarded – undo
5211 5211
             $reset_scripts = "";
5212 5212
 
5213 5213
             // Generate the date part, depending on the use or not of the javascript calendar
5214
-            $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . AlDolUtils::dol_print_date(dol_now(), 'day') . '\');';
5215
-            $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%d') . '\');';
5216
-            $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%m') . '\');';
5217
-            $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%Y') . '\');';
5214
+            $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.AlDolUtils::dol_print_date(dol_now(), 'day').'\');';
5215
+            $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%d').'\');';
5216
+            $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%m').'\');';
5217
+            $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%Y').'\');';
5218 5218
             // Update the hour part
5219 5219
             if ($h) {
5220 5220
                 if ($fullday)
5221 5221
                     $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5222
-                $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%H') . '\');';
5222
+                $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%H').'\');';
5223 5223
                 if ($fullday)
5224 5224
                     $reset_scripts .= ' } ';
5225 5225
             }
@@ -5227,13 +5227,13 @@  discard block
 block discarded – undo
5227 5227
             if ($m) {
5228 5228
                 if ($fullday)
5229 5229
                     $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5230
-                $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%M') . '\');';
5230
+                $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.AlDolUtils::dol_print_date(dol_now(), '%M').'\');';
5231 5231
                 if ($fullday)
5232 5232
                     $reset_scripts .= ' } ';
5233 5233
             }
5234 5234
             // If reset_scripts is not empty, print the link with the reset_scripts in the onClick
5235 5235
             if ($reset_scripts && empty(Globals::$conf->dol_optimize_smallscreen)) {
5236
-                $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
5236
+                $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
5237 5237
                 $retstring .= $langs->trans("DateStartPlusOne");
5238 5238
                 $retstring .= '</button> ';
5239 5239
             }
@@ -5242,7 +5242,7 @@  discard block
 block discarded – undo
5242 5242
         // Add a "Plus one hour" link
5243 5243
         if (Globals::$conf->use_javascript_ajax && $adddateof) {
5244 5244
             $tmparray = dol_getdate($adddateof);
5245
-            $retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\'' . AlDolUtils::dol_print_date($adddateof, 'day') . '\');jQuery(\'#reday\').val(\'' . $tmparray['mday'] . '\');jQuery(\'#remonth\').val(\'' . $tmparray['mon'] . '\');jQuery(\'#reyear\').val(\'' . $tmparray['year'] . '\');">' . $langs->trans("DateInvoice") . '</a>';
5245
+            $retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.AlDolUtils::dol_print_date($adddateof, 'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$langs->trans("DateInvoice").'</a>';
5246 5246
         }
5247 5247
 
5248 5248
         return $retstring;
@@ -5274,29 +5274,29 @@  discard block
 block discarded – undo
5274 5274
 
5275 5275
         // Hours
5276 5276
         if ($iSecond != '') {
5277
-            require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
5277
+            require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
5278 5278
 
5279 5279
             $hourSelected = convertSecondToTime($iSecond, 'allhour');
5280 5280
             $minSelected = convertSecondToTime($iSecond, 'min');
5281 5281
         }
5282 5282
 
5283 5283
         if ($typehour == 'select') {
5284
-            $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
5284
+            $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
5285 5285
             for ($hour = 0; $hour < 25; $hour++) { // For a duration, we allow 24 hours
5286
-                $retstring .= '<option value="' . $hour . '"';
5286
+                $retstring .= '<option value="'.$hour.'"';
5287 5287
                 if ($hourSelected == $hour) {
5288 5288
                     $retstring .= " selected";
5289 5289
                 }
5290
-                $retstring .= ">" . $hour . "</option>";
5290
+                $retstring .= ">".$hour."</option>";
5291 5291
             }
5292 5292
             $retstring .= "</select>";
5293 5293
         } elseif ($typehour == 'text' || $typehour == 'textselect') {
5294
-            $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" size="1" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
5294
+            $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" size="1" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
5295 5295
         } else
5296 5296
             return 'BadValueForParameterTypeHour';
5297 5297
 
5298 5298
         if ($typehour != 'text')
5299
-            $retstring .= ' ' . $langs->trans('HourShort');
5299
+            $retstring .= ' '.$langs->trans('HourShort');
5300 5300
         else
5301 5301
             $retstring .= '<span class="hideonsmartphone">:</span>';
5302 5302
 
@@ -5307,21 +5307,21 @@  discard block
 block discarded – undo
5307 5307
             $retstring .= '<span class="hideonsmartphone">&nbsp;</span>';
5308 5308
 
5309 5309
         if ($typehour == 'select' || $typehour == 'textselect') {
5310
-            $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
5310
+            $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
5311 5311
             for ($min = 0; $min <= 55; $min = $min + 5) {
5312
-                $retstring .= '<option value="' . $min . '"';
5312
+                $retstring .= '<option value="'.$min.'"';
5313 5313
                 if ($minSelected == $min)
5314 5314
                     $retstring .= ' selected';
5315
-                $retstring .= '>' . $min . '</option>';
5315
+                $retstring .= '>'.$min.'</option>';
5316 5316
             }
5317 5317
             $retstring .= "</select>";
5318 5318
         }
5319 5319
         elseif ($typehour == 'text') {
5320
-            $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" size="1" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
5320
+            $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" size="1" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
5321 5321
         }
5322 5322
 
5323 5323
         if ($typehour != 'text')
5324
-            $retstring .= ' ' . $langs->trans('MinuteShort');
5324
+            $retstring .= ' '.$langs->trans('MinuteShort');
5325 5325
 
5326 5326
         //$retstring.="&nbsp;";
5327 5327
 
@@ -5364,30 +5364,30 @@  discard block
 block discarded – undo
5364 5364
             }
5365 5365
         }
5366 5366
         if (!is_object($objecttmp)) {
5367
-            dol_syslog('Error bad setup of type for field ' . $InfoFieldList, LOG_WARNING);
5368
-            return 'Error bad setup of type for field ' . join(',', $InfoFieldList);
5367
+            dol_syslog('Error bad setup of type for field '.$InfoFieldList, LOG_WARNING);
5368
+            return 'Error bad setup of type for field '.join(',', $InfoFieldList);
5369 5369
         }
5370 5370
 
5371 5371
         $prefixforautocompletemode = $objecttmp->element;
5372 5372
         if ($prefixforautocompletemode == 'societe')
5373 5373
             $prefixforautocompletemode = 'company';
5374
-        $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
5374
+        $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
5375 5375
 
5376
-        dol_syslog(get_class($this) . "::selectForForms", LOG_DEBUG);
5376
+        dol_syslog(get_class($this)."::selectForForms", LOG_DEBUG);
5377 5377
 
5378 5378
         $out = '';
5379 5379
         if (!empty(Globals::$conf->use_javascript_ajax) && !empty(Globals::$conf->global->$confkeyforautocompletemode) && !$forcecombo) {
5380
-            $objectdesc = $classname . ':' . $classpath;
5381
-            $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
5380
+            $objectdesc = $classname.':'.$classpath;
5381
+            $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
5382 5382
             //if ($objecttmp->element == 'societe') $urlforajaxcall = DOL_URL_ROOT.'/societe/ajax/company.php';
5383 5383
             // No immediate load of all database
5384
-            $urloption = 'htmlname=' . $htmlname . '&outjson=1&objectdesc=' . $objectdesc . ($moreparams ? $moreparams : '');
5384
+            $urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.($moreparams ? $moreparams : '');
5385 5385
             // Activate the auto complete using ajax call.
5386 5386
             $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, Globals::$conf->global->$confkeyforautocompletemode, 0, array());
5387 5387
             $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
5388 5388
             if ($placeholder)
5389
-                $placeholder = ' placeholder="' . $placeholder . '"';
5390
-            $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $preselectedvalue . '"' . $placeholder . ' />';
5389
+                $placeholder = ' placeholder="'.$placeholder.'"';
5390
+            $out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$preselectedvalue.'"'.$placeholder.' />';
5391 5391
         }
5392 5392
         else {
5393 5393
             // Immediate load of all database
@@ -5421,14 +5421,14 @@  discard block
 block discarded – undo
5421 5421
         $prefixforautocompletemode = $objecttmp->element;
5422 5422
         if ($prefixforautocompletemode == 'societe')
5423 5423
             $prefixforautocompletemode = 'company';
5424
-        $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
5424
+        $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
5425 5425
 
5426 5426
         $fieldstoshow = 't.ref';
5427 5427
         if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields ( like societe, contact, ...)
5428 5428
             $tmpfieldstoshow = '';
5429 5429
             foreach ($objecttmp->fields as $key => $val) {
5430 5430
                 if ($val['showoncombobox'])
5431
-                    $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
5431
+                    $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
5432 5432
             }
5433 5433
             if ($tmpfieldstoshow)
5434 5434
                 $fieldstoshow = $tmpfieldstoshow;
@@ -5440,36 +5440,36 @@  discard block
 block discarded – undo
5440 5440
         $num = 0;
5441 5441
 
5442 5442
         // Search data
5443
-        $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . MAIN_DB_PREFIX . $objecttmp->table_element . " as t";
5443
+        $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t";
5444 5444
         if ($objecttmp->ismultientitymanaged == 2)
5445 5445
             if (!$user->rights->societe->client->voir && !$user->societe_id)
5446
-                $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
5446
+                $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
5447 5447
         $sql .= " WHERE 1=1";
5448 5448
         if (!empty($objecttmp->ismultientitymanaged))
5449
-            $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
5449
+            $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
5450 5450
         if ($objecttmp->ismultientitymanaged == 1 && !empty($user->societe_id)) {
5451 5451
             if ($objecttmp->element == 'societe')
5452
-                $sql .= " AND t.rowid = " . $user->societe_id;
5452
+                $sql .= " AND t.rowid = ".$user->societe_id;
5453 5453
             else
5454
-                $sql .= " AND t.fk_soc = " . $user->societe_id;
5454
+                $sql .= " AND t.fk_soc = ".$user->societe_id;
5455 5455
         }
5456 5456
         if ($searchkey != '')
5457 5457
             $sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
5458 5458
         if ($objecttmp->ismultientitymanaged == 2)
5459 5459
             if (!$user->rights->societe->client->voir && !$user->societe_id)
5460
-                $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
5460
+                $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
5461 5461
         $sql .= $this->db->order($fieldstoshow, "ASC");
5462 5462
         //$sql.=$this->db->plimit($limit, 0);
5463 5463
         // Build output string
5464 5464
         $resql = $this->db->query($sql);
5465 5465
         if ($resql) {
5466 5466
             if (!$forcecombo) {
5467
-                include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
5467
+                include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
5468 5468
                 $out .= ajax_combobox($htmlname, null, Globals::$conf->global->$confkeyforautocompletemode);
5469 5469
             }
5470 5470
 
5471 5471
             // Construct $out and $outarray
5472
-            $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
5472
+            $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
5473 5473
 
5474 5474
             // Warning: Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
5475 5475
             $textifempty = '&nbsp;';
@@ -5482,7 +5482,7 @@  discard block
 block discarded – undo
5482 5482
                     $textifempty .= $langs->trans("All");
5483 5483
             }
5484 5484
             if ($showempty)
5485
-                $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
5485
+                $out .= '<option value="-1">'.$textifempty.'</option>'."\n";
5486 5486
 
5487 5487
             $num = $this->db->num_rows($resql);
5488 5488
             $i = 0;
@@ -5493,13 +5493,13 @@  discard block
 block discarded – undo
5493 5493
                     $tmparray = explode(',', $fieldstoshow);
5494 5494
                     foreach ($tmparray as $key => $val) {
5495 5495
                         $val = preg_replace('/t\./', '', $val);
5496
-                        $label .= (($label && $obj->$val) ? ' - ' : '') . $obj->$val;
5496
+                        $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val;
5497 5497
                     }
5498 5498
                     if (empty($outputmode)) {
5499 5499
                         if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
5500
-                            $out .= '<option value="' . $obj->rowid . '" selected>' . $label . '</option>';
5500
+                            $out .= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>';
5501 5501
                         } else {
5502
-                            $out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
5502
+                            $out .= '<option value="'.$obj->rowid.'">'.$label.'</option>';
5503 5503
                         }
5504 5504
                     } else {
5505 5505
                         array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -5511,7 +5511,7 @@  discard block
 block discarded – undo
5511 5511
                 }
5512 5512
             }
5513 5513
 
5514
-            $out .= '</select>' . "\n";
5514
+            $out .= '</select>'."\n";
5515 5515
         }
5516 5516
         else {
5517 5517
             AlDolUtils::dol_print_error($this->db);
@@ -5567,12 +5567,12 @@  discard block
 block discarded – undo
5567 5567
             $tmpplugin = empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) ? (constant('REQUIRE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : 'select2') : Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT;
5568 5568
 
5569 5569
             // Enhance with select2
5570
-            include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
5570
+            include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
5571 5571
             $out .= ajax_combobox($htmlname);
5572 5572
         }
5573 5573
 
5574
-        $out .= '<select id="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($disabled ? 'disabled ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . '"';
5575
-        $out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
5574
+        $out .= '<select id="'.preg_replace('/^\./', '', $htmlname).'" '.($disabled ? 'disabled ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').'"';
5575
+        $out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
5576 5576
         $out .= '>';
5577 5577
 
5578 5578
         if ($show_empty) {
@@ -5581,7 +5581,7 @@  discard block
 block discarded – undo
5581 5581
                 $textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
5582 5582
             if (!is_numeric($show_empty))
5583 5583
                 $textforempty = $show_empty;
5584
-            $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
5584
+            $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.($show_empty < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
5585 5585
         }
5586 5586
 
5587 5587
         if (is_array($array)) {
@@ -5611,9 +5611,9 @@  discard block
 block discarded – undo
5611 5611
 
5612 5612
                 if ($key_in_label) {
5613 5613
                     if (empty($nohtmlescape))
5614
-                        $selectOptionValue = AlDolUtils::dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
5614
+                        $selectOptionValue = AlDolUtils::dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
5615 5615
                     else
5616
-                        $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
5616
+                        $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
5617 5617
                 }
5618 5618
                 else {
5619 5619
                     if (empty($nohtmlescape))
@@ -5624,12 +5624,12 @@  discard block
 block discarded – undo
5624 5624
                         $selectOptionValue = '&nbsp;';
5625 5625
                 }
5626 5626
 
5627
-                $out .= '<option value="' . $key . '"';
5628
-                $out .= $style . $disabled;
5627
+                $out .= '<option value="'.$key.'"';
5628
+                $out .= $style.$disabled;
5629 5629
                 if ($id != '' && $id == $key && !$disabled)
5630
-                    $out .= ' selected';  // To preselect a value
5630
+                    $out .= ' selected'; // To preselect a value
5631 5631
                 if ($nohtmlescape)
5632
-                    $out .= ' data-html="' . AlDolUtils::dol_escape_htmltag($selectOptionValue) . '"';
5632
+                    $out .= ' data-html="'.AlDolUtils::dol_escape_htmltag($selectOptionValue).'"';
5633 5633
                 $out .= '>';
5634 5634
                 //var_dump($selectOptionValue);
5635 5635
                 $out .= $selectOptionValue;
@@ -5668,19 +5668,19 @@  discard block
 block discarded – undo
5668 5668
         if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT'))
5669 5669
             return '';
5670 5670
 
5671
-        $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
5671
+        $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
5672 5672
 
5673 5673
         $tmpplugin = 'select2';
5674
-        $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
5674
+        $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
5675 5675
 	    	<script type="text/javascript">
5676 5676
 	    	$(document).ready(function () {
5677 5677
 
5678
-    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
5678
+    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
5679 5679
 
5680
-                $(".' . $htmlname . '").select2({
5680
+                $(".' . $htmlname.'").select2({
5681 5681
 			    	ajax: {
5682 5682
 				    	dir: "ltr",
5683
-				    	url: "' . $url . '",
5683
+				    	url: "' . $url.'",
5684 5684
 				    	dataType: \'json\',
5685 5685
 				    	delay: 250,
5686 5686
 				    	data: function (params) {
@@ -5707,9 +5707,9 @@  discard block
 block discarded – undo
5707 5707
 			    	},
5708 5708
 	 				language: select2arrayoflanguage,
5709 5709
 					containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
5710
-				    placeholder: "' . dol_escape_js($placeholder) . '",
5710
+				    placeholder: "' . dol_escape_js($placeholder).'",
5711 5711
 			    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
5712
-			    	minimumInputLength: ' . $minimumInputLength . ',
5712
+			    	minimumInputLength: ' . $minimumInputLength.',
5713 5713
 			        formatResult: function(result, container, query, escapeMarkup) {
5714 5714
                         return escapeMarkup(result.text);
5715 5715
                     },
@@ -5717,10 +5717,10 @@  discard block
 block discarded – undo
5717 5717
 
5718 5718
                 ' . ($callurlonselect ? '
5719 5719
                 /* Code to execute a GET when we select a value */
5720
-                $(".' . $htmlname . '").change(function() {
5721
-			    	var selected = $(".' . $htmlname . '").val();
5720
+                $(".' . $htmlname.'").change(function() {
5721
+			    	var selected = $(".' . $htmlname.'").val();
5722 5722
                 	console.log("We select in selectArrayAjax the entry "+selected)
5723
-			        $(".' . $htmlname . '").val("");  /* reset visible combo value */
5723
+			        $(".' . $htmlname.'").val("");  /* reset visible combo value */
5724 5724
     			    $.each( saveRemoteData, function( key, value ) {
5725 5725
     				        if (key == selected)
5726 5726
     			            {
@@ -5728,7 +5728,7 @@  discard block
 block discarded – undo
5728 5728
     			                 location.assign(value.url);
5729 5729
     			            }
5730 5730
                     });
5731
-    			});' : '' ) . '
5731
+    			});' : '').'
5732 5732
 
5733 5733
     	   });
5734 5734
 	       </script>';
@@ -5768,7 +5768,7 @@  discard block
 block discarded – undo
5768 5768
         if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT'))
5769 5769
             return '';
5770 5770
 
5771
-        $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"><option></option></select>';
5771
+        $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"><option></option></select>';
5772 5772
 
5773 5773
         $formattedarrayresult = array();
5774 5774
 
@@ -5781,20 +5781,20 @@  discard block
 block discarded – undo
5781 5781
         }
5782 5782
 
5783 5783
         $tmpplugin = 'select2';
5784
-        $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
5784
+        $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
5785 5785
 			<script type="text/javascript">
5786 5786
 			$(document).ready(function () {
5787
-				var data = ' . json_encode($formattedarrayresult) . ';
5787
+				var data = ' . json_encode($formattedarrayresult).';
5788 5788
 
5789
-				' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
5789
+				' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
5790 5790
 
5791
-				$(".' . $htmlname . '").select2({
5791
+				$(".' . $htmlname.'").select2({
5792 5792
 					data: data,
5793 5793
 					language: select2arrayoflanguage,
5794 5794
 					containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
5795
-					placeholder: "' . dol_escape_js($placeholder) . '",
5795
+					placeholder: "' . dol_escape_js($placeholder).'",
5796 5796
 					escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
5797
-					minimumInputLength: ' . $minimumInputLength . ',
5797
+					minimumInputLength: ' . $minimumInputLength.',
5798 5798
 					formatResult: function(result, container, query, escapeMarkup) {
5799 5799
 						return escapeMarkup(result.text);
5800 5800
 					},
@@ -5832,11 +5832,11 @@  discard block
 block discarded – undo
5832 5832
 
5833 5833
 				' . ($callurlonselect ? '
5834 5834
 				/* Code to execute a GET when we select a value */
5835
-				$(".' . $htmlname . '").change(function() {
5836
-					var selected = $(".' . $htmlname . '").val();
5835
+				$(".' . $htmlname.'").change(function() {
5836
+					var selected = $(".' . $htmlname.'").val();
5837 5837
 					console.log("We select "+selected)
5838 5838
 
5839
-					$(".' . $htmlname . '").val("");  /* reset visible combo value */
5839
+					$(".' . $htmlname.'").val("");  /* reset visible combo value */
5840 5840
 					$.each( saveRemoteData, function( key, value ) {
5841 5841
 						if (key == selected)
5842 5842
 						{
@@ -5844,7 +5844,7 @@  discard block
 block discarded – undo
5844 5844
 							location.assign(value.url);
5845 5845
 						}
5846 5846
 					});
5847
-				});' : '' ) . '
5847
+				});' : '').'
5848 5848
 
5849 5849
 			});
5850 5850
 			</script>';
@@ -5884,28 +5884,28 @@  discard block
 block discarded – undo
5884 5884
 
5885 5885
         // Add code for jquery to use multiselect
5886 5886
         if (!empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
5887
-            $out .= "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
5887
+            $out .= "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
5888 5888
 						<script type="text/javascript">' . "\n";
5889 5889
             if ($addjscombo == 1) {
5890 5890
                 $tmpplugin = empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT;
5891
-                $out .= 'function formatResult(record) {' . "\n";
5891
+                $out .= 'function formatResult(record) {'."\n";
5892 5892
                 if ($elemtype == 'category') {
5893
-                    $out .= '	//return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png' . '"> <a href="' . DOL_URL_ROOT . '/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\';
5894
-									  	return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png' . '"> \'+record.text+\'</span>\';';
5893
+                    $out .= '	//return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\';
5894
+									  	return \'<span><img src="' . DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';';
5895 5895
                 } else {
5896 5896
                     $out .= 'return record.text;';
5897 5897
                 }
5898
-                $out .= '};' . "\n";
5899
-                $out .= 'function formatSelection(record) {' . "\n";
5898
+                $out .= '};'."\n";
5899
+                $out .= 'function formatSelection(record) {'."\n";
5900 5900
                 if ($elemtype == 'category') {
5901
-                    $out .= '	//return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png' . '"> <a href="' . DOL_URL_ROOT . '/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\';
5902
-									  	return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png' . '"> \'+record.text+\'</span>\';';
5901
+                    $out .= '	//return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\';
5902
+									  	return \'<span><img src="' . DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';';
5903 5903
                 } else {
5904 5904
                     $out .= 'return record.text;';
5905 5905
                 }
5906
-                $out .= '};' . "\n";
5906
+                $out .= '};'."\n";
5907 5907
                 $out .= '$(document).ready(function () {
5908
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({
5908
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({
5909 5909
 								dir: \'ltr\',
5910 5910
 								// Specify format function for dropdown item
5911 5911
 								formatResult: formatResult,
@@ -5919,13 +5919,13 @@  discard block
 block discarded – undo
5919 5919
                 // Add other js lib
5920 5920
                 // ...
5921 5921
                 $out .= '$(document).ready(function () {
5922
-							$(\'#' . $htmlname . '\').multiSelect({
5922
+							$(\'#' . $htmlname.'\').multiSelect({
5923 5923
 								containerHTML: \'<div class="multi-select-container">\',
5924 5924
 								menuHTML: \'<div class="multi-select-menu">\',
5925
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
5925
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
5926 5926
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
5927 5927
 								activeClass: \'multi-select-container--open\',
5928
-								noneText: \'' . $placeholder . '\'
5928
+								noneText: \'' . $placeholder.'\'
5929 5929
 							});
5930 5930
 						})';
5931 5931
             }
@@ -5934,27 +5934,27 @@  discard block
 block discarded – undo
5934 5934
 
5935 5935
         // Try also magic suggest
5936 5936
 
5937
-        $out .= '<select id="' . $htmlname . '" class="multiselect' . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n";
5937
+        $out .= '<select id="'.$htmlname.'" class="multiselect'.($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n";
5938 5938
         if (is_array($array) && !empty($array)) {
5939 5939
             if ($value_as_key)
5940 5940
                 $array = array_combine($array, $array);
5941 5941
 
5942 5942
             if (!empty($array)) {
5943 5943
                 foreach ($array as $key => $value) {
5944
-                    $out .= '<option value="' . $key . '"';
5944
+                    $out .= '<option value="'.$key.'"';
5945 5945
                     if (is_array($selected) && !empty($selected) && in_array($key, $selected) && !empty($key)) {
5946 5946
                         $out .= ' selected';
5947 5947
                     }
5948 5948
                     $out .= '>';
5949 5949
 
5950 5950
                     $newval = ($translate ? $langs->trans($value) : $value);
5951
-                    $newval = ($key_in_label ? $key . ' - ' . $newval : $newval);
5951
+                    $newval = ($key_in_label ? $key.' - '.$newval : $newval);
5952 5952
                     $out .= dol_htmlentitiesbr($newval);
5953
-                    $out .= '</option>' . "\n";
5953
+                    $out .= '</option>'."\n";
5954 5954
                 }
5955 5955
             }
5956 5956
         }
5957
-        $out .= '</select>' . "\n";
5957
+        $out .= '</select>'."\n";
5958 5958
 
5959 5959
         return $out;
5960 5960
     }
@@ -5975,7 +5975,7 @@  discard block
 block discarded – undo
5975 5975
         if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
5976 5976
             return '';
5977 5977
 
5978
-        $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage;
5978
+        $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage;
5979 5979
         if (!empty($user->conf->$tmpvar)) {
5980 5980
             $tmparray = explode(',', $user->conf->$tmpvar);
5981 5981
             foreach ($array as $key => $val) {
@@ -5997,28 +5997,28 @@  discard block
 block discarded – undo
5997 5997
               var_dump(array_key_exists('enabled', $val));
5998 5998
               var_dump(!$val['enabled']); */
5999 5999
             if (array_key_exists('enabled', $val) && isset($val['enabled']) && !$val['enabled']) {
6000
-                unset($array[$key]);     // We don't want this field
6000
+                unset($array[$key]); // We don't want this field
6001 6001
                 continue;
6002 6002
             }
6003 6003
             if ($val['label']) {
6004
-                $lis .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . (empty($val['checked']) ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . AlDolUtils::dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';
6005
-                $listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
6004
+                $lis .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.(empty($val['checked']) ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.AlDolUtils::dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
6005
+                $listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
6006 6006
             }
6007 6007
         }
6008 6008
 
6009
-        $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
6009
+        $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
6010 6010
 
6011 6011
         <dl class="dropdown">
6012 6012
             <dt>
6013 6013
             <a href="#">
6014
-              ' . img_picto('', 'list') . '
6014
+              ' . img_picto('', 'list').'
6015 6015
             </a>
6016
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
6016
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
6017 6017
             </dt>
6018 6018
             <dd class="dropdowndd">
6019
-                <div class="multiselectcheckbox' . $htmlname . '">
6020
-                    <ul class="ul' . $htmlname . '">
6021
-                    ' . $lis . '
6019
+                <div class="multiselectcheckbox' . $htmlname.'">
6020
+                    <ul class="ul' . $htmlname.'">
6021
+                    ' . $lis.'
6022 6022
                     </ul>
6023 6023
                 </div>
6024 6024
             </dd>
@@ -6026,15 +6026,15 @@  discard block
 block discarded – undo
6026 6026
 
6027 6027
         <script type="text/javascript">
6028 6028
           jQuery(document).ready(function () {
6029
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
6029
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
6030 6030
                   console.log("A new field was added/removed")
6031 6031
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\')
6032 6032
                   var title = $(this).val() + ",";
6033 6033
                   if ($(this).is(\':checked\')) {
6034
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
6034
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
6035 6035
                   }
6036 6036
                   else {
6037
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
6037
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
6038 6038
                   }
6039 6039
                   // Now, we submit page
6040 6040
                   $(this).parents(\'form:first\').submit();
@@ -6058,7 +6058,7 @@  discard block
 block discarded – undo
6058 6058
     {
6059 6059
         global $db;
6060 6060
 
6061
-        include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
6061
+        include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
6062 6062
 
6063 6063
         $cat = new Categorie($db);
6064 6064
         $categories = $cat->containing($id, $type);
@@ -6066,12 +6066,12 @@  discard block
 block discarded – undo
6066 6066
         if ($rendermode == 1) {
6067 6067
             $toprint = array();
6068 6068
             foreach ($categories as $c) {
6069
-                $ways = $c->print_all_ways();       // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
6069
+                $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
6070 6070
                 foreach ($ways as $way) {
6071
-                    $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
6071
+                    $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
6072 6072
                 }
6073 6073
             }
6074
-            return '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
6074
+            return '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
6075 6075
         }
6076 6076
 
6077 6077
         if ($rendermode == 0) {
@@ -6107,7 +6107,7 @@  discard block
 block discarded – undo
6107 6107
             'morehtmlright' => $morehtmlright,
6108 6108
             'compatibleImportElementsList' => & $compatibleImportElementsList,
6109 6109
         );
6110
-        $reshook = $hookmanager->executeHooks('showLinkedObjectBlock', $parameters, $object, $action);    // Note that $action and $object may have been modified by hook
6110
+        $reshook = $hookmanager->executeHooks('showLinkedObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
6111 6111
 
6112 6112
         if (empty($reshook)) {
6113 6113
             $nbofdifferenttypes = count($object->linkedObjects);
@@ -6117,15 +6117,15 @@  discard block
 block discarded – undo
6117 6117
 
6118 6118
 
6119 6119
             print '<div class="div-table-responsive-no-min">';
6120
-            print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
6120
+            print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
6121 6121
 
6122 6122
             print '<tr class="liste_titre">';
6123
-            print '<td>' . $langs->trans("Type") . '</td>';
6124
-            print '<td>' . $langs->trans("Ref") . '</td>';
6123
+            print '<td>'.$langs->trans("Type").'</td>';
6124
+            print '<td>'.$langs->trans("Ref").'</td>';
6125 6125
             print '<td align="center"></td>';
6126
-            print '<td align="center">' . $langs->trans("Date") . '</td>';
6127
-            print '<td align="right">' . $langs->trans("AmountHTShort") . '</td>';
6128
-            print '<td align="right">' . $langs->trans("Status") . '</td>';
6126
+            print '<td align="center">'.$langs->trans("Date").'</td>';
6127
+            print '<td align="right">'.$langs->trans("AmountHTShort").'</td>';
6128
+            print '<td align="right">'.$langs->trans("Status").'</td>';
6129 6129
             print '<td></td>';
6130 6130
             print '</tr>';
6131 6131
 
@@ -6143,13 +6143,13 @@  discard block
 block discarded – undo
6143 6143
                 if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
6144 6144
                     $element = $regs[1];
6145 6145
                     $subelement = $regs[2];
6146
-                    $tplpath = $element . '/' . $subelement;
6146
+                    $tplpath = $element.'/'.$subelement;
6147 6147
                 }
6148 6148
                 $tplname = 'linkedobjectblock';
6149 6149
 
6150 6150
                 // To work with non standard path
6151 6151
                 if ($objecttype == 'facture') {
6152
-                    $tplpath = 'compta/' . $element;
6152
+                    $tplpath = 'compta/'.$element;
6153 6153
                     if (empty(Globals::$conf->facture->enabled))
6154 6154
                         continue; // Do not show if module disabled
6155 6155
                 }
@@ -6160,7 +6160,7 @@  discard block
 block discarded – undo
6160 6160
                         continue; // Do not show if module disabled
6161 6161
                 }
6162 6162
                 else if ($objecttype == 'propal') {
6163
-                    $tplpath = 'comm/' . $element;
6163
+                    $tplpath = 'comm/'.$element;
6164 6164
                     if (empty(Globals::$conf->propal->enabled))
6165 6165
                         continue; // Do not show if module disabled
6166 6166
                 }
@@ -6198,14 +6198,14 @@  discard block
 block discarded – undo
6198 6198
 
6199 6199
 
6200 6200
                 // Output template part (modules that overwrite templates must declare this into descriptor)
6201
-                $dirtpls = array_merge(Globals::$conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
6201
+                $dirtpls = array_merge(Globals::$conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
6202 6202
                 foreach ($dirtpls as $reldir) {
6203 6203
                     if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
6204 6204
                         global $noMoreLinkedObjectBlockAfter;
6205 6205
                         $noMoreLinkedObjectBlockAfter = 1;
6206 6206
                     }
6207 6207
 
6208
-                    $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
6208
+                    $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
6209 6209
                     if ($res) {
6210 6210
                         $nboftypesoutput++;
6211 6211
                         break;
@@ -6214,7 +6214,7 @@  discard block
 block discarded – undo
6214 6214
             }
6215 6215
 
6216 6216
             if (!$nboftypesoutput) {
6217
-                print '<tr><td class="impair opacitymedium" colspan="7">' . $langs->trans("None") . '</td></tr>';
6217
+                print '<tr><td class="impair opacitymedium" colspan="7">'.$langs->trans("None").'</td></tr>';
6218 6218
             }
6219 6219
 
6220 6220
             print '</table>';
@@ -6254,26 +6254,26 @@  discard block
 block discarded – undo
6254 6254
         if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
6255 6255
             $listofidcompanytoscan = $object->thirdparty->id;
6256 6256
             if (($object->thirdparty->parent > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO))
6257
-                $listofidcompanytoscan .= ',' . $object->thirdparty->parent;
6257
+                $listofidcompanytoscan .= ','.$object->thirdparty->parent;
6258 6258
             if (($object->fk_project > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO)) {
6259
-                include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
6259
+                include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
6260 6260
                 $tmpproject = new Project($this->db);
6261 6261
                 $tmpproject->fetch($object->fk_project);
6262 6262
                 if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id))
6263
-                    $listofidcompanytoscan .= ',' . $tmpproject->socid;
6263
+                    $listofidcompanytoscan .= ','.$tmpproject->socid;
6264 6264
                 unset($tmpproject);
6265 6265
             }
6266 6266
 
6267 6267
             $possiblelinks = array(
6268
-                'propal' => array('enabled' => Globals::$conf->propal->enabled, 'perms' => 1, 'label' => 'LinkToProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('propal') . ')'),
6269
-                'order' => array('enabled' => Globals::$conf->commande->enabled, 'perms' => 1, 'label' => 'LinkToOrder', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('commande') . ')'),
6270
-                'invoice' => array('enabled' => Globals::$conf->facture->enabled, 'perms' => 1, 'label' => 'LinkToInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('invoice') . ')'),
6271
-                'invoice_template' => array('enabled' => Globals::$conf->facture->enabled, 'perms' => 1, 'label' => 'LinkToTemplateInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('invoice') . ')'),
6272
-                'contrat' => array('enabled' => Globals::$conf->contrat->enabled, 'perms' => 1, 'label' => 'LinkToContract', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('contract') . ')'),
6273
-                'fichinter' => array('enabled' => Globals::$conf->ficheinter->enabled, 'perms' => 1, 'label' => 'LinkToIntervention', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('intervention') . ')'),
6274
-                'supplier_proposal' => array('enabled' => Globals::$conf->supplier_proposal->enabled, 'perms' => 1, 'label' => 'LinkToSupplierProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('supplier_proposal') . ')'),
6275
-                'order_supplier' => array('enabled' => Globals::$conf->supplier_order->enabled, 'perms' => 1, 'label' => 'LinkToSupplierOrder', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('commande_fournisseur') . ')'),
6276
-                'invoice_supplier' => array('enabled' => Globals::$conf->supplier_invoice->enabled, 'perms' => 1, 'label' => 'LinkToSupplierInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $listofidcompanytoscan . ') AND t.entity IN (' . getEntity('facture_fourn') . ')')
6268
+                'propal' => array('enabled' => Globals::$conf->propal->enabled, 'perms' => 1, 'label' => 'LinkToProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'),
6269
+                'order' => array('enabled' => Globals::$conf->commande->enabled, 'perms' => 1, 'label' => 'LinkToOrder', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'),
6270
+                'invoice' => array('enabled' => Globals::$conf->facture->enabled, 'perms' => 1, 'label' => 'LinkToInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
6271
+                'invoice_template' => array('enabled' => Globals::$conf->facture->enabled, 'perms' => 1, 'label' => 'LinkToTemplateInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'),
6272
+                'contrat' => array('enabled' => Globals::$conf->contrat->enabled, 'perms' => 1, 'label' => 'LinkToContract', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
6273
+                'fichinter' => array('enabled' => Globals::$conf->ficheinter->enabled, 'perms' => 1, 'label' => 'LinkToIntervention', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
6274
+                'supplier_proposal' => array('enabled' => Globals::$conf->supplier_proposal->enabled, 'perms' => 1, 'label' => 'LinkToSupplierProposal', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
6275
+                'order_supplier' => array('enabled' => Globals::$conf->supplier_order->enabled, 'perms' => 1, 'label' => 'LinkToSupplierOrder', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
6276
+                'invoice_supplier' => array('enabled' => Globals::$conf->supplier_invoice->enabled, 'perms' => 1, 'label' => 'LinkToSupplierInvoice', 'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')')
6277 6277
             );
6278 6278
         }
6279 6279
 
@@ -6282,7 +6282,7 @@  discard block
 block discarded – undo
6282 6282
         // Can complete the possiblelink array
6283 6283
         $hookmanager->initHooks(array('commonobject'));
6284 6284
         $parameters = array('listofidcompanytoscan' => $listofidcompanytoscan);
6285
-        $reshook = $hookmanager->executeHooks('showLinkToObjectBlock', $parameters, $object, $action);    // Note that $action and $object may have been modified by hook
6285
+        $reshook = $hookmanager->executeHooks('showLinkToObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
6286 6286
         if (empty($reshook)) {
6287 6287
             if (is_array($hookmanager->resArray) && count($hookmanager->resArray)) {
6288 6288
                 $possiblelinks = array_merge($possiblelinks, $hookmanager->resArray);
@@ -6300,7 +6300,7 @@  discard block
 block discarded – undo
6300 6300
                 continue;
6301 6301
 
6302 6302
             if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
6303
-                print '<div id="' . $key . 'list"' . (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display:none"' : '') . '>';
6303
+                print '<div id="'.$key.'list"'.(empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display:none"' : '').'>';
6304 6304
                 $sql = $possiblelink['sql'];
6305 6305
 
6306 6306
                 $resqllist = $this->db->query($sql);
@@ -6308,34 +6308,34 @@  discard block
 block discarded – undo
6308 6308
                     $num = $this->db->num_rows($resqllist);
6309 6309
                     $i = 0;
6310 6310
 
6311
-                    print '<br><form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
6312
-                    print '<input type="hidden" name="id" value="' . $object->id . '">';
6311
+                    print '<br><form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
6312
+                    print '<input type="hidden" name="id" value="'.$object->id.'">';
6313 6313
                     print '<input type="hidden" name="action" value="addlink">';
6314
-                    print '<input type="hidden" name="addlink" value="' . $key . '">';
6314
+                    print '<input type="hidden" name="addlink" value="'.$key.'">';
6315 6315
                     print '<table class="noborder">';
6316 6316
                     print '<tr class="liste_titre">';
6317 6317
                     print '<td class="nowrap"></td>';
6318
-                    print '<td align="center">' . $langs->trans("Ref") . '</td>';
6319
-                    print '<td align="left">' . $langs->trans("RefCustomer") . '</td>';
6320
-                    print '<td align="right">' . $langs->trans("AmountHTShort") . '</td>';
6321
-                    print '<td align="left">' . $langs->trans("Company") . '</td>';
6318
+                    print '<td align="center">'.$langs->trans("Ref").'</td>';
6319
+                    print '<td align="left">'.$langs->trans("RefCustomer").'</td>';
6320
+                    print '<td align="right">'.$langs->trans("AmountHTShort").'</td>';
6321
+                    print '<td align="left">'.$langs->trans("Company").'</td>';
6322 6322
                     print '</tr>';
6323 6323
                     while ($i < $num) {
6324 6324
                         $objp = $this->db->fetch_object($resqllist);
6325 6325
 
6326 6326
                         print '<tr class="oddeven">';
6327 6327
                         print '<td aling="left">';
6328
-                        print '<input type="radio" name="idtolinkto" value=' . $objp->rowid . '>';
6328
+                        print '<input type="radio" name="idtolinkto" value='.$objp->rowid.'>';
6329 6329
                         print '</td>';
6330
-                        print '<td align="center">' . $objp->ref . '</td>';
6331
-                        print '<td>' . $objp->ref_client . '</td>';
6332
-                        print '<td align="right">' . price($objp->total_ht) . '</td>';
6333
-                        print '<td>' . $objp->name . '</td>';
6330
+                        print '<td align="center">'.$objp->ref.'</td>';
6331
+                        print '<td>'.$objp->ref_client.'</td>';
6332
+                        print '<td align="right">'.price($objp->total_ht).'</td>';
6333
+                        print '<td>'.$objp->name.'</td>';
6334 6334
                         print '</tr>';
6335 6335
                         $i++;
6336 6336
                     }
6337 6337
                     print '</table>';
6338
-                    print '<div class="center"><input type="submit" class="button valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
6338
+                    print '<div class="center"><input type="submit" class="button valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></div>';
6339 6339
 
6340 6340
                     print '</form>';
6341 6341
                     $this->db->free($resqllist);
@@ -6349,20 +6349,20 @@  discard block
 block discarded – undo
6349 6349
 
6350 6350
                 //$linktoelem.=($linktoelem?' &nbsp; ':'');
6351 6351
                 if ($num > 0)
6352
-                    $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
6352
+                    $linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
6353 6353
                 //else $linktoelem.=$langs->trans($possiblelink['label']);
6354 6354
                 else
6355
-                    $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
6355
+                    $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
6356 6356
             }
6357 6357
         }
6358 6358
 
6359 6359
         if ($linktoelemlist) {
6360 6360
             $linktoelem = '
6361 6361
     		<dl class="dropdown" id="linktoobjectname">
6362
-    		<dt><a href="#linktoobjectname">' . $langs->trans("LinkTo") . '...</a></dt>
6362
+    		<dt><a href="#linktoobjectname">' . $langs->trans("LinkTo").'...</a></dt>
6363 6363
     		<dd>
6364 6364
     		<div class="multiselectlinkto">
6365
-    		<ul class="ulselectedfields">' . $linktoelemlist . '
6365
+    		<ul class="ulselectedfields">' . $linktoelemlist.'
6366 6366
     		</ul>
6367 6367
     		</div>
6368 6368
     		</dd>
@@ -6409,18 +6409,18 @@  discard block
 block discarded – undo
6409 6409
 
6410 6410
         $disabled = ($disabled ? ' disabled' : '');
6411 6411
 
6412
-        $resultyesno = '<select class="flat width75" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
6412
+        $resultyesno = '<select class="flat width75" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
6413 6413
         if ($useempty)
6414
-            $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
6414
+            $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
6415 6415
         if (("$value" == 'yes') || ($value == 1)) {
6416
-            $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans("Yes") . '</option>' . "\n";
6417
-            $resultyesno .= '<option value="' . $no . '">' . $langs->trans("No") . '</option>' . "\n";
6416
+            $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans("Yes").'</option>'."\n";
6417
+            $resultyesno .= '<option value="'.$no.'">'.$langs->trans("No").'</option>'."\n";
6418 6418
         } else {
6419 6419
             $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
6420
-            $resultyesno .= '<option value="' . $yes . '">' . $langs->trans("Yes") . '</option>' . "\n";
6421
-            $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans("No") . '</option>' . "\n";
6420
+            $resultyesno .= '<option value="'.$yes.'">'.$langs->trans("Yes").'</option>'."\n";
6421
+            $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans("No").'</option>'."\n";
6422 6422
         }
6423
-        $resultyesno .= '</select>' . "\n";
6423
+        $resultyesno .= '</select>'."\n";
6424 6424
         return $resultyesno;
6425 6425
     }
6426 6426
 
@@ -6438,12 +6438,12 @@  discard block
 block discarded – undo
6438 6438
     {
6439 6439
         // phpcs:enable
6440 6440
         $sql = "SELECT rowid, label";
6441
-        $sql .= " FROM " . MAIN_DB_PREFIX . "export_model";
6442
-        $sql .= " WHERE type = '" . $type . "'";
6441
+        $sql .= " FROM ".MAIN_DB_PREFIX."export_model";
6442
+        $sql .= " WHERE type = '".$type."'";
6443 6443
         $sql .= " ORDER BY rowid";
6444 6444
         $result = $this->db->query($sql);
6445 6445
         if ($result) {
6446
-            print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
6446
+            print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
6447 6447
             if ($useempty) {
6448 6448
                 print '<option value="-1">&nbsp;</option>';
6449 6449
             }
@@ -6453,9 +6453,9 @@  discard block
 block discarded – undo
6453 6453
             while ($i < $num) {
6454 6454
                 $obj = $this->db->fetch_object($result);
6455 6455
                 if ($selected == $obj->rowid) {
6456
-                    print '<option value="' . $obj->rowid . '" selected>';
6456
+                    print '<option value="'.$obj->rowid.'" selected>';
6457 6457
                 } else {
6458
-                    print '<option value="' . $obj->rowid . '">';
6458
+                    print '<option value="'.$obj->rowid.'">';
6459 6459
                 }
6460 6460
                 print $obj->label;
6461 6461
                 print '</option>';
@@ -6498,7 +6498,7 @@  discard block
 block discarded – undo
6498 6498
         // Add where from hooks
6499 6499
         if (is_object($hookmanager)) {
6500 6500
             $parameters = array();
6501
-            $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object);    // Note that $action and $object may have been modified by hook
6501
+            $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
6502 6502
             $object->next_prev_filter .= $hookmanager->resPrint;
6503 6503
         }
6504 6504
         $previous_ref = $next_ref = '';
@@ -6524,8 +6524,8 @@  discard block
 block discarded – undo
6524 6524
                 $stringforfirstkey .= ' CTL +';
6525 6525
             }
6526 6526
 
6527
-            $previous_ref = $object->ref_previous ? '<a accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
6528
-            $next_ref = $object->ref_next ? '<a accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
6527
+            $previous_ref = $object->ref_previous ? '<a accesskey="p" title="'.$stringforfirstkey.' p" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
6528
+            $next_ref = $object->ref_next ? '<a accesskey="n" title="'.$stringforfirstkey.' n" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
6529 6529
         }
6530 6530
 
6531 6531
         //print "xx".$previous_ref."x".$next_ref;
@@ -6533,30 +6533,30 @@  discard block
 block discarded – undo
6533 6533
 
6534 6534
         // Right part of banner
6535 6535
         if ($morehtmlright)
6536
-            $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
6536
+            $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
6537 6537
 
6538 6538
         if ($previous_ref || $next_ref || $morehtml) {
6539 6539
             $ret .= '<div class="pagination paginationref"><ul class="right">';
6540 6540
         }
6541 6541
         if ($morehtml) {
6542
-            $ret .= '<li class="noborder litext">' . $morehtml . '</li>';
6542
+            $ret .= '<li class="noborder litext">'.$morehtml.'</li>';
6543 6543
         }
6544 6544
         if ($shownav && ($previous_ref || $next_ref)) {
6545
-            $ret .= '<li class="pagination">' . $previous_ref . '</li>';
6546
-            $ret .= '<li class="pagination">' . $next_ref . '</li>';
6545
+            $ret .= '<li class="pagination">'.$previous_ref.'</li>';
6546
+            $ret .= '<li class="pagination">'.$next_ref.'</li>';
6547 6547
         }
6548 6548
         if ($previous_ref || $next_ref || $morehtml) {
6549 6549
             $ret .= '</ul></div>';
6550 6550
         }
6551 6551
 
6552 6552
         $parameters = array();
6553
-        $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object);    // Note that $action and $object may have been modified by hook
6553
+        $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook
6554 6554
         if (empty($reshook))
6555 6555
             $morehtmlstatus .= $hookmanager->resPrint;
6556 6556
         else
6557 6557
             $morehtmlstatus = $hookmanager->resPrint;
6558 6558
         if ($morehtmlstatus)
6559
-            $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
6559
+            $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
6560 6560
 
6561 6561
         $parameters = array();
6562 6562
         $reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -6568,29 +6568,29 @@  discard block
 block discarded – undo
6568 6568
         // Left part of banner
6569 6569
         if ($morehtmlleft) {
6570 6570
             if (Globals::$conf->browser->layout == 'phone')
6571
-                $ret .= '<div class="floatleft">' . $morehtmlleft . '</div>';    // class="center" to have photo in middle
6571
+                $ret .= '<div class="floatleft">'.$morehtmlleft.'</div>'; // class="center" to have photo in middle
6572 6572
             else
6573
-                $ret .= '<div class="inline-block floatleft">' . $morehtmlleft . '</div>';
6573
+                $ret .= '<div class="inline-block floatleft">'.$morehtmlleft.'</div>';
6574 6574
         }
6575 6575
 
6576 6576
         //if (Globals::$conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
6577
-        $ret .= '<div class="inline-block floatleft valignmiddle refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
6577
+        $ret .= '<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
6578 6578
 
6579 6579
         // For thirdparty, contact, user, member, the ref is the id, so we show something else
6580 6580
         if ($object->element == 'societe') {
6581 6581
             $ret .= dol_htmlentities($object->name);
6582 6582
         } else if ($object->element == 'member') {
6583
-            $ret .= $object->ref . '<br>';
6583
+            $ret .= $object->ref.'<br>';
6584 6584
             $fullname = $object->getFullName($langs);
6585 6585
             if ($object->morphy == 'mor' && $object->societe) {
6586
-                $ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . ')' : '');
6586
+                $ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).')' : '');
6587 6587
             } else {
6588
-                $ret .= dol_htmlentities($fullname) . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
6588
+                $ret .= dol_htmlentities($fullname).((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
6589 6589
             }
6590 6590
         } else if (in_array($object->element, array('contact', 'user', 'usergroup'))) {
6591 6591
             $ret .= dol_htmlentities($object->getFullName($langs));
6592 6592
         } else if (in_array($object->element, array('action', 'agenda'))) {
6593
-            $ret .= $object->ref . '<br>' . $object->label;
6593
+            $ret .= $object->ref.'<br>'.$object->label;
6594 6594
         } else if (in_array($object->element, array('adherent_type'))) {
6595 6595
             $ret .= $object->label;
6596 6596
         } else if ($object->element == 'ecm_directories') {
@@ -6600,7 +6600,7 @@  discard block
 block discarded – undo
6600 6600
 
6601 6601
 
6602 6602
         if ($morehtmlref) {
6603
-            $ret .= ' ' . $morehtmlref;
6603
+            $ret .= ' '.$morehtmlref;
6604 6604
         }
6605 6605
         $ret .= '</div>';
6606 6606
 
@@ -6633,9 +6633,9 @@  discard block
 block discarded – undo
6633 6633
         }
6634 6634
 
6635 6635
         // Barcode image
6636
-        $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
6637
-        $out = '<!-- url barcode = ' . $url . ' -->';
6638
-        $out .= '<img src="' . $url . '">';
6636
+        $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
6637
+        $out = '<!-- url barcode = '.$url.' -->';
6638
+        $out .= '<img src="'.$url.'">';
6639 6639
         return $out;
6640 6640
     }
6641 6641
 
@@ -6670,46 +6670,46 @@  discard block
 block discarded – undo
6670 6670
             $dir = Globals::$conf->societe->multidir_output[$entity];
6671 6671
             if (!empty($object->logo)) {
6672 6672
                 if ((string) $imagesize == 'mini') {
6673
-                    $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . '/logos/' . getImageFileNameForSize($object->logo, '_mini');             // getImageFileNameForSize include the thumbs
6673
+                    $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
6674 6674
                 } else {
6675 6675
                     if ((string) $imagesize == 'small') {
6676
-                        $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . '/logos/' . getImageFileNameForSize($object->logo, '_small');
6676
+                        $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_small');
6677 6677
                     } else {
6678
-                        $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . '/logos/' . $object->logo;
6678
+                        $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo;
6679 6679
                     }
6680 6680
                 }
6681
-                $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . '/logos/' . $object->logo;
6681
+                $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo;
6682 6682
             }
6683 6683
             $email = $object->email;
6684 6684
         } else if ($modulepart == 'contact') {
6685
-            $dir = Globals::$conf->societe->multidir_output[$entity] . '/contact';
6685
+            $dir = Globals::$conf->societe->multidir_output[$entity].'/contact';
6686 6686
             if (!empty($object->photo)) {
6687 6687
                 if ((string) $imagesize == 'mini') {
6688
-                    $file = get_exdir(0, 0, 0, 0, $object, 'contact') . '/photos/' . getImageFileNameForSize($object->photo, '_mini');
6688
+                    $file = get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_mini');
6689 6689
                 } else if ((string) $imagesize == 'small') {
6690
-                    $file = get_exdir(0, 0, 0, 0, $object, 'contact') . '/photos/' . getImageFileNameForSize($object->photo, '_small');
6690
+                    $file = get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_small');
6691 6691
                 } else {
6692
-                    $file = get_exdir(0, 0, 0, 0, $object, 'contact') . '/photos/' . $object->photo;
6692
+                    $file = get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo;
6693 6693
                 }
6694
-                $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . '/photos/' . $object->photo;
6694
+                $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo;
6695 6695
             }
6696 6696
             $email = $object->email;
6697 6697
             $capture = 'user';
6698 6698
         } else {
6699 6699
             if ($modulepart == 'userphoto') {
6700
-                $dir = Globals::$conf->user->dir_output ?? (DOL_BASE_URI . '/users');
6700
+                $dir = Globals::$conf->user->dir_output ?? (DOL_BASE_URI.'/users');
6701 6701
                 if (!empty($object->photo)) {
6702 6702
                     if ((string) $imagesize == 'mini') {
6703
-                        $file = get_exdir(0, 0, 0, 0, $object, 'user') . $object->id . '/' . getImageFileNameForSize($object->photo, '_mini');
6703
+                        $file = get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_mini');
6704 6704
                     } else if ((string) $imagesize == 'small') {
6705
-                        $file = get_exdir(0, 0, 0, 0, $object, 'user') . $object->id . '/' . getImageFileNameForSize($object->photo, '_small');
6705
+                        $file = get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_small');
6706 6706
                     } else {
6707
-                        $file = get_exdir(0, 0, 0, 0, $object, 'user') . '/' . $object->id . '/' . $object->photo;
6707
+                        $file = get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/'.$object->photo;
6708 6708
                     }
6709
-                    $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . '/' . $object->id . '/' . $object->photo;
6709
+                    $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/'.$object->photo;
6710 6710
                 }
6711 6711
                 if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) {
6712
-                    $altfile = $object->id . ".jpg"; // For backward compatibility
6712
+                    $altfile = $object->id.".jpg"; // For backward compatibility
6713 6713
                 }
6714 6714
                 $email = $object->email;
6715 6715
                 $capture = 'user';
@@ -6718,15 +6718,15 @@  discard block
 block discarded – undo
6718 6718
                     $dir = Globals::$conf->adherent->dir_output;
6719 6719
                     if (!empty($object->photo)) {
6720 6720
                         if ((string) $imagesize == 'mini')
6721
-                            $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
6721
+                            $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
6722 6722
                         else if ((string) $imagesize == 'small')
6723
-                            $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
6723
+                            $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
6724 6724
                         else
6725
-                            $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
6726
-                        $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
6725
+                            $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
6726
+                        $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
6727 6727
                     }
6728 6728
                     if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS))
6729
-                        $altfile = $object->id . ".jpg"; // For backward compatibility
6729
+                        $altfile = $object->id.".jpg"; // For backward compatibility
6730 6730
                     $email = $object->email;
6731 6731
                     $capture = 'user';
6732 6732
                 }
@@ -6735,15 +6735,15 @@  discard block
 block discarded – undo
6735 6735
                     $dir = Globals::$conf->$modulepart->dir_output;
6736 6736
                     if (!empty($object->photo)) {
6737 6737
                         if ((string) $imagesize == 'mini')
6738
-                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
6738
+                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini');
6739 6739
                         else if ((string) $imagesize == 'small')
6740
-                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small');
6740
+                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small');
6741 6741
                         else
6742
-                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
6743
-                        $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
6742
+                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo;
6743
+                        $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo;
6744 6744
                     }
6745 6745
                     if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS))
6746
-                        $altfile = $object->id . ".jpg"; // For backward compatibility
6746
+                        $altfile = $object->id.".jpg"; // For backward compatibility
6747 6747
                     $email = $object->email;
6748 6748
                 }
6749 6749
             }
@@ -6752,27 +6752,27 @@  discard block
 block discarded – undo
6752 6752
             $capture = $forcecapture;
6753 6753
 
6754 6754
         if ($dir) {
6755
-            if ($file && file_exists($dir . "/" . $file)) {
6755
+            if ($file && file_exists($dir."/".$file)) {
6756 6756
                 if ($addlinktofullsize) {
6757
-                    $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
6757
+                    $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
6758 6758
                     if ($urladvanced)
6759
-                        $ret .= '<a href="' . $urladvanced . '">';
6759
+                        $ret .= '<a href="'.$urladvanced.'">';
6760 6760
                     else
6761
-                        $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
6761
+                        $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
6762 6762
                 }
6763
-                $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">';
6763
+                $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Photo" id="photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
6764 6764
                 if ($addlinktofullsize)
6765 6765
                     $ret .= '</a>';
6766 6766
             }
6767
-            else if ($altfile && file_exists($dir . "/" . $altfile)) {
6767
+            else if ($altfile && file_exists($dir."/".$altfile)) {
6768 6768
                 if ($addlinktofullsize) {
6769
-                    $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
6769
+                    $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
6770 6770
                     if ($urladvanced)
6771
-                        $ret .= '<a href="' . $urladvanced . '">';
6771
+                        $ret .= '<a href="'.$urladvanced.'">';
6772 6772
                     else
6773
-                        $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
6773
+                        $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
6774 6774
                 }
6775
-                $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo alt" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" class="' . $cssclass . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($altfile) . '&cache=' . $cache . '">';
6775
+                $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" class="'.$cssclass.'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">';
6776 6776
                 if ($addlinktofullsize)
6777 6777
                     $ret .= '</a>';
6778 6778
             }
@@ -6796,10 +6796,10 @@  discard block
 block discarded – undo
6796 6796
                     $ret .= '<!-- Put link to gravatar -->';
6797 6797
                     //$defaultimg=urlencode(dol_buildpath($nophoto,3));
6798 6798
                     $defaultimg = 'mm';
6799
-                    $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Gravatar avatar" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 3) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash
6799
+                    $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Gravatar avatar" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)), 3).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash
6800 6800
                 } else {
6801 6801
                     //$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
6802
-                    $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '">';
6802
+                    $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'">';
6803 6803
                 }
6804 6804
             }
6805 6805
 
@@ -6809,13 +6809,13 @@  discard block
 block discarded – undo
6809 6809
                 }
6810 6810
                 $ret .= '<table class="nobordernopadding centpercent">';
6811 6811
                 if ($object->photo) {
6812
-                    $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> ' . $langs->trans("Delete") . '<br><br></td></tr>';
6812
+                    $ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
6813 6813
                 }
6814
-                $ret .= '<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput"' . ($capture ? ' capture="' . $capture . '"' : '') . '></td></tr>';
6814
+                $ret .= '<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput"'.($capture ? ' capture="'.$capture.'"' : '').'></td></tr>';
6815 6815
                 $ret .= '</table>';
6816 6816
             }
6817 6817
         } else
6818
-            AlDolUtils::dol_print_error('', 'Call of showphoto with wrong parameters modulepart=' . $modulepart);
6818
+            AlDolUtils::dol_print_error('', 'Call of showphoto with wrong parameters modulepart='.$modulepart);
6819 6819
 
6820 6820
         return $ret;
6821 6821
     }
@@ -6858,37 +6858,37 @@  discard block
 block discarded – undo
6858 6858
         if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) {
6859 6859
             $sql .= ", e.label";
6860 6860
         }
6861
-        $sql .= " FROM " . MAIN_DB_PREFIX . "usergroup as ug ";
6861
+        $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as ug ";
6862 6862
         if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) {
6863
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=ug.entity";
6863
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid=ug.entity";
6864 6864
             if ($force_entity)
6865
-                $sql .= " WHERE ug.entity IN (0," . $force_entity . ")";
6865
+                $sql .= " WHERE ug.entity IN (0,".$force_entity.")";
6866 6866
             else
6867 6867
                 $sql .= " WHERE ug.entity IS NOT NULL";
6868 6868
         }
6869 6869
         else {
6870
-            $sql .= " WHERE ug.entity IN (0," . Globals::$conf->entity . ")";
6870
+            $sql .= " WHERE ug.entity IN (0,".Globals::$conf->entity.")";
6871 6871
         }
6872 6872
         if (is_array($exclude) && $excludeGroups)
6873
-            $sql .= " AND ug.rowid NOT IN ('" . $excludeGroups . "')";
6873
+            $sql .= " AND ug.rowid NOT IN ('".$excludeGroups."')";
6874 6874
         if (is_array($include) && $includeGroups)
6875
-            $sql .= " AND ug.rowid IN ('" . $includeGroups . "')";
6875
+            $sql .= " AND ug.rowid IN ('".$includeGroups."')";
6876 6876
         $sql .= " ORDER BY ug.nom ASC";
6877 6877
 
6878
-        dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
6878
+        dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
6879 6879
         $resql = $this->db->query($sql);
6880 6880
         if ($resql) {
6881 6881
             // Enhance with select2
6882
-            include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6882
+            include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6883 6883
             $out .= ajax_combobox($htmlname);
6884 6884
 
6885
-            $out .= '<select class="flat minwidth200" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
6885
+            $out .= '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
6886 6886
 
6887 6887
             $num = $this->db->num_rows($resql);
6888 6888
             $i = 0;
6889 6889
             if ($num) {
6890 6890
                 if ($show_empty && !$multiple)
6891
-                    $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
6891
+                    $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
6892 6892
 
6893 6893
                 while ($i < $num) {
6894 6894
                     $obj = $this->db->fetch_object($resql);
@@ -6896,17 +6896,17 @@  discard block
 block discarded – undo
6896 6896
                     if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly))
6897 6897
                         $disableline = 1;
6898 6898
 
6899
-                    $out .= '<option value="' . $obj->rowid . '"';
6899
+                    $out .= '<option value="'.$obj->rowid.'"';
6900 6900
                     if ($disableline)
6901 6901
                         $out .= ' disabled';
6902
-                    if ((is_object($selected[0]) && $selected[0]->id == $obj->rowid) || (!is_object($selected[0]) && in_array($obj->rowid, $selected) )) {
6902
+                    if ((is_object($selected[0]) && $selected[0]->id == $obj->rowid) || (!is_object($selected[0]) && in_array($obj->rowid, $selected))) {
6903 6903
                         $out .= ' selected';
6904 6904
                     }
6905 6905
                     $out .= '>';
6906 6906
 
6907 6907
                     $out .= $obj->name;
6908 6908
                     if (!empty(Globals::$conf->multicompany->enabled) && empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE) && Globals::$conf->entity == 1) {
6909
-                        $out .= " (" . $obj->label . ")";
6909
+                        $out .= " (".$obj->label.")";
6910 6910
                     }
6911 6911
 
6912 6912
                     $out .= '</option>';
@@ -6914,8 +6914,8 @@  discard block
 block discarded – undo
6914 6914
                 }
6915 6915
             } else {
6916 6916
                 if ($show_empty)
6917
-                    $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
6918
-                $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
6917
+                    $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
6918
+                $out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
6919 6919
             }
6920 6920
             $out .= '</select>';
6921 6921
         }
@@ -6936,8 +6936,8 @@  discard block
 block discarded – undo
6936 6936
         global $conf, $langs;
6937 6937
 
6938 6938
         $out = '<div class="nowrap">';
6939
-        $out .= '<input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . AlDolUtils::dol_escape_htmltag($langs->trans("Search")) . '" title="' . AlDolUtils::dol_escape_htmltag($langs->trans("Search")) . '">';
6940
-        $out .= '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . AlDolUtils::dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . AlDolUtils::dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
6939
+        $out .= '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.AlDolUtils::dol_escape_htmltag($langs->trans("Search")).'" title="'.AlDolUtils::dol_escape_htmltag($langs->trans("Search")).'">';
6940
+        $out .= '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.AlDolUtils::dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.AlDolUtils::dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
6941 6941
         $out .= '</div>';
6942 6942
 
6943 6943
         return $out;
@@ -6962,12 +6962,12 @@  discard block
 block discarded – undo
6962 6962
             	$("#checkallactions").click(function() {
6963 6963
                     if($(this).is(\':checked\')){
6964 6964
                         console.log("We check all");
6965
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
6965
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
6966 6966
                     }
6967 6967
                     else
6968 6968
                     {
6969 6969
                         console.log("We uncheck all");
6970
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
6970
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
6971 6971
                     }' . "\n";
6972 6972
         if ($calljsfunction)
6973 6973
             $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
@@ -7016,64 +7016,64 @@  discard block
 block discarded – undo
7016 7016
     {
7017 7017
         global $db, $conf, $langs, $user;
7018 7018
 
7019
-        $sql = 'SELECT rowid, label FROM ' . MAIN_DB_PREFIX . 'c_exp_tax_cat WHERE active = 1';
7020
-        $sql .= ' AND entity IN (0,' . getEntity('exp_tax_cat') . ')';
7019
+        $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1';
7020
+        $sql .= ' AND entity IN (0,'.getEntity('exp_tax_cat').')';
7021 7021
         if (!empty($excludeid))
7022
-            $sql .= ' AND rowid NOT IN (' . implode(',', $excludeid) . ')';
7022
+            $sql .= ' AND rowid NOT IN ('.implode(',', $excludeid).')';
7023 7023
         $sql .= ' ORDER BY label';
7024 7024
 
7025 7025
         $resql = $db->query($sql);
7026 7026
         if ($resql) {
7027
-            $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
7027
+            $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
7028 7028
             if ($useempty)
7029 7029
                 $out .= '<option value="0">&nbsp;</option>';
7030 7030
 
7031 7031
             while ($obj = $db->fetch_object($resql)) {
7032
-                $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
7032
+                $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
7033 7033
             }
7034 7034
             $out .= '</select>';
7035 7035
             if (!empty($htmlname) && $user->admin)
7036
-                $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
7036
+                $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
7037 7037
 
7038 7038
             if (!empty($target)) {
7039
-                $sql = "SELECT c.id FROM " . MAIN_DB_PREFIX . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
7039
+                $sql = "SELECT c.id FROM ".MAIN_DB_PREFIX."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
7040 7040
                 $resql = $db->query($sql);
7041 7041
                 if ($resql) {
7042 7042
                     if ($db->num_rows($resql) > 0) {
7043 7043
                         $obj = $db->fetch_object($resql);
7044 7044
                         $out .= '<script type="text/javascript">
7045 7045
 							$(function() {
7046
-								$("select[name=' . $target . ']").on("change", function() {
7046
+								$("select[name=' . $target.']").on("change", function() {
7047 7047
 									var current_val = $(this).val();
7048
-									if (current_val == ' . $obj->id . ') {';
7048
+									if (current_val == ' . $obj->id.') {';
7049 7049
                         if (!empty($default_selected) || !empty($selected))
7050
-                            $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
7050
+                            $out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
7051 7051
 
7052 7052
                         $out .= '
7053
-										$("select[name=' . $htmlname . ']").change();
7053
+										$("select[name=' . $htmlname.']").change();
7054 7054
 									}
7055 7055
 								});
7056 7056
 
7057
-								$("select[name=' . $htmlname . ']").change(function() {
7057
+								$("select[name=' . $htmlname.']").change(function() {
7058 7058
 
7059
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
7059
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
7060 7060
 										// get price of kilometer to fill the unit price
7061
-										var data = ' . json_encode($params) . ';
7061
+										var data = ' . json_encode($params).';
7062 7062
 										data.fk_c_exp_tax_cat = $(this).val();
7063 7063
 
7064 7064
 										$.ajax({
7065 7065
 											method: "POST",
7066 7066
 											dataType: "json",
7067 7067
 											data: data,
7068
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php') . '",
7068
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php').'",
7069 7069
 										}).done(function( data, textStatus, jqXHR ) {
7070 7070
 											console.log(data);
7071 7071
 											if (typeof data.up != "undefined") {
7072 7072
 												$("input[name=value_unit]").val(data.up);
7073
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
7073
+												$("select[name=' . $htmlname.']").attr("title", data.title);
7074 7074
 											} else {
7075 7075
 												$("input[name=value_unit]").val("");
7076
-												$("select[name=' . $htmlname . ']").attr("title", "");
7076
+												$("select[name=' . $htmlname.']").attr("title", "");
7077 7077
 											}
7078 7078
 										});
7079 7079
 									}
@@ -7103,17 +7103,17 @@  discard block
 block discarded – undo
7103 7103
     {
7104 7104
         global $db, $conf, $langs;
7105 7105
 
7106
-        $sql = 'SELECT rowid, range_ik FROM ' . MAIN_DB_PREFIX . 'c_exp_tax_range';
7107
-        $sql .= ' WHERE entity = ' . Globals::$conf->entity . ' AND active = 1';
7106
+        $sql = 'SELECT rowid, range_ik FROM '.MAIN_DB_PREFIX.'c_exp_tax_range';
7107
+        $sql .= ' WHERE entity = '.Globals::$conf->entity.' AND active = 1';
7108 7108
 
7109 7109
         $resql = $db->query($sql);
7110 7110
         if ($resql) {
7111
-            $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
7111
+            $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
7112 7112
             if ($useempty)
7113 7113
                 $out .= '<option value="0"></option>';
7114 7114
 
7115 7115
             while ($obj = $db->fetch_object($resql)) {
7116
-                $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
7116
+                $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
7117 7117
             }
7118 7118
             $out .= '</select>';
7119 7119
         } else {
@@ -7137,16 +7137,16 @@  discard block
 block discarded – undo
7137 7137
     {
7138 7138
         global $db, $langs;
7139 7139
 
7140
-        $sql = 'SELECT id, code, label FROM ' . MAIN_DB_PREFIX . 'c_type_fees';
7140
+        $sql = 'SELECT id, code, label FROM '.MAIN_DB_PREFIX.'c_type_fees';
7141 7141
         $sql .= ' WHERE active = 1';
7142 7142
 
7143 7143
         $resql = $db->query($sql);
7144 7144
         if ($resql) {
7145
-            $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
7145
+            $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
7146 7146
             if ($useempty)
7147 7147
                 $out .= '<option value="0"></option>';
7148 7148
             if ($allchoice)
7149
-                $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
7149
+                $out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
7150 7150
 
7151 7151
             $field = 'code';
7152 7152
             if ($useid)
@@ -7154,7 +7154,7 @@  discard block
 block discarded – undo
7154 7154
 
7155 7155
             while ($obj = $db->fetch_object($resql)) {
7156 7156
                 $key = $langs->trans($obj->code);
7157
-                $out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
7157
+                $out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
7158 7158
             }
7159 7159
             $out .= '</select>';
7160 7160
         } else {
Please login to merge, or discard this patch.
Braces   +1224 added lines, -911 removed lines patch added patch discarded remove patch
@@ -113,22 +113,24 @@  discard block
 block discarded – undo
113 113
             if (!empty($perm)) {
114 114
                 $tmp = explode(':', $typeofdata);
115 115
                 $ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
116
-                if ($fieldrequired)
117
-                    $ret .= '<span class="fieldrequired">';
116
+                if ($fieldrequired) {
117
+                                    $ret .= '<span class="fieldrequired">';
118
+                }
118 119
                 $ret .= $langs->trans($text);
119
-                if ($fieldrequired)
120
-                    $ret .= '</span>';
120
+                if ($fieldrequired) {
121
+                                    $ret .= '</span>';
122
+                }
121 123
                 $ret .= '</div>' . "\n";
122
-            }
123
-            else {
124
-                if ($fieldrequired)
125
-                    $ret .= '<span class="fieldrequired">';
124
+            } else {
125
+                if ($fieldrequired) {
126
+                                    $ret .= '<span class="fieldrequired">';
127
+                }
126 128
                 $ret .= $langs->trans($text);
127
-                if ($fieldrequired)
128
-                    $ret .= '</span>';
129
+                if ($fieldrequired) {
130
+                                    $ret .= '</span>';
131
+                }
129 132
             }
130
-        }
131
-        else {
133
+        } else {
132 134
             if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
133 135
                 $ret .= '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
134 136
             }
@@ -193,8 +195,9 @@  discard block
 block discarded – undo
193 195
         $ret = '';
194 196
 
195 197
         // Check parameters
196
-        if (empty($typeofdata))
197
-            return 'ErrorBadParameter';
198
+        if (empty($typeofdata)) {
199
+                    return 'ErrorBadParameter';
200
+        }
198 201
 
199 202
         // When option to edit inline is activated
200 203
         if (!empty(Globals::$conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker
@@ -206,10 +209,12 @@  discard block
 block discarded – undo
206 209
                 $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
207 210
                 $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
208 211
                 $ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
209
-                if (empty($notabletag))
210
-                    $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
211
-                if (empty($notabletag))
212
-                    $ret .= '<tr><td>';
212
+                if (empty($notabletag)) {
213
+                                    $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
214
+                }
215
+                if (empty($notabletag)) {
216
+                                    $ret .= '<tr><td>';
217
+                }
213 218
                 if (preg_match('/^(string|email)/', $typeofdata)) {
214 219
                     $tmp = explode(':', $typeofdata);
215 220
                     $ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . ($tmp[1] ? ' size="' . $tmp[1] . '"' : '') . '>';
@@ -248,35 +253,39 @@  discard block
 block discarded – undo
248 253
                     $doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), ($tmp[2] ? $tmp[2] : ''), ($tmp[3] ? $tmp[3] : '100'), ($tmp[1] ? $tmp[1] : 'dolibarr_notes'), 'In', ($tmp[5] ? $tmp[5] : 0), true, true, ($tmp[6] ? $tmp[6] : '20'), ($tmp[7] ? $tmp[7] : '100'));
249 254
                     $ret .= $doleditor->Create(1);
250 255
                 }
251
-                if (empty($notabletag))
252
-                    $ret .= '</td>';
256
+                if (empty($notabletag)) {
257
+                                    $ret .= '</td>';
258
+                }
253 259
 
254
-                if (empty($notabletag))
255
-                    $ret .= '<td align="left">';
260
+                if (empty($notabletag)) {
261
+                                    $ret .= '<td align="left">';
262
+                }
256 263
                 //else $ret.='<div class="clearboth"></div>';
257 264
                 $ret .= '<input type="submit" class="button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
258
-                if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag))
259
-                    $ret .= '<br>' . "\n";
265
+                if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) {
266
+                                    $ret .= '<br>' . "\n";
267
+                }
260 268
                 $ret .= '<input type="submit" class="button' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
261
-                if (empty($notabletag))
262
-                    $ret .= '</td>';
269
+                if (empty($notabletag)) {
270
+                                    $ret .= '</td>';
271
+                }
263 272
 
264
-                if (empty($notabletag))
265
-                    $ret .= '</tr></table>' . "\n";
273
+                if (empty($notabletag)) {
274
+                                    $ret .= '</tr></table>' . "\n";
275
+                }
266 276
                 $ret .= '</form>' . "\n";
267
-            }
268
-            else {
269
-                if (preg_match('/^(email)/', $typeofdata))
270
-                    $ret .= dol_print_email($value, 0, 0, 0, 0, 1);
271
-                elseif (preg_match('/^(amount|numeric)/', $typeofdata))
272
-                    $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, Globals::$conf->currency) : '');
273
-                elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata))
274
-                    $ret .= dol_htmlentitiesbr($value);
275
-                elseif ($typeofdata == 'day' || $typeofdata == 'datepicker')
276
-                    $ret .= AlDolUtils::dol_print_date($value, 'day');
277
-                elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker')
278
-                    $ret .= AlDolUtils::dol_print_date($value, 'dayhour');
279
-                else if (preg_match('/^select;/', $typeofdata)) {
277
+            } else {
278
+                if (preg_match('/^(email)/', $typeofdata)) {
279
+                                    $ret .= dol_print_email($value, 0, 0, 0, 0, 1);
280
+                } elseif (preg_match('/^(amount|numeric)/', $typeofdata)) {
281
+                                    $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, Globals::$conf->currency) : '');
282
+                } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
283
+                                    $ret .= dol_htmlentitiesbr($value);
284
+                } elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
285
+                                    $ret .= AlDolUtils::dol_print_date($value, 'day');
286
+                } elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
287
+                                    $ret .= AlDolUtils::dol_print_date($value, 'dayhour');
288
+                } else if (preg_match('/^select;/', $typeofdata)) {
280 289
                     $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
281 290
                     foreach ($arraydata as $val) {
282 291
                         $tmp = explode(':', $val);
@@ -291,8 +300,9 @@  discard block
 block discarded – undo
291 300
                         $tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
292 301
                     }
293 302
                     $ret .= $tmpcontent;
294
-                } else
295
-                    $ret .= $value;
303
+                } else {
304
+                                    $ret .= $value;
305
+                }
296 306
 
297 307
                 if ($formatfunc && method_exists($object, $formatfunc)) {
298 308
                     $ret = $object->$formatfunc($ret);
@@ -322,12 +332,13 @@  discard block
 block discarded – undo
322 332
         $out = '';
323 333
 
324 334
         // Check parameters
325
-        if (preg_match('/^text/', $inputType))
326
-            $value = dol_nl2br($value);
327
-        else if (preg_match('/^numeric/', $inputType))
328
-            $value = price($value);
329
-        else if ($inputType == 'day' || $inputType == 'datepicker')
330
-            $value = AlDolUtils::dol_print_date($value, 'day');
335
+        if (preg_match('/^text/', $inputType)) {
336
+                    $value = dol_nl2br($value);
337
+        } else if (preg_match('/^numeric/', $inputType)) {
338
+                    $value = price($value);
339
+        } else if ($inputType == 'day' || $inputType == 'datepicker') {
340
+                    $value = AlDolUtils::dol_print_date($value, 'day');
341
+        }
331 342
 
332 343
         if ($condition) {
333 344
             $element = false;
@@ -352,32 +363,35 @@  discard block
 block discarded – undo
352 363
             if (preg_match('/^(string|email|numeric)/', $inputType)) {
353 364
                 $tmp = explode(':', $inputType);
354 365
                 $inputType = $tmp[0];
355
-                if (!empty($tmp[1]))
356
-                    $inputOption = $tmp[1];
357
-                if (!empty($tmp[2]))
358
-                    $savemethod = $tmp[2];
366
+                if (!empty($tmp[1])) {
367
+                                    $inputOption = $tmp[1];
368
+                }
369
+                if (!empty($tmp[2])) {
370
+                                    $savemethod = $tmp[2];
371
+                }
359 372
                 $out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
360
-            }
361
-            else if ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
373
+            } else if ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
362 374
                 $tmp = explode(':', $inputType);
363 375
                 $inputType = $tmp[0];
364
-                if (!empty($tmp[1]))
365
-                    $inputOption = $tmp[1];
366
-                if (!empty($tmp[2]))
367
-                    $savemethod = $tmp[2];
376
+                if (!empty($tmp[1])) {
377
+                                    $inputOption = $tmp[1];
378
+                }
379
+                if (!empty($tmp[2])) {
380
+                                    $savemethod = $tmp[2];
381
+                }
368 382
 
369 383
                 $out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
370
-            }
371
-            else if (preg_match('/^(select|autocomplete)/', $inputType)) {
384
+            } else if (preg_match('/^(select|autocomplete)/', $inputType)) {
372 385
                 $tmp = explode(':', $inputType);
373 386
                 $inputType = $tmp[0];
374 387
                 $loadmethod = $tmp[1];
375
-                if (!empty($tmp[2]))
376
-                    $savemethod = $tmp[2];
377
-                if (!empty($tmp[3]))
378
-                    $button_only = true;
379
-            }
380
-            else if (preg_match('/^textarea/', $inputType)) {
388
+                if (!empty($tmp[2])) {
389
+                                    $savemethod = $tmp[2];
390
+                }
391
+                if (!empty($tmp[3])) {
392
+                                    $button_only = true;
393
+                }
394
+            } else if (preg_match('/^textarea/', $inputType)) {
381 395
                 $tmp = explode(':', $inputType);
382 396
                 $inputType = $tmp[0];
383 397
                 $rows = (empty($tmp[1]) ? '8' : $tmp[1]);
@@ -386,12 +400,15 @@  discard block
 block discarded – undo
386 400
                 $tmp = explode(':', $inputType);
387 401
                 $inputType = $tmp[0];
388 402
                 $toolbar = $tmp[1];
389
-                if (!empty($tmp[2]))
390
-                    $width = $tmp[2];
391
-                if (!empty($tmp[3]))
392
-                    $heigth = $tmp[3];
393
-                if (!empty($tmp[4]))
394
-                    $savemethod = $tmp[4];
403
+                if (!empty($tmp[2])) {
404
+                                    $width = $tmp[2];
405
+                }
406
+                if (!empty($tmp[3])) {
407
+                                    $heigth = $tmp[3];
408
+                }
409
+                if (!empty($tmp[4])) {
410
+                                    $savemethod = $tmp[4];
411
+                }
395 412
 
396 413
                 if (!empty(Globals::$conf->fckeditor->enabled)) {
397 414
                     $out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
@@ -404,18 +421,23 @@  discard block
 block discarded – undo
404 421
             $out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
405 422
             $out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
406 423
             $out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
407
-            if (!empty($savemethod))
408
-                $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
409
-            if (!empty($ext_element))
410
-                $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
424
+            if (!empty($savemethod)) {
425
+                            $out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
426
+            }
427
+            if (!empty($ext_element)) {
428
+                            $out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
429
+            }
411 430
             if (!empty($custommsg)) {
412 431
                 if (is_array($custommsg)) {
413
-                    if (!empty($custommsg['success']))
414
-                        $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
415
-                    if (!empty($custommsg['error']))
416
-                        $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
417
-                } else
418
-                    $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
432
+                    if (!empty($custommsg['success'])) {
433
+                                            $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
434
+                    }
435
+                    if (!empty($custommsg['error'])) {
436
+                                            $out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
437
+                    }
438
+                } else {
439
+                                    $out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
440
+                }
419 441
             }
420 442
             if ($inputType == 'textarea') {
421 443
                 $out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
@@ -567,20 +589,22 @@  discard block
 block discarded – undo
567 589
         global $conf, $langs;
568 590
 
569 591
         $alt = '';
570
-        if ($tooltiptrigger)
571
-            $alt = $langs->transnoentitiesnoconv("ClickToShowHelp");
592
+        if ($tooltiptrigger) {
593
+                    $alt = $langs->transnoentitiesnoconv("ClickToShowHelp");
594
+        }
572 595
 
573 596
         //For backwards compatibility
574
-        if ($type == '0')
575
-            $type = 'info';
576
-        elseif ($type == '1')
577
-            $type = 'help';
597
+        if ($type == '0') {
598
+                    $type = 'info';
599
+        } elseif ($type == '1') {
600
+                    $type = 'help';
601
+        }
578 602
 
579 603
         // If info or help with no javascript, show only text
580 604
         if (empty(Globals::$conf->use_javascript_ajax)) {
581
-            if ($type == 'info' || $type == 'help')
582
-                return $text;
583
-            else {
605
+            if ($type == 'info' || $type == 'help') {
606
+                            return $text;
607
+            } else {
584 608
                 $alt = $htmltext;
585 609
                 $htmltext = '';
586 610
             }
@@ -588,27 +612,30 @@  discard block
 block discarded – undo
588 612
 
589 613
         // If info or help with smartphone, show only text (tooltip hover can't works)
590 614
         if (!empty(Globals::$conf->dol_no_mouse_hover) && empty($tooltiptrigger)) {
591
-            if ($type == 'info' || $type == 'help')
592
-                return $text;
615
+            if ($type == 'info' || $type == 'help') {
616
+                            return $text;
617
+            }
593 618
         }
594 619
         // If info or help with smartphone, show only text (tooltip on lick does not works with dialog on smaprtphone)
595 620
         if (!empty(Globals::$conf->dol_no_mouse_hover) && !empty($tooltiptrigger)) {
596
-            if ($type == 'info' || $type == 'help')
597
-                return $text;
598
-        }
599
-
600
-        if ($type == 'info')
601
-            $img = img_help(0, $alt);
602
-        elseif ($type == 'help')
603
-            $img = img_help(($tooltiptrigger != '' ? 2 : 1), $alt);
604
-        elseif ($type == 'superadmin')
605
-            $img = img_picto($alt, 'redstar');
606
-        elseif ($type == 'admin')
607
-            $img = img_picto($alt, 'star');
608
-        elseif ($type == 'warning')
609
-            $img = img_warning($alt);
610
-        else
611
-            $img = img_picto($alt, $type);
621
+            if ($type == 'info' || $type == 'help') {
622
+                            return $text;
623
+            }
624
+        }
625
+
626
+        if ($type == 'info') {
627
+                    $img = img_help(0, $alt);
628
+        } elseif ($type == 'help') {
629
+                    $img = img_help(($tooltiptrigger != '' ? 2 : 1), $alt);
630
+        } elseif ($type == 'superadmin') {
631
+                    $img = img_picto($alt, 'redstar');
632
+        } elseif ($type == 'admin') {
633
+                    $img = img_picto($alt, 'star');
634
+        } elseif ($type == 'warning') {
635
+                    $img = img_warning($alt);
636
+        } else {
637
+                    $img = img_picto($alt, $type);
638
+        }
612 639
 
613 640
         return $this->textwithtooltip($text, $htmltext, (($tooltiptrigger && !$img) ? 3 : 2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger, $forcenowrap);
614 641
     }
@@ -625,8 +652,9 @@  discard block
 block discarded – undo
625 652
     {
626 653
         global $conf, $langs, $hookmanager;
627 654
 
628
-        if (count($arrayofaction) == 0)
629
-            return;
655
+        if (count($arrayofaction) == 0) {
656
+                    return;
657
+        }
630 658
 
631 659
         $disabled = 0;
632 660
         $ret = '<div class="centpercent center">';
@@ -758,10 +786,11 @@  discard block
 block discarded – undo
758 786
                     $i++;
759 787
                 }
760 788
 
761
-                if (empty($disablefavorites))
762
-                    array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray);
763
-                else
764
-                    $countryArray = dol_sort_array($countryArray, 'label');
789
+                if (empty($disablefavorites)) {
790
+                                    array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray);
791
+                } else {
792
+                                    $countryArray = dol_sort_array($countryArray, 'label');
793
+                }
765 794
 
766 795
                 if ($showempty) {
767 796
                     $out .= '<option value="">&nbsp;</option>' . "\n";
@@ -771,8 +800,9 @@  discard block
 block discarded – undo
771 800
                     //if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
772 801
                     $out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
773 802
                     $out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>';
774
-                    if ($mysoc->isInEEC())
775
-                        $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
803
+                    if ($mysoc->isInEEC()) {
804
+                                            $out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
805
+                    }
776 806
                     $out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>';
777 807
                     $out .= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
778 808
                 }
@@ -783,8 +813,9 @@  discard block
 block discarded – undo
783 813
                         continue;
784 814
                     }
785 815
 
786
-                    if (empty($disablefavorites) && $row['favorite'] && $row['code_iso'])
787
-                        $atleastonefavorite++;
816
+                    if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) {
817
+                                            $atleastonefavorite++;
818
+                    }
788 819
                     if (empty($row['favorite']) && $atleastonefavorite) {
789 820
                         $atleastonefavorite = 0;
790 821
                         $out .= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
@@ -795,18 +826,19 @@  discard block
 block discarded – undo
795 826
                     } else {
796 827
                         $out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '">';
797 828
                     }
798
-                    if ($row['label'])
799
-                        $out .= dol_trunc($row['label'], $maxlength, 'middle');
800
-                    else
801
-                        $out .= '&nbsp;';
802
-                    if ($row['code_iso'])
803
-                        $out .= ' (' . $row['code_iso'] . ')';
829
+                    if ($row['label']) {
830
+                                            $out .= dol_trunc($row['label'], $maxlength, 'middle');
831
+                    } else {
832
+                                            $out .= '&nbsp;';
833
+                    }
834
+                    if ($row['code_iso']) {
835
+                                            $out .= ' (' . $row['code_iso'] . ')';
836
+                    }
804 837
                     $out .= '</option>';
805 838
                 }
806 839
             }
807 840
             $out .= '</select>';
808
-        }
809
-        else {
841
+        } else {
810 842
             AlDolUtils::dol_print_error($this->db);
811 843
         }
812 844
 
@@ -880,8 +912,9 @@  discard block
 block discarded – undo
880 912
                         $out .= '<option value="' . $row['rowid'] . '">';
881 913
                     }
882 914
 
883
-                    if ($row['code'])
884
-                        $out .= $row['code'];
915
+                    if ($row['code']) {
916
+                                            $out .= $row['code'];
917
+                    }
885 918
 
886 919
                     $out .= '</option>';
887 920
                 }
@@ -919,24 +952,28 @@  discard block
 block discarded – undo
919 952
 
920 953
         // If product & services are enabled or both disabled.
921 954
         if ($forceall == 1 || (empty($forceall) && !empty(Globals::$conf->product->enabled) && !empty(Globals::$conf->service->enabled)) || (empty($forceall) && empty(Globals::$conf->product->enabled) && empty(Globals::$conf->service->enabled))) {
922
-            if (empty($hidetext))
923
-                print $langs->trans("Type") . ': ';
955
+            if (empty($hidetext)) {
956
+                            print $langs->trans("Type") . ': ';
957
+            }
924 958
             print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
925 959
             if ($showempty) {
926 960
                 print '<option value="-1"';
927
-                if ($selected == -1)
928
-                    print ' selected';
961
+                if ($selected == -1) {
962
+                                    print ' selected';
963
+                }
929 964
                 print '>&nbsp;</option>';
930 965
             }
931 966
 
932 967
             print '<option value="0"';
933
-            if (0 == $selected)
934
-                print ' selected';
968
+            if (0 == $selected) {
969
+                            print ' selected';
970
+            }
935 971
             print '>' . $langs->trans("Product");
936 972
 
937 973
             print '<option value="1"';
938
-            if (1 == $selected)
939
-                print ' selected';
974
+            if (1 == $selected) {
975
+                            print ' selected';
976
+            }
940 977
             print '>' . $langs->trans("Service");
941 978
 
942 979
             print '</select>';
@@ -967,8 +1004,10 @@  discard block
 block discarded – undo
967 1004
         global $langs;
968 1005
 
969 1006
         $num = count($this->cache_types_fees);
970
-        if ($num > 0)
971
-            return 0;    // Cache already loaded
1007
+        if ($num > 0) {
1008
+                    return 0;
1009
+        }
1010
+        // Cache already loaded
972 1011
 
973 1012
         dol_syslog(__METHOD__, LOG_DEBUG);
974 1013
 
@@ -1022,23 +1061,26 @@  discard block
 block discarded – undo
1022 1061
         print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1023 1062
         if ($showempty) {
1024 1063
             print '<option value="-1"';
1025
-            if ($selected == -1)
1026
-                print ' selected';
1064
+            if ($selected == -1) {
1065
+                            print ' selected';
1066
+            }
1027 1067
             print '>&nbsp;</option>';
1028 1068
         }
1029 1069
 
1030 1070
         foreach ($this->cache_types_fees as $key => $value) {
1031 1071
             print '<option value="' . $key . '"';
1032
-            if ($key == $selected)
1033
-                print ' selected';
1072
+            if ($key == $selected) {
1073
+                            print ' selected';
1074
+            }
1034 1075
             print '>';
1035 1076
             print $value;
1036 1077
             print '</option>';
1037 1078
         }
1038 1079
 
1039 1080
         print '</select>';
1040
-        if ($user->admin)
1041
-            print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1081
+        if ($user->admin) {
1082
+                    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1083
+        }
1042 1084
     }
1043 1085
 
1044 1086
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -1101,9 +1143,9 @@  discard block
 block discarded – undo
1101 1143
             $urloption = 'htmlname=' . $htmlname . '&outjson=1&filter=' . $filter . ($showtype ? '&showtype=' . $showtype : '');
1102 1144
             $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1103 1145
             $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
1104
-            if (empty($hidelabel))
1105
-                print $langs->trans("RefOrLabel") . ' : ';
1106
-            else if ($hidelabel > 1) {
1146
+            if (empty($hidelabel)) {
1147
+                            print $langs->trans("RefOrLabel") . ' : ';
1148
+            } else if ($hidelabel > 1) {
1107 1149
                 $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
1108 1150
                 if ($hidelabel == 2) {
1109 1151
                     $out .= img_picto($langs->trans("Search"), 'search');
@@ -1150,10 +1192,11 @@  discard block
 block discarded – undo
1150 1192
         $num = 0;
1151 1193
         $outarray = array();
1152 1194
 
1153
-        if ($selected === '')
1154
-            $selected = array();
1155
-        else if (!is_array($selected))
1156
-            $selected = array($selected);
1195
+        if ($selected === '') {
1196
+                    $selected = array();
1197
+        } else if (!is_array($selected)) {
1198
+                    $selected = array($selected);
1199
+        }
1157 1200
 
1158 1201
         // Clean $filter that may contains sql conditions so sql code
1159 1202
         if (function_exists('testSqlAndScriptInject')) {
@@ -1171,21 +1214,26 @@  discard block
 block discarded – undo
1171 1214
         }
1172 1215
 
1173 1216
         $sql .= " FROM (" . MAIN_DB_PREFIX . "societe as s";
1174
-        if (!$user->rights->societe->client->voir && !$user->socid)
1175
-            $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
1217
+        if (!$user->rights->societe->client->voir && !$user->socid) {
1218
+                    $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
1219
+        }
1176 1220
         $sql .= " )";
1177 1221
         if (Globals::$conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
1178 1222
             $sql .= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "c_country as dictp ON dictp.rowid=s.fk_pays";
1179 1223
         }
1180 1224
         $sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1181
-        if (!empty($user->socid))
1182
-            $sql .= " AND s.rowid = " . $user->socid;
1183
-        if ($filter)
1184
-            $sql .= " AND (" . $filter . ")";
1185
-        if (!$user->rights->societe->client->voir && !$user->socid)
1186
-            $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
1187
-        if (!empty(Globals::$conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX))
1188
-            $sql .= " AND s.status <> 0";
1225
+        if (!empty($user->socid)) {
1226
+                    $sql .= " AND s.rowid = " . $user->socid;
1227
+        }
1228
+        if ($filter) {
1229
+                    $sql .= " AND (" . $filter . ")";
1230
+        }
1231
+        if (!$user->rights->societe->client->voir && !$user->socid) {
1232
+                    $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
1233
+        }
1234
+        if (!empty(Globals::$conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) {
1235
+                    $sql .= " AND s.status <> 0";
1236
+        }
1189 1237
         // Add criteria
1190 1238
         if ($filterkey && $filterkey != '') {
1191 1239
             $sql .= " AND (";
@@ -1193,16 +1241,19 @@  discard block
 block discarded – undo
1193 1241
             // For natural search
1194 1242
             $scrit = explode(' ', $filterkey);
1195 1243
             $i = 0;
1196
-            if (count($scrit) > 1)
1197
-                $sql .= "(";
1244
+            if (count($scrit) > 1) {
1245
+                            $sql .= "(";
1246
+            }
1198 1247
             foreach ($scrit as $crit) {
1199
-                if ($i > 0)
1200
-                    $sql .= " AND ";
1248
+                if ($i > 0) {
1249
+                                    $sql .= " AND ";
1250
+                }
1201 1251
                 $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1202 1252
                 $i++;
1203 1253
             }
1204
-            if (count($scrit) > 1)
1205
-                $sql .= ")";
1254
+            if (count($scrit) > 1) {
1255
+                            $sql .= ")";
1256
+            }
1206 1257
             if (!empty(Globals::$conf->barcode->enabled)) {
1207 1258
                 $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1208 1259
             }
@@ -1228,13 +1279,15 @@  discard block
 block discarded – undo
1228 1279
             // Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
1229 1280
             //if (! empty(Globals::$conf->use_javascript_ajax) || $forcecombo) $textifempty='';
1230 1281
             if (!empty(Globals::$conf->global->COMPANY_USE_SEARCH_TO_SELECT)) {
1231
-                if ($showempty && !is_numeric($showempty))
1232
-                    $textifempty = $langs->trans($showempty);
1233
-                else
1234
-                    $textifempty .= $langs->trans("All");
1282
+                if ($showempty && !is_numeric($showempty)) {
1283
+                                    $textifempty = $langs->trans($showempty);
1284
+                } else {
1285
+                                    $textifempty .= $langs->trans("All");
1286
+                }
1235 1287
             }
1236
-            if ($showempty)
1237
-                $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
1288
+            if ($showempty) {
1289
+                            $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
1290
+            }
1238 1291
 
1239 1292
             $num = $this->db->num_rows($resql);
1240 1293
             $i = 0;
@@ -1259,16 +1312,21 @@  discard block
 block discarded – undo
1259 1312
                     }
1260 1313
 
1261 1314
                     if ($showtype) {
1262
-                        if ($obj->client || $obj->fournisseur)
1263
-                            $label .= ' (';
1264
-                        if ($obj->client == 1 || $obj->client == 3)
1265
-                            $label .= $langs->trans("Customer");
1266
-                        if ($obj->client == 2 || $obj->client == 3)
1267
-                            $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1268
-                        if ($obj->fournisseur)
1269
-                            $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1270
-                        if ($obj->client || $obj->fournisseur)
1271
-                            $label .= ')';
1315
+                        if ($obj->client || $obj->fournisseur) {
1316
+                                                    $label .= ' (';
1317
+                        }
1318
+                        if ($obj->client == 1 || $obj->client == 3) {
1319
+                                                    $label .= $langs->trans("Customer");
1320
+                        }
1321
+                        if ($obj->client == 2 || $obj->client == 3) {
1322
+                                                    $label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1323
+                        }
1324
+                        if ($obj->fournisseur) {
1325
+                                                    $label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1326
+                        }
1327
+                        if ($obj->client || $obj->fournisseur) {
1328
+                                                    $label .= ')';
1329
+                        }
1272 1330
                     }
1273 1331
 
1274 1332
                     if (Globals::$conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
@@ -1289,20 +1347,21 @@  discard block
 block discarded – undo
1289 1347
                     }
1290 1348
 
1291 1349
                     $i++;
1292
-                    if (($i % 10) == 0)
1293
-                        $out .= "\n";
1350
+                    if (($i % 10) == 0) {
1351
+                                            $out .= "\n";
1352
+                    }
1294 1353
                 }
1295 1354
             }
1296 1355
             $out .= '</select>' . "\n";
1297
-        }
1298
-        else {
1356
+        } else {
1299 1357
             AlDolUtils::dol_print_error($this->db);
1300 1358
         }
1301 1359
 
1302 1360
         $this->result = array('nbofthirdparties' => $num);
1303 1361
 
1304
-        if ($outputmode)
1305
-            return $outarray;
1362
+        if ($outputmode) {
1363
+                    return $outarray;
1364
+        }
1306 1365
         return $out;
1307 1366
     }
1308 1367
 
@@ -1328,8 +1387,9 @@  discard block
 block discarded – undo
1328 1387
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
1329 1388
         $sql .= " WHERE re.fk_soc = " . (int) $socid;
1330 1389
         $sql .= " AND re.entity = " . Globals::$conf->entity;
1331
-        if ($filter)
1332
-            $sql .= " AND " . $filter;
1390
+        if ($filter) {
1391
+                    $sql .= " AND " . $filter;
1392
+        }
1333 1393
         $sql .= " ORDER BY re.description ASC";
1334 1394
 
1335 1395
         dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
@@ -1346,18 +1406,23 @@  discard block
 block discarded – undo
1346 1406
                 while ($i < $num) {
1347 1407
                     $obj = $this->db->fetch_object($resql);
1348 1408
                     $desc = dol_trunc($obj->description, 40);
1349
-                    if (preg_match('/\(CREDIT_NOTE\)/', $desc))
1350
-                        $desc = preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $desc);
1351
-                    if (preg_match('/\(DEPOSIT\)/', $desc))
1352
-                        $desc = preg_replace('/\(DEPOSIT\)/', $langs->trans("Deposit"), $desc);
1353
-                    if (preg_match('/\(EXCESS RECEIVED\)/', $desc))
1354
-                        $desc = preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("ExcessReceived"), $desc);
1355
-                    if (preg_match('/\(EXCESS PAID\)/', $desc))
1356
-                        $desc = preg_replace('/\(EXCESS PAID\)/', $langs->trans("ExcessPaid"), $desc);
1409
+                    if (preg_match('/\(CREDIT_NOTE\)/', $desc)) {
1410
+                                            $desc = preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $desc);
1411
+                    }
1412
+                    if (preg_match('/\(DEPOSIT\)/', $desc)) {
1413
+                                            $desc = preg_replace('/\(DEPOSIT\)/', $langs->trans("Deposit"), $desc);
1414
+                    }
1415
+                    if (preg_match('/\(EXCESS RECEIVED\)/', $desc)) {
1416
+                                            $desc = preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("ExcessReceived"), $desc);
1417
+                    }
1418
+                    if (preg_match('/\(EXCESS PAID\)/', $desc)) {
1419
+                                            $desc = preg_replace('/\(EXCESS PAID\)/', $langs->trans("ExcessPaid"), $desc);
1420
+                    }
1357 1421
 
1358 1422
                     $selectstring = '';
1359
-                    if ($selected > 0 && $selected == $obj->rowid)
1360
-                        $selectstring = ' selected';
1423
+                    if ($selected > 0 && $selected == $obj->rowid) {
1424
+                                            $selectstring = ' selected';
1425
+                    }
1361 1426
 
1362 1427
                     $disabled = '';
1363 1428
                     if ($maxvalue > 0 && $obj->amount_ttc > $maxvalue) {
@@ -1367,8 +1432,9 @@  discard block
 block discarded – undo
1367 1432
 
1368 1433
                     if (!empty(Globals::$conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST) && !empty($obj->fk_facture_source)) {
1369 1434
                         $tmpfac = new Facture($this->db);
1370
-                        if ($tmpfac->fetch($obj->fk_facture_source) > 0)
1371
-                            $desc = $desc . ' - ' . $tmpfac->ref;
1435
+                        if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
1436
+                                                    $desc = $desc . ' - ' . $tmpfac->ref;
1437
+                        }
1372 1438
                     }
1373 1439
 
1374 1440
                     print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
@@ -1377,8 +1443,7 @@  discard block
 block discarded – undo
1377 1443
             }
1378 1444
             print '</select>';
1379 1445
             return $qualifiedlines;
1380
-        }
1381
-        else {
1446
+        } else {
1382 1447
             AlDolUtils::dol_print_error($this->db);
1383 1448
             return -1;
1384 1449
         }
@@ -1441,13 +1506,15 @@  discard block
 block discarded – undo
1441 1506
 
1442 1507
         $langs->load('companies');
1443 1508
 
1444
-        if (empty($htmlid))
1445
-            $htmlid = $htmlname;
1509
+        if (empty($htmlid)) {
1510
+                    $htmlid = $htmlname;
1511
+        }
1446 1512
 
1447
-        if ($selected === '')
1448
-            $selected = array();
1449
-        else if (!is_array($selected))
1450
-            $selected = array($selected);
1513
+        if ($selected === '') {
1514
+                    $selected = array();
1515
+        } else if (!is_array($selected)) {
1516
+                    $selected = array($selected);
1517
+        }
1451 1518
         $out = '';
1452 1519
 
1453 1520
         if (!is_object($hookmanager)) {
@@ -1457,16 +1524,20 @@  discard block
 block discarded – undo
1457 1524
 
1458 1525
         // We search third parties
1459 1526
         $sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste";
1460
-        if ($showsoc > 0)
1461
-            $sql .= " , s.nom as company";
1527
+        if ($showsoc > 0) {
1528
+                    $sql .= " , s.nom as company";
1529
+        }
1462 1530
         $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as sp";
1463
-        if ($showsoc > 0)
1464
-            $sql .= " LEFT OUTER JOIN  " . MAIN_DB_PREFIX . "societe as s ON s.rowid=sp.fk_soc";
1531
+        if ($showsoc > 0) {
1532
+                    $sql .= " LEFT OUTER JOIN  " . MAIN_DB_PREFIX . "societe as s ON s.rowid=sp.fk_soc";
1533
+        }
1465 1534
         $sql .= " WHERE sp.entity IN (" . getEntity('socpeople') . ")";
1466
-        if ($socid > 0 || $socid == -1)
1467
-            $sql .= " AND sp.fk_soc=" . $socid;
1468
-        if (!empty(Globals::$conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX))
1469
-            $sql .= " AND sp.statut <> 0";
1535
+        if ($socid > 0 || $socid == -1) {
1536
+                    $sql .= " AND sp.fk_soc=" . $socid;
1537
+        }
1538
+        if (!empty(Globals::$conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
1539
+                    $sql .= " AND sp.statut <> 0";
1540
+        }
1470 1541
         $sql .= " ORDER BY sp.lastname ASC";
1471 1542
 
1472 1543
         dol_syslog(get_class($this) . "::select_contacts", LOG_DEBUG);
@@ -1479,12 +1550,15 @@  discard block
 block discarded – undo
1479 1550
                 $out .= ajax_combobox($htmlid, $events, Globals::$conf->global->CONTACT_USE_SEARCH_TO_SELECT);
1480 1551
             }
1481 1552
 
1482
-            if ($htmlname != 'none' || $options_only)
1483
-                $out .= '<select class="flat' . ($moreclass ? ' ' . $moreclass : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1484
-            if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple)
1485
-                $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1486
-            if ($showempty == 2)
1487
-                $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>' . $langs->trans("Internal") . '</option>';
1553
+            if ($htmlname != 'none' || $options_only) {
1554
+                            $out .= '<select class="flat' . ($moreclass ? ' ' . $moreclass : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1555
+            }
1556
+            if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1557
+                            $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1558
+            }
1559
+            if ($showempty == 2) {
1560
+                            $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>' . $langs->trans("Internal") . '</option>';
1561
+            }
1488 1562
             $num = $this->db->num_rows($resql);
1489 1563
             $i = 0;
1490 1564
             if ($num) {
@@ -1500,49 +1574,56 @@  discard block
 block discarded – undo
1500 1574
                     if ($obj->statut == 1) {
1501 1575
                         if ($htmlname != 'none') {
1502 1576
                             $disabled = 0;
1503
-                            if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude))
1504
-                                $disabled = 1;
1505
-                            if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto))
1506
-                                $disabled = 1;
1577
+                            if (is_array($exclude) && count($exclude) && in_array($obj->rowid, $exclude)) {
1578
+                                                            $disabled = 1;
1579
+                            }
1580
+                            if (is_array($limitto) && count($limitto) && !in_array($obj->rowid, $limitto)) {
1581
+                                                            $disabled = 1;
1582
+                            }
1507 1583
                             if (!empty($selected) && in_array($obj->rowid, $selected)) {
1508 1584
                                 $out .= '<option value="' . $obj->rowid . '"';
1509
-                                if ($disabled)
1510
-                                    $out .= ' disabled';
1585
+                                if ($disabled) {
1586
+                                                                    $out .= ' disabled';
1587
+                                }
1511 1588
                                 $out .= ' selected>';
1512 1589
                                 $out .= $contactstatic->getFullName($langs);
1513
-                                if ($showfunction && $obj->poste)
1514
-                                    $out .= ' (' . $obj->poste . ')';
1515
-                                if (($showsoc > 0) && $obj->company)
1516
-                                    $out .= ' - (' . $obj->company . ')';
1590
+                                if ($showfunction && $obj->poste) {
1591
+                                                                    $out .= ' (' . $obj->poste . ')';
1592
+                                }
1593
+                                if (($showsoc > 0) && $obj->company) {
1594
+                                                                    $out .= ' - (' . $obj->company . ')';
1595
+                                }
1517 1596
                                 $out .= '</option>';
1518
-                            }
1519
-                            else {
1597
+                            } else {
1520 1598
                                 $out .= '<option value="' . $obj->rowid . '"';
1521
-                                if ($disabled)
1522
-                                    $out .= ' disabled';
1599
+                                if ($disabled) {
1600
+                                                                    $out .= ' disabled';
1601
+                                }
1523 1602
                                 $out .= '>';
1524 1603
                                 $out .= $contactstatic->getFullName($langs);
1525
-                                if ($showfunction && $obj->poste)
1526
-                                    $out .= ' (' . $obj->poste . ')';
1527
-                                if (($showsoc > 0) && $obj->company)
1528
-                                    $out .= ' - (' . $obj->company . ')';
1604
+                                if ($showfunction && $obj->poste) {
1605
+                                                                    $out .= ' (' . $obj->poste . ')';
1606
+                                }
1607
+                                if (($showsoc > 0) && $obj->company) {
1608
+                                                                    $out .= ' - (' . $obj->company . ')';
1609
+                                }
1529 1610
                                 $out .= '</option>';
1530 1611
                             }
1531
-                        }
1532
-                        else {
1612
+                        } else {
1533 1613
                             if (in_array($obj->rowid, $selected)) {
1534 1614
                                 $out .= $contactstatic->getFullName($langs);
1535
-                                if ($showfunction && $obj->poste)
1536
-                                    $out .= ' (' . $obj->poste . ')';
1537
-                                if (($showsoc > 0) && $obj->company)
1538
-                                    $out .= ' - (' . $obj->company . ')';
1615
+                                if ($showfunction && $obj->poste) {
1616
+                                                                    $out .= ' (' . $obj->poste . ')';
1617
+                                }
1618
+                                if (($showsoc > 0) && $obj->company) {
1619
+                                                                    $out .= ' - (' . $obj->company . ')';
1620
+                                }
1539 1621
                             }
1540 1622
                         }
1541 1623
                     }
1542 1624
                     $i++;
1543 1625
                 }
1544
-            }
1545
-            else {
1626
+            } else {
1546 1627
                 $out .= '<option value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled>';
1547 1628
                 $out .= ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1548 1629
                 $out .= '</option>';
@@ -1623,24 +1704,27 @@  discard block
 block discarded – undo
1623 1704
         global $conf, $user, $langs;
1624 1705
 
1625 1706
         // If no preselected user defined, we take current user
1626
-        if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty(Globals::$conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE))
1627
-            $selected = $user->id;
1707
+        if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty(Globals::$conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) {
1708
+                    $selected = $user->id;
1709
+        }
1628 1710
 
1629
-        if ($selected === '')
1630
-            $selected = array();
1631
-        else if (!is_array($selected))
1632
-            $selected = array($selected);
1711
+        if ($selected === '') {
1712
+                    $selected = array();
1713
+        } else if (!is_array($selected)) {
1714
+                    $selected = array($selected);
1715
+        }
1633 1716
 
1634 1717
         $excludeUsers = null;
1635 1718
         $includeUsers = null;
1636 1719
 
1637 1720
         // Permettre l'exclusion d'utilisateurs
1638
-        if (is_array($exclude))
1639
-            $excludeUsers = implode(",", $exclude);
1721
+        if (is_array($exclude)) {
1722
+                    $excludeUsers = implode(",", $exclude);
1723
+        }
1640 1724
         // Permettre l'inclusion d'utilisateurs
1641
-        if (is_array($include))
1642
-            $includeUsers = implode(",", $include);
1643
-        else if ($include == 'hierarchy') {
1725
+        if (is_array($include)) {
1726
+                    $includeUsers = implode(",", $include);
1727
+        } else if ($include == 'hierarchy') {
1644 1728
             // Build list includeUsers to have only hierarchy
1645 1729
             $includeUsers = implode(",", $user->getAllChildIds(0));
1646 1730
         } else if ($include == 'hierarchyme') {
@@ -1659,12 +1743,12 @@  discard block
 block discarded – undo
1659 1743
         $sql .= " FROM " . MAIN_DB_PREFIX . "user as u";
1660 1744
         if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) {
1661 1745
             $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=u.entity";
1662
-            if ($force_entity)
1663
-                $sql .= " WHERE u.entity IN (0," . $force_entity . ")";
1664
-            else
1665
-                $sql .= " WHERE u.entity IS NOT NULL";
1666
-        }
1667
-        else {
1746
+            if ($force_entity) {
1747
+                            $sql .= " WHERE u.entity IN (0," . $force_entity . ")";
1748
+            } else {
1749
+                            $sql .= " WHERE u.entity IS NOT NULL";
1750
+            }
1751
+        } else {
1668 1752
             if (!empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
1669 1753
                 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "usergroup_user as ug";
1670 1754
                 $sql .= " ON ug.fk_user = u.rowid";
@@ -1673,16 +1757,21 @@  discard block
 block discarded – undo
1673 1757
                 $sql .= " WHERE u.entity IN (0," . Globals::$conf->entity . ")";
1674 1758
             }
1675 1759
         }
1676
-        if (!empty($user->societe_id))
1677
-            $sql .= " AND u.fk_soc = " . $user->societe_id;
1678
-        if (is_array($exclude) && $excludeUsers)
1679
-            $sql .= " AND u.rowid NOT IN (" . $excludeUsers . ")";
1680
-        if ($includeUsers)
1681
-            $sql .= " AND u.rowid IN (" . $includeUsers . ")";
1682
-        if (!empty(Globals::$conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive)
1683
-            $sql .= " AND u.statut <> 0";
1684
-        if (!empty($morefilter))
1685
-            $sql .= " " . $morefilter;
1760
+        if (!empty($user->societe_id)) {
1761
+                    $sql .= " AND u.fk_soc = " . $user->societe_id;
1762
+        }
1763
+        if (is_array($exclude) && $excludeUsers) {
1764
+                    $sql .= " AND u.rowid NOT IN (" . $excludeUsers . ")";
1765
+        }
1766
+        if ($includeUsers) {
1767
+                    $sql .= " AND u.rowid IN (" . $includeUsers . ")";
1768
+        }
1769
+        if (!empty(Globals::$conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) {
1770
+                    $sql .= " AND u.statut <> 0";
1771
+        }
1772
+        if (!empty($morefilter)) {
1773
+                    $sql .= " " . $morefilter;
1774
+        }
1686 1775
 
1687 1776
         if (empty(Globals::$conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
1688 1777
             $sql .= " ORDER BY u.firstname ASC";
@@ -1702,10 +1791,12 @@  discard block
 block discarded – undo
1702 1791
 
1703 1792
                 // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
1704 1793
                 $out .= '<select class="flat' . ($morecss ? ' minwidth100 ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
1705
-                if ($show_empty && !$multiple)
1706
-                    $out .= '<option value="-1"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
1707
-                if ($show_every)
1708
-                    $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
1794
+                if ($show_empty && !$multiple) {
1795
+                                    $out .= '<option value="-1"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
1796
+                }
1797
+                if ($show_every) {
1798
+                                    $out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
1799
+                }
1709 1800
 
1710 1801
                 $userstatic = new User($this->db);
1711 1802
 
@@ -1717,19 +1808,21 @@  discard block
 block discarded – undo
1717 1808
                     $userstatic->firstname = $obj->firstname;
1718 1809
 
1719 1810
                     $disableline = '';
1720
-                    if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly))
1721
-                        $disableline = ($enableonlytext ? $enableonlytext : '1');
1811
+                    if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) {
1812
+                                            $disableline = ($enableonlytext ? $enableonlytext : '1');
1813
+                    }
1722 1814
 
1723 1815
                     if ((is_object($selected) && $selected->id == $obj->rowid) || (!is_object($selected) && in_array($obj->rowid, $selected) )) {
1724 1816
                         $out .= '<option value="' . $obj->rowid . '"';
1725
-                        if ($disableline)
1726
-                            $out .= ' disabled';
1817
+                        if ($disableline) {
1818
+                                                    $out .= ' disabled';
1819
+                        }
1727 1820
                         $out .= ' selected>';
1728
-                    }
1729
-                    else {
1821
+                    } else {
1730 1822
                         $out .= '<option value="' . $obj->rowid . '"';
1731
-                        if ($disableline)
1732
-                            $out .= ' disabled';
1823
+                        if ($disableline) {
1824
+                                                    $out .= ' disabled';
1825
+                        }
1733 1826
                         $out .= '>';
1734 1827
                     }
1735 1828
 
@@ -1783,8 +1876,9 @@  discard block
 block discarded – undo
1783 1876
             AlDolUtils::dol_print_error($this->db);
1784 1877
         }
1785 1878
 
1786
-        if ($outputmode)
1787
-            return $outarray;
1879
+        if ($outputmode) {
1880
+                    return $outarray;
1881
+        }
1788 1882
         return $out;
1789 1883
     }
1790 1884
 
@@ -1836,15 +1930,18 @@  discard block
 block discarded – undo
1836 1930
         }
1837 1931
         $nbassignetouser = count($assignedtouser);
1838 1932
 
1839
-        if ($nbassignetouser && $action != 'view')
1840
-            $out .= '<br>';
1841
-        if ($nbassignetouser)
1842
-            $out .= '<ul class="attendees">';
1933
+        if ($nbassignetouser && $action != 'view') {
1934
+                    $out .= '<br>';
1935
+        }
1936
+        if ($nbassignetouser) {
1937
+                    $out .= '<ul class="attendees">';
1938
+        }
1843 1939
         $i = 0;
1844 1940
         $ownerid = 0;
1845 1941
         foreach ($assignedtouser as $key => $value) {
1846
-            if ($value['id'] == $ownerid)
1847
-                continue;
1942
+            if ($value['id'] == $ownerid) {
1943
+                            continue;
1944
+            }
1848 1945
 
1849 1946
             $out .= '<li>';
1850 1947
             $userstatic->fetch($value['id']);
@@ -1870,8 +1967,9 @@  discard block
 block discarded – undo
1870 1967
             $out .= '</li>';
1871 1968
             $i++;
1872 1969
         }
1873
-        if ($nbassignetouser)
1874
-            $out .= '</ul>';
1970
+        if ($nbassignetouser) {
1971
+                    $out .= '</ul>';
1972
+        }
1875 1973
 
1876 1974
         //$out.='</form>';
1877 1975
         return $out;
@@ -2002,9 +2100,9 @@  discard block
 block discarded – undo
2002 2100
                                 </script>
2003 2101
                                 <?php
2004 2102
                             }
2005
-                            if (empty($hidelabel))
2006
-                                print $langs->trans("RefOrLabel") . ' : ';
2007
-                            else if ($hidelabel > 1) {
2103
+                            if (empty($hidelabel)) {
2104
+                                                            print $langs->trans("RefOrLabel") . ' : ';
2105
+                            } else if ($hidelabel > 1) {
2008 2106
                                 $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
2009 2107
                                 if ($hidelabel == 2) {
2010 2108
                                     print img_picto($langs->trans("Search"), 'search');
@@ -2095,13 +2193,15 @@  discard block
 block discarded – undo
2095 2193
         // Price by quantity
2096 2194
         if (!empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
2097 2195
             $sql .= ", (SELECT pp.rowid FROM " . MAIN_DB_PREFIX . "product_price as pp WHERE pp.fk_product = p.rowid";
2098
-            if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
2099
-                $sql .= " AND price_level=" . $price_level;
2196
+            if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
2197
+                            $sql .= " AND price_level=" . $price_level;
2198
+            }
2100 2199
             $sql .= " ORDER BY date_price";
2101 2200
             $sql .= " DESC LIMIT 1) as price_rowid";
2102 2201
             $sql .= ", (SELECT pp.price_by_qty FROM " . MAIN_DB_PREFIX . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2103
-            if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
2104
-                $sql .= " AND price_level=" . $price_level;
2202
+            if ($price_level >= 1 && !empty(Globals::$conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
2203
+                            $sql .= " AND price_level=" . $price_level;
2204
+            }
2105 2205
             $sql .= " ORDER BY date_price";
2106 2206
             $sql .= " DESC LIMIT 1) as price_by_qty";
2107 2207
             $selectFields .= ", price_rowid, price_by_qty";
@@ -2143,14 +2243,15 @@  discard block
 block discarded – undo
2143 2243
             $sql .= " AND p.finished = " . $finished;
2144 2244
         } elseif ($finished == 1) {
2145 2245
             $sql .= " AND p.finished = " . $finished;
2146
-            if ($status >= 0)
2147
-                $sql .= " AND p.tosell = " . $status;
2148
-        }
2149
-        elseif ($status >= 0) {
2246
+            if ($status >= 0) {
2247
+                            $sql .= " AND p.tosell = " . $status;
2248
+            }
2249
+        } elseif ($status >= 0) {
2150 2250
             $sql .= " AND p.tosell = " . $status;
2151 2251
         }
2152
-        if (strval($filtertype) != '')
2153
-            $sql .= " AND p.fk_product_type=" . $filtertype;
2252
+        if (strval($filtertype) != '') {
2253
+                    $sql .= " AND p.fk_product_type=" . $filtertype;
2254
+        }
2154 2255
         // Add criteria on ref/label
2155 2256
         if ($filterkey != '') {
2156 2257
             $sql .= ' AND (';
@@ -2158,28 +2259,35 @@  discard block
 block discarded – undo
2158 2259
             // For natural search
2159 2260
             $scrit = explode(' ', $filterkey);
2160 2261
             $i = 0;
2161
-            if (count($scrit) > 1)
2162
-                $sql .= "(";
2262
+            if (count($scrit) > 1) {
2263
+                            $sql .= "(";
2264
+            }
2163 2265
             foreach ($scrit as $crit) {
2164
-                if ($i > 0)
2165
-                    $sql .= " AND ";
2266
+                if ($i > 0) {
2267
+                                    $sql .= " AND ";
2268
+                }
2166 2269
                 $sql .= "(p.ref LIKE '" . $db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $db->escape($prefix . $crit) . "%'";
2167
-                if (!empty(Globals::$conf->global->MAIN_MULTILANGS))
2168
-                    $sql .= " OR pl.label LIKE '" . $db->escape($prefix . $crit) . "%'";
2270
+                if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) {
2271
+                                    $sql .= " OR pl.label LIKE '" . $db->escape($prefix . $crit) . "%'";
2272
+                }
2169 2273
                 if (!empty(Globals::$conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION)) {
2170 2274
                     $sql .= " OR p.description LIKE '" . $db->escape($prefix . $crit) . "%'";
2171
-                    if (!empty(Globals::$conf->global->MAIN_MULTILANGS))
2172
-                        $sql .= " OR pl.description LIKE '" . $db->escape($prefix . $crit) . "%'";
2275
+                    if (!empty(Globals::$conf->global->MAIN_MULTILANGS)) {
2276
+                                            $sql .= " OR pl.description LIKE '" . $db->escape($prefix . $crit) . "%'";
2277
+                    }
2173 2278
                 }
2174
-                if (!empty(Globals::$conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF))
2175
-                    $sql .= " OR pfp.ref_fourn LIKE '" . $db->escape($prefix . $crit) . "%'";
2279
+                if (!empty(Globals::$conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
2280
+                                    $sql .= " OR pfp.ref_fourn LIKE '" . $db->escape($prefix . $crit) . "%'";
2281
+                }
2176 2282
                 $sql .= ")";
2177 2283
                 $i++;
2178 2284
             }
2179
-            if (count($scrit) > 1)
2180
-                $sql .= ")";
2181
-            if (!empty(Globals::$conf->barcode->enabled))
2182
-                $sql .= " OR p.barcode LIKE '" . $db->escape($prefix . $filterkey) . "%'";
2285
+            if (count($scrit) > 1) {
2286
+                            $sql .= ")";
2287
+            }
2288
+            if (!empty(Globals::$conf->barcode->enabled)) {
2289
+                            $sql .= " OR p.barcode LIKE '" . $db->escape($prefix . $filterkey) . "%'";
2290
+            }
2183 2291
             $sql .= ')';
2184 2292
         }
2185 2293
         if (count($warehouseStatusArray)) {
@@ -2218,13 +2326,15 @@  discard block
 block discarded – undo
2218 2326
             // Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
2219 2327
             //if (! empty(Globals::$conf->use_javascript_ajax) || $forcecombo) $textifempty='';
2220 2328
             if (!empty(Globals::$conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) {
2221
-                if ($showempty && !is_numeric($showempty))
2222
-                    $textifempty = $langs->trans($showempty);
2223
-                else
2224
-                    $textifempty .= $langs->trans("All");
2329
+                if ($showempty && !is_numeric($showempty)) {
2330
+                                    $textifempty = $langs->trans($showempty);
2331
+                } else {
2332
+                                    $textifempty .= $langs->trans("All");
2333
+                }
2225 2334
             }
2226
-            if ($showempty)
2227
-                $out .= '<option value="0" selected>' . $textifempty . '</option>';
2335
+            if ($showempty) {
2336
+                            $out .= '<option value="0" selected>' . $textifempty . '</option>';
2337
+            }
2228 2338
 
2229 2339
             $i = 0;
2230 2340
             while ($num && $i < $num) {
@@ -2298,11 +2408,11 @@  discard block
 block discarded – undo
2298 2408
 
2299 2409
             $this->db->free($result);
2300 2410
 
2301
-            if (empty($outputmode))
2302
-                return $out;
2411
+            if (empty($outputmode)) {
2412
+                            return $out;
2413
+            }
2303 2414
             return $outarray;
2304
-        }
2305
-        else {
2415
+        } else {
2306 2416
             AlDolUtils::dol_print_error($db);
2307 2417
         }
2308 2418
     }
@@ -2339,10 +2449,12 @@  discard block
 block discarded – undo
2339 2449
         $maxlengtharticle = (empty(Globals::$conf->global->PRODUCT_MAX_LENGTH_COMBO) ? 48 : Globals::$conf->global->PRODUCT_MAX_LENGTH_COMBO);
2340 2450
 
2341 2451
         $label = $objp->label;
2342
-        if (!empty($objp->label_translated))
2343
-            $label = $objp->label_translated;
2344
-        if (!empty($filterkey) && $filterkey != '')
2345
-            $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1);
2452
+        if (!empty($objp->label_translated)) {
2453
+                    $label = $objp->label_translated;
2454
+        }
2455
+        if (!empty($filterkey) && $filterkey != '') {
2456
+                    $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1);
2457
+        }
2346 2458
 
2347 2459
         $outkey = $objp->rowid;
2348 2460
         $outref = $objp->ref;
@@ -2360,23 +2472,27 @@  discard block
 block discarded – undo
2360 2472
             $opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"';
2361 2473
         }
2362 2474
         if (!empty(Globals::$conf->stock->enabled) && $objp->fk_product_type == 0 && isset($objp->stock)) {
2363
-            if ($objp->stock > 0)
2364
-                $opt .= ' class="product_line_stock_ok"';
2365
-            else if ($objp->stock <= 0)
2366
-                $opt .= ' class="product_line_stock_too_low"';
2475
+            if ($objp->stock > 0) {
2476
+                            $opt .= ' class="product_line_stock_ok"';
2477
+            } else if ($objp->stock <= 0) {
2478
+                            $opt .= ' class="product_line_stock_too_low"';
2479
+            }
2367 2480
         }
2368 2481
         $opt .= '>';
2369 2482
         $opt .= $objp->ref;
2370
-        if ($outbarcode)
2371
-            $opt .= ' (' . $outbarcode . ')';
2483
+        if ($outbarcode) {
2484
+                    $opt .= ' (' . $outbarcode . ')';
2485
+        }
2372 2486
         $opt .= ' - ' . dol_trunc($label, $maxlengtharticle);
2373 2487
 
2374 2488
         $objRef = $objp->ref;
2375
-        if (!empty($filterkey) && $filterkey != '')
2376
-            $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1);
2489
+        if (!empty($filterkey) && $filterkey != '') {
2490
+                    $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1);
2491
+        }
2377 2492
         $outval .= $objRef;
2378
-        if ($outbarcode)
2379
-            $outval .= ' (' . $outbarcode . ')';
2493
+        if ($outbarcode) {
2494
+                    $outval .= ' (' . $outbarcode . ')';
2495
+        }
2380 2496
         $outval .= ' - ' . dol_trunc($label, $maxlengtharticle);
2381 2497
 
2382 2498
         $found = 0;
@@ -2575,15 +2691,18 @@  discard block
 block discarded – undo
2575 2691
         $sql .= " pfp.supplier_reputation";
2576 2692
         $sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
2577 2693
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2578
-        if ($socid)
2579
-            $sql .= " AND pfp.fk_soc = " . $socid;
2694
+        if ($socid) {
2695
+                    $sql .= " AND pfp.fk_soc = " . $socid;
2696
+        }
2580 2697
         $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON pfp.fk_soc = s.rowid";
2581 2698
         $sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
2582 2699
         $sql .= " AND p.tobuy = 1";
2583
-        if (strval($filtertype) != '')
2584
-            $sql .= " AND p.fk_product_type=" . $this->db->escape($filtertype);
2585
-        if (!empty($filtre))
2586
-            $sql .= " " . $filtre;
2700
+        if (strval($filtertype) != '') {
2701
+                    $sql .= " AND p.fk_product_type=" . $this->db->escape($filtertype);
2702
+        }
2703
+        if (!empty($filtre)) {
2704
+                    $sql .= " " . $filtre;
2705
+        }
2587 2706
         // Add criteria on ref/label
2588 2707
         if ($filterkey != '') {
2589 2708
             $sql .= ' AND (';
@@ -2591,18 +2710,22 @@  discard block
 block discarded – undo
2591 2710
             // For natural search
2592 2711
             $scrit = explode(' ', $filterkey);
2593 2712
             $i = 0;
2594
-            if (count($scrit) > 1)
2595
-                $sql .= "(";
2713
+            if (count($scrit) > 1) {
2714
+                            $sql .= "(";
2715
+            }
2596 2716
             foreach ($scrit as $crit) {
2597
-                if ($i > 0)
2598
-                    $sql .= " AND ";
2717
+                if ($i > 0) {
2718
+                                    $sql .= " AND ";
2719
+                }
2599 2720
                 $sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%')";
2600 2721
                 $i++;
2601 2722
             }
2602
-            if (count($scrit) > 1)
2603
-                $sql .= ")";
2604
-            if (!empty(Globals::$conf->barcode->enabled))
2605
-                $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
2723
+            if (count($scrit) > 1) {
2724
+                            $sql .= ")";
2725
+            }
2726
+            if (!empty(Globals::$conf->barcode->enabled)) {
2727
+                            $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
2728
+            }
2606 2729
             $sql .= ')';
2607 2730
         }
2608 2731
         $sql .= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
@@ -2619,18 +2742,21 @@  discard block
 block discarded – undo
2619 2742
 
2620 2743
             //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
2621 2744
             $out .= '<select class="flat maxwidthonsmartphone" id="' . $htmlname . '" name="' . $htmlname . '">';
2622
-            if (!$selected)
2623
-                $out .= '<option value="0" selected>&nbsp;</option>';
2624
-            else
2625
-                $out .= '<option value="0">&nbsp;</option>';
2745
+            if (!$selected) {
2746
+                            $out .= '<option value="0" selected>&nbsp;</option>';
2747
+            } else {
2748
+                            $out .= '<option value="0">&nbsp;</option>';
2749
+            }
2626 2750
 
2627 2751
             $i = 0;
2628 2752
             while ($i < $num) {
2629 2753
                 $objp = $this->db->fetch_object($result);
2630 2754
 
2631 2755
                 $outkey = $objp->idprodfournprice;                                                    // id in table of price
2632
-                if (!$outkey && $alsoproductwithnosupplierprice)
2633
-                    $outkey = 'idprod_' . $objp->rowid;   // id of product
2756
+                if (!$outkey && $alsoproductwithnosupplierprice) {
2757
+                                    $outkey = 'idprod_' . $objp->rowid;
2758
+                }
2759
+                // id of product
2634 2760
 
2635 2761
                 $outref = $objp->ref;
2636 2762
                 $outval = '';
@@ -2641,32 +2767,39 @@  discard block
 block discarded – undo
2641 2767
                 $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
2642 2768
 
2643 2769
                 $opt = '<option value="' . $outkey . '"';
2644
-                if ($selected && $selected == $objp->idprodfournprice)
2645
-                    $opt .= ' selected';
2646
-                if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice))
2647
-                    $opt .= ' disabled';
2770
+                if ($selected && $selected == $objp->idprodfournprice) {
2771
+                                    $opt .= ' selected';
2772
+                }
2773
+                if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) {
2774
+                                    $opt .= ' disabled';
2775
+                }
2648 2776
                 if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
2649 2777
                     $opt .= ' pbq="' . $objp->idprodfournprice . '" data-pbq="' . $objp->idprodfournprice . '" data-pbqqty="' . $objp->quantity . '" data-pbqpercent="' . $objp->remise_percent . '"';
2650 2778
                 }
2651 2779
                 $opt .= '>';
2652 2780
 
2653 2781
                 $objRef = $objp->ref;
2654
-                if ($filterkey && $filterkey != '')
2655
-                    $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1);
2782
+                if ($filterkey && $filterkey != '') {
2783
+                                    $objRef = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRef, 1);
2784
+                }
2656 2785
                 $objRefFourn = $objp->ref_fourn;
2657
-                if ($filterkey && $filterkey != '')
2658
-                    $objRefFourn = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
2786
+                if ($filterkey && $filterkey != '') {
2787
+                                    $objRefFourn = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
2788
+                }
2659 2789
                 $label = $objp->label;
2660
-                if ($filterkey && $filterkey != '')
2661
-                    $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1);
2790
+                if ($filterkey && $filterkey != '') {
2791
+                                    $label = preg_replace('/(' . preg_quote($filterkey) . ')/i', '<strong>$1</strong>', $label, 1);
2792
+                }
2662 2793
 
2663 2794
                 $opt .= $objp->ref;
2664
-                if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
2665
-                    $opt .= ' (' . $objp->ref_fourn . ')';
2795
+                if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
2796
+                                    $opt .= ' (' . $objp->ref_fourn . ')';
2797
+                }
2666 2798
                 $opt .= ' - ';
2667 2799
                 $outval .= $objRef;
2668
-                if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
2669
-                    $outval .= ' (' . $objRefFourn . ')';
2800
+                if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
2801
+                                    $outval .= ' (' . $objRefFourn . ')';
2802
+                }
2670 2803
                 $outval .= ' - ';
2671 2804
                 $opt .= dol_trunc($label, 72) . ' - ';
2672 2805
                 $outval .= dol_trunc($label, 72) . ' - ';
@@ -2760,11 +2893,11 @@  discard block
 block discarded – undo
2760 2893
             include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2761 2894
             $out .= ajax_combobox($htmlname);
2762 2895
 
2763
-            if (empty($outputmode))
2764
-                return $out;
2896
+            if (empty($outputmode)) {
2897
+                            return $out;
2898
+            }
2765 2899
             return $outarray;
2766
-        }
2767
-        else {
2900
+        } else {
2768 2901
             AlDolUtils::dol_print_error($this->db);
2769 2902
         }
2770 2903
     }
@@ -2853,8 +2986,9 @@  discard block
 block discarded – undo
2853 2986
                         $opt .= " - ";
2854 2987
                         $opt .= price($objp->unitprice, 1, $langs, 0, 0, -1, Globals::$conf->currency) . "/" . $langs->trans("Unit");
2855 2988
                     }
2856
-                    if ($objp->duration)
2857
-                        $opt .= " - " . $objp->duration;
2989
+                    if ($objp->duration) {
2990
+                                            $opt .= " - " . $objp->duration;
2991
+                    }
2858 2992
                     $opt .= "</option>\n";
2859 2993
 
2860 2994
                     $form .= $opt;
@@ -2865,8 +2999,7 @@  discard block
 block discarded – undo
2865 2999
             $form .= '</select>';
2866 3000
             $this->db->free($result);
2867 3001
             return $form;
2868
-        }
2869
-        else {
3002
+        } else {
2870 3003
             AlDolUtils::dol_print_error($this->db);
2871 3004
         }
2872 3005
     }
@@ -2894,8 +3027,9 @@  discard block
 block discarded – undo
2894 3027
         $resql = $this->db->query($sql);
2895 3028
         if ($resql) {
2896 3029
             print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
2897
-            if ($showempty)
2898
-                print '<option value="0">&nbsp;</option>';
3030
+            if ($showempty) {
3031
+                            print '<option value="0">&nbsp;</option>';
3032
+            }
2899 3033
             $num = $this->db->num_rows($resql);
2900 3034
             $i = 0;
2901 3035
             if ($num) {
@@ -2929,8 +3063,10 @@  discard block
 block discarded – undo
2929 3063
         global $langs;
2930 3064
 
2931 3065
         $num = count($this->cache_conditions_paiements);
2932
-        if ($num > 0)
2933
-            return 0;    // Cache already loaded
3066
+        if ($num > 0) {
3067
+                    return 0;
3068
+        }
3069
+        // Cache already loaded
2934 3070
 
2935 3071
         dol_syslog(__METHOD__, LOG_DEBUG);
2936 3072
 
@@ -2975,8 +3111,10 @@  discard block
 block discarded – undo
2975 3111
         global $langs;
2976 3112
 
2977 3113
         $num = count($this->cache_availability);
2978
-        if ($num > 0)
2979
-            return 0;    // Cache already loaded
3114
+        if ($num > 0) {
3115
+                    return 0;
3116
+        }
3117
+        // Cache already loaded
2980 3118
 
2981 3119
         dol_syslog(__METHOD__, LOG_DEBUG);
2982 3120
 
@@ -3027,8 +3165,9 @@  discard block
 block discarded – undo
3027 3165
         dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
3028 3166
 
3029 3167
         print '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
3030
-        if ($addempty)
3031
-            print '<option value="0">&nbsp;</option>';
3168
+        if ($addempty) {
3169
+                    print '<option value="0">&nbsp;</option>';
3170
+        }
3032 3171
         foreach ($this->cache_availability as $id => $arrayavailability) {
3033 3172
             if ($selected == $id) {
3034 3173
                 print '<option value="' . $id . '" selected>';
@@ -3039,8 +3178,9 @@  discard block
 block discarded – undo
3039 3178
             print '</option>';
3040 3179
         }
3041 3180
         print '</select>';
3042
-        if ($user->admin)
3043
-            print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3181
+        if ($user->admin) {
3182
+                    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3183
+        }
3044 3184
     }
3045 3185
 
3046 3186
     /**
@@ -3053,8 +3193,10 @@  discard block
 block discarded – undo
3053 3193
         global $langs;
3054 3194
 
3055 3195
         $num = count($this->cache_demand_reason);
3056
-        if ($num > 0)
3057
-            return 0;    // Cache already loaded
3196
+        if ($num > 0) {
3197
+                    return 0;
3198
+        }
3199
+        // Cache already loaded
3058 3200
 
3059 3201
         $sql = "SELECT rowid, code, label";
3060 3202
         $sql .= " FROM " . MAIN_DB_PREFIX . 'c_input_reason';
@@ -3070,10 +3212,14 @@  discard block
 block discarded – undo
3070 3212
 
3071 3213
                 // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
3072 3214
                 $label = ($obj->label != '-' ? $obj->label : '');
3073
-                if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code))
3074
-                    $label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
3075
-                if ($langs->trans($obj->code) != $obj->code)
3076
-                    $label = $langs->trans($obj->code);                // So translation key SRC_XXX will work
3215
+                if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code)) {
3216
+                                    $label = $langs->trans("DemandReasonType" . $obj->code);
3217
+                }
3218
+                // So translation key DemandReasonTypeSRC_XXX will work
3219
+                if ($langs->trans($obj->code) != $obj->code) {
3220
+                                    $label = $langs->trans($obj->code);
3221
+                }
3222
+                // So translation key SRC_XXX will work
3077 3223
 
3078 3224
                 $tmparray[$obj->rowid]['id'] = $obj->rowid;
3079 3225
                 $tmparray[$obj->rowid]['code'] = $obj->code;
@@ -3085,8 +3231,7 @@  discard block
 block discarded – undo
3085 3231
 
3086 3232
             unset($tmparray);
3087 3233
             return $num;
3088
-        }
3089
-        else {
3234
+        } else {
3090 3235
             AlDolUtils::dol_print_error($this->db);
3091 3236
             return -1;
3092 3237
         }
@@ -3109,11 +3254,13 @@  discard block
 block discarded – undo
3109 3254
         $this->loadCacheInputReason();
3110 3255
 
3111 3256
         print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
3112
-        if ($addempty)
3113
-            print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
3257
+        if ($addempty) {
3258
+                    print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
3259
+        }
3114 3260
         foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
3115
-            if ($arraydemandreason['code'] == $exclude)
3116
-                continue;
3261
+            if ($arraydemandreason['code'] == $exclude) {
3262
+                            continue;
3263
+            }
3117 3264
 
3118 3265
             if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
3119 3266
                 print '<option value="' . $arraydemandreason['id'] . '" selected>';
@@ -3125,8 +3272,9 @@  discard block
 block discarded – undo
3125 3272
             print '</option>';
3126 3273
         }
3127 3274
         print '</select>';
3128
-        if ($user->admin)
3129
-            print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3275
+        if ($user->admin) {
3276
+                    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3277
+        }
3130 3278
     }
3131 3279
 
3132 3280
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -3141,8 +3289,10 @@  discard block
 block discarded – undo
3141 3289
         global $langs;
3142 3290
 
3143 3291
         $num = count($this->cache_types_paiements);
3144
-        if ($num > 0)
3145
-            return $num;    // Cache already loaded
3292
+        if ($num > 0) {
3293
+                    return $num;
3294
+        }
3295
+        // Cache already loaded
3146 3296
 
3147 3297
         dol_syslog(__METHOD__, LOG_DEBUG);
3148 3298
 
@@ -3203,12 +3353,14 @@  discard block
 block discarded – undo
3203 3353
         $this->load_cache_conditions_paiements();
3204 3354
 
3205 3355
         // Set default value if not already set by caller
3206
-        if (empty($selected) && !empty(Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID))
3207
-            $selected = Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID;
3356
+        if (empty($selected) && !empty(Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID)) {
3357
+                    $selected = Globals::$conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID;
3358
+        }
3208 3359
 
3209 3360
         print '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
3210
-        if ($addempty)
3211
-            print '<option value="0">&nbsp;</option>';
3361
+        if ($addempty) {
3362
+                    print '<option value="0">&nbsp;</option>';
3363
+        }
3212 3364
         foreach ($this->cache_conditions_paiements as $id => $arrayconditions) {
3213 3365
             if ($selected == $id) {
3214 3366
                 print '<option value="' . $id . '" selected>';
@@ -3219,8 +3371,9 @@  discard block
 block discarded – undo
3219 3371
             print '</option>';
3220 3372
         }
3221 3373
         print '</select>';
3222
-        if ($user->admin && empty($noinfoadmin))
3223
-            print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3374
+        if ($user->admin && empty($noinfoadmin)) {
3375
+                    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3376
+        }
3224 3377
     }
3225 3378
 
3226 3379
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -3246,59 +3399,68 @@  discard block
 block discarded – undo
3246 3399
         dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
3247 3400
 
3248 3401
         $filterarray = array();
3249
-        if ($filtertype == 'CRDT')
3250
-            $filterarray = array(0, 2, 3);
3251
-        elseif ($filtertype == 'DBIT')
3252
-            $filterarray = array(1, 2, 3);
3253
-        elseif ($filtertype != '' && $filtertype != '-1')
3254
-            $filterarray = explode(',', $filtertype);
3402
+        if ($filtertype == 'CRDT') {
3403
+                    $filterarray = array(0, 2, 3);
3404
+        } elseif ($filtertype == 'DBIT') {
3405
+                    $filterarray = array(1, 2, 3);
3406
+        } elseif ($filtertype != '' && $filtertype != '-1') {
3407
+                    $filterarray = explode(',', $filtertype);
3408
+        }
3255 3409
 
3256 3410
         $this->load_cache_types_paiements();
3257 3411
 
3258 3412
         print '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
3259
-        if ($empty)
3260
-            print '<option value="">&nbsp;</option>';
3413
+        if ($empty) {
3414
+                    print '<option value="">&nbsp;</option>';
3415
+        }
3261 3416
         foreach ($this->cache_types_paiements as $id => $arraytypes) {
3262 3417
             // If not good status
3263
-            if ($active >= 0 && $arraytypes['active'] != $active)
3264
-                continue;
3418
+            if ($active >= 0 && $arraytypes['active'] != $active) {
3419
+                            continue;
3420
+            }
3265 3421
 
3266 3422
             // On passe si on a demande de filtrer sur des modes de paiments particuliers
3267
-            if (count($filterarray) && !in_array($arraytypes['type'], $filterarray))
3268
-                continue;
3423
+            if (count($filterarray) && !in_array($arraytypes['type'], $filterarray)) {
3424
+                            continue;
3425
+            }
3269 3426
 
3270 3427
             // We discard empty line if showempty is on because an empty line has already been output.
3271
-            if ($empty && empty($arraytypes['code']))
3272
-                continue;
3273
-
3274
-            if ($format == 0)
3275
-                print '<option value="' . $id . '"';
3276
-            elseif ($format == 1)
3277
-                print '<option value="' . $arraytypes['code'] . '"';
3278
-            elseif ($format == 2)
3279
-                print '<option value="' . $arraytypes['code'] . '"';
3280
-            elseif ($format == 3)
3281
-                print '<option value="' . $id . '"';
3428
+            if ($empty && empty($arraytypes['code'])) {
3429
+                            continue;
3430
+            }
3431
+
3432
+            if ($format == 0) {
3433
+                            print '<option value="' . $id . '"';
3434
+            } elseif ($format == 1) {
3435
+                            print '<option value="' . $arraytypes['code'] . '"';
3436
+            } elseif ($format == 2) {
3437
+                            print '<option value="' . $arraytypes['code'] . '"';
3438
+            } elseif ($format == 3) {
3439
+                            print '<option value="' . $id . '"';
3440
+            }
3282 3441
             // Si selected est text, on compare avec code, sinon avec id
3283
-            if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code'])
3284
-                print ' selected';
3285
-            elseif ($selected == $id)
3286
-                print ' selected';
3442
+            if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
3443
+                            print ' selected';
3444
+            } elseif ($selected == $id) {
3445
+                            print ' selected';
3446
+            }
3287 3447
             print '>';
3288
-            if ($format == 0)
3289
-                $value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
3290
-            elseif ($format == 1)
3291
-                $value = $arraytypes['code'];
3292
-            elseif ($format == 2)
3293
-                $value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
3294
-            elseif ($format == 3)
3295
-                $value = $arraytypes['code'];
3448
+            if ($format == 0) {
3449
+                            $value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
3450
+            } elseif ($format == 1) {
3451
+                            $value = $arraytypes['code'];
3452
+            } elseif ($format == 2) {
3453
+                            $value = ($maxlength ? dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
3454
+            } elseif ($format == 3) {
3455
+                            $value = $arraytypes['code'];
3456
+            }
3296 3457
             print $value ? $value : '&nbsp;';
3297 3458
             print '</option>';
3298 3459
         }
3299 3460
         print '</select>';
3300
-        if ($user->admin && !$noadmininfo)
3301
-            print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3461
+        if ($user->admin && !$noadmininfo) {
3462
+                    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3463
+        }
3302 3464
     }
3303 3465
 
3304 3466
     /**
@@ -3352,8 +3514,9 @@  discard block
 block discarded – undo
3352 3514
         $sql = "SELECT rowid, code, libelle as label";
3353 3515
         $sql .= " FROM " . MAIN_DB_PREFIX . "c_shipment_mode";
3354 3516
         $sql .= " WHERE active > 0";
3355
-        if ($filtre)
3356
-            $sql .= " AND " . $filtre;
3517
+        if ($filtre) {
3518
+                    $sql .= " AND " . $filtre;
3519
+        }
3357 3520
         $sql .= " ORDER BY libelle ASC";
3358 3521
 
3359 3522
         dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
@@ -3378,8 +3541,9 @@  discard block
 block discarded – undo
3378 3541
                     $i++;
3379 3542
                 }
3380 3543
                 print "</select>";
3381
-                if ($user->admin)
3382
-                    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3544
+                if ($user->admin) {
3545
+                                    print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
3546
+                }
3383 3547
             } else {
3384 3548
                 print $langs->trans("NoShippingMethodDefined");
3385 3549
             }
@@ -3492,8 +3656,9 @@  discard block
 block discarded – undo
3492 3656
 
3493 3657
         $resql = $this->db->query($sql);
3494 3658
         if ($resql && $this->db->num_rows($resql) > 0) {
3495
-            if ($showempty)
3496
-                $return .= '<option value="none"></option>';
3659
+            if ($showempty) {
3660
+                            $return .= '<option value="none"></option>';
3661
+            }
3497 3662
 
3498 3663
             while ($res = $this->db->fetch_object($resql)) {
3499 3664
                 $unitLabel = $res->label;
@@ -3536,10 +3701,12 @@  discard block
 block discarded – undo
3536 3701
         $sql = "SELECT rowid, label, bank, clos as status, currency_code";
3537 3702
         $sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
3538 3703
         $sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
3539
-        if ($statut != 2)
3540
-            $sql .= " AND clos = '" . $statut . "'";
3541
-        if ($filtre)
3542
-            $sql .= " AND " . $filtre;
3704
+        if ($statut != 2) {
3705
+                    $sql .= " AND clos = '" . $statut . "'";
3706
+        }
3707
+        if ($filtre) {
3708
+                    $sql .= " AND " . $filtre;
3709
+        }
3543 3710
         $sql .= " ORDER BY label";
3544 3711
 
3545 3712
         dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
@@ -3561,23 +3728,24 @@  discard block
 block discarded – undo
3561 3728
                         print '<option value="' . $obj->rowid . '">';
3562 3729
                     }
3563 3730
                     print trim($obj->label);
3564
-                    if ($showcurrency)
3565
-                        print ' (' . $obj->currency_code . ')';
3566
-                    if ($statut == 2 && $obj->status == 1)
3567
-                        print ' (' . $langs->trans("Closed") . ')';
3731
+                    if ($showcurrency) {
3732
+                                            print ' (' . $obj->currency_code . ')';
3733
+                    }
3734
+                    if ($statut == 2 && $obj->status == 1) {
3735
+                                            print ' (' . $langs->trans("Closed") . ')';
3736
+                    }
3568 3737
                     print '</option>';
3569 3738
                     $i++;
3570 3739
                 }
3571 3740
                 print "</select>";
3741
+            } else {
3742
+                if ($statut == 0) {
3743
+                                    print '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
3744
+                } else {
3745
+                                    print '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>';
3746
+                }
3572 3747
             }
3573
-            else {
3574
-                if ($statut == 0)
3575
-                    print '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
3576
-                else
3577
-                    print '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>';
3578
-            }
3579
-        }
3580
-        else {
3748
+        } else {
3581 3749
             AlDolUtils::dol_print_error($this->db);
3582 3750
         }
3583 3751
 
@@ -3601,8 +3769,9 @@  discard block
 block discarded – undo
3601 3769
             print '<input type="hidden" name="action" value="setbankaccount">';
3602 3770
             print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
3603 3771
             $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
3604
-            if ($nbaccountfound > 0)
3605
-                print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
3772
+            if ($nbaccountfound > 0) {
3773
+                            print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
3774
+            }
3606 3775
             print '</form>';
3607 3776
         } else {
3608 3777
 
@@ -3612,8 +3781,9 @@  discard block
 block discarded – undo
3612 3781
                 require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
3613 3782
                 $bankstatic = new Account($this->db);
3614 3783
                 $result = $bankstatic->fetch($selected);
3615
-                if ($result)
3616
-                    print $bankstatic->getNomUrl(1);
3784
+                if ($result) {
3785
+                                    print $bankstatic->getNomUrl(1);
3786
+                }
3617 3787
             } else {
3618 3788
                 print "&nbsp;";
3619 3789
             }
@@ -3659,15 +3829,16 @@  discard block
 block discarded – undo
3659 3829
                 $i = 0;
3660 3830
                 while ($i < $num) {
3661 3831
                     $objp = $this->db->fetch_object($result);
3662
-                    if ($objp)
3663
-                        $cate_arbo[$objp->rowid] = array('id' => $objp->rowid, 'fulllabel' => $objp->label);
3832
+                    if ($objp) {
3833
+                                            $cate_arbo[$objp->rowid] = array('id' => $objp->rowid, 'fulllabel' => $objp->label);
3834
+                    }
3664 3835
                     $i++;
3665 3836
                 }
3666 3837
                 $this->db->free($result);
3667
-            } else
3668
-                AlDolUtils::dol_print_error($this->db);
3669
-        }
3670
-        else {
3838
+            } else {
3839
+                            AlDolUtils::dol_print_error($this->db);
3840
+            }
3841
+        } else {
3671 3842
             $cat = new Categorie($this->db);
3672 3843
             $cate_arbo = $cat->get_full_arbo($type, $excludeafterid);
3673 3844
         }
@@ -3675,9 +3846,9 @@  discard block
 block discarded – undo
3675 3846
         $output = '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">';
3676 3847
         $outarray = array();
3677 3848
         if (is_array($cate_arbo)) {
3678
-            if (!count($cate_arbo))
3679
-                $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
3680
-            else {
3849
+            if (!count($cate_arbo)) {
3850
+                            $output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
3851
+            } else {
3681 3852
                 $output .= '<option value="-1">&nbsp;</option>';
3682 3853
                 foreach ($cate_arbo as $key => $value) {
3683 3854
                     if ($cate_arbo[$key]['id'] == $selected || ($selected == 'auto' && count($cate_arbo) == 1)) {
@@ -3694,8 +3865,9 @@  discard block
 block discarded – undo
3694 3865
         $output .= '</select>';
3695 3866
         $output .= "\n";
3696 3867
 
3697
-        if ($outputmode)
3698
-            return $outarray;
3868
+        if ($outputmode) {
3869
+                    return $outarray;
3870
+        }
3699 3871
         return $output;
3700 3872
     }
3701 3873
 
@@ -3759,8 +3931,9 @@  discard block
 block discarded – undo
3759 3931
 
3760 3932
         // Clean parameters
3761 3933
         $newselectedchoice = empty($selectedchoice) ? "no" : $selectedchoice;
3762
-        if (Globals::$conf->browser->layout == 'phone')
3763
-            $width = '95%';
3934
+        if (Globals::$conf->browser->layout == 'phone') {
3935
+                    $width = '95%';
3936
+        }
3764 3937
 
3765 3938
         if (is_array($formquestion) && !empty($formquestion)) {
3766 3939
             // First add hidden fields and value
@@ -3774,8 +3947,9 @@  discard block
 block discarded – undo
3774 3947
 
3775 3948
             // Now add questions
3776 3949
             $more .= '<table class="paddingtopbottomonly" width="100%">' . "\n";
3777
-            if (!empty($formquestion['text']))
3778
-                $more .= '<tr><td colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
3950
+            if (!empty($formquestion['text'])) {
3951
+                            $more .= '<tr><td colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
3952
+            }
3779 3953
             foreach ($formquestion as $key => $input) {
3780 3954
                 if (is_array($input) && !empty($input)) {
3781 3955
                     $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');
@@ -3788,42 +3962,45 @@  discard block
 block discarded – undo
3788 3962
                         $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td><td align="left"><input type="password" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $size . ' value="' . $input['value'] . '"' . $moreattr . ' /></td></tr>' . "\n";
3789 3963
                     } elseif ($input['type'] == 'select') {
3790 3964
                         $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>';
3791
-                        if (!empty($input['label']))
3792
-                            $more .= $input['label'] . '</td><td class="tdtop" align="left">';
3965
+                        if (!empty($input['label'])) {
3966
+                                                    $more .= $input['label'] . '</td><td class="tdtop" align="left">';
3967
+                        }
3793 3968
                         $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss);
3794 3969
                         $more .= '</td></tr>' . "\n";
3795
-                    }
3796
-                    elseif ($input['type'] == 'checkbox') {
3970
+                    } elseif ($input['type'] == 'checkbox') {
3797 3971
                         $more .= '<tr>';
3798 3972
                         $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . ' </td><td align="left">';
3799 3973
                         $more .= '<input type="checkbox" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '"' . $moreattr;
3800
-                        if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0')
3801
-                            $more .= ' checked';
3802
-                        if (is_bool($input['value']) && $input['value'])
3803
-                            $more .= ' checked';
3804
-                        if (isset($input['disabled']))
3805
-                            $more .= ' disabled';
3974
+                        if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0') {
3975
+                                                    $more .= ' checked';
3976
+                        }
3977
+                        if (is_bool($input['value']) && $input['value']) {
3978
+                                                    $more .= ' checked';
3979
+                        }
3980
+                        if (isset($input['disabled'])) {
3981
+                                                    $more .= ' disabled';
3982
+                        }
3806 3983
                         $more .= ' /></td>';
3807 3984
                         $more .= '</tr>' . "\n";
3808
-                    }
3809
-                    elseif ($input['type'] == 'radio') {
3985
+                    } elseif ($input['type'] == 'radio') {
3810 3986
                         $i = 0;
3811 3987
                         foreach ($input['values'] as $selkey => $selval) {
3812 3988
                             $more .= '<tr>';
3813
-                            if ($i == 0)
3814
-                                $more .= '<td' . (empty($input['tdclass']) ? ' class="tdtop"' : (' class="tdtop ' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>';
3815
-                            else
3816
-                                $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>&nbsp;</td>';
3989
+                            if ($i == 0) {
3990
+                                                            $more .= '<td' . (empty($input['tdclass']) ? ' class="tdtop"' : (' class="tdtop ' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>';
3991
+                            } else {
3992
+                                                            $more .= '<td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>&nbsp;</td>';
3993
+                            }
3817 3994
                             $more .= '<td><input type="radio" class="flat' . $morecss . '" id="' . $input['name'] . '" name="' . $input['name'] . '" value="' . $selkey . '"' . $moreattr;
3818
-                            if ($input['disabled'])
3819
-                                $more .= ' disabled';
3995
+                            if ($input['disabled']) {
3996
+                                                            $more .= ' disabled';
3997
+                            }
3820 3998
                             $more .= ' /> ';
3821 3999
                             $more .= $selval;
3822 4000
                             $more .= '</td></tr>' . "\n";
3823 4001
                             $i++;
3824 4002
                         }
3825
-                    }
3826
-                    elseif ($input['type'] == 'date') {
4003
+                    } elseif ($input['type'] == 'date') {
3827 4004
                         $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>' . $input['label'] . '</td>';
3828 4005
                         $more .= '<td align="left">';
3829 4006
                         $more .= $this->selectDate($input['value'], $input['name'], 0, 0, 0, '', 1, 0);
@@ -3835,13 +4012,12 @@  discard block
 block discarded – undo
3835 4012
                         $formquestion[] = array('name' => $input['name'] . 'min');
3836 4013
                     } elseif ($input['type'] == 'other') {
3837 4014
                         $more .= '<tr><td' . (empty($input['tdclass']) ? '' : (' class="' . $input['tdclass'] . '"')) . '>';
3838
-                        if (!empty($input['label']))
3839
-                            $more .= $input['label'] . '</td><td align="left">';
4015
+                        if (!empty($input['label'])) {
4016
+                                                    $more .= $input['label'] . '</td><td align="left">';
4017
+                        }
3840 4018
                         $more .= $input['value'];
3841 4019
                         $more .= '</td></tr>' . "\n";
3842
-                    }
3843
-
3844
-                    elseif ($input['type'] == 'onecolumn') {
4020
+                    } elseif ($input['type'] == 'onecolumn') {
3845 4021
                         $more .= '<tr><td colspan="2" align="left">';
3846 4022
                         $more .= $input['value'];
3847 4023
                         $more .= '</td></tr>' . "\n";
@@ -3854,10 +4030,12 @@  discard block
 block discarded – undo
3854 4030
         // JQUI method dialog is broken with jmobile, we use standard HTML.
3855 4031
         // Note: When using dol_use_jmobile or no js, you must also check code for button use a GET url with action=xxx and check that you also output the confirm code when action=xxx
3856 4032
         // See page product/card.php for example
3857
-        if (!empty(Globals::$conf->dol_use_jmobile))
3858
-            $useajax = 0;
3859
-        if (empty(Globals::$conf->use_javascript_ajax))
3860
-            $useajax = 0;
4033
+        if (!empty(Globals::$conf->dol_use_jmobile)) {
4034
+                    $useajax = 0;
4035
+        }
4036
+        if (empty(Globals::$conf->use_javascript_ajax)) {
4037
+                    $useajax = 0;
4038
+        }
3861 4039
 
3862 4040
         if ($useajax) {
3863 4041
             $autoOpen = true;
@@ -3875,10 +4053,12 @@  discard block
 block discarded – undo
3875 4053
             if (is_array($formquestion)) {
3876 4054
                 foreach ($formquestion as $key => $input) {
3877 4055
                     //print "xx ".$key." rr ".is_array($input)."<br>\n";
3878
-                    if (is_array($input) && isset($input['name']))
3879
-                        array_push($inputok, $input['name']);
3880
-                    if (isset($input['inputko']) && $input['inputko'] == 1)
3881
-                        array_push($inputko, $input['name']);
4056
+                    if (is_array($input) && isset($input['name'])) {
4057
+                                            array_push($inputok, $input['name']);
4058
+                    }
4059
+                    if (isset($input['inputko']) && $input['inputko'] == 1) {
4060
+                                            array_push($inputko, $input['name']);
4061
+                    }
3882 4062
                 }
3883 4063
             }
3884 4064
             // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template
@@ -3963,12 +4143,14 @@  discard block
 block discarded – undo
3963 4143
         } else {
3964 4144
             $formconfirm .= "\n<!-- begin formconfirm page=" . $page . " -->\n";
3965 4145
 
3966
-            if (empty($disableformtag))
3967
-                $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
4146
+            if (empty($disableformtag)) {
4147
+                            $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
4148
+            }
3968 4149
 
3969 4150
             $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
3970
-            if (empty($disableformtag))
3971
-                $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
4151
+            if (empty($disableformtag)) {
4152
+                            $formconfirm .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
4153
+            }
3972 4154
 
3973 4155
             $formconfirm .= '<table width="100%" class="valid">' . "\n";
3974 4156
 
@@ -3993,8 +4175,9 @@  discard block
 block discarded – undo
3993 4175
 
3994 4176
             $formconfirm .= '</table>' . "\n";
3995 4177
 
3996
-            if (empty($disableformtag))
3997
-                $formconfirm .= "</form>\n";
4178
+            if (empty($disableformtag)) {
4179
+                            $formconfirm .= "</form>\n";
4180
+            }
3998 4181
             $formconfirm .= '<br>';
3999 4182
 
4000 4183
             $formconfirm .= "<!-- end formconfirm -->\n";
@@ -4184,14 +4367,16 @@  discard block
 block discarded – undo
4184 4367
             $ret .= '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>';
4185 4368
             $ret .= '</tr></table></form>';
4186 4369
         } else {
4187
-            if ($displayhour)
4188
-                $ret .= AlDolUtils::dol_print_date($selected, 'dayhour');
4189
-            else
4190
-                $ret .= AlDolUtils::dol_print_date($selected, 'day');
4370
+            if ($displayhour) {
4371
+                            $ret .= AlDolUtils::dol_print_date($selected, 'dayhour');
4372
+            } else {
4373
+                            $ret .= AlDolUtils::dol_print_date($selected, 'day');
4374
+            }
4191 4375
         }
4192 4376
 
4193
-        if (empty($nooutput))
4194
-            print $ret;
4377
+        if (empty($nooutput)) {
4378
+                    print $ret;
4379
+        }
4195 4380
         return $ret;
4196 4381
     }
4197 4382
 
@@ -4317,10 +4502,10 @@  discard block
 block discarded – undo
4317 4502
         } else {
4318 4503
             if (!empty($rate)) {
4319 4504
                 print price($rate, 1, $langs, 1, 0);
4320
-                if ($currency && $rate != 1)
4321
-                    print ' &nbsp; (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . Globals::$conf->currency . ')';
4322
-            }
4323
-            else {
4505
+                if ($currency && $rate != 1) {
4506
+                                    print ' &nbsp; (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . Globals::$conf->currency . ')';
4507
+                }
4508
+            } else {
4324 4509
                 print 1;
4325 4510
             }
4326 4511
         }
@@ -4353,34 +4538,41 @@  discard block
 block discarded – undo
4353 4538
             print '<div class="inline-block">';
4354 4539
             if (!empty($discount_type)) {
4355 4540
                 if (!empty(Globals::$conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
4356
-                    if (!$filter || $filter == "fk_invoice_supplier_source IS NULL")
4357
-                        $translationKey = 'HasAbsoluteDiscountFromSupplier';    // If we want deposit to be substracted to payments only and not to total of final invoice
4358
-                    else
4359
-                        $translationKey = 'HasCreditNoteFromSupplier';
4360
-                }
4361
-                else {
4362
-                    if (!$filter || $filter == "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')")
4363
-                        $translationKey = 'HasAbsoluteDiscountFromSupplier';
4364
-                    else
4365
-                        $translationKey = 'HasCreditNoteFromSupplier';
4541
+                    if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") {
4542
+                                            $translationKey = 'HasAbsoluteDiscountFromSupplier';
4543
+                    }
4544
+                    // If we want deposit to be substracted to payments only and not to total of final invoice
4545
+                    else {
4546
+                                            $translationKey = 'HasCreditNoteFromSupplier';
4547
+                    }
4548
+                } else {
4549
+                    if (!$filter || $filter == "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
4550
+                                            $translationKey = 'HasAbsoluteDiscountFromSupplier';
4551
+                    } else {
4552
+                                            $translationKey = 'HasCreditNoteFromSupplier';
4553
+                    }
4366 4554
                 }
4367 4555
             } else {
4368 4556
                 if (!empty(Globals::$conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
4369
-                    if (!$filter || $filter == "fk_facture_source IS NULL")
4370
-                        $translationKey = 'CompanyHasAbsoluteDiscount';    // If we want deposit to be substracted to payments only and not to total of final invoice
4371
-                    else
4372
-                        $translationKey = 'CompanyHasCreditNote';
4373
-                }
4374
-                else {
4375
-                    if (!$filter || $filter == "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')")
4376
-                        $translationKey = 'CompanyHasAbsoluteDiscount';
4377
-                    else
4378
-                        $translationKey = 'CompanyHasCreditNote';
4557
+                    if (!$filter || $filter == "fk_facture_source IS NULL") {
4558
+                                            $translationKey = 'CompanyHasAbsoluteDiscount';
4559
+                    }
4560
+                    // If we want deposit to be substracted to payments only and not to total of final invoice
4561
+                    else {
4562
+                                            $translationKey = 'CompanyHasCreditNote';
4563
+                    }
4564
+                } else {
4565
+                    if (!$filter || $filter == "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
4566
+                                            $translationKey = 'CompanyHasAbsoluteDiscount';
4567
+                    } else {
4568
+                                            $translationKey = 'CompanyHasCreditNote';
4569
+                    }
4379 4570
                 }
4380 4571
             }
4381 4572
             print $langs->trans($translationKey, price($amount, 0, $langs, 0, 0, -1, Globals::$conf->currency));
4382
-            if (empty($hidelist))
4383
-                print ': ';
4573
+            if (empty($hidelist)) {
4574
+                            print ': ';
4575
+            }
4384 4576
             print '</div>';
4385 4577
             if (empty($hidelist)) {
4386 4578
                 print '<div class="inline-block" style="padding-right: 10px">';
@@ -4390,15 +4582,18 @@  discard block
 block discarded – undo
4390 4582
                 } else {
4391 4583
                     $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
4392 4584
                 }
4393
-                if ($filter)
4394
-                    $newfilter .= ' AND (' . $filter . ')';
4585
+                if ($filter) {
4586
+                                    $newfilter .= ' AND (' . $filter . ')';
4587
+                }
4395 4588
                 $nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);
4396 4589
                 if ($nbqualifiedlines > 0) {
4397 4590
                     print ' &nbsp; <input type="submit" class="button" value="' . AlDolUtils::dol_escape_htmltag($langs->trans("UseLine")) . '"';
4398
-                    if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')")
4399
-                        print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
4400
-                    if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')")
4401
-                        print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
4591
+                    if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
4592
+                                            print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
4593
+                    }
4594
+                    if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
4595
+                                            print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
4596
+                    }
4402 4597
 
4403 4598
                     print '>';
4404 4599
                 }
@@ -4499,10 +4694,11 @@  discard block
 block discarded – undo
4499 4694
             }
4500 4695
         }
4501 4696
 
4502
-        if ($nooutput)
4503
-            return $out;
4504
-        else
4505
-            print $out;
4697
+        if ($nooutput) {
4698
+                    return $out;
4699
+        } else {
4700
+                    print $out;
4701
+        }
4506 4702
     }
4507 4703
 
4508 4704
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -4535,8 +4731,10 @@  discard block
 block discarded – undo
4535 4731
 
4536 4732
         $out = '';
4537 4733
 
4538
-        if ($selected == 'euro' || $selected == 'euros')
4539
-            $selected = 'EUR';   // Pour compatibilite
4734
+        if ($selected == 'euro' || $selected == 'euros') {
4735
+                    $selected = 'EUR';
4736
+        }
4737
+        // Pour compatibilite
4540 4738
 
4541 4739
         $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
4542 4740
         foreach ($langs->cache_currencies as $code_iso => $currency) {
@@ -4550,8 +4748,9 @@  discard block
 block discarded – undo
4550 4748
             $out .= '</option>';
4551 4749
         }
4552 4750
         $out .= '</select>';
4553
-        if ($user->admin)
4554
-            $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4751
+        if ($user->admin) {
4752
+                    $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4753
+        }
4555 4754
 
4556 4755
         // Make select dynamic
4557 4756
         include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
@@ -4580,14 +4779,16 @@  discard block
 block discarded – undo
4580 4779
         $sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
4581 4780
         $resql = $db->query($sql);
4582 4781
         if ($resql) {
4583
-            while ($obj = $db->fetch_object($resql))
4584
-                $TCurrency[$obj->code] = $obj->code;
4782
+            while ($obj = $db->fetch_object($resql)) {
4783
+                            $TCurrency[$obj->code] = $obj->code;
4784
+            }
4585 4785
         }
4586 4786
 
4587 4787
         $out = '';
4588 4788
         $out .= '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">';
4589
-        if ($useempty)
4590
-            $out .= '<option value=""></option>';
4789
+        if ($useempty) {
4790
+                    $out .= '<option value=""></option>';
4791
+        }
4591 4792
         // If company current currency not in table, we add it into list. Should always be available.
4592 4793
         if (!in_array(Globals::$conf->currency, $TCurrency)) {
4593 4794
             $TCurrency[Globals::$conf->currency] = Globals::$conf->currency;
@@ -4595,10 +4796,11 @@  discard block
 block discarded – undo
4595 4796
         if (count($TCurrency) > 0) {
4596 4797
             foreach ($langs->cache_currencies as $code_iso => $currency) {
4597 4798
                 if (isset($TCurrency[$code_iso])) {
4598
-                    if (!empty($selected) && $selected == $code_iso)
4599
-                        $out .= '<option value="' . $code_iso . '" selected="selected">';
4600
-                    else
4601
-                        $out .= '<option value="' . $code_iso . '">';
4799
+                    if (!empty($selected) && $selected == $code_iso) {
4800
+                                            $out .= '<option value="' . $code_iso . '" selected="selected">';
4801
+                    } else {
4802
+                                            $out .= '<option value="' . $code_iso . '">';
4803
+                    }
4602 4804
 
4603 4805
                     $out .= $currency['label'];
4604 4806
                     $out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
@@ -4628,8 +4830,10 @@  discard block
 block discarded – undo
4628 4830
         global $langs;
4629 4831
 
4630 4832
         $num = count($this->cache_vatrates);
4631
-        if ($num > 0)
4632
-            return $num;    // Cache already loaded
4833
+        if ($num > 0) {
4834
+                    return $num;
4835
+        }
4836
+        // Cache already loaded
4633 4837
 
4634 4838
         dol_syslog(__METHOD__, LOG_DEBUG);
4635 4839
 
@@ -4658,20 +4862,23 @@  discard block
 block discarded – undo
4658 4862
                     $this->cache_vatrates[$i]['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : '');   // Label must contains only 0-9 , . % or *
4659 4863
                     $this->cache_vatrates[$i]['labelallrates'] = $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
4660 4864
                     $positiverates = '';
4661
-                    if ($obj->taux)
4662
-                        $positiverates .= ($positiverates ? '/' : '') . $obj->taux;
4663
-                    if ($obj->localtax1)
4664
-                        $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
4665
-                    if ($obj->localtax2)
4666
-                        $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
4667
-                    if (empty($positiverates))
4668
-                        $positiverates = '0';
4865
+                    if ($obj->taux) {
4866
+                                            $positiverates .= ($positiverates ? '/' : '') . $obj->taux;
4867
+                    }
4868
+                    if ($obj->localtax1) {
4869
+                                            $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
4870
+                    }
4871
+                    if ($obj->localtax2) {
4872
+                                            $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
4873
+                    }
4874
+                    if (empty($positiverates)) {
4875
+                                            $positiverates = '0';
4876
+                    }
4669 4877
                     $this->cache_vatrates[$i]['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
4670 4878
                 }
4671 4879
 
4672 4880
                 return $num;
4673
-            }
4674
-            else {
4881
+            } else {
4675 4882
                 $this->error = '<font class="error">' . $langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code) . '</font>';
4676 4883
                 return -1;
4677 4884
             }
@@ -4808,16 +5015,19 @@  discard block
 block discarded – undo
4808 5015
             $selectedfound = false;
4809 5016
             foreach ($this->cache_vatrates as $rate) {
4810 5017
                 // Keep only 0 if seller is not subject to VAT
4811
-                if ($disabled && $rate['txtva'] != 0)
4812
-                    continue;
5018
+                if ($disabled && $rate['txtva'] != 0) {
5019
+                                    continue;
5020
+                }
4813 5021
 
4814 5022
                 // Define key to use into select list
4815 5023
                 $key = $rate['txtva'];
4816 5024
                 $key .= $rate['nprtva'] ? '*' : '';
4817
-                if ($mode > 0 && $rate['code'])
4818
-                    $key .= ' (' . $rate['code'] . ')';
4819
-                if ($mode < 0)
4820
-                    $key = $rate['rowid'];
5025
+                if ($mode > 0 && $rate['code']) {
5026
+                                    $key .= ' (' . $rate['code'] . ')';
5027
+                }
5028
+                if ($mode < 0) {
5029
+                                    $key = $rate['rowid'];
5030
+                }
4821 5031
 
4822 5032
                 $return .= '<option value="' . $key . '"';
4823 5033
                 if (!$selectedfound) {
@@ -4844,10 +5054,10 @@  discard block
 block discarded – undo
4844 5054
                 $return .= '</option>';
4845 5055
             }
4846 5056
 
4847
-            if (!$options_only)
4848
-                $return .= '</select>';
4849
-        }
4850
-        else {
5057
+            if (!$options_only) {
5058
+                            $return .= '</select>';
5059
+            }
5060
+        } else {
4851 5061
             $return .= $this->error;
4852 5062
         }
4853 5063
 
@@ -4919,12 +5129,15 @@  discard block
 block discarded – undo
4919 5129
 
4920 5130
         $retstring = '';
4921 5131
 
4922
-        if ($prefix == '')
4923
-            $prefix = 're';
4924
-        if ($h == '')
4925
-            $h = 0;
4926
-        if ($m == '')
4927
-            $m = 0;
5132
+        if ($prefix == '') {
5133
+                    $prefix = 're';
5134
+        }
5135
+        if ($h == '') {
5136
+                    $h = 0;
5137
+        }
5138
+        if ($m == '') {
5139
+                    $m = 0;
5140
+        }
4928 5141
         $emptydate = 0;
4929 5142
         $emptyhours = 0;
4930 5143
         if ($empty == 1) {
@@ -4973,10 +5186,12 @@  discard block
 block discarded – undo
4973 5186
             $smin = !isset(Globals::$conf->global->MAIN_DEFAULT_DATE_MIN) ? ($h == -1 ? '59' : '') : Globals::$conf->global->MAIN_DEFAULT_DATE_MIN;
4974 5187
             $ssec = !isset(Globals::$conf->global->MAIN_DEFAULT_DATE_SEC) ? ($h == -1 ? '59' : '') : Globals::$conf->global->MAIN_DEFAULT_DATE_SEC;
4975 5188
         }
4976
-        if ($h == 3)
4977
-            $shour = '';
4978
-        if ($m == 3)
4979
-            $smin = '';
5189
+        if ($h == 3) {
5190
+                    $shour = '';
5191
+        }
5192
+        if ($m == 3) {
5193
+                    $smin = '';
5194
+        }
4980 5195
 
4981 5196
         // You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
4982 5197
         $usecalendar = 'combo';
@@ -5008,14 +5223,14 @@  discard block
 block discarded – undo
5008 5223
                         $base = DOL_URL_ROOT . '/core/';
5009 5224
                         $retstring .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
5010 5225
                         $retstring .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
5011
-                    } else
5012
-                        $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
5226
+                    } else {
5227
+                                            $retstring .= '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
5228
+                    }
5013 5229
 
5014 5230
                     $retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
5015 5231
                     $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
5016 5232
                     $retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
5017
-                }
5018
-                elseif ($usecalendar == 'jquery') {
5233
+                } elseif ($usecalendar == 'jquery') {
5019 5234
                     if (!$disabled) {
5020 5235
                         // Output javascript for datepicker
5021 5236
                         $retstring .= "<script type='text/javascript'>";
@@ -5125,32 +5340,38 @@  discard block
 block discarded – undo
5125 5340
             }
5126 5341
         }
5127 5342
 
5128
-        if ($d && $h)
5129
-            $retstring .= ($h == 2 ? '<br>' : ' ');
5343
+        if ($d && $h) {
5344
+                    $retstring .= ($h == 2 ? '<br>' : ' ');
5345
+        }
5130 5346
 
5131 5347
         if ($h) {
5132 5348
             // Show hour
5133 5349
             $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
5134
-            if ($emptyhours)
5135
-                $retstring .= '<option value="-1">&nbsp;</option>';
5350
+            if ($emptyhours) {
5351
+                            $retstring .= '<option value="-1">&nbsp;</option>';
5352
+            }
5136 5353
             for ($hour = 0; $hour < 24; $hour++) {
5137
-                if (strlen($hour) < 2)
5138
-                    $hour = "0" . $hour;
5354
+                if (strlen($hour) < 2) {
5355
+                                    $hour = "0" . $hour;
5356
+                }
5139 5357
                 $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour . (empty(Globals::$conf->dol_optimize_smallscreen) ? '' : 'H') . '</option>';
5140 5358
             }
5141 5359
             $retstring .= '</select>';
5142
-            if ($m && empty(Globals::$conf->dol_optimize_smallscreen))
5143
-                $retstring .= ":";
5360
+            if ($m && empty(Globals::$conf->dol_optimize_smallscreen)) {
5361
+                            $retstring .= ":";
5362
+            }
5144 5363
         }
5145 5364
 
5146 5365
         if ($m) {
5147 5366
             // Show minutes
5148 5367
             $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
5149
-            if ($emptyhours)
5150
-                $retstring .= '<option value="-1">&nbsp;</option>';
5368
+            if ($emptyhours) {
5369
+                            $retstring .= '<option value="-1">&nbsp;</option>';
5370
+            }
5151 5371
             for ($min = 0; $min < 60; $min++) {
5152
-                if (strlen($min) < 2)
5153
-                    $min = "0" . $min;
5372
+                if (strlen($min) < 2) {
5373
+                                    $min = "0" . $min;
5374
+                }
5154 5375
                 $retstring .= '<option value="' . $min . '"' . (($min == $smin) ? ' selected' : '') . '>' . $min . (empty(Globals::$conf->dol_optimize_smallscreen) ? '' : '') . '</option>';
5155 5376
             }
5156 5377
             $retstring .= '</select>';
@@ -5181,21 +5402,25 @@  discard block
 block discarded – undo
5181 5402
               } */
5182 5403
             // Update the hour part
5183 5404
             if ($h) {
5184
-                if ($fullday)
5185
-                    $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5405
+                if ($fullday) {
5406
+                                    $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5407
+                }
5186 5408
                 //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
5187 5409
                 $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%H') . '\');';
5188
-                if ($fullday)
5189
-                    $reset_scripts .= ' } ';
5410
+                if ($fullday) {
5411
+                                    $reset_scripts .= ' } ';
5412
+                }
5190 5413
             }
5191 5414
             // Update the minute part
5192 5415
             if ($m) {
5193
-                if ($fullday)
5194
-                    $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5416
+                if ($fullday) {
5417
+                                    $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5418
+                }
5195 5419
                 //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
5196 5420
                 $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%M') . '\');';
5197
-                if ($fullday)
5198
-                    $reset_scripts .= ' } ';
5421
+                if ($fullday) {
5422
+                                    $reset_scripts .= ' } ';
5423
+                }
5199 5424
             }
5200 5425
             // If reset_scripts is not empty, print the link with the reset_scripts in the onClick
5201 5426
             if ($reset_scripts && empty(Globals::$conf->dol_optimize_smallscreen)) {
@@ -5217,19 +5442,23 @@  discard block
 block discarded – undo
5217 5442
             $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%Y') . '\');';
5218 5443
             // Update the hour part
5219 5444
             if ($h) {
5220
-                if ($fullday)
5221
-                    $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5445
+                if ($fullday) {
5446
+                                    $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5447
+                }
5222 5448
                 $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%H') . '\');';
5223
-                if ($fullday)
5224
-                    $reset_scripts .= ' } ';
5449
+                if ($fullday) {
5450
+                                    $reset_scripts .= ' } ';
5451
+                }
5225 5452
             }
5226 5453
             // Update the minute part
5227 5454
             if ($m) {
5228
-                if ($fullday)
5229
-                    $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5455
+                if ($fullday) {
5456
+                                    $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
5457
+                }
5230 5458
                 $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . AlDolUtils::dol_print_date(dol_now(), '%M') . '\');';
5231
-                if ($fullday)
5232
-                    $reset_scripts .= ' } ';
5459
+                if ($fullday) {
5460
+                                    $reset_scripts .= ' } ';
5461
+                }
5233 5462
             }
5234 5463
             // If reset_scripts is not empty, print the link with the reset_scripts in the onClick
5235 5464
             if ($reset_scripts && empty(Globals::$conf->dol_optimize_smallscreen)) {
@@ -5292,41 +5521,46 @@  discard block
 block discarded – undo
5292 5521
             $retstring .= "</select>";
5293 5522
         } elseif ($typehour == 'text' || $typehour == 'textselect') {
5294 5523
             $retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" size="1" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
5295
-        } else
5296
-            return 'BadValueForParameterTypeHour';
5524
+        } else {
5525
+                    return 'BadValueForParameterTypeHour';
5526
+        }
5297 5527
 
5298
-        if ($typehour != 'text')
5299
-            $retstring .= ' ' . $langs->trans('HourShort');
5300
-        else
5301
-            $retstring .= '<span class="hideonsmartphone">:</span>';
5528
+        if ($typehour != 'text') {
5529
+                    $retstring .= ' ' . $langs->trans('HourShort');
5530
+        } else {
5531
+                    $retstring .= '<span class="hideonsmartphone">:</span>';
5532
+        }
5302 5533
 
5303 5534
         // Minutes
5304
-        if ($minunderhours)
5305
-            $retstring .= '<br>';
5306
-        else
5307
-            $retstring .= '<span class="hideonsmartphone">&nbsp;</span>';
5535
+        if ($minunderhours) {
5536
+                    $retstring .= '<br>';
5537
+        } else {
5538
+                    $retstring .= '<span class="hideonsmartphone">&nbsp;</span>';
5539
+        }
5308 5540
 
5309 5541
         if ($typehour == 'select' || $typehour == 'textselect') {
5310 5542
             $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
5311 5543
             for ($min = 0; $min <= 55; $min = $min + 5) {
5312 5544
                 $retstring .= '<option value="' . $min . '"';
5313
-                if ($minSelected == $min)
5314
-                    $retstring .= ' selected';
5545
+                if ($minSelected == $min) {
5546
+                                    $retstring .= ' selected';
5547
+                }
5315 5548
                 $retstring .= '>' . $min . '</option>';
5316 5549
             }
5317 5550
             $retstring .= "</select>";
5318
-        }
5319
-        elseif ($typehour == 'text') {
5551
+        } elseif ($typehour == 'text') {
5320 5552
             $retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" size="1" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
5321 5553
         }
5322 5554
 
5323
-        if ($typehour != 'text')
5324
-            $retstring .= ' ' . $langs->trans('MinuteShort');
5555
+        if ($typehour != 'text') {
5556
+                    $retstring .= ' ' . $langs->trans('MinuteShort');
5557
+        }
5325 5558
 
5326 5559
         //$retstring.="&nbsp;";
5327 5560
 
5328
-        if (!empty($nooutput))
5329
-            return $retstring;
5561
+        if (!empty($nooutput)) {
5562
+                    return $retstring;
5563
+        }
5330 5564
 
5331 5565
         print $retstring;
5332 5566
         return;
@@ -5369,8 +5603,9 @@  discard block
 block discarded – undo
5369 5603
         }
5370 5604
 
5371 5605
         $prefixforautocompletemode = $objecttmp->element;
5372
-        if ($prefixforautocompletemode == 'societe')
5373
-            $prefixforautocompletemode = 'company';
5606
+        if ($prefixforautocompletemode == 'societe') {
5607
+                    $prefixforautocompletemode = 'company';
5608
+        }
5374 5609
         $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
5375 5610
 
5376 5611
         dol_syslog(get_class($this) . "::selectForForms", LOG_DEBUG);
@@ -5385,11 +5620,11 @@  discard block
 block discarded – undo
5385 5620
             // Activate the auto complete using ajax call.
5386 5621
             $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, Globals::$conf->global->$confkeyforautocompletemode, 0, array());
5387 5622
             $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
5388
-            if ($placeholder)
5389
-                $placeholder = ' placeholder="' . $placeholder . '"';
5623
+            if ($placeholder) {
5624
+                            $placeholder = ' placeholder="' . $placeholder . '"';
5625
+            }
5390 5626
             $out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $preselectedvalue . '"' . $placeholder . ' />';
5391
-        }
5392
-        else {
5627
+        } else {
5393 5628
             // Immediate load of all database
5394 5629
             $out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo);
5395 5630
         }
@@ -5419,19 +5654,22 @@  discard block
 block discarded – undo
5419 5654
         global $conf, $langs, $user;
5420 5655
 
5421 5656
         $prefixforautocompletemode = $objecttmp->element;
5422
-        if ($prefixforautocompletemode == 'societe')
5423
-            $prefixforautocompletemode = 'company';
5657
+        if ($prefixforautocompletemode == 'societe') {
5658
+                    $prefixforautocompletemode = 'company';
5659
+        }
5424 5660
         $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
5425 5661
 
5426 5662
         $fieldstoshow = 't.ref';
5427 5663
         if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields ( like societe, contact, ...)
5428 5664
             $tmpfieldstoshow = '';
5429 5665
             foreach ($objecttmp->fields as $key => $val) {
5430
-                if ($val['showoncombobox'])
5431
-                    $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
5666
+                if ($val['showoncombobox']) {
5667
+                                    $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
5668
+                }
5432 5669
             }
5433
-            if ($tmpfieldstoshow)
5434
-                $fieldstoshow = $tmpfieldstoshow;
5670
+            if ($tmpfieldstoshow) {
5671
+                            $fieldstoshow = $tmpfieldstoshow;
5672
+            }
5435 5673
         }
5436 5674
 
5437 5675
         $out = '';
@@ -5441,23 +5679,28 @@  discard block
 block discarded – undo
5441 5679
 
5442 5680
         // Search data
5443 5681
         $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . MAIN_DB_PREFIX . $objecttmp->table_element . " as t";
5444
-        if ($objecttmp->ismultientitymanaged == 2)
5445
-            if (!$user->rights->societe->client->voir && !$user->societe_id)
5446
-                $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
5682
+        if ($objecttmp->ismultientitymanaged == 2) {
5683
+                    if (!$user->rights->societe->client->voir && !$user->societe_id)
5684
+                $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
5685
+        }
5447 5686
         $sql .= " WHERE 1=1";
5448
-        if (!empty($objecttmp->ismultientitymanaged))
5449
-            $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
5687
+        if (!empty($objecttmp->ismultientitymanaged)) {
5688
+                    $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
5689
+        }
5450 5690
         if ($objecttmp->ismultientitymanaged == 1 && !empty($user->societe_id)) {
5451
-            if ($objecttmp->element == 'societe')
5452
-                $sql .= " AND t.rowid = " . $user->societe_id;
5453
-            else
5454
-                $sql .= " AND t.fk_soc = " . $user->societe_id;
5455
-        }
5456
-        if ($searchkey != '')
5457
-            $sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
5458
-        if ($objecttmp->ismultientitymanaged == 2)
5459
-            if (!$user->rights->societe->client->voir && !$user->societe_id)
5460
-                $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
5691
+            if ($objecttmp->element == 'societe') {
5692
+                            $sql .= " AND t.rowid = " . $user->societe_id;
5693
+            } else {
5694
+                            $sql .= " AND t.fk_soc = " . $user->societe_id;
5695
+            }
5696
+        }
5697
+        if ($searchkey != '') {
5698
+                    $sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
5699
+        }
5700
+        if ($objecttmp->ismultientitymanaged == 2) {
5701
+                    if (!$user->rights->societe->client->voir && !$user->societe_id)
5702
+                $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
5703
+        }
5461 5704
         $sql .= $this->db->order($fieldstoshow, "ASC");
5462 5705
         //$sql.=$this->db->plimit($limit, 0);
5463 5706
         // Build output string
@@ -5476,13 +5719,15 @@  discard block
 block discarded – undo
5476 5719
 
5477 5720
             //if (! empty(Globals::$conf->use_javascript_ajax) || $forcecombo) $textifempty='';
5478 5721
             if (!empty(Globals::$conf->global->$confkeyforautocompletemode)) {
5479
-                if ($showempty && !is_numeric($showempty))
5480
-                    $textifempty = $langs->trans($showempty);
5481
-                else
5482
-                    $textifempty .= $langs->trans("All");
5722
+                if ($showempty && !is_numeric($showempty)) {
5723
+                                    $textifempty = $langs->trans($showempty);
5724
+                } else {
5725
+                                    $textifempty .= $langs->trans("All");
5726
+                }
5483 5727
             }
5484
-            if ($showempty)
5485
-                $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
5728
+            if ($showempty) {
5729
+                            $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
5730
+            }
5486 5731
 
5487 5732
             $num = $this->db->num_rows($resql);
5488 5733
             $i = 0;
@@ -5506,21 +5751,22 @@  discard block
 block discarded – undo
5506 5751
                     }
5507 5752
 
5508 5753
                     $i++;
5509
-                    if (($i % 10) == 0)
5510
-                        $out .= "\n";
5754
+                    if (($i % 10) == 0) {
5755
+                                            $out .= "\n";
5756
+                    }
5511 5757
                 }
5512 5758
             }
5513 5759
 
5514 5760
             $out .= '</select>' . "\n";
5515
-        }
5516
-        else {
5761
+        } else {
5517 5762
             AlDolUtils::dol_print_error($this->db);
5518 5763
         }
5519 5764
 
5520 5765
         $this->result = array('nbofelement' => $num);
5521 5766
 
5522
-        if ($outputmode)
5523
-            return $outarray;
5767
+        if ($outputmode) {
5768
+                    return $outarray;
5769
+        }
5524 5770
         return $out;
5525 5771
     }
5526 5772
 
@@ -5556,8 +5802,9 @@  discard block
 block discarded – undo
5556 5802
         //if (preg_match('/^multi/',$htmlname)) $jsbeautify = 1;
5557 5803
         $jsbeautify = 1;
5558 5804
 
5559
-        if ($value_as_key)
5560
-            $array = array_combine($array, $array);
5805
+        if ($value_as_key) {
5806
+                    $array = array_combine($array, $array);
5807
+        }
5561 5808
 
5562 5809
         $out = '';
5563 5810
 
@@ -5577,10 +5824,13 @@  discard block
 block discarded – undo
5577 5824
 
5578 5825
         if ($show_empty) {
5579 5826
             $textforempty = ' ';
5580
-            if (!empty(Globals::$conf->use_javascript_ajax))
5581
-                $textforempty = '&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
5582
-            if (!is_numeric($show_empty))
5583
-                $textforempty = $show_empty;
5827
+            if (!empty(Globals::$conf->use_javascript_ajax)) {
5828
+                            $textforempty = '&nbsp;';
5829
+            }
5830
+            // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
5831
+            if (!is_numeric($show_empty)) {
5832
+                            $textforempty = $show_empty;
5833
+            }
5584 5834
             $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
5585 5835
         }
5586 5836
 
@@ -5593,10 +5843,11 @@  discard block
 block discarded – undo
5593 5843
             }
5594 5844
 
5595 5845
             // Sort
5596
-            if ($sort == 'ASC')
5597
-                asort($array);
5598
-            elseif ($sort == 'DESC')
5599
-                arsort($array);
5846
+            if ($sort == 'ASC') {
5847
+                            asort($array);
5848
+            } elseif ($sort == 'DESC') {
5849
+                            arsort($array);
5850
+            }
5600 5851
 
5601 5852
             foreach ($array as $key => $value) {
5602 5853
                 $disabled = '';
@@ -5610,26 +5861,31 @@  discard block
 block discarded – undo
5610 5861
                 }
5611 5862
 
5612 5863
                 if ($key_in_label) {
5613
-                    if (empty($nohtmlescape))
5614
-                        $selectOptionValue = AlDolUtils::dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
5615
-                    else
5616
-                        $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
5617
-                }
5618
-                else {
5619
-                    if (empty($nohtmlescape))
5620
-                        $selectOptionValue = AlDolUtils::dol_escape_htmltag($maxlen ? dol_trunc($value, $maxlen) : $value);
5621
-                    else
5622
-                        $selectOptionValue = $maxlen ? dol_trunc($value, $maxlen) : $value;
5623
-                    if ($value == '' || $value == '-')
5624
-                        $selectOptionValue = '&nbsp;';
5864
+                    if (empty($nohtmlescape)) {
5865
+                                            $selectOptionValue = AlDolUtils::dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
5866
+                    } else {
5867
+                                            $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
5868
+                    }
5869
+                } else {
5870
+                    if (empty($nohtmlescape)) {
5871
+                                            $selectOptionValue = AlDolUtils::dol_escape_htmltag($maxlen ? dol_trunc($value, $maxlen) : $value);
5872
+                    } else {
5873
+                                            $selectOptionValue = $maxlen ? dol_trunc($value, $maxlen) : $value;
5874
+                    }
5875
+                    if ($value == '' || $value == '-') {
5876
+                                            $selectOptionValue = '&nbsp;';
5877
+                    }
5625 5878
                 }
5626 5879
 
5627 5880
                 $out .= '<option value="' . $key . '"';
5628 5881
                 $out .= $style . $disabled;
5629
-                if ($id != '' && $id == $key && !$disabled)
5630
-                    $out .= ' selected';  // To preselect a value
5631
-                if ($nohtmlescape)
5632
-                    $out .= ' data-html="' . AlDolUtils::dol_escape_htmltag($selectOptionValue) . '"';
5882
+                if ($id != '' && $id == $key && !$disabled) {
5883
+                                    $out .= ' selected';
5884
+                }
5885
+                // To preselect a value
5886
+                if ($nohtmlescape) {
5887
+                                    $out .= ' data-html="' . AlDolUtils::dol_escape_htmltag($selectOptionValue) . '"';
5888
+                }
5633 5889
                 $out .= '>';
5634 5890
                 //var_dump($selectOptionValue);
5635 5891
                 $out .= $selectOptionValue;
@@ -5665,8 +5921,9 @@  discard block
 block discarded – undo
5665 5921
         global $delayedhtmlcontent;
5666 5922
 
5667 5923
         // TODO Use an internal dolibarr component instead of select2
5668
-        if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT'))
5669
-            return '';
5924
+        if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
5925
+                    return '';
5926
+        }
5670 5927
 
5671 5928
         $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
5672 5929
 
@@ -5765,8 +6022,9 @@  discard block
 block discarded – undo
5765 6022
         global $delayedhtmlcontent;
5766 6023
 
5767 6024
         // TODO Use an internal dolibarr component instead of select2
5768
-        if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT'))
5769
-            return '';
6025
+        if (empty(Globals::$conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
6026
+                    return '';
6027
+        }
5770 6028
 
5771 6029
         $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"><option></option></select>';
5772 6030
 
@@ -5936,8 +6194,9 @@  discard block
 block discarded – undo
5936 6194
 
5937 6195
         $out .= '<select id="' . $htmlname . '" class="multiselect' . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n";
5938 6196
         if (is_array($array) && !empty($array)) {
5939
-            if ($value_as_key)
5940
-                $array = array_combine($array, $array);
6197
+            if ($value_as_key) {
6198
+                            $array = array_combine($array, $array);
6199
+            }
5941 6200
 
5942 6201
             if (!empty($array)) {
5943 6202
                 foreach ($array as $key => $value) {
@@ -5972,8 +6231,9 @@  discard block
 block discarded – undo
5972 6231
     {
5973 6232
         global $conf, $langs, $user;
5974 6233
 
5975
-        if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
5976
-            return '';
6234
+        if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
6235
+                    return '';
6236
+        }
5977 6237
 
5978 6238
         $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage;
5979 6239
         if (!empty($user->conf->$tmpvar)) {
@@ -5981,10 +6241,11 @@  discard block
 block discarded – undo
5981 6241
             foreach ($array as $key => $val) {
5982 6242
                 //var_dump($key);
5983 6243
                 //var_dump($tmparray);
5984
-                if (in_array($key, $tmparray))
5985
-                    $array[$key]['checked'] = 1;
5986
-                else
5987
-                    $array[$key]['checked'] = 0;
6244
+                if (in_array($key, $tmparray)) {
6245
+                                    $array[$key]['checked'] = 1;
6246
+                } else {
6247
+                                    $array[$key]['checked'] = 0;
6248
+                }
5988 6249
             }
5989 6250
         }
5990 6251
         //var_dump($array);
@@ -6150,40 +6411,47 @@  discard block
 block discarded – undo
6150 6411
                 // To work with non standard path
6151 6412
                 if ($objecttype == 'facture') {
6152 6413
                     $tplpath = 'compta/' . $element;
6153
-                    if (empty(Globals::$conf->facture->enabled))
6154
-                        continue; // Do not show if module disabled
6155
-                }
6156
-                else if ($objecttype == 'facturerec') {
6414
+                    if (empty(Globals::$conf->facture->enabled)) {
6415
+                                            continue;
6416
+                    }
6417
+                    // Do not show if module disabled
6418
+                } else if ($objecttype == 'facturerec') {
6157 6419
                     $tplpath = 'compta/facture';
6158 6420
                     $tplname = 'linkedobjectblockForRec';
6159
-                    if (empty(Globals::$conf->facture->enabled))
6160
-                        continue; // Do not show if module disabled
6161
-                }
6162
-                else if ($objecttype == 'propal') {
6421
+                    if (empty(Globals::$conf->facture->enabled)) {
6422
+                                            continue;
6423
+                    }
6424
+                    // Do not show if module disabled
6425
+                } else if ($objecttype == 'propal') {
6163 6426
                     $tplpath = 'comm/' . $element;
6164
-                    if (empty(Globals::$conf->propal->enabled))
6165
-                        continue; // Do not show if module disabled
6166
-                }
6167
-                else if ($objecttype == 'supplier_proposal') {
6168
-                    if (empty(Globals::$conf->supplier_proposal->enabled))
6169
-                        continue; // Do not show if module disabled
6170
-                }
6171
-                else if ($objecttype == 'shipping' || $objecttype == 'shipment') {
6427
+                    if (empty(Globals::$conf->propal->enabled)) {
6428
+                                            continue;
6429
+                    }
6430
+                    // Do not show if module disabled
6431
+                } else if ($objecttype == 'supplier_proposal') {
6432
+                    if (empty(Globals::$conf->supplier_proposal->enabled)) {
6433
+                                            continue;
6434
+                    }
6435
+                    // Do not show if module disabled
6436
+                } else if ($objecttype == 'shipping' || $objecttype == 'shipment') {
6172 6437
                     $tplpath = 'expedition';
6173
-                    if (empty(Globals::$conf->expedition->enabled))
6174
-                        continue; // Do not show if module disabled
6175
-                }
6176
-                else if ($objecttype == 'reception') {
6438
+                    if (empty(Globals::$conf->expedition->enabled)) {
6439
+                                            continue;
6440
+                    }
6441
+                    // Do not show if module disabled
6442
+                } else if ($objecttype == 'reception') {
6177 6443
                     $tplpath = 'reception';
6178
-                    if (empty(Globals::$conf->reception->enabled))
6179
-                        continue; // Do not show if module disabled
6180
-                }
6181
-                else if ($objecttype == 'delivery') {
6444
+                    if (empty(Globals::$conf->reception->enabled)) {
6445
+                                            continue;
6446
+                    }
6447
+                    // Do not show if module disabled
6448
+                } else if ($objecttype == 'delivery') {
6182 6449
                     $tplpath = 'livraison';
6183
-                    if (empty(Globals::$conf->expedition->enabled))
6184
-                        continue; // Do not show if module disabled
6185
-                }
6186
-                else if ($objecttype == 'invoice_supplier') {
6450
+                    if (empty(Globals::$conf->expedition->enabled)) {
6451
+                                            continue;
6452
+                    }
6453
+                    // Do not show if module disabled
6454
+                } else if ($objecttype == 'invoice_supplier') {
6187 6455
                     $tplpath = 'fourn/facture';
6188 6456
                 } else if ($objecttype == 'order_supplier') {
6189 6457
                     $tplpath = 'fourn/commande';
@@ -6247,20 +6515,23 @@  discard block
 block discarded – undo
6247 6515
         $linktoelemlist = '';
6248 6516
         $listofidcompanytoscan = '';
6249 6517
 
6250
-        if (!is_object($object->thirdparty))
6251
-            $object->fetch_thirdparty();
6518
+        if (!is_object($object->thirdparty)) {
6519
+                    $object->fetch_thirdparty();
6520
+        }
6252 6521
 
6253 6522
         $possiblelinks = array();
6254 6523
         if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
6255 6524
             $listofidcompanytoscan = $object->thirdparty->id;
6256
-            if (($object->thirdparty->parent > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO))
6257
-                $listofidcompanytoscan .= ',' . $object->thirdparty->parent;
6525
+            if (($object->thirdparty->parent > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) {
6526
+                            $listofidcompanytoscan .= ',' . $object->thirdparty->parent;
6527
+            }
6258 6528
             if (($object->fk_project > 0) && !empty(Globals::$conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO)) {
6259 6529
                 include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
6260 6530
                 $tmpproject = new Project($this->db);
6261 6531
                 $tmpproject->fetch($object->fk_project);
6262
-                if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id))
6263
-                    $listofidcompanytoscan .= ',' . $tmpproject->socid;
6532
+                if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
6533
+                                    $listofidcompanytoscan .= ',' . $tmpproject->socid;
6534
+                }
6264 6535
                 unset($tmpproject);
6265 6536
             }
6266 6537
 
@@ -6296,8 +6567,9 @@  discard block
 block discarded – undo
6296 6567
         foreach ($possiblelinks as $key => $possiblelink) {
6297 6568
             $num = 0;
6298 6569
 
6299
-            if (empty($possiblelink['enabled']))
6300
-                continue;
6570
+            if (empty($possiblelink['enabled'])) {
6571
+                            continue;
6572
+            }
6301 6573
 
6302 6574
             if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
6303 6575
                 print '<div id="' . $key . 'list"' . (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' style="display:none"' : '') . '>';
@@ -6348,11 +6620,13 @@  discard block
 block discarded – undo
6348 6620
                 }
6349 6621
 
6350 6622
                 //$linktoelem.=($linktoelem?' &nbsp; ':'');
6351
-                if ($num > 0)
6352
-                    $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
6623
+                if ($num > 0) {
6624
+                                    $linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
6625
+                }
6353 6626
                 //else $linktoelem.=$langs->trans($possiblelink['label']);
6354
-                else
6355
-                    $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
6627
+                else {
6628
+                                    $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
6629
+                }
6356 6630
             }
6357 6631
         }
6358 6632
 
@@ -6410,8 +6684,9 @@  discard block
 block discarded – undo
6410 6684
         $disabled = ($disabled ? ' disabled' : '');
6411 6685
 
6412 6686
         $resultyesno = '<select class="flat width75" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
6413
-        if ($useempty)
6414
-            $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
6687
+        if ($useempty) {
6688
+                    $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
6689
+        }
6415 6690
         if (("$value" == 'yes') || ($value == 1)) {
6416 6691
             $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans("Yes") . '</option>' . "\n";
6417 6692
             $resultyesno .= '<option value="' . $no . '">' . $langs->trans("No") . '</option>' . "\n";
@@ -6490,10 +6765,12 @@  discard block
 block discarded – undo
6490 6765
         global $langs, $conf, $hookmanager;
6491 6766
 
6492 6767
         $ret = '';
6493
-        if (empty($fieldid))
6494
-            $fieldid = 'rowid';
6495
-        if (empty($fieldref))
6496
-            $fieldref = 'ref';
6768
+        if (empty($fieldid)) {
6769
+                    $fieldid = 'rowid';
6770
+        }
6771
+        if (empty($fieldref)) {
6772
+                    $fieldref = 'ref';
6773
+        }
6497 6774
 
6498 6775
         // Add where from hooks
6499 6776
         if (is_object($hookmanager)) {
@@ -6532,8 +6809,9 @@  discard block
 block discarded – undo
6532 6809
         $ret .= '<!-- Start banner content --><div style="vertical-align: middle">';
6533 6810
 
6534 6811
         // Right part of banner
6535
-        if ($morehtmlright)
6536
-            $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
6812
+        if ($morehtmlright) {
6813
+                    $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
6814
+        }
6537 6815
 
6538 6816
         if ($previous_ref || $next_ref || $morehtml) {
6539 6817
             $ret .= '<div class="pagination paginationref"><ul class="right">';
@@ -6551,26 +6829,32 @@  discard block
 block discarded – undo
6551 6829
 
6552 6830
         $parameters = array();
6553 6831
         $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object);    // Note that $action and $object may have been modified by hook
6554
-        if (empty($reshook))
6555
-            $morehtmlstatus .= $hookmanager->resPrint;
6556
-        else
6557
-            $morehtmlstatus = $hookmanager->resPrint;
6558
-        if ($morehtmlstatus)
6559
-            $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
6832
+        if (empty($reshook)) {
6833
+                    $morehtmlstatus .= $hookmanager->resPrint;
6834
+        } else {
6835
+                    $morehtmlstatus = $hookmanager->resPrint;
6836
+        }
6837
+        if ($morehtmlstatus) {
6838
+                    $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
6839
+        }
6560 6840
 
6561 6841
         $parameters = array();
6562 6842
         $reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object); // Note that $action and $object may have been modified by hook
6563
-        if (empty($reshook))
6564
-            $morehtmlref .= $hookmanager->resPrint;
6565
-        elseif ($reshook > 0)
6566
-            $morehtmlref = $hookmanager->resPrint;
6843
+        if (empty($reshook)) {
6844
+                    $morehtmlref .= $hookmanager->resPrint;
6845
+        } elseif ($reshook > 0) {
6846
+                    $morehtmlref = $hookmanager->resPrint;
6847
+        }
6567 6848
 
6568 6849
         // Left part of banner
6569 6850
         if ($morehtmlleft) {
6570
-            if (Globals::$conf->browser->layout == 'phone')
6571
-                $ret .= '<div class="floatleft">' . $morehtmlleft . '</div>';    // class="center" to have photo in middle
6572
-            else
6573
-                $ret .= '<div class="inline-block floatleft">' . $morehtmlleft . '</div>';
6851
+            if (Globals::$conf->browser->layout == 'phone') {
6852
+                            $ret .= '<div class="floatleft">' . $morehtmlleft . '</div>';
6853
+            }
6854
+            // class="center" to have photo in middle
6855
+            else {
6856
+                            $ret .= '<div class="inline-block floatleft">' . $morehtmlleft . '</div>';
6857
+            }
6574 6858
         }
6575 6859
 
6576 6860
         //if (Globals::$conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
@@ -6595,8 +6879,9 @@  discard block
 block discarded – undo
6595 6879
             $ret .= $object->label;
6596 6880
         } else if ($object->element == 'ecm_directories') {
6597 6881
             $ret .= '';
6598
-        } else if ($fieldref != 'none')
6599
-            $ret .= dol_htmlentities($object->$fieldref);
6882
+        } else if ($fieldref != 'none') {
6883
+                    $ret .= dol_htmlentities($object->$fieldref);
6884
+        }
6600 6885
 
6601 6886
 
6602 6887
         if ($morehtmlref) {
@@ -6621,15 +6906,17 @@  discard block
 block discarded – undo
6621 6906
         global $conf;
6622 6907
 
6623 6908
         //Check if barcode is filled in the card
6624
-        if (empty($object->barcode))
6625
-            return '';
6909
+        if (empty($object->barcode)) {
6910
+                    return '';
6911
+        }
6626 6912
 
6627 6913
         // Complete object if not complete
6628 6914
         if (empty($object->barcode_type_code) || empty($object->barcode_type_coder)) {
6629 6915
             $result = $object->fetch_barcode();
6630 6916
             //Check if fetch_barcode() failed
6631
-            if ($result < 1)
6632
-                return '<!-- ErrorFetchBarcode -->';
6917
+            if ($result < 1) {
6918
+                            return '<!-- ErrorFetchBarcode -->';
6919
+            }
6633 6920
         }
6634 6921
 
6635 6922
         // Barcode image
@@ -6717,66 +7004,74 @@  discard block
 block discarded – undo
6717 7004
                 if ($modulepart == 'memberphoto') {
6718 7005
                     $dir = Globals::$conf->adherent->dir_output;
6719 7006
                     if (!empty($object->photo)) {
6720
-                        if ((string) $imagesize == 'mini')
6721
-                            $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
6722
-                        else if ((string) $imagesize == 'small')
6723
-                            $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
6724
-                        else
6725
-                            $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
7007
+                        if ((string) $imagesize == 'mini') {
7008
+                                                    $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
7009
+                        } else if ((string) $imagesize == 'small') {
7010
+                                                    $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
7011
+                        } else {
7012
+                                                    $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
7013
+                        }
6726 7014
                         $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
6727 7015
                     }
6728
-                    if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS))
6729
-                        $altfile = $object->id . ".jpg"; // For backward compatibility
7016
+                    if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) {
7017
+                                            $altfile = $object->id . ".jpg";
7018
+                    }
7019
+                    // For backward compatibility
6730 7020
                     $email = $object->email;
6731 7021
                     $capture = 'user';
6732
-                }
6733
-                else {
7022
+                } else {
6734 7023
                     // Generic case to show photos
6735 7024
                     $dir = Globals::$conf->$modulepart->dir_output;
6736 7025
                     if (!empty($object->photo)) {
6737
-                        if ((string) $imagesize == 'mini')
6738
-                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
6739
-                        else if ((string) $imagesize == 'small')
6740
-                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small');
6741
-                        else
6742
-                            $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
7026
+                        if ((string) $imagesize == 'mini') {
7027
+                                                    $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
7028
+                        } else if ((string) $imagesize == 'small') {
7029
+                                                    $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small');
7030
+                        } else {
7031
+                                                    $file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
7032
+                        }
6743 7033
                         $originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
6744 7034
                     }
6745
-                    if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS))
6746
-                        $altfile = $object->id . ".jpg"; // For backward compatibility
7035
+                    if (!empty(Globals::$conf->global->MAIN_OLD_IMAGE_LINKS)) {
7036
+                                            $altfile = $object->id . ".jpg";
7037
+                    }
7038
+                    // For backward compatibility
6747 7039
                     $email = $object->email;
6748 7040
                 }
6749 7041
             }
6750 7042
         }
6751
-        if ($forcecapture)
6752
-            $capture = $forcecapture;
7043
+        if ($forcecapture) {
7044
+                    $capture = $forcecapture;
7045
+        }
6753 7046
 
6754 7047
         if ($dir) {
6755 7048
             if ($file && file_exists($dir . "/" . $file)) {
6756 7049
                 if ($addlinktofullsize) {
6757 7050
                     $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
6758
-                    if ($urladvanced)
6759
-                        $ret .= '<a href="' . $urladvanced . '">';
6760
-                    else
6761
-                        $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
7051
+                    if ($urladvanced) {
7052
+                                            $ret .= '<a href="' . $urladvanced . '">';
7053
+                    } else {
7054
+                                            $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
7055
+                    }
6762 7056
                 }
6763 7057
                 $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">';
6764
-                if ($addlinktofullsize)
6765
-                    $ret .= '</a>';
6766
-            }
6767
-            else if ($altfile && file_exists($dir . "/" . $altfile)) {
7058
+                if ($addlinktofullsize) {
7059
+                                    $ret .= '</a>';
7060
+                }
7061
+            } else if ($altfile && file_exists($dir . "/" . $altfile)) {
6768 7062
                 if ($addlinktofullsize) {
6769 7063
                     $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
6770
-                    if ($urladvanced)
6771
-                        $ret .= '<a href="' . $urladvanced . '">';
6772
-                    else
6773
-                        $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
7064
+                    if ($urladvanced) {
7065
+                                            $ret .= '<a href="' . $urladvanced . '">';
7066
+                    } else {
7067
+                                            $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
7068
+                    }
6774 7069
                 }
6775 7070
                 $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo alt" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" class="' . $cssclass . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($altfile) . '&cache=' . $cache . '">';
6776
-                if ($addlinktofullsize)
6777
-                    $ret .= '</a>';
6778
-            }
6779
-            else {
7071
+                if ($addlinktofullsize) {
7072
+                                    $ret .= '</a>';
7073
+                }
7074
+            } else {
6780 7075
                 $nophoto = '/public/theme/common/nophoto.png';
6781 7076
                 if (in_array($modulepart, array('userphoto', 'contact'))) { // For module that are "physical" users
6782 7077
                     $nophoto = '/public/theme/common/user_anonymous.png';
@@ -6814,8 +7109,9 @@  discard block
 block discarded – undo
6814 7109
                 $ret .= '<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput"' . ($capture ? ' capture="' . $capture . '"' : '') . '></td></tr>';
6815 7110
                 $ret .= '</table>';
6816 7111
             }
6817
-        } else
6818
-            AlDolUtils::dol_print_error('', 'Call of showphoto with wrong parameters modulepart=' . $modulepart);
7112
+        } else {
7113
+                    AlDolUtils::dol_print_error('', 'Call of showphoto with wrong parameters modulepart=' . $modulepart);
7114
+        }
6819 7115
 
6820 7116
         return $ret;
6821 7117
     }
@@ -6842,14 +7138,17 @@  discard block
 block discarded – undo
6842 7138
         global $conf, $user, $langs;
6843 7139
 
6844 7140
         // Permettre l'exclusion de groupes
6845
-        if (is_array($exclude))
6846
-            $excludeGroups = implode("','", $exclude);
7141
+        if (is_array($exclude)) {
7142
+                    $excludeGroups = implode("','", $exclude);
7143
+        }
6847 7144
         // Permettre l'inclusion de groupes
6848
-        if (is_array($include))
6849
-            $includeGroups = implode("','", $include);
7145
+        if (is_array($include)) {
7146
+                    $includeGroups = implode("','", $include);
7147
+        }
6850 7148
 
6851
-        if (!is_array($selected))
6852
-            $selected = array($selected);
7149
+        if (!is_array($selected)) {
7150
+                    $selected = array($selected);
7151
+        }
6853 7152
 
6854 7153
         $out = '';
6855 7154
 
@@ -6861,18 +7160,20 @@  discard block
 block discarded – undo
6861 7160
         $sql .= " FROM " . MAIN_DB_PREFIX . "usergroup as ug ";
6862 7161
         if (!empty(Globals::$conf->multicompany->enabled) && Globals::$conf->entity == 1 && $user->admin && !$user->entity) {
6863 7162
             $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entity as e ON e.rowid=ug.entity";
6864
-            if ($force_entity)
6865
-                $sql .= " WHERE ug.entity IN (0," . $force_entity . ")";
6866
-            else
6867
-                $sql .= " WHERE ug.entity IS NOT NULL";
6868
-        }
6869
-        else {
7163
+            if ($force_entity) {
7164
+                            $sql .= " WHERE ug.entity IN (0," . $force_entity . ")";
7165
+            } else {
7166
+                            $sql .= " WHERE ug.entity IS NOT NULL";
7167
+            }
7168
+        } else {
6870 7169
             $sql .= " WHERE ug.entity IN (0," . Globals::$conf->entity . ")";
6871 7170
         }
6872
-        if (is_array($exclude) && $excludeGroups)
6873
-            $sql .= " AND ug.rowid NOT IN ('" . $excludeGroups . "')";
6874
-        if (is_array($include) && $includeGroups)
6875
-            $sql .= " AND ug.rowid IN ('" . $includeGroups . "')";
7171
+        if (is_array($exclude) && $excludeGroups) {
7172
+                    $sql .= " AND ug.rowid NOT IN ('" . $excludeGroups . "')";
7173
+        }
7174
+        if (is_array($include) && $includeGroups) {
7175
+                    $sql .= " AND ug.rowid IN ('" . $includeGroups . "')";
7176
+        }
6876 7177
         $sql .= " ORDER BY ug.nom ASC";
6877 7178
 
6878 7179
         dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
@@ -6887,18 +7188,21 @@  discard block
 block discarded – undo
6887 7188
             $num = $this->db->num_rows($resql);
6888 7189
             $i = 0;
6889 7190
             if ($num) {
6890
-                if ($show_empty && !$multiple)
6891
-                    $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
7191
+                if ($show_empty && !$multiple) {
7192
+                                    $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
7193
+                }
6892 7194
 
6893 7195
                 while ($i < $num) {
6894 7196
                     $obj = $this->db->fetch_object($resql);
6895 7197
                     $disableline = 0;
6896
-                    if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly))
6897
-                        $disableline = 1;
7198
+                    if (is_array($enableonly) && count($enableonly) && !in_array($obj->rowid, $enableonly)) {
7199
+                                            $disableline = 1;
7200
+                    }
6898 7201
 
6899 7202
                     $out .= '<option value="' . $obj->rowid . '"';
6900
-                    if ($disableline)
6901
-                        $out .= ' disabled';
7203
+                    if ($disableline) {
7204
+                                            $out .= ' disabled';
7205
+                    }
6902 7206
                     if ((is_object($selected[0]) && $selected[0]->id == $obj->rowid) || (!is_object($selected[0]) && in_array($obj->rowid, $selected) )) {
6903 7207
                         $out .= ' selected';
6904 7208
                     }
@@ -6913,13 +7217,13 @@  discard block
 block discarded – undo
6913 7217
                     $i++;
6914 7218
                 }
6915 7219
             } else {
6916
-                if ($show_empty)
6917
-                    $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
7220
+                if ($show_empty) {
7221
+                                    $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
7222
+                }
6918 7223
                 $out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
6919 7224
             }
6920 7225
             $out .= '</select>';
6921
-        }
6922
-        else {
7226
+        } else {
6923 7227
             AlDolUtils::dol_print_error($this->db);
6924 7228
         }
6925 7229
 
@@ -6955,8 +7259,9 @@  discard block
 block discarded – undo
6955 7259
         global $conf, $langs;
6956 7260
 
6957 7261
         $out = '';
6958
-        if (!empty(Globals::$conf->use_javascript_ajax))
6959
-            $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions"></div>';
7262
+        if (!empty(Globals::$conf->use_javascript_ajax)) {
7263
+                    $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="checkallactions" name="checkallactions" class="checkallactions"></div>';
7264
+        }
6960 7265
         $out .= '<script type="text/javascript">
6961 7266
             $(document).ready(function() {
6962 7267
             	$("#checkallactions").click(function() {
@@ -6969,8 +7274,9 @@  discard block
 block discarded – undo
6969 7274
                         console.log("We uncheck all");
6970 7275
                 		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
6971 7276
                     }' . "\n";
6972
-        if ($calljsfunction)
6973
-            $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
7277
+        if ($calljsfunction) {
7278
+                    $out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
7279
+        }
6974 7280
         $out .= '         });
6975 7281
 
6976 7282
         	$(".checkforselect").change(function() {
@@ -7018,22 +7324,25 @@  discard block
 block discarded – undo
7018 7324
 
7019 7325
         $sql = 'SELECT rowid, label FROM ' . MAIN_DB_PREFIX . 'c_exp_tax_cat WHERE active = 1';
7020 7326
         $sql .= ' AND entity IN (0,' . getEntity('exp_tax_cat') . ')';
7021
-        if (!empty($excludeid))
7022
-            $sql .= ' AND rowid NOT IN (' . implode(',', $excludeid) . ')';
7327
+        if (!empty($excludeid)) {
7328
+                    $sql .= ' AND rowid NOT IN (' . implode(',', $excludeid) . ')';
7329
+        }
7023 7330
         $sql .= ' ORDER BY label';
7024 7331
 
7025 7332
         $resql = $db->query($sql);
7026 7333
         if ($resql) {
7027 7334
             $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
7028
-            if ($useempty)
7029
-                $out .= '<option value="0">&nbsp;</option>';
7335
+            if ($useempty) {
7336
+                            $out .= '<option value="0">&nbsp;</option>';
7337
+            }
7030 7338
 
7031 7339
             while ($obj = $db->fetch_object($resql)) {
7032 7340
                 $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
7033 7341
             }
7034 7342
             $out .= '</select>';
7035
-            if (!empty($htmlname) && $user->admin)
7036
-                $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
7343
+            if (!empty($htmlname) && $user->admin) {
7344
+                            $out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
7345
+            }
7037 7346
 
7038 7347
             if (!empty($target)) {
7039 7348
                 $sql = "SELECT c.id FROM " . MAIN_DB_PREFIX . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
@@ -7046,8 +7355,9 @@  discard block
 block discarded – undo
7046 7355
 								$("select[name=' . $target . ']").on("change", function() {
7047 7356
 									var current_val = $(this).val();
7048 7357
 									if (current_val == ' . $obj->id . ') {';
7049
-                        if (!empty($default_selected) || !empty($selected))
7050
-                            $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
7358
+                        if (!empty($default_selected) || !empty($selected)) {
7359
+                                                    $out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
7360
+                        }
7051 7361
 
7052 7362
                         $out .= '
7053 7363
 										$("select[name=' . $htmlname . ']").change();
@@ -7083,8 +7393,7 @@  discard block
 block discarded – undo
7083 7393
                     }
7084 7394
                 }
7085 7395
             }
7086
-        }
7087
-        else {
7396
+        } else {
7088 7397
             AlDolUtils::dol_print_error($db);
7089 7398
         }
7090 7399
 
@@ -7109,8 +7418,9 @@  discard block
 block discarded – undo
7109 7418
         $resql = $db->query($sql);
7110 7419
         if ($resql) {
7111 7420
             $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
7112
-            if ($useempty)
7113
-                $out .= '<option value="0"></option>';
7421
+            if ($useempty) {
7422
+                            $out .= '<option value="0"></option>';
7423
+            }
7114 7424
 
7115 7425
             while ($obj = $db->fetch_object($resql)) {
7116 7426
                 $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
@@ -7143,14 +7453,17 @@  discard block
 block discarded – undo
7143 7453
         $resql = $db->query($sql);
7144 7454
         if ($resql) {
7145 7455
             $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
7146
-            if ($useempty)
7147
-                $out .= '<option value="0"></option>';
7148
-            if ($allchoice)
7149
-                $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
7456
+            if ($useempty) {
7457
+                            $out .= '<option value="0"></option>';
7458
+            }
7459
+            if ($allchoice) {
7460
+                            $out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
7461
+            }
7150 7462
 
7151 7463
             $field = 'code';
7152
-            if ($useid)
7153
-                $field = 'id';
7464
+            if ($useid) {
7465
+                            $field = 'id';
7466
+            }
7154 7467
 
7155 7468
             while ($obj = $db->fetch_object($resql)) {
7156 7469
                 $key = $langs->trans($obj->code);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/security2.lib.php 2 patches
Indentation   +359 added lines, -359 removed lines patch added patch discarded remove patch
@@ -51,70 +51,70 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode)
53 53
 {
54
-	global $conf,$langs;
54
+    global $conf,$langs;
55 55
     //global $dolauthmode;    // To return authentication finally used
56 56
 
57
-	// Check parameters
58
-	if ($entitytotest == '') $entitytotest=1;
57
+    // Check parameters
58
+    if ($entitytotest == '') $entitytotest=1;
59 59
 
60 60
     dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',',$authmode));
61
-	$login = '';
62
-
63
-	// Validation of login/pass/entity with standard modules
64
-	if (empty($login))
65
-	{
66
-	    $test=true;
67
-    	foreach($authmode as $mode)
68
-    	{
69
-    		if ($test && $mode && ! $login)
70
-    		{
71
-    		    // Validation of login/pass/entity for mode $mode
72
-    		    $mode=trim($mode);
73
-        		$authfile='functions_'.$mode.'.php';
74
-        		$fullauthfile='';
75
-
76
-    		    $dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
77
-    		    foreach($dirlogin as $reldir)
78
-    		    {
79
-    		        $dir=dol_buildpath($reldir,0);
80
-    		        $newdir=dol_osencode($dir);
81
-
82
-    		        // Check if file found (do not use dol_is_file to avoid loading files.lib.php)
83
-    		        $tmpnewauthfile = $newdir.(preg_match('/\/$/',$newdir)?'':'/').$authfile;
84
-    		        if (is_file($tmpnewauthfile)) $fullauthfile=$tmpnewauthfile;
85
-    		    }
86
-
87
-    		    $result=false;
88
-    		    if ($fullauthfile) $result=include_once $fullauthfile;
89
-    			if ($fullauthfile && $result)
90
-    			{
91
-    				// Call function to check user/password
92
-    				$function='check_user_password_'.$mode;
93
-    				$login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
94
-    				if ($login)	// Login is successfull
95
-    				{
96
-    					$test=false;            // To stop once at first login success
97
-    					$conf->authmode=$mode;	// This properties is defined only when logged to say what mode was successfully used
98
-    					$dol_tz=GETPOST('tz');
99
-    					$dol_dst=GETPOST('dst');
100
-    					$dol_screenwidth=GETPOST('screenwidth');
101
-    					$dol_screenheight=GETPOST('screenheight');
102
-    				}
103
-    			}
104
-    			else
105
-    			{
106
-    				dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
107
-    				sleep(1);
108
-    				// Load translation files required by the page
61
+    $login = '';
62
+
63
+    // Validation of login/pass/entity with standard modules
64
+    if (empty($login))
65
+    {
66
+        $test=true;
67
+        foreach($authmode as $mode)
68
+        {
69
+            if ($test && $mode && ! $login)
70
+            {
71
+                // Validation of login/pass/entity for mode $mode
72
+                $mode=trim($mode);
73
+                $authfile='functions_'.$mode.'.php';
74
+                $fullauthfile='';
75
+
76
+                $dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
77
+                foreach($dirlogin as $reldir)
78
+                {
79
+                    $dir=dol_buildpath($reldir,0);
80
+                    $newdir=dol_osencode($dir);
81
+
82
+                    // Check if file found (do not use dol_is_file to avoid loading files.lib.php)
83
+                    $tmpnewauthfile = $newdir.(preg_match('/\/$/',$newdir)?'':'/').$authfile;
84
+                    if (is_file($tmpnewauthfile)) $fullauthfile=$tmpnewauthfile;
85
+                }
86
+
87
+                $result=false;
88
+                if ($fullauthfile) $result=include_once $fullauthfile;
89
+                if ($fullauthfile && $result)
90
+                {
91
+                    // Call function to check user/password
92
+                    $function='check_user_password_'.$mode;
93
+                    $login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
94
+                    if ($login)	// Login is successfull
95
+                    {
96
+                        $test=false;            // To stop once at first login success
97
+                        $conf->authmode=$mode;	// This properties is defined only when logged to say what mode was successfully used
98
+                        $dol_tz=GETPOST('tz');
99
+                        $dol_dst=GETPOST('dst');
100
+                        $dol_screenwidth=GETPOST('screenwidth');
101
+                        $dol_screenheight=GETPOST('screenheight');
102
+                    }
103
+                }
104
+                else
105
+                {
106
+                    dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
107
+                    sleep(1);
108
+                    // Load translation files required by the page
109 109
                     $langs->loadLangs(array('other', 'main', 'errors'));
110 110
 
111
-    				$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
112
-    			}
113
-    		}
114
-    	}
115
-	}
111
+                    $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
112
+                }
113
+            }
114
+        }
115
+    }
116 116
 
117
-	return $login;
117
+    return $login;
118 118
 }
119 119
 
120 120
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
      * @return      void
131 131
      */
132 132
     function dol_loginfunction($langs,$conf,$mysoc)
133
-	{
134
-		global $dolibarr_main_demo,$db;
135
-		global $smartphone,$hookmanager;
133
+    {
134
+        global $dolibarr_main_demo,$db;
135
+        global $smartphone,$hookmanager;
136 136
 
137 137
         $langs->loadLangs(array("main", "other", "help", "admin"));
138 138
 
@@ -143,16 +143,16 @@  discard block
 block discarded – undo
143 143
 
144 144
         $session_name=session_name();	// Get current session name
145 145
 
146
-		$dol_url_root = DOL_URL_ROOT;
146
+        $dol_url_root = DOL_URL_ROOT;
147 147
 
148
-		// Title
149
-		$appli=constant('DOL_APPLICATION_TITLE');
150
-		$title=$appli.' '.constant('DOL_VERSION');
151
-		if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
152
-		$titletruedolibarrversion=constant('DOL_VERSION');	// $title used by login template after the @ to inform of true Dolibarr version
148
+        // Title
149
+        $appli=constant('DOL_APPLICATION_TITLE');
150
+        $title=$appli.' '.constant('DOL_VERSION');
151
+        if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
152
+        $titletruedolibarrversion=constant('DOL_VERSION');	// $title used by login template after the @ to inform of true Dolibarr version
153 153
 
154
-		// Note: $conf->css looks like '/theme/eldy/style.css.php'
155
-		/*
154
+        // Note: $conf->css looks like '/theme/eldy/style.css.php'
155
+        /*
156 156
 		$conf->css = "/theme/".(GETPOST('theme','alpha')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
157 157
 		$themepath=dol_buildpath($conf->css,1);
158 158
 		if (! empty($conf->modules_parts['theme']))		// Using this feature slow down application
@@ -169,138 +169,138 @@  discard block
 block discarded – undo
169 169
 		$conf_css = $themepath."?lang=".$langs->defaultlang;
170 170
 		*/
171 171
 
172
-		// Select templates dir
173
-		if (! empty($conf->modules_parts['tpl']))	// Using this feature slow down application
174
-		{
175
-			$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/'));
176
-			foreach($dirtpls as $reldir)
177
-			{
178
-				$tmp=dol_buildpath($reldir.'login.tpl.php');
179
-				if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/','',$tmp); break; }
180
-			}
181
-		}
182
-		else
183
-		{
184
-			$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
185
-		}
172
+        // Select templates dir
173
+        if (! empty($conf->modules_parts['tpl']))	// Using this feature slow down application
174
+        {
175
+            $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/'));
176
+            foreach($dirtpls as $reldir)
177
+            {
178
+                $tmp=dol_buildpath($reldir.'login.tpl.php');
179
+                if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/','',$tmp); break; }
180
+            }
181
+        }
182
+        else
183
+        {
184
+            $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
185
+        }
186 186
 
187
-		// Set cookie for timeout management
188
-		$prefix=dol_getprefix('');
189
-		$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
190
-		if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
187
+        // Set cookie for timeout management
188
+        $prefix=dol_getprefix('');
189
+        $sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
190
+        if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
191 191
 
192
-		if (GETPOST('urlfrom','alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom','alpha');
193
-		else unset($_SESSION["urlfrom"]);
192
+        if (GETPOST('urlfrom','alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom','alpha');
193
+        else unset($_SESSION["urlfrom"]);
194 194
 
195
-		if (! GETPOST("username",'alpha')) $focus_element='username';
196
-		else $focus_element='password';
195
+        if (! GETPOST("username",'alpha')) $focus_element='username';
196
+        else $focus_element='password';
197 197
 
198
-		$demologin='';
199
-		$demopassword='';
200
-		if (! empty($dolibarr_main_demo))
201
-		{
202
-			$tab=explode(',',$dolibarr_main_demo);
203
-			$demologin=$tab[0];
204
-			$demopassword=$tab[1];
205
-		}
198
+        $demologin='';
199
+        $demopassword='';
200
+        if (! empty($dolibarr_main_demo))
201
+        {
202
+            $tab=explode(',',$dolibarr_main_demo);
203
+            $demologin=$tab[0];
204
+            $demopassword=$tab[1];
205
+        }
206 206
 
207
-		// Execute hook getLoginPageOptions (for table)
208
-		$parameters=array('entity' => GETPOST('entity','int'));
209
-		$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
210
-		if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
211
-			$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
212
-		} else {
213
-			$morelogincontent = $hookmanager->resPrint;
214
-		}
207
+        // Execute hook getLoginPageOptions (for table)
208
+        $parameters=array('entity' => GETPOST('entity','int'));
209
+        $reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
210
+        if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
211
+            $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
212
+        } else {
213
+            $morelogincontent = $hookmanager->resPrint;
214
+        }
215 215
 
216
-		// Execute hook getLoginPageExtraOptions (eg for js)
217
-		$parameters=array('entity' => GETPOST('entity','int'));
218
-		$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
219
-		$moreloginextracontent = $hookmanager->resPrint;
216
+        // Execute hook getLoginPageExtraOptions (eg for js)
217
+        $parameters=array('entity' => GETPOST('entity','int'));
218
+        $reshook = $hookmanager->executeHooks('getLoginPageExtraOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
219
+        $moreloginextracontent = $hookmanager->resPrint;
220 220
 
221
-		// Login
222
-		$login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));
223
-		$password = $demopassword;
221
+        // Login
222
+        $login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));
223
+        $password = $demopassword;
224 224
 
225
-		// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
226
-		$width=0;
227
-		$urllogo = DOL_BASE_URI . '/theme/login_logo.png';
225
+        // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
226
+        $width=0;
227
+        $urllogo = DOL_BASE_URI . '/theme/login_logo.png';
228 228
 
229 229
         if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
230
-		{
231
-			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
232
-		}
233
-		elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
234
-		{
235
-			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
236
-			$width=128;
237
-		}
238
-		elseif (is_readable(DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
239
-			$urllogo = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
230
+        {
231
+            $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
240 232
         }
241
-		elseif (is_readable(DOL_BASE_URI . '/theme/dolibarr_logo.png')) {
242
-			$urllogo = DOL_BASE_URI . '/theme/dolibarr_logo.png';
233
+        elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
234
+        {
235
+            $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
236
+            $width=128;
237
+        }
238
+        elseif (is_readable(DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
239
+            $urllogo = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
240
+        }
241
+        elseif (is_readable(DOL_BASE_URI . '/theme/dolibarr_logo.png')) {
242
+            $urllogo = DOL_BASE_URI . '/theme/dolibarr_logo.png';
243 243
         }
244 244
 
245
-		// Security graphical code
246
-		$captcha=0;
247
-		$captcha_refresh='';
248
-		if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
249
-		{
250
-			$captcha=1;
251
-			$captcha_refresh=img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"');
252
-		}
253
-
254
-		// Extra link
255
-		$forgetpasslink=0;
256
-		$helpcenterlink=0;
257
-		if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
258
-		{
259
-			if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
260
-			{
261
-				$forgetpasslink=1;
262
-			}
245
+        // Security graphical code
246
+        $captcha=0;
247
+        $captcha_refresh='';
248
+        if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
249
+        {
250
+            $captcha=1;
251
+            $captcha_refresh=img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"');
252
+        }
263 253
 
264
-			if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
265
-			{
266
-				$helpcenterlink=1;
267
-			}
268
-		}
254
+        // Extra link
255
+        $forgetpasslink=0;
256
+        $helpcenterlink=0;
257
+        if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
258
+        {
259
+            if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
260
+            {
261
+                $forgetpasslink=1;
262
+            }
263
+
264
+            if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
265
+            {
266
+                $helpcenterlink=1;
267
+            }
268
+        }
269 269
 
270
-		// Home message
271
-		$main_home='';
272
-		if (! empty($conf->global->MAIN_HOME))
273
-		{
274
-		    $substitutionarray=getCommonSubstitutionArray($langs);
275
-		    complete_substitutions_array($substitutionarray, $langs);
276
-		    $texttoshow = make_substitutions($conf->global->MAIN_HOME, $substitutionarray, $langs);
270
+        // Home message
271
+        $main_home='';
272
+        if (! empty($conf->global->MAIN_HOME))
273
+        {
274
+            $substitutionarray=getCommonSubstitutionArray($langs);
275
+            complete_substitutions_array($substitutionarray, $langs);
276
+            $texttoshow = make_substitutions($conf->global->MAIN_HOME, $substitutionarray, $langs);
277 277
 
278
-			$main_home=dol_htmlcleanlastbr($texttoshow);
279
-		}
278
+            $main_home=dol_htmlcleanlastbr($texttoshow);
279
+        }
280 280
 
281
-		// Google AD
282
-		$main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0);
281
+        // Google AD
282
+        $main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0);
283 283
 
284
-		// Set jquery theme
285
-		$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
286
-		$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
287
-		if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
288
-		$jquerytheme = 'base';
289
-		if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
284
+        // Set jquery theme
285
+        $dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
286
+        $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
287
+        if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
288
+        $jquerytheme = 'base';
289
+        if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
290 290
 
291
-		// Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_no_mouse_hover
292
-		$dol_hide_topmenu=GETPOST('dol_hide_topmenu','int');
293
-		$dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int');
294
-		$dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen','int');
295
-		$dol_no_mouse_hover=GETPOST('dol_no_mouse_hover','int');
296
-		$dol_use_jmobile=GETPOST('dol_use_jmobile','int');
291
+        // Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_no_mouse_hover
292
+        $dol_hide_topmenu=GETPOST('dol_hide_topmenu','int');
293
+        $dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int');
294
+        $dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen','int');
295
+        $dol_no_mouse_hover=GETPOST('dol_no_mouse_hover','int');
296
+        $dol_use_jmobile=GETPOST('dol_use_jmobile','int');
297 297
 
298
-		// Include login page template
299
-		include $template_dir.'login.tpl.php';
298
+        // Include login page template
299
+        include $template_dir.'login.tpl.php';
300 300
 
301 301
 
302
-		$_SESSION["dol_loginmesg"] = '';
303
-	}
302
+        $_SESSION["dol_loginmesg"] = '';
303
+    }
304 304
 }
305 305
 
306 306
 /**
@@ -313,23 +313,23 @@  discard block
 block discarded – undo
313 313
  */
314 314
 function makesalt($type=CRYPT_SALT_LENGTH)
315 315
 {
316
-	dol_syslog("makesalt type=".$type);
317
-	switch($type)
318
-	{
319
-		case 12:	// 8 + 4
320
-			$saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
321
-		case 8:		// 8 (Pour compatibilite, ne devrait pas etre utilise)
322
-			$saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
323
-		case 2:		// 2
324
-		default: 	// by default, fall back on Standard DES (should work everywhere)
325
-			$saltlen=2; $saltprefix=''; $saltsuffix=''; break;
326
-	}
327
-	$salt='';
328
-	while(dol_strlen($salt) < $saltlen) $salt.=chr(mt_rand(64,126));
329
-
330
-	$result=$saltprefix.$salt.$saltsuffix;
331
-	dol_syslog("makesalt return=".$result);
332
-	return $result;
316
+    dol_syslog("makesalt type=".$type);
317
+    switch($type)
318
+    {
319
+        case 12:	// 8 + 4
320
+            $saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
321
+        case 8:		// 8 (Pour compatibilite, ne devrait pas etre utilise)
322
+            $saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
323
+        case 2:		// 2
324
+        default: 	// by default, fall back on Standard DES (should work everywhere)
325
+            $saltlen=2; $saltprefix=''; $saltsuffix=''; break;
326
+    }
327
+    $salt='';
328
+    while(dol_strlen($salt) < $saltlen) $salt.=chr(mt_rand(64,126));
329
+
330
+    $result=$saltprefix.$salt.$saltsuffix;
331
+    dol_syslog("makesalt return=".$result);
332
+    return $result;
333 333
 }
334 334
 
335 335
 /**
@@ -340,102 +340,102 @@  discard block
 block discarded – undo
340 340
  */
341 341
 function encodedecode_dbpassconf($level=0)
342 342
 {
343
-	dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG);
344
-	$config = '';
345
-	$passwd='';
346
-	$passwd_crypted='';
347
-
348
-	if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php','r'))
349
-	{
350
-		while(!feof($fp))
351
-		{
352
-			$buffer = fgets($fp,4096);
353
-
354
-			$lineofpass=0;
355
-
356
-			if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))	// Old way to save crypted value
357
-			{
358
-				$val = trim($reg[1]);	// This also remove CR/LF
359
-				$val=preg_replace('/^["\']/','',$val);
360
-				$val=preg_replace('/["\'][\s;]*$/','',$val);
361
-				if (! empty($val))
362
-				{
363
-					$passwd_crypted = $val;
364
-					$val = dol_decode($val);
365
-					$passwd = $val;
366
-					$lineofpass=1;
367
-				}
368
-			}
369
-			elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))
370
-			{
371
-				$val = trim($reg[1]);	// This also remove CR/LF
372
-				$val=preg_replace('/^["\']/','',$val);
373
-				$val=preg_replace('/["\'][\s;]*$/','',$val);
374
-				if (preg_match('/crypted:/i',$buffer))
375
-				{
376
-					$val = preg_replace('/crypted:/i','',$val);
377
-					$passwd_crypted = $val;
378
-					$val = dol_decode($val);
379
-					$passwd = $val;
380
-				}
381
-				else
382
-				{
383
-					$passwd = $val;
384
-					$val = dol_encode($val);
385
-					$passwd_crypted = $val;
386
-				}
387
-				$lineofpass=1;
388
-			}
389
-
390
-			// Output line
391
-			if ($lineofpass)
392
-			{
393
-				// Add value at end of file
394
-				if ($level == 0)
395
-				{
396
-					$config .= '$dolibarr_main_db_pass=\''.$passwd.'\';'."\n";
397
-				}
398
-				if ($level == 1)
399
-				{
400
-					$config .= '$dolibarr_main_db_pass=\'crypted:'.$passwd_crypted.'\';'."\n";
401
-				}
402
-
403
-				//print 'passwd = '.$passwd.' - passwd_crypted = '.$passwd_crypted;
404
-				//exit;
405
-			}
406
-			else
407
-			{
408
-				$config .= $buffer;
409
-			}
410
-		}
411
-		fclose($fp);
412
-
413
-		// Write new conf file
414
-		$file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
415
-		if ($fp = @fopen($file,'w'))
416
-		{
417
-			fputs($fp, $config);
418
-			fflush($fp);
419
-			fclose($fp);
420
-			clearstatcache();
421
-
422
-			// It's config file, so we set read permission for creator only.
423
-			// Should set permission to web user and groups for users used by batch
424
-			//@chmod($file, octdec('0600'));
425
-
426
-			return 1;
427
-		}
428
-		else
429
-		{
430
-			dol_syslog("encodedecode_dbpassconf Failed to open conf.php file for writing", LOG_WARNING);
431
-			return -1;
432
-		}
433
-	}
434
-	else
435
-	{
436
-		dol_syslog("encodedecode_dbpassconf Failed to read conf.php", LOG_ERR);
437
-		return -2;
438
-	}
343
+    dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG);
344
+    $config = '';
345
+    $passwd='';
346
+    $passwd_crypted='';
347
+
348
+    if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php','r'))
349
+    {
350
+        while(!feof($fp))
351
+        {
352
+            $buffer = fgets($fp,4096);
353
+
354
+            $lineofpass=0;
355
+
356
+            if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))	// Old way to save crypted value
357
+            {
358
+                $val = trim($reg[1]);	// This also remove CR/LF
359
+                $val=preg_replace('/^["\']/','',$val);
360
+                $val=preg_replace('/["\'][\s;]*$/','',$val);
361
+                if (! empty($val))
362
+                {
363
+                    $passwd_crypted = $val;
364
+                    $val = dol_decode($val);
365
+                    $passwd = $val;
366
+                    $lineofpass=1;
367
+                }
368
+            }
369
+            elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))
370
+            {
371
+                $val = trim($reg[1]);	// This also remove CR/LF
372
+                $val=preg_replace('/^["\']/','',$val);
373
+                $val=preg_replace('/["\'][\s;]*$/','',$val);
374
+                if (preg_match('/crypted:/i',$buffer))
375
+                {
376
+                    $val = preg_replace('/crypted:/i','',$val);
377
+                    $passwd_crypted = $val;
378
+                    $val = dol_decode($val);
379
+                    $passwd = $val;
380
+                }
381
+                else
382
+                {
383
+                    $passwd = $val;
384
+                    $val = dol_encode($val);
385
+                    $passwd_crypted = $val;
386
+                }
387
+                $lineofpass=1;
388
+            }
389
+
390
+            // Output line
391
+            if ($lineofpass)
392
+            {
393
+                // Add value at end of file
394
+                if ($level == 0)
395
+                {
396
+                    $config .= '$dolibarr_main_db_pass=\''.$passwd.'\';'."\n";
397
+                }
398
+                if ($level == 1)
399
+                {
400
+                    $config .= '$dolibarr_main_db_pass=\'crypted:'.$passwd_crypted.'\';'."\n";
401
+                }
402
+
403
+                //print 'passwd = '.$passwd.' - passwd_crypted = '.$passwd_crypted;
404
+                //exit;
405
+            }
406
+            else
407
+            {
408
+                $config .= $buffer;
409
+            }
410
+        }
411
+        fclose($fp);
412
+
413
+        // Write new conf file
414
+        $file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
415
+        if ($fp = @fopen($file,'w'))
416
+        {
417
+            fputs($fp, $config);
418
+            fflush($fp);
419
+            fclose($fp);
420
+            clearstatcache();
421
+
422
+            // It's config file, so we set read permission for creator only.
423
+            // Should set permission to web user and groups for users used by batch
424
+            //@chmod($file, octdec('0600'));
425
+
426
+            return 1;
427
+        }
428
+        else
429
+        {
430
+            dol_syslog("encodedecode_dbpassconf Failed to open conf.php file for writing", LOG_WARNING);
431
+            return -1;
432
+        }
433
+    }
434
+    else
435
+    {
436
+        dol_syslog("encodedecode_dbpassconf Failed to read conf.php", LOG_ERR);
437
+        return -2;
438
+    }
439 439
 }
440 440
 
441 441
 /**
@@ -448,72 +448,72 @@  discard block
 block discarded – undo
448 448
  */
449 449
 function getRandomPassword($generic=false, $replaceambiguouschars=null)
450 450
 {
451
-	global $db,$conf,$langs,$user;
452
-
453
-	$generated_password='';
454
-	if ($generic)
455
-	{
456
-		$length = 32;
457
-		$lowercase = "qwertyuiopasdfghjklzxcvbnm";
458
-		$uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
459
-		$numbers = "1234567890";
460
-		$randomCode = "";
461
-		$nbofchar = round($length/3);
462
-		$nbofcharlast = ($length - 2*$nbofchar);
463
-		//var_dump($nbofchar.'-'.$nbofcharlast);
464
-		if (function_exists('random_int'))	// Cryptographic random
465
-		{
466
-			$max = strlen($lowercase) - 1;
467
-			for ($x = 0; $x < $nbofchar; $x++) {
468
-				$randomCode .= $lowercase{random_int(0, $max)};
469
-			}
470
-			$max = strlen($uppercase) - 1;
471
-			for ($x = 0; $x < $nbofchar; $x++) {
472
-				$randomCode .= $uppercase{random_int(0, $max)};
473
-			}
474
-			$max = strlen($numbers) - 1;
475
-			for ($x = 0; $x < $nbofcharlast; $x++) {
476
-				$randomCode .= $numbers{random_int(0, $max)};
477
-			}
478
-
479
-			$generated_password=str_shuffle($randomCode);
480
-		}
481
-		else	// Old platform, non cryptographic random
482
-		{
483
-			$max = strlen($lowercase) - 1;
484
-			for ($x = 0; $x < $nbofchar; $x++) {
485
-				$randomCode .= $lowercase{mt_rand(0, $max)};
486
-			}
487
-			$max = strlen($uppercase) - 1;
488
-			for ($x = 0; $x < $nbofchar; $x++) {
489
-				$randomCode .= $uppercase{mt_rand(0, $max)};
490
-			}
491
-			$max = strlen($numbers) - 1;
492
-			for ($x = 0; $x < $nbofcharlast; $x++) {
493
-				$randomCode .= $numbers{mt_rand(0, $max)};
494
-			}
495
-
496
-			$generated_password=str_shuffle($randomCode);
497
-		}
498
-	}
499
-	else if (! empty($conf->global->USER_PASSWORD_GENERATED))
500
-	{
501
-		$nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
502
-		$nomfichier=$nomclass.".class.php";
503
-		//print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass;
504
-		require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier;
505
-		$genhandler=new $nomclass($db,$conf,$langs,$user);
506
-		$generated_password=$genhandler->getNewGeneratedPassword();
507
-		unset($genhandler);
508
-	}
509
-
510
-	// Do we have to discard some alphabetic characters ?
511
-	if (is_array($replaceambiguouschars) && count($replaceambiguouschars) > 0)
512
-	{
513
-		$numbers = "ABCDEF";
514
-		$max = strlen($numbers) - 1;
515
-		$generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
516
-	}
517
-
518
-	return $generated_password;
451
+    global $db,$conf,$langs,$user;
452
+
453
+    $generated_password='';
454
+    if ($generic)
455
+    {
456
+        $length = 32;
457
+        $lowercase = "qwertyuiopasdfghjklzxcvbnm";
458
+        $uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
459
+        $numbers = "1234567890";
460
+        $randomCode = "";
461
+        $nbofchar = round($length/3);
462
+        $nbofcharlast = ($length - 2*$nbofchar);
463
+        //var_dump($nbofchar.'-'.$nbofcharlast);
464
+        if (function_exists('random_int'))	// Cryptographic random
465
+        {
466
+            $max = strlen($lowercase) - 1;
467
+            for ($x = 0; $x < $nbofchar; $x++) {
468
+                $randomCode .= $lowercase{random_int(0, $max)};
469
+            }
470
+            $max = strlen($uppercase) - 1;
471
+            for ($x = 0; $x < $nbofchar; $x++) {
472
+                $randomCode .= $uppercase{random_int(0, $max)};
473
+            }
474
+            $max = strlen($numbers) - 1;
475
+            for ($x = 0; $x < $nbofcharlast; $x++) {
476
+                $randomCode .= $numbers{random_int(0, $max)};
477
+            }
478
+
479
+            $generated_password=str_shuffle($randomCode);
480
+        }
481
+        else	// Old platform, non cryptographic random
482
+        {
483
+            $max = strlen($lowercase) - 1;
484
+            for ($x = 0; $x < $nbofchar; $x++) {
485
+                $randomCode .= $lowercase{mt_rand(0, $max)};
486
+            }
487
+            $max = strlen($uppercase) - 1;
488
+            for ($x = 0; $x < $nbofchar; $x++) {
489
+                $randomCode .= $uppercase{mt_rand(0, $max)};
490
+            }
491
+            $max = strlen($numbers) - 1;
492
+            for ($x = 0; $x < $nbofcharlast; $x++) {
493
+                $randomCode .= $numbers{mt_rand(0, $max)};
494
+            }
495
+
496
+            $generated_password=str_shuffle($randomCode);
497
+        }
498
+    }
499
+    else if (! empty($conf->global->USER_PASSWORD_GENERATED))
500
+    {
501
+        $nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
502
+        $nomfichier=$nomclass.".class.php";
503
+        //print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass;
504
+        require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier;
505
+        $genhandler=new $nomclass($db,$conf,$langs,$user);
506
+        $generated_password=$genhandler->getNewGeneratedPassword();
507
+        unset($genhandler);
508
+    }
509
+
510
+    // Do we have to discard some alphabetic characters ?
511
+    if (is_array($replaceambiguouschars) && count($replaceambiguouschars) > 0)
512
+    {
513
+        $numbers = "ABCDEF";
514
+        $max = strlen($numbers) - 1;
515
+        $generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
516
+    }
517
+
518
+    return $generated_password;
519 519
 }
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function dol_getwebuser($mode)
36 36
 {
37
-    $t='?';
38
-    if ($mode=='user')  $t=getenv('APACHE_RUN_USER');   // $_ENV['APACHE_RUN_USER'] is empty
39
-    if ($mode=='group') $t=getenv('APACHE_RUN_GROUP');
37
+    $t = '?';
38
+    if ($mode == 'user')  $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty
39
+    if ($mode == 'group') $t = getenv('APACHE_RUN_GROUP');
40 40
     return $t;
41 41
 }
42 42
 
@@ -49,56 +49,56 @@  discard block
 block discarded – undo
49 49
  *	@param		array	$authmode			Array list of selected authentication mode array('http', 'dolibarr', 'xxx'...)
50 50
  *  @return		string						Login or ''
51 51
  */
52
-function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode)
52
+function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode)
53 53
 {
54
-	global $conf,$langs;
54
+	global $conf, $langs;
55 55
     //global $dolauthmode;    // To return authentication finally used
56 56
 
57 57
 	// Check parameters
58
-	if ($entitytotest == '') $entitytotest=1;
58
+	if ($entitytotest == '') $entitytotest = 1;
59 59
 
60
-    dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',',$authmode));
60
+    dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',', $authmode));
61 61
 	$login = '';
62 62
 
63 63
 	// Validation of login/pass/entity with standard modules
64 64
 	if (empty($login))
65 65
 	{
66
-	    $test=true;
67
-    	foreach($authmode as $mode)
66
+	    $test = true;
67
+    	foreach ($authmode as $mode)
68 68
     	{
69
-    		if ($test && $mode && ! $login)
69
+    		if ($test && $mode && !$login)
70 70
     		{
71 71
     		    // Validation of login/pass/entity for mode $mode
72
-    		    $mode=trim($mode);
73
-        		$authfile='functions_'.$mode.'.php';
74
-        		$fullauthfile='';
72
+    		    $mode = trim($mode);
73
+        		$authfile = 'functions_'.$mode.'.php';
74
+        		$fullauthfile = '';
75 75
 
76
-    		    $dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
77
-    		    foreach($dirlogin as $reldir)
76
+    		    $dirlogin = array_merge(array("/core/login"), (array) $conf->modules_parts['login']);
77
+    		    foreach ($dirlogin as $reldir)
78 78
     		    {
79
-    		        $dir=dol_buildpath($reldir,0);
80
-    		        $newdir=dol_osencode($dir);
79
+    		        $dir = dol_buildpath($reldir, 0);
80
+    		        $newdir = dol_osencode($dir);
81 81
 
82 82
     		        // Check if file found (do not use dol_is_file to avoid loading files.lib.php)
83
-    		        $tmpnewauthfile = $newdir.(preg_match('/\/$/',$newdir)?'':'/').$authfile;
84
-    		        if (is_file($tmpnewauthfile)) $fullauthfile=$tmpnewauthfile;
83
+    		        $tmpnewauthfile = $newdir.(preg_match('/\/$/', $newdir) ? '' : '/').$authfile;
84
+    		        if (is_file($tmpnewauthfile)) $fullauthfile = $tmpnewauthfile;
85 85
     		    }
86 86
 
87
-    		    $result=false;
88
-    		    if ($fullauthfile) $result=include_once $fullauthfile;
87
+    		    $result = false;
88
+    		    if ($fullauthfile) $result = include_once $fullauthfile;
89 89
     			if ($fullauthfile && $result)
90 90
     			{
91 91
     				// Call function to check user/password
92
-    				$function='check_user_password_'.$mode;
93
-    				$login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
92
+    				$function = 'check_user_password_'.$mode;
93
+    				$login = call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
94 94
     				if ($login)	// Login is successfull
95 95
     				{
96
-    					$test=false;            // To stop once at first login success
97
-    					$conf->authmode=$mode;	// This properties is defined only when logged to say what mode was successfully used
98
-    					$dol_tz=GETPOST('tz');
99
-    					$dol_dst=GETPOST('dst');
100
-    					$dol_screenwidth=GETPOST('screenwidth');
101
-    					$dol_screenheight=GETPOST('screenheight');
96
+    					$test = false; // To stop once at first login success
97
+    					$conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used
98
+    					$dol_tz = GETPOST('tz');
99
+    					$dol_dst = GETPOST('dst');
100
+    					$dol_screenwidth = GETPOST('screenwidth');
101
+    					$dol_screenheight = GETPOST('screenheight');
102 102
     				}
103 103
     			}
104 104
     			else
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     				// Load translation files required by the page
109 109
                     $langs->loadLangs(array('other', 'main', 'errors'));
110 110
 
111
-    				$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
111
+    				$_SESSION["dol_loginmesg"] = $langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
112 112
     			}
113 113
     		}
114 114
     	}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 }
119 119
 
120 120
 
121
-if (! function_exists('dol_loginfunction'))
121
+if (!function_exists('dol_loginfunction'))
122 122
 {
123 123
     /**
124 124
      * Show Dolibarr default login page.
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
      * @param       Societe     $mysoc      Company object
130 130
      * @return      void
131 131
      */
132
-    function dol_loginfunction($langs,$conf,$mysoc)
132
+    function dol_loginfunction($langs, $conf, $mysoc)
133 133
 	{
134
-		global $dolibarr_main_demo,$db;
135
-		global $smartphone,$hookmanager;
134
+		global $dolibarr_main_demo, $db;
135
+		global $smartphone, $hookmanager;
136 136
 
137 137
         $langs->loadLangs(array("main", "other", "help", "admin"));
138 138
 
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 
142 142
         $main_authentication = $conf->file->main_authentication;
143 143
 
144
-        $session_name=session_name();	// Get current session name
144
+        $session_name = session_name(); // Get current session name
145 145
 
146 146
 		$dol_url_root = DOL_URL_ROOT;
147 147
 
148 148
 		// Title
149
-		$appli=constant('DOL_APPLICATION_TITLE');
150
-		$title=$appli.' '.constant('DOL_VERSION');
151
-		if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
152
-		$titletruedolibarrversion=constant('DOL_VERSION');	// $title used by login template after the @ to inform of true Dolibarr version
149
+		$appli = constant('DOL_APPLICATION_TITLE');
150
+		$title = $appli.' '.constant('DOL_VERSION');
151
+		if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = $conf->global->MAIN_APPLICATION_TITLE;
152
+		$titletruedolibarrversion = constant('DOL_VERSION'); // $title used by login template after the @ to inform of true Dolibarr version
153 153
 
154 154
 		// Note: $conf->css looks like '/theme/eldy/style.css.php'
155 155
 		/*
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 		*/
171 171
 
172 172
 		// Select templates dir
173
-		if (! empty($conf->modules_parts['tpl']))	// Using this feature slow down application
173
+		if (!empty($conf->modules_parts['tpl']))	// Using this feature slow down application
174 174
 		{
175
-			$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/'));
176
-			foreach($dirtpls as $reldir)
175
+			$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl/'));
176
+			foreach ($dirtpls as $reldir)
177 177
 			{
178
-				$tmp=dol_buildpath($reldir.'login.tpl.php');
179
-				if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/','',$tmp); break; }
178
+				$tmp = dol_buildpath($reldir.'login.tpl.php');
179
+				if (file_exists($tmp)) { $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); break; }
180 180
 			}
181 181
 		}
182 182
 		else
@@ -185,115 +185,115 @@  discard block
 block discarded – undo
185 185
 		}
186 186
 
187 187
 		// Set cookie for timeout management
188
-		$prefix=dol_getprefix('');
189
-		$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
190
-		if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
188
+		$prefix = dol_getprefix('');
189
+		$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
190
+		if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
191 191
 
192
-		if (GETPOST('urlfrom','alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom','alpha');
192
+		if (GETPOST('urlfrom', 'alpha')) $_SESSION["urlfrom"] = GETPOST('urlfrom', 'alpha');
193 193
 		else unset($_SESSION["urlfrom"]);
194 194
 
195
-		if (! GETPOST("username",'alpha')) $focus_element='username';
196
-		else $focus_element='password';
195
+		if (!GETPOST("username", 'alpha')) $focus_element = 'username';
196
+		else $focus_element = 'password';
197 197
 
198
-		$demologin='';
199
-		$demopassword='';
200
-		if (! empty($dolibarr_main_demo))
198
+		$demologin = '';
199
+		$demopassword = '';
200
+		if (!empty($dolibarr_main_demo))
201 201
 		{
202
-			$tab=explode(',',$dolibarr_main_demo);
203
-			$demologin=$tab[0];
204
-			$demopassword=$tab[1];
202
+			$tab = explode(',', $dolibarr_main_demo);
203
+			$demologin = $tab[0];
204
+			$demopassword = $tab[1];
205 205
 		}
206 206
 
207 207
 		// Execute hook getLoginPageOptions (for table)
208
-		$parameters=array('entity' => GETPOST('entity','int'));
209
-		$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
210
-		if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
208
+		$parameters = array('entity' => GETPOST('entity', 'int'));
209
+		$reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
210
+		if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
211 211
 			$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
212 212
 		} else {
213 213
 			$morelogincontent = $hookmanager->resPrint;
214 214
 		}
215 215
 
216 216
 		// Execute hook getLoginPageExtraOptions (eg for js)
217
-		$parameters=array('entity' => GETPOST('entity','int'));
218
-		$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
217
+		$parameters = array('entity' => GETPOST('entity', 'int'));
218
+		$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
219 219
 		$moreloginextracontent = $hookmanager->resPrint;
220 220
 
221 221
 		// Login
222
-		$login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));
222
+		$login = (!empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha") ? GETPOST("username", "alpha") : $demologin));
223 223
 		$password = $demopassword;
224 224
 
225 225
 		// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
226
-		$width=0;
227
-		$urllogo = DOL_BASE_URI . '/theme/login_logo.png';
226
+		$width = 0;
227
+		$urllogo = DOL_BASE_URI.'/theme/login_logo.png';
228 228
 
229
-        if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
229
+        if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
230 230
 		{
231
-			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
231
+			$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
232 232
 		}
233
-		elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
233
+		elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
234 234
 		{
235
-			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
236
-			$width=128;
235
+			$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
236
+			$width = 128;
237 237
 		}
238
-		elseif (is_readable(DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
239
-			$urllogo = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
238
+		elseif (is_readable(DOL_BASE_URI.'/theme/'.$conf->theme.'/img/dolibarr_logo.png')) {
239
+			$urllogo = DOL_BASE_URI.'/theme/'.$conf->theme.'/img/dolibarr_logo.png';
240 240
         }
241
-		elseif (is_readable(DOL_BASE_URI . '/theme/dolibarr_logo.png')) {
242
-			$urllogo = DOL_BASE_URI . '/theme/dolibarr_logo.png';
241
+		elseif (is_readable(DOL_BASE_URI.'/theme/dolibarr_logo.png')) {
242
+			$urllogo = DOL_BASE_URI.'/theme/dolibarr_logo.png';
243 243
         }
244 244
 
245 245
 		// Security graphical code
246
-		$captcha=0;
247
-		$captcha_refresh='';
248
-		if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
246
+		$captcha = 0;
247
+		$captcha_refresh = '';
248
+		if (function_exists("imagecreatefrompng") && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
249 249
 		{
250
-			$captcha=1;
251
-			$captcha_refresh=img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"');
250
+			$captcha = 1;
251
+			$captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
252 252
 		}
253 253
 
254 254
 		// Extra link
255
-		$forgetpasslink=0;
256
-		$helpcenterlink=0;
255
+		$forgetpasslink = 0;
256
+		$helpcenterlink = 0;
257 257
 		if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
258 258
 		{
259 259
 			if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
260 260
 			{
261
-				$forgetpasslink=1;
261
+				$forgetpasslink = 1;
262 262
 			}
263 263
 
264 264
 			if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
265 265
 			{
266
-				$helpcenterlink=1;
266
+				$helpcenterlink = 1;
267 267
 			}
268 268
 		}
269 269
 
270 270
 		// Home message
271
-		$main_home='';
272
-		if (! empty($conf->global->MAIN_HOME))
271
+		$main_home = '';
272
+		if (!empty($conf->global->MAIN_HOME))
273 273
 		{
274
-		    $substitutionarray=getCommonSubstitutionArray($langs);
274
+		    $substitutionarray = getCommonSubstitutionArray($langs);
275 275
 		    complete_substitutions_array($substitutionarray, $langs);
276 276
 		    $texttoshow = make_substitutions($conf->global->MAIN_HOME, $substitutionarray, $langs);
277 277
 
278
-			$main_home=dol_htmlcleanlastbr($texttoshow);
278
+			$main_home = dol_htmlcleanlastbr($texttoshow);
279 279
 		}
280 280
 
281 281
 		// Google AD
282
-		$main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0);
282
+		$main_google_ad_client = ((!empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) ? 1 : 0);
283 283
 
284 284
 		// Set jquery theme
285
-		$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
286
-		$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
287
-		if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
285
+		$dol_loginmesg = (!empty($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"] : '');
286
+		$favicon = dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1);
287
+		if (!empty($conf->global->MAIN_FAVICON_URL)) $favicon = $conf->global->MAIN_FAVICON_URL;
288 288
 		$jquerytheme = 'base';
289
-		if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
289
+		if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
290 290
 
291 291
 		// Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_no_mouse_hover
292
-		$dol_hide_topmenu=GETPOST('dol_hide_topmenu','int');
293
-		$dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int');
294
-		$dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen','int');
295
-		$dol_no_mouse_hover=GETPOST('dol_no_mouse_hover','int');
296
-		$dol_use_jmobile=GETPOST('dol_use_jmobile','int');
292
+		$dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int');
293
+		$dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int');
294
+		$dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int');
295
+		$dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int');
296
+		$dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
297 297
 
298 298
 		// Include login page template
299 299
 		include $template_dir.'login.tpl.php';
@@ -311,23 +311,23 @@  discard block
 block discarded – undo
311 311
  *									non defini=>renvoi un salt pour cryptage par defaut
312 312
  *	@return		string				Salt string
313 313
  */
314
-function makesalt($type=CRYPT_SALT_LENGTH)
314
+function makesalt($type = CRYPT_SALT_LENGTH)
315 315
 {
316 316
 	dol_syslog("makesalt type=".$type);
317
-	switch($type)
317
+	switch ($type)
318 318
 	{
319 319
 		case 12:	// 8 + 4
320
-			$saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
320
+			$saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; break;
321 321
 		case 8:		// 8 (Pour compatibilite, ne devrait pas etre utilise)
322
-			$saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
322
+			$saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; break;
323 323
 		case 2:		// 2
324 324
 		default: 	// by default, fall back on Standard DES (should work everywhere)
325
-			$saltlen=2; $saltprefix=''; $saltsuffix=''; break;
325
+			$saltlen = 2; $saltprefix = ''; $saltsuffix = ''; break;
326 326
 	}
327
-	$salt='';
328
-	while(dol_strlen($salt) < $saltlen) $salt.=chr(mt_rand(64,126));
327
+	$salt = '';
328
+	while (dol_strlen($salt) < $saltlen) $salt .= chr(mt_rand(64, 126));
329 329
 
330
-	$result=$saltprefix.$salt.$saltsuffix;
330
+	$result = $saltprefix.$salt.$saltsuffix;
331 331
 	dol_syslog("makesalt return=".$result);
332 332
 	return $result;
333 333
 }
@@ -338,42 +338,42 @@  discard block
 block discarded – undo
338 338
  *  @param   	int		$level   	Encode level: 0 no encoding, 1 encoding
339 339
  *	@return		int					<0 if KO, >0 if OK
340 340
  */
341
-function encodedecode_dbpassconf($level=0)
341
+function encodedecode_dbpassconf($level = 0)
342 342
 {
343 343
 	dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG);
344 344
 	$config = '';
345
-	$passwd='';
346
-	$passwd_crypted='';
345
+	$passwd = '';
346
+	$passwd_crypted = '';
347 347
 
348
-	if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php','r'))
348
+	if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php', 'r'))
349 349
 	{
350
-		while(!feof($fp))
350
+		while (!feof($fp))
351 351
 		{
352
-			$buffer = fgets($fp,4096);
352
+			$buffer = fgets($fp, 4096);
353 353
 
354
-			$lineofpass=0;
354
+			$lineofpass = 0;
355 355
 
356
-			if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))	// Old way to save crypted value
356
+			if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i', $buffer, $reg))	// Old way to save crypted value
357 357
 			{
358
-				$val = trim($reg[1]);	// This also remove CR/LF
359
-				$val=preg_replace('/^["\']/','',$val);
360
-				$val=preg_replace('/["\'][\s;]*$/','',$val);
361
-				if (! empty($val))
358
+				$val = trim($reg[1]); // This also remove CR/LF
359
+				$val = preg_replace('/^["\']/', '', $val);
360
+				$val = preg_replace('/["\'][\s;]*$/', '', $val);
361
+				if (!empty($val))
362 362
 				{
363 363
 					$passwd_crypted = $val;
364 364
 					$val = dol_decode($val);
365 365
 					$passwd = $val;
366
-					$lineofpass=1;
366
+					$lineofpass = 1;
367 367
 				}
368 368
 			}
369
-			elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))
369
+			elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i', $buffer, $reg))
370 370
 			{
371
-				$val = trim($reg[1]);	// This also remove CR/LF
372
-				$val=preg_replace('/^["\']/','',$val);
373
-				$val=preg_replace('/["\'][\s;]*$/','',$val);
374
-				if (preg_match('/crypted:/i',$buffer))
371
+				$val = trim($reg[1]); // This also remove CR/LF
372
+				$val = preg_replace('/^["\']/', '', $val);
373
+				$val = preg_replace('/["\'][\s;]*$/', '', $val);
374
+				if (preg_match('/crypted:/i', $buffer))
375 375
 				{
376
-					$val = preg_replace('/crypted:/i','',$val);
376
+					$val = preg_replace('/crypted:/i', '', $val);
377 377
 					$passwd_crypted = $val;
378 378
 					$val = dol_decode($val);
379 379
 					$passwd = $val;
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 					$val = dol_encode($val);
385 385
 					$passwd_crypted = $val;
386 386
 				}
387
-				$lineofpass=1;
387
+				$lineofpass = 1;
388 388
 			}
389 389
 
390 390
 			// Output line
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 		fclose($fp);
412 412
 
413 413
 		// Write new conf file
414
-		$file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
415
-		if ($fp = @fopen($file,'w'))
414
+		$file = DOL_DOCUMENT_ROOT.'/conf/conf.php';
415
+		if ($fp = @fopen($file, 'w'))
416 416
 		{
417 417
 			fputs($fp, $config);
418 418
 			fflush($fp);
@@ -446,11 +446,11 @@  discard block
 block discarded – undo
446 446
  * @return		string								New value for password
447 447
  * @see dol_hash
448 448
  */
449
-function getRandomPassword($generic=false, $replaceambiguouschars=null)
449
+function getRandomPassword($generic = false, $replaceambiguouschars = null)
450 450
 {
451
-	global $db,$conf,$langs,$user;
451
+	global $db, $conf, $langs, $user;
452 452
 
453
-	$generated_password='';
453
+	$generated_password = '';
454 454
 	if ($generic)
455 455
 	{
456 456
 		$length = 32;
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
 		$uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
459 459
 		$numbers = "1234567890";
460 460
 		$randomCode = "";
461
-		$nbofchar = round($length/3);
462
-		$nbofcharlast = ($length - 2*$nbofchar);
461
+		$nbofchar = round($length / 3);
462
+		$nbofcharlast = ($length - 2 * $nbofchar);
463 463
 		//var_dump($nbofchar.'-'.$nbofcharlast);
464 464
 		if (function_exists('random_int'))	// Cryptographic random
465 465
 		{
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 				$randomCode .= $numbers{random_int(0, $max)};
477 477
 			}
478 478
 
479
-			$generated_password=str_shuffle($randomCode);
479
+			$generated_password = str_shuffle($randomCode);
480 480
 		}
481 481
 		else	// Old platform, non cryptographic random
482 482
 		{
@@ -493,17 +493,17 @@  discard block
 block discarded – undo
493 493
 				$randomCode .= $numbers{mt_rand(0, $max)};
494 494
 			}
495 495
 
496
-			$generated_password=str_shuffle($randomCode);
496
+			$generated_password = str_shuffle($randomCode);
497 497
 		}
498 498
 	}
499
-	else if (! empty($conf->global->USER_PASSWORD_GENERATED))
499
+	else if (!empty($conf->global->USER_PASSWORD_GENERATED))
500 500
 	{
501
-		$nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
502
-		$nomfichier=$nomclass.".class.php";
501
+		$nomclass = "modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
502
+		$nomfichier = $nomclass.".class.php";
503 503
 		//print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass;
504 504
 		require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier;
505
-		$genhandler=new $nomclass($db,$conf,$langs,$user);
506
-		$generated_password=$genhandler->getNewGeneratedPassword();
505
+		$genhandler = new $nomclass($db, $conf, $langs, $user);
506
+		$generated_password = $genhandler->getNewGeneratedPassword();
507 507
 		unset($genhandler);
508 508
 	}
509 509
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	{
513 513
 		$numbers = "ABCDEF";
514 514
 		$max = strlen($numbers) - 1;
515
-		$generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
515
+		$generated_password = str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
516 516
 	}
517 517
 
518 518
 	return $generated_password;
Please login to merge, or discard this patch.
dolibarr/htdocs/adherents/index.php 3 patches
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -70,25 +70,25 @@  discard block
 block discarded – undo
70 70
 $result = $db->query($sql);
71 71
 if ($result)
72 72
 {
73
-	$num = $db->num_rows($result);
74
-	$i = 0;
75
-	while ($i < $num)
76
-	{
77
-		$objp = $db->fetch_object($result);
78
-
79
-		$adhtype=new AdherentType($db);
80
-		$adhtype->id=$objp->rowid;
81
-		$adhtype->subscription=$objp->subscription;
82
-		$adhtype->label=$objp->label;
83
-		$AdherentType[$objp->rowid]=$adhtype;
84
-
85
-		if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; }
86
-		if ($objp->statut == 1)  { $MembersValidated[$objp->rowid]=$objp->somme; }
87
-		if ($objp->statut == 0)  { $MembersResiliated[$objp->rowid]=$objp->somme; }
88
-
89
-		$i++;
90
-	}
91
-	$db->free($result);
73
+    $num = $db->num_rows($result);
74
+    $i = 0;
75
+    while ($i < $num)
76
+    {
77
+        $objp = $db->fetch_object($result);
78
+
79
+        $adhtype=new AdherentType($db);
80
+        $adhtype->id=$objp->rowid;
81
+        $adhtype->subscription=$objp->subscription;
82
+        $adhtype->label=$objp->label;
83
+        $AdherentType[$objp->rowid]=$adhtype;
84
+
85
+        if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; }
86
+        if ($objp->statut == 1)  { $MembersValidated[$objp->rowid]=$objp->somme; }
87
+        if ($objp->statut == 0)  { $MembersResiliated[$objp->rowid]=$objp->somme; }
88
+
89
+        $i++;
90
+    }
91
+    $db->free($result);
92 92
 }
93 93
 
94 94
 $now=dol_now();
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 $result = $db->query($sql);
109 109
 if ($result)
110 110
 {
111
-	$num = $db->num_rows($result);
112
-	$i = 0;
113
-	while ($i < $num)
114
-	{
115
-		$objp = $db->fetch_object($result);
116
-		$MemberUpToDate[$objp->fk_adherent_type]=$objp->somme;
117
-		$i++;
118
-	}
119
-	$db->free();
111
+    $num = $db->num_rows($result);
112
+    $i = 0;
113
+    while ($i < $num)
114
+    {
115
+        $objp = $db->fetch_object($result);
116
+        $MemberUpToDate[$objp->fk_adherent_type]=$objp->somme;
117
+        $i++;
118
+    }
119
+    $db->free();
120 120
 }
121 121
 
122 122
 
@@ -129,27 +129,27 @@  discard block
 block discarded – undo
129 129
     // Search contact/address
130 130
     if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire)
131 131
     {
132
-    	$listofsearchfields['search_member']=array('text'=>'Member');
132
+        $listofsearchfields['search_member']=array('text'=>'Member');
133 133
     }
134 134
 
135 135
     if (count($listofsearchfields))
136 136
     {
137
-    	print '<form method="post" action="'.BASE_URI.'?controller=core&method=search">';
138
-    	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
139
-    	print '<table class="noborder nohover centpercent">';
140
-    	$i=0;
141
-    	foreach($listofsearchfields as $key => $value)
142
-    	{
143
-    		if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
144
-    		print '<tr class="oddeven">';
145
-    		print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
146
-    		if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
147
-    		print '</tr>';
148
-    		$i++;
149
-    	}
150
-    	print '</table>';
151
-    	print '</form>';
152
-    	print '<br>';
137
+        print '<form method="post" action="'.BASE_URI.'?controller=core&method=search">';
138
+        print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
139
+        print '<table class="noborder nohover centpercent">';
140
+        $i=0;
141
+        foreach($listofsearchfields as $key => $value)
142
+        {
143
+            if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
144
+            print '<tr class="oddeven">';
145
+            print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
146
+            if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
147
+            print '</tr>';
148
+            $i++;
149
+        }
150
+        print '</table>';
151
+        print '</form>';
152
+        print '<br>';
153 153
     }
154 154
 }
155 155
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 
161 161
 if ($conf->use_javascript_ajax)
162 162
 {
163
-	print '<div class="div-table-responsive-no-min">';
164
-	print '<table class="noborder nohover" width="100%">';
163
+    print '<div class="div-table-responsive-no-min">';
164
+    print '<table class="noborder nohover" width="100%">';
165 165
     print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
166 166
     print '<tr><td align="center" colspan="2">';
167 167
 
@@ -294,49 +294,49 @@  discard block
 block discarded – undo
294 294
 $resql=$db->query($sql);
295 295
 if ($resql)
296 296
 {
297
-	print '<div class="div-table-responsive-no-min">';
298
-	print '<table class="noborder" width="100%">';
299
-	print '<tr class="liste_titre">';
300
-	print '<th colspan="4">'.$langs->trans("LastMembersModified",$max).'</th></tr>';
301
-
302
-	$num = $db->num_rows($resql);
303
-	if ($num)
304
-	{
305
-		$i = 0;
306
-		while ($i < $num)
307
-		{
308
-			$obj = $db->fetch_object($resql);
309
-			print '<tr class="oddeven">';
310
-			$staticmember->id=$obj->rowid;
311
-			$staticmember->lastname=$obj->lastname;
312
-			$staticmember->firstname=$obj->firstname;
313
-			if (! empty($obj->fk_soc))
314
-			{
315
-				$staticmember->fk_soc = $obj->fk_soc;
316
-				$staticmember->fetch_thirdparty();
317
-				$staticmember->name=$staticmember->thirdparty->name;
318
-			}
319
-			else
320
-			{
321
-				$staticmember->name=$obj->company;
322
-			}
323
-			$staticmember->ref=$staticmember->getFullName($langs);
324
-			$statictype->id=$obj->typeid;
325
-			$statictype->label=$obj->label;
326
-			print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
327
-			print '<td>'.$statictype->getNomUrl(1,32).'</td>';
328
-			print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
329
-			print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
330
-			print '</tr>';
331
-			$i++;
332
-		}
333
-	}
334
-	print "</table></div>";
335
-	print "<br>";
297
+    print '<div class="div-table-responsive-no-min">';
298
+    print '<table class="noborder" width="100%">';
299
+    print '<tr class="liste_titre">';
300
+    print '<th colspan="4">'.$langs->trans("LastMembersModified",$max).'</th></tr>';
301
+
302
+    $num = $db->num_rows($resql);
303
+    if ($num)
304
+    {
305
+        $i = 0;
306
+        while ($i < $num)
307
+        {
308
+            $obj = $db->fetch_object($resql);
309
+            print '<tr class="oddeven">';
310
+            $staticmember->id=$obj->rowid;
311
+            $staticmember->lastname=$obj->lastname;
312
+            $staticmember->firstname=$obj->firstname;
313
+            if (! empty($obj->fk_soc))
314
+            {
315
+                $staticmember->fk_soc = $obj->fk_soc;
316
+                $staticmember->fetch_thirdparty();
317
+                $staticmember->name=$staticmember->thirdparty->name;
318
+            }
319
+            else
320
+            {
321
+                $staticmember->name=$obj->company;
322
+            }
323
+            $staticmember->ref=$staticmember->getFullName($langs);
324
+            $statictype->id=$obj->typeid;
325
+            $statictype->label=$obj->label;
326
+            print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
327
+            print '<td>'.$statictype->getNomUrl(1,32).'</td>';
328
+            print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
329
+            print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
330
+            print '</tr>';
331
+            $i++;
332
+        }
333
+    }
334
+    print "</table></div>";
335
+    print "<br>";
336 336
 }
337 337
 else
338 338
 {
339
-	dol_print_error($db);
339
+    dol_print_error($db);
340 340
 }
341 341
 
342 342
 
@@ -357,48 +357,48 @@  discard block
 block discarded – undo
357 357
 $resql=$db->query($sql);
358 358
 if ($resql)
359 359
 {
360
-	print '<div class="div-table-responsive-no-min">';
361
-	print '<table class="noborder" width="100%">';
362
-	print '<tr class="liste_titre">';
363
-	print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified",$max).'</th></tr>';
364
-
365
-	$num = $db->num_rows($resql);
366
-	if ($num)
367
-	{
368
-		$i = 0;
369
-		while ($i < $num)
370
-		{
371
-			$obj = $db->fetch_object($resql);
372
-			print '<tr class="oddeven">';
373
-			$subscriptionstatic->id=$obj->cid;
374
-			$subscriptionstatic->ref=$obj->cid;
375
-			$staticmember->id=$obj->rowid;
376
-			$staticmember->lastname=$obj->lastname;
377
-			$staticmember->firstname=$obj->firstname;
378
-			if (! empty($obj->fk_soc)) {
379
-				$staticmember->fk_soc = $obj->fk_soc;
380
-				$staticmember->fetch_thirdparty();
381
-				$staticmember->name=$staticmember->thirdparty->name;
382
-			} else {
383
-				$staticmember->name=$obj->company;
384
-			}
385
-			$staticmember->ref=$staticmember->getFullName($langs);
386
-			print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
387
-			print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
388
-			print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
389
-			print '<td align="right">'.price($obj->subscription).'</td>';
390
-			//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
391
-			print '<td align="right">'.dol_print_date($db->jdate($obj->datem?$obj->datem:$obj->datec),'dayhour').'</td>';
392
-			print '</tr>';
393
-			$i++;
394
-		}
395
-	}
396
-	print "</table></div>";
397
-	print "<br>";
360
+    print '<div class="div-table-responsive-no-min">';
361
+    print '<table class="noborder" width="100%">';
362
+    print '<tr class="liste_titre">';
363
+    print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified",$max).'</th></tr>';
364
+
365
+    $num = $db->num_rows($resql);
366
+    if ($num)
367
+    {
368
+        $i = 0;
369
+        while ($i < $num)
370
+        {
371
+            $obj = $db->fetch_object($resql);
372
+            print '<tr class="oddeven">';
373
+            $subscriptionstatic->id=$obj->cid;
374
+            $subscriptionstatic->ref=$obj->cid;
375
+            $staticmember->id=$obj->rowid;
376
+            $staticmember->lastname=$obj->lastname;
377
+            $staticmember->firstname=$obj->firstname;
378
+            if (! empty($obj->fk_soc)) {
379
+                $staticmember->fk_soc = $obj->fk_soc;
380
+                $staticmember->fetch_thirdparty();
381
+                $staticmember->name=$staticmember->thirdparty->name;
382
+            } else {
383
+                $staticmember->name=$obj->company;
384
+            }
385
+            $staticmember->ref=$staticmember->getFullName($langs);
386
+            print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
387
+            print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
388
+            print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
389
+            print '<td align="right">'.price($obj->subscription).'</td>';
390
+            //print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
391
+            print '<td align="right">'.dol_print_date($db->jdate($obj->datem?$obj->datem:$obj->datec),'dayhour').'</td>';
392
+            print '</tr>';
393
+            $i++;
394
+        }
395
+    }
396
+    print "</table></div>";
397
+    print "<br>";
398 398
 }
399 399
 else
400 400
 {
401
-	dol_print_error($db);
401
+    dol_print_error($db);
402 402
 }
403 403
 
404 404
 
@@ -415,13 +415,13 @@  discard block
 block discarded – undo
415 415
 
416 416
 foreach ($AdherentType as $key => $adhtype)
417 417
 {
418
-	print '<tr class="oddeven">';
419
-	print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
420
-	print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).'</td>';
421
-	print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).'</td>';
422
-	print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->subscription,$now,3).'</td>';
423
-	print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->subscription,0,3).'</td>';
424
-	print "</tr>\n";
418
+    print '<tr class="oddeven">';
419
+    print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
420
+    print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).'</td>';
421
+    print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).'</td>';
422
+    print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->subscription,$now,3).'</td>';
423
+    print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->subscription,0,3).'</td>';
424
+    print "</tr>\n";
425 425
 }
426 426
 print '<tr class="liste_total">';
427 427
 print '<td class="liste_total">'.$langs->trans("Total").'</td>';
Please login to merge, or discard this patch.
Spacing   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -25,46 +25,46 @@  discard block
 block discarded – undo
25 25
  *       \brief      Page accueil module adherents
26 26
  */
27 27
 
28
-require DOL_BASE_PATH . '/main.inc.php';
29
-require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
28
+require DOL_BASE_PATH.'/main.inc.php';
29
+require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
30 30
 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
31 31
 require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
32 32
 
33 33
 // Load translation files required by the page
34
-$langs->loadLangs(array("companies","members"));
34
+$langs->loadLangs(array("companies", "members"));
35 35
 
36 36
 // Security check
37
-$result=restrictedArea($user,'adherent');
37
+$result = restrictedArea($user, 'adherent');
38 38
 
39 39
 
40 40
 /*
41 41
  * View
42 42
  */
43 43
 
44
-llxHeader('',$langs->trans("Members"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
44
+llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
45 45
 
46
-$staticmember=new Adherent($db);
47
-$statictype=new AdherentType($db);
48
-$subscriptionstatic=new Subscription($db);
46
+$staticmember = new Adherent($db);
47
+$statictype = new AdherentType($db);
48
+$subscriptionstatic = new Subscription($db);
49 49
 
50 50
 print load_fiche_titre($langs->trans("MembersArea"));
51 51
 
52
-$Adherents=array();
53
-$AdherentsAValider=array();
54
-$MemberUpToDate=array();
55
-$AdherentsResilies=array();
52
+$Adherents = array();
53
+$AdherentsAValider = array();
54
+$MemberUpToDate = array();
55
+$AdherentsResilies = array();
56 56
 
57
-$AdherentType=array();
57
+$AdherentType = array();
58 58
 
59 59
 // Members list
60 60
 $sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
61
-$sql.= " d.statut, count(d.rowid) as somme";
62
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
63
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
64
-$sql.= " ON t.rowid = d.fk_adherent_type";
65
-$sql.= " AND d.entity IN (".getEntity('adherent').")";
66
-$sql.= " WHERE t.entity IN (".getEntity('member_type').")";
67
-$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
61
+$sql .= " d.statut, count(d.rowid) as somme";
62
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
63
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
64
+$sql .= " ON t.rowid = d.fk_adherent_type";
65
+$sql .= " AND d.entity IN (".getEntity('adherent').")";
66
+$sql .= " WHERE t.entity IN (".getEntity('member_type').")";
67
+$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
68 68
 
69 69
 dol_syslog("index.php::select nb of members by type", LOG_DEBUG);
70 70
 $result = $db->query($sql);
@@ -76,33 +76,33 @@  discard block
 block discarded – undo
76 76
 	{
77 77
 		$objp = $db->fetch_object($result);
78 78
 
79
-		$adhtype=new AdherentType($db);
80
-		$adhtype->id=$objp->rowid;
81
-		$adhtype->subscription=$objp->subscription;
82
-		$adhtype->label=$objp->label;
83
-		$AdherentType[$objp->rowid]=$adhtype;
79
+		$adhtype = new AdherentType($db);
80
+		$adhtype->id = $objp->rowid;
81
+		$adhtype->subscription = $objp->subscription;
82
+		$adhtype->label = $objp->label;
83
+		$AdherentType[$objp->rowid] = $adhtype;
84 84
 
85
-		if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; }
86
-		if ($objp->statut == 1)  { $MembersValidated[$objp->rowid]=$objp->somme; }
87
-		if ($objp->statut == 0)  { $MembersResiliated[$objp->rowid]=$objp->somme; }
85
+		if ($objp->statut == -1) { $MemberToValidate[$objp->rowid] = $objp->somme; }
86
+		if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; }
87
+		if ($objp->statut == 0) { $MembersResiliated[$objp->rowid] = $objp->somme; }
88 88
 
89 89
 		$i++;
90 90
 	}
91 91
 	$db->free($result);
92 92
 }
93 93
 
94
-$now=dol_now();
94
+$now = dol_now();
95 95
 
96 96
 // Members up to date list
97 97
 // current rule: uptodate = the end date is in future whatever is type
98 98
 // old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
99 99
 $sql = "SELECT count(*) as somme , d.fk_adherent_type";
100
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
101
-$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
100
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
101
+$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
102 102
 //$sql.= " AND d.statut = 1 AND ((t.subscription = 0 AND d.datefin IS NULL) OR d.datefin >= '".$db->idate($now)."')";
103
-$sql.= " AND d.statut = 1 AND d.datefin >= '".$db->idate($now)."'";
104
-$sql.= " AND t.rowid = d.fk_adherent_type";
105
-$sql.= " GROUP BY d.fk_adherent_type";
103
+$sql .= " AND d.statut = 1 AND d.datefin >= '".$db->idate($now)."'";
104
+$sql .= " AND t.rowid = d.fk_adherent_type";
105
+$sql .= " GROUP BY d.fk_adherent_type";
106 106
 
107 107
 dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
108 108
 $result = $db->query($sql);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	while ($i < $num)
114 114
 	{
115 115
 		$objp = $db->fetch_object($result);
116
-		$MemberUpToDate[$objp->fk_adherent_type]=$objp->somme;
116
+		$MemberUpToDate[$objp->fk_adherent_type] = $objp->somme;
117 117
 		$i++;
118 118
 	}
119 119
 	$db->free();
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 print '<div class="fichecenter"><div class="fichethirdleft">';
125 125
 
126 126
 
127
-if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))     // This is useless due to the global search combo
127
+if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))     // This is useless due to the global search combo
128 128
 {
129 129
     // Search contact/address
130
-    if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire)
130
+    if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire)
131 131
     {
132
-    	$listofsearchfields['search_member']=array('text'=>'Member');
132
+    	$listofsearchfields['search_member'] = array('text'=>'Member');
133 133
     }
134 134
 
135 135
     if (count($listofsearchfields))
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
     	print '<form method="post" action="'.BASE_URI.'?controller=core&method=search">';
138 138
     	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
139 139
     	print '<table class="noborder nohover centpercent">';
140
-    	$i=0;
141
-    	foreach($listofsearchfields as $key => $value)
140
+    	$i = 0;
141
+    	foreach ($listofsearchfields as $key => $value)
142 142
     	{
143 143
     		if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
144 144
     		print '<tr class="oddeven">';
@@ -165,33 +165,33 @@  discard block
 block discarded – undo
165 165
     print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
166 166
     print '<tr><td align="center" colspan="2">';
167 167
 
168
-    $SommeA=0;
169
-    $SommeB=0;
170
-    $SommeC=0;
171
-    $SommeD=0;
172
-    $total=0;
173
-    $dataval=array();
174
-    $datalabels=array();
175
-    $i=0;
168
+    $SommeA = 0;
169
+    $SommeB = 0;
170
+    $SommeC = 0;
171
+    $SommeD = 0;
172
+    $total = 0;
173
+    $dataval = array();
174
+    $datalabels = array();
175
+    $i = 0;
176 176
     foreach ($AdherentType as $key => $adhtype)
177 177
     {
178
-        $datalabels[]=array($i,$adhtype->getNomUrl(0,dol_size(16)));
179
-        $dataval['draft'][]=array($i,isset($MemberToValidate[$key])?$MemberToValidate[$key]:0);
180
-        $dataval['notuptodate'][]=array($i,isset($MembersValidated[$key])?$MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):0);
181
-        $dataval['uptodate'][]=array($i,isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0);
182
-        $dataval['resiliated'][]=array($i,isset($MembersResiliated[$key])?$MembersResiliated[$key]:0);
183
-        $SommeA+=isset($MemberToValidate[$key])?$MemberToValidate[$key]:0;
184
-        $SommeB+=isset($MembersValidated[$key])?$MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):0;
185
-        $SommeC+=isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0;
186
-        $SommeD+=isset($MembersResiliated[$key])?$MembersResiliated[$key]:0;
178
+        $datalabels[] = array($i, $adhtype->getNomUrl(0, dol_size(16)));
179
+        $dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
180
+        $dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
181
+        $dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
182
+        $dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
183
+        $SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0;
184
+        $SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
185
+        $SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
186
+        $SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
187 187
         $i++;
188 188
     }
189 189
     $total = $SommeA + $SommeB + $SommeC + $SommeD;
190
-    $dataseries=array();
191
-    $dataseries[]=array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
192
-    $dataseries[]=array($langs->trans("MenuMembersUpToDate"), round($SommeC));
193
-    $dataseries[]=array($langs->trans("MembersStatusResiliated"), round($SommeD));
194
-    $dataseries[]=array($langs->trans("MembersStatusToValid"), round($SommeA));
190
+    $dataseries = array();
191
+    $dataseries[] = array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
192
+    $dataseries[] = array($langs->trans("MenuMembersUpToDate"), round($SommeC));
193
+    $dataseries[] = array($langs->trans("MembersStatusResiliated"), round($SommeD));
194
+    $dataseries[] = array($langs->trans("MembersStatusToValid"), round($SommeA));
195 195
 
196 196
     include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
197 197
     $dolgraph = new DolGraph();
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
     $dolgraph->SetType(array('pie'));
202 202
     $dolgraph->setWidth('100%');
203 203
     $dolgraph->draw('idgraphstatus');
204
-    print $dolgraph->show($total?0:1);
204
+    print $dolgraph->show($total ? 0 : 1);
205 205
 
206 206
     print '</td></tr>';
207 207
     print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
208
-    print $SommeA+$SommeB+$SommeC+$SommeD;
208
+    print $SommeA + $SommeB + $SommeC + $SommeD;
209 209
     print '</td></tr>';
210 210
     print '</table>';
211 211
     print '</div>';
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
 print '<br>';
215 215
 
216 216
 // List of subscription by year
217
-$Total=array();
218
-$Number=array();
219
-$tot=0;
220
-$numb=0;
217
+$Total = array();
218
+$Number = array();
219
+$tot = 0;
220
+$numb = 0;
221 221
 
222 222
 $sql = "SELECT c.subscription, c.dateadh as dateh";
223
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
224
-$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
225
-$sql.= " AND d.rowid = c.fk_adherent";
226
-if(isset($date_select) && $date_select != '')
223
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
224
+$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
225
+$sql .= " AND d.rowid = c.fk_adherent";
226
+if (isset($date_select) && $date_select != '')
227 227
 {
228 228
     $sql .= " AND c.dateadh LIKE '".$date_select."%'";
229 229
 }
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
     while ($i < $num)
236 236
     {
237 237
         $objp = $db->fetch_object($result);
238
-        $year=dol_print_date($db->jdate($objp->dateh),"%Y");
239
-        $Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->subscription;
240
-        $Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1;
241
-        $tot+=$objp->subscription;
242
-        $numb+=1;
238
+        $year = dol_print_date($db->jdate($objp->dateh), "%Y");
239
+        $Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
240
+        $Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
241
+        $tot += $objp->subscription;
242
+        $numb += 1;
243 243
         $i++;
244 244
     }
245 245
 }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
261 261
     print "<td align=\"right\">".$Number[$key]."</td>";
262 262
     print "<td align=\"right\">".price($value)."</td>";
263
-    print "<td align=\"right\">".price(price2num($value/$Number[$key],'MT'))."</td>";
263
+    print "<td align=\"right\">".price(price2num($value / $Number[$key], 'MT'))."</td>";
264 264
     print "</tr>\n";
265 265
 }
266 266
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 print '<td>'.$langs->trans("Total").'</td>';
270 270
 print "<td align=\"right\">".$numb."</td>";
271 271
 print '<td align="right">'.price($tot)."</td>";
272
-print "<td align=\"right\">".price(price2num($numb>0?($tot/$numb):0,'MT'))."</td>";
272
+print "<td align=\"right\">".price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT'))."</td>";
273 273
 print "</tr>\n";
274 274
 print "</table></div>";
275 275
 print "<br>\n";
@@ -280,24 +280,24 @@  discard block
 block discarded – undo
280 280
 /*
281 281
  * Last modified members
282 282
  */
283
-$max=5;
283
+$max = 5;
284 284
 
285 285
 $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
286
-$sql.= " a.tms as datem, datefin as date_end_subscription,";
287
-$sql.= " ta.rowid as typeid, ta.libelle as label, ta.subscription";
288
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
289
-$sql.= " WHERE a.entity IN (".getEntity('adherent').")";
290
-$sql.= " AND a.fk_adherent_type = ta.rowid";
291
-$sql.= $db->order("a.tms","DESC");
292
-$sql.= $db->plimit($max, 0);
293
-
294
-$resql=$db->query($sql);
286
+$sql .= " a.tms as datem, datefin as date_end_subscription,";
287
+$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription";
288
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
289
+$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
290
+$sql .= " AND a.fk_adherent_type = ta.rowid";
291
+$sql .= $db->order("a.tms", "DESC");
292
+$sql .= $db->plimit($max, 0);
293
+
294
+$resql = $db->query($sql);
295 295
 if ($resql)
296 296
 {
297 297
 	print '<div class="div-table-responsive-no-min">';
298 298
 	print '<table class="noborder" width="100%">';
299 299
 	print '<tr class="liste_titre">';
300
-	print '<th colspan="4">'.$langs->trans("LastMembersModified",$max).'</th></tr>';
300
+	print '<th colspan="4">'.$langs->trans("LastMembersModified", $max).'</th></tr>';
301 301
 
302 302
 	$num = $db->num_rows($resql);
303 303
 	if ($num)
@@ -307,26 +307,26 @@  discard block
 block discarded – undo
307 307
 		{
308 308
 			$obj = $db->fetch_object($resql);
309 309
 			print '<tr class="oddeven">';
310
-			$staticmember->id=$obj->rowid;
311
-			$staticmember->lastname=$obj->lastname;
312
-			$staticmember->firstname=$obj->firstname;
313
-			if (! empty($obj->fk_soc))
310
+			$staticmember->id = $obj->rowid;
311
+			$staticmember->lastname = $obj->lastname;
312
+			$staticmember->firstname = $obj->firstname;
313
+			if (!empty($obj->fk_soc))
314 314
 			{
315 315
 				$staticmember->fk_soc = $obj->fk_soc;
316 316
 				$staticmember->fetch_thirdparty();
317
-				$staticmember->name=$staticmember->thirdparty->name;
317
+				$staticmember->name = $staticmember->thirdparty->name;
318 318
 			}
319 319
 			else
320 320
 			{
321
-				$staticmember->name=$obj->company;
321
+				$staticmember->name = $obj->company;
322 322
 			}
323
-			$staticmember->ref=$staticmember->getFullName($langs);
324
-			$statictype->id=$obj->typeid;
325
-			$statictype->label=$obj->label;
326
-			print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
327
-			print '<td>'.$statictype->getNomUrl(1,32).'</td>';
328
-			print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
329
-			print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
323
+			$staticmember->ref = $staticmember->getFullName($langs);
324
+			$statictype->id = $obj->typeid;
325
+			$statictype->label = $obj->label;
326
+			print '<td>'.$staticmember->getNomUrl(1, 32).'</td>';
327
+			print '<td>'.$statictype->getNomUrl(1, 32).'</td>';
328
+			print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
329
+			print '<td align="right">'.$staticmember->LibStatut($obj->statut, ($obj->subscription == 'yes' ? 1 : 0), $db->jdate($obj->date_end_subscription), 5).'</td>';
330 330
 			print '</tr>';
331 331
 			$i++;
332 332
 		}
@@ -343,24 +343,24 @@  discard block
 block discarded – undo
343 343
 /*
344 344
  * Last modified subscriptions
345 345
  */
346
-$max=5;
346
+$max = 5;
347 347
 
348 348
 $sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
349
-$sql.= " datefin as date_end_subscription,";
350
-$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
351
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c";
352
-$sql.= " WHERE a.entity IN (".getEntity('adherent').")";
353
-$sql.= " AND c.fk_adherent = a.rowid";
354
-$sql.= $db->order("c.tms","DESC");
355
-$sql.= $db->plimit($max, 0);
356
-
357
-$resql=$db->query($sql);
349
+$sql .= " datefin as date_end_subscription,";
350
+$sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
351
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c";
352
+$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
353
+$sql .= " AND c.fk_adherent = a.rowid";
354
+$sql .= $db->order("c.tms", "DESC");
355
+$sql .= $db->plimit($max, 0);
356
+
357
+$resql = $db->query($sql);
358 358
 if ($resql)
359 359
 {
360 360
 	print '<div class="div-table-responsive-no-min">';
361 361
 	print '<table class="noborder" width="100%">';
362 362
 	print '<tr class="liste_titre">';
363
-	print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified",$max).'</th></tr>';
363
+	print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified", $max).'</th></tr>';
364 364
 
365 365
 	$num = $db->num_rows($resql);
366 366
 	if ($num)
@@ -370,25 +370,25 @@  discard block
 block discarded – undo
370 370
 		{
371 371
 			$obj = $db->fetch_object($resql);
372 372
 			print '<tr class="oddeven">';
373
-			$subscriptionstatic->id=$obj->cid;
374
-			$subscriptionstatic->ref=$obj->cid;
375
-			$staticmember->id=$obj->rowid;
376
-			$staticmember->lastname=$obj->lastname;
377
-			$staticmember->firstname=$obj->firstname;
378
-			if (! empty($obj->fk_soc)) {
373
+			$subscriptionstatic->id = $obj->cid;
374
+			$subscriptionstatic->ref = $obj->cid;
375
+			$staticmember->id = $obj->rowid;
376
+			$staticmember->lastname = $obj->lastname;
377
+			$staticmember->firstname = $obj->firstname;
378
+			if (!empty($obj->fk_soc)) {
379 379
 				$staticmember->fk_soc = $obj->fk_soc;
380 380
 				$staticmember->fetch_thirdparty();
381
-				$staticmember->name=$staticmember->thirdparty->name;
381
+				$staticmember->name = $staticmember->thirdparty->name;
382 382
 			} else {
383
-				$staticmember->name=$obj->company;
383
+				$staticmember->name = $obj->company;
384 384
 			}
385
-			$staticmember->ref=$staticmember->getFullName($langs);
385
+			$staticmember->ref = $staticmember->getFullName($langs);
386 386
 			print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
387
-			print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
388
-			print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
387
+			print '<td>'.$staticmember->getNomUrl(1, 32, 'subscription').'</td>';
388
+			print '<td>'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).'</td>';
389 389
 			print '<td align="right">'.price($obj->subscription).'</td>';
390 390
 			//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
391
-			print '<td align="right">'.dol_print_date($db->jdate($obj->datem?$obj->datem:$obj->datec),'dayhour').'</td>';
391
+			print '<td align="right">'.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour').'</td>';
392 392
 			print '</tr>';
393 393
 			$i++;
394 394
 		}
@@ -417,18 +417,18 @@  discard block
 block discarded – undo
417 417
 {
418 418
 	print '<tr class="oddeven">';
419 419
 	print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
420
-	print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).'</td>';
421
-	print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).'</td>';
422
-	print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->subscription,$now,3).'</td>';
423
-	print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->subscription,0,3).'</td>';
420
+	print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
421
+	print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
422
+	print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
423
+	print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '').' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
424 424
 	print "</tr>\n";
425 425
 }
426 426
 print '<tr class="liste_total">';
427 427
 print '<td class="liste_total">'.$langs->trans("Total").'</td>';
428
-print '<td class="liste_total" align="right">'.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).'</td>';
429
-print '<td class="liste_total" align="right">'.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).'</td>';
430
-print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->subscription,$now,3).'</td>';
431
-print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->subscription,0,3).'</td>';
428
+print '<td class="liste_total" align="right">'.$SommeA.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
429
+print '<td class="liste_total" align="right">'.$SommeB.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
430
+print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
431
+print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
432 432
 print '</tr>';
433 433
 
434 434
 print "</table>\n";
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -124,12 +124,14 @@  discard block
 block discarded – undo
124 124
 print '<div class="fichecenter"><div class="fichethirdleft">';
125 125
 
126 126
 
127
-if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))     // This is useless due to the global search combo
127
+if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
128
+    // This is useless due to the global search combo
128 129
 {
129 130
     // Search contact/address
130 131
     if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire)
131 132
     {
132
-    	$listofsearchfields['search_member']=array('text'=>'Member');
133
+    	$listofsearchfields['search_member']=array('text'=>'Member');
134
+}
133 135
     }
134 136
 
135 137
     if (count($listofsearchfields))
@@ -140,10 +142,14 @@  discard block
 block discarded – undo
140 142
     	$i=0;
141 143
     	foreach($listofsearchfields as $key => $value)
142 144
     	{
143
-    		if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
145
+    		if ($i == 0) {
146
+    		    print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
147
+    		}
144 148
     		print '<tr class="oddeven">';
145 149
     		print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
146
-    		if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
150
+    		if ($i == 0) {
151
+    		    print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
152
+    		}
147 153
     		print '</tr>';
148 154
     		$i++;
149 155
     	}
@@ -315,8 +321,7 @@  discard block
 block discarded – undo
315 321
 				$staticmember->fk_soc = $obj->fk_soc;
316 322
 				$staticmember->fetch_thirdparty();
317 323
 				$staticmember->name=$staticmember->thirdparty->name;
318
-			}
319
-			else
324
+			} else
320 325
 			{
321 326
 				$staticmember->name=$obj->company;
322 327
 			}
@@ -333,8 +338,7 @@  discard block
 block discarded – undo
333 338
 	}
334 339
 	print "</table></div>";
335 340
 	print "<br>";
336
-}
337
-else
341
+} else
338 342
 {
339 343
 	dol_print_error($db);
340 344
 }
@@ -395,8 +399,7 @@  discard block
 block discarded – undo
395 399
 	}
396 400
 	print "</table></div>";
397 401
 	print "<br>";
398
-}
399
-else
402
+} else
400 403
 {
401 404
 	dol_print_error($db);
402 405
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/categories/index.php 3 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -114,30 +114,30 @@  discard block
 block discarded – undo
114 114
  */
115 115
 if ($catname || $id > 0)
116 116
 {
117
-	$cats = $categstatic->rechercher($id, $catname, $typetext);
118
-
119
-	print '<table class="noborder" width="100%">';
120
-	print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
121
-
122
-	foreach ($cats as $cat)
123
-	{
124
-		print "\t".'<tr class="oddeven">'."\n";
125
-		print "\t\t<td>";
126
-		$categstatic->id=$cat->id;
127
-		$categstatic->ref=$cat->label;
128
-		$categstatic->label=$cat->label;
129
-		$categstatic->type=$cat->type;
130
-		$categstatic->color=$cat->color;
131
-		print '<span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>';
132
-		print $categstatic->getNomUrl(1,'');
133
-		print '</span>';
134
-		print "</td>\n";
135
-		print "\t\t<td>";
136
-		print dolGetFirstLineOfText($cat->description);
137
-		print "</td>\n";
138
-		print "\t</tr>\n";
139
-	}
140
-	print "</table>";
117
+    $cats = $categstatic->rechercher($id, $catname, $typetext);
118
+
119
+    print '<table class="noborder" width="100%">';
120
+    print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
121
+
122
+    foreach ($cats as $cat)
123
+    {
124
+        print "\t".'<tr class="oddeven">'."\n";
125
+        print "\t\t<td>";
126
+        $categstatic->id=$cat->id;
127
+        $categstatic->ref=$cat->label;
128
+        $categstatic->label=$cat->label;
129
+        $categstatic->type=$cat->type;
130
+        $categstatic->color=$cat->color;
131
+        print '<span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>';
132
+        print $categstatic->getNomUrl(1,'');
133
+        print '</span>';
134
+        print "</td>\n";
135
+        print "\t\t<td>";
136
+        print dolGetFirstLineOfText($cat->description);
137
+        print "</td>\n";
138
+        print "\t</tr>\n";
139
+    }
140
+    print "</table>";
141 141
 }
142 142
 else print '&nbsp;';
143 143
 
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
 $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
160 160
 foreach($fulltree as $key => $val)
161 161
 {
162
-	$categstatic->id=$val['id'];
163
-	$categstatic->ref=$val['label'];
164
-	$categstatic->color=$val['color'];
165
-	$categstatic->type=$type;
166
-	$li=$categstatic->getNomUrl(1,'',60);
167
-	$desc=dol_htmlcleanlastbr($val['description']);
168
-
169
-	$data[] = array(
170
-	'rowid'=>$val['rowid'],
171
-	'fk_menu'=>$val['fk_parent'],
172
-	'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.'</span></td>'.
173
-	//'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
174
-	'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
175
-	'</tr></table>'
176
-	);
162
+    $categstatic->id=$val['id'];
163
+    $categstatic->ref=$val['label'];
164
+    $categstatic->color=$val['color'];
165
+    $categstatic->type=$type;
166
+    $li=$categstatic->getNomUrl(1,'',60);
167
+    $desc=dol_htmlcleanlastbr($val['description']);
168
+
169
+    $data[] = array(
170
+    'rowid'=>$val['rowid'],
171
+    'fk_menu'=>$val['fk_parent'],
172
+    'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.'</span></td>'.
173
+    //'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
174
+    '<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
175
+    '</tr></table>'
176
+    );
177 177
 }
178 178
 
179 179
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td></td><td align="right">';
184 184
 if (! empty($conf->use_javascript_ajax))
185 185
 {
186
-	print '<div id="iddivjstreecontrol"><a class="notasortlink" href="#">'.img_picto('','object_category').' '.$langs->trans("UndoExpandAll").'</a> | <a class="notasortlink" href="#">'.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div>';
186
+    print '<div id="iddivjstreecontrol"><a class="notasortlink" href="#">'.img_picto('','object_category').' '.$langs->trans("UndoExpandAll").'</a> | <a class="notasortlink" href="#">'.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div>';
187 187
 }
188 188
 print '</td></tr>';
189 189
 
@@ -191,20 +191,20 @@  discard block
 block discarded – undo
191 191
 
192 192
 if ($nbofentries > 0)
193 193
 {
194
-	print '<tr class="pair"><td colspan="3">';
195
-	tree_recur($data,$data[0],0);
196
-	print '</td></tr>';
194
+    print '<tr class="pair"><td colspan="3">';
195
+    tree_recur($data,$data[0],0);
196
+    print '</td></tr>';
197 197
 }
198 198
 else
199 199
 {
200
-	print '<tr class="pair">';
201
-	print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
202
-	print '<td valign="middle">';
203
-	print $langs->trans("NoCategoryYet");
204
-	print '</td>';
205
-	print '<td>&nbsp;</td>';
206
-	print '</table></td>';
207
-	print '</tr>';
200
+    print '<tr class="pair">';
201
+    print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
202
+    print '<td valign="middle">';
203
+    print $langs->trans("NoCategoryYet");
204
+    print '</td>';
205
+    print '<td>&nbsp;</td>';
206
+    print '</table></td>';
207
+    print '</tr>';
208 208
 }
209 209
 
210 210
 print "</table>";
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
  *      \brief      Home page of category area
28 28
  */
29 29
 
30
-require DOL_BASE_PATH . '/main.inc.php';
31
-require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
30
+require DOL_BASE_PATH.'/main.inc.php';
31
+require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
32 32
 require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
33 33
 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
34 34
 
35 35
 // Load translation files required by the page
36 36
 $langs->load("categories");
37 37
 
38
-if (! $user->rights->categorie->lire) accessforbidden();
38
+if (!$user->rights->categorie->lire) accessforbidden();
39 39
 
40
-$id=GETPOST('id','int');
41
-$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
42
-$catname=GETPOST('catname','alpha');
40
+$id = GETPOST('id', 'int');
41
+$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
42
+$catname = GETPOST('catname', 'alpha');
43 43
 
44
-if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type];	// For backward compatibility
44
+if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
45 45
 
46 46
 
47 47
 /*
@@ -51,25 +51,25 @@  discard block
 block discarded – undo
51 51
 $categstatic = new Categorie($db);
52 52
 $form = new Form($db);
53 53
 
54
-if ($type == Categorie::TYPE_PRODUCT)       { $title=$langs->trans("ProductsCategoriesArea");  $typetext='product'; }
55
-elseif ($type == Categorie::TYPE_SUPPLIER)  { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; }
56
-elseif ($type == Categorie::TYPE_CUSTOMER)  { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
57
-elseif ($type == Categorie::TYPE_MEMBER)    { $title=$langs->trans("MembersCategoriesArea");   $typetext='member'; }
58
-elseif ($type == Categorie::TYPE_CONTACT)   { $title=$langs->trans("ContactsCategoriesArea");  $typetext='contact'; }
59
-elseif ($type == Categorie::TYPE_ACCOUNT)   { $title=$langs->trans("AccountsCategoriesArea");  $typetext='bank_account'; }
60
-elseif ($type == Categorie::TYPE_PROJECT)   { $title=$langs->trans("ProjectsCategoriesArea");  $typetext='project'; }
61
-elseif ($type == Categorie::TYPE_USER)      { $title=$langs->trans("UsersCategoriesArea");     $typetext='user'; }
62
-else                                        { $title=$langs->trans("CategoriesArea");          $typetext='unknown'; }
54
+if ($type == Categorie::TYPE_PRODUCT) { $title = $langs->trans("ProductsCategoriesArea"); $typetext = 'product'; }
55
+elseif ($type == Categorie::TYPE_SUPPLIER) { $title = $langs->trans("SuppliersCategoriesArea"); $typetext = 'supplier'; }
56
+elseif ($type == Categorie::TYPE_CUSTOMER) { $title = $langs->trans("CustomersCategoriesArea"); $typetext = 'customer'; }
57
+elseif ($type == Categorie::TYPE_MEMBER) { $title = $langs->trans("MembersCategoriesArea"); $typetext = 'member'; }
58
+elseif ($type == Categorie::TYPE_CONTACT) { $title = $langs->trans("ContactsCategoriesArea"); $typetext = 'contact'; }
59
+elseif ($type == Categorie::TYPE_ACCOUNT) { $title = $langs->trans("AccountsCategoriesArea"); $typetext = 'bank_account'; }
60
+elseif ($type == Categorie::TYPE_PROJECT) { $title = $langs->trans("ProjectsCategoriesArea"); $typetext = 'project'; }
61
+elseif ($type == Categorie::TYPE_USER) { $title = $langs->trans("UsersCategoriesArea"); $typetext = 'user'; }
62
+else { $title = $langs->trans("CategoriesArea"); $typetext = 'unknown'; }
63 63
 
64
-$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
65
-$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
64
+$arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
65
+$arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
66 66
 
67
-llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss);
67
+llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
68 68
 
69 69
 //$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle">'.$langs->trans("NewCategory").'</span>';
70
-$newcardbutton = '<a class="butActionNew" href="' . BASE_URI . '?controller=categories&method=card&action=create&type=' . $type . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type) . '"><span class="valignmiddle">' . $langs->trans("NewCategory") . '</span>';
71
-$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
72
-$newcardbutton.= '</a>';
70
+$newcardbutton = '<a class="butActionNew" href="'.BASE_URI.'?controller=categories&method=card&action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'"><span class="valignmiddle">'.$langs->trans("NewCategory").'</span>';
71
+$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
72
+$newcardbutton .= '</a>';
73 73
 
74 74
 print load_fiche_titre($title, $newcardbutton);
75 75
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 print '<td colspan="3">'.$langs->trans("Search").'</td>';
92 92
 print '</tr>';
93 93
 print '<tr class="oddeven"><td>';
94
-print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
94
+print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
95 95
 /*
96 96
 // faire une rech dans une sous categorie uniquement
97 97
 print '<tr '.$bc[0].'><td>';
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		print "\t".'<tr class="oddeven">'."\n";
125 125
 		print "\t\t<td>";
126
-		$categstatic->id=$cat->id;
127
-		$categstatic->ref=$cat->label;
128
-		$categstatic->label=$cat->label;
129
-		$categstatic->type=$cat->type;
130
-		$categstatic->color=$cat->color;
131
-		print '<span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>';
132
-		print $categstatic->getNomUrl(1,'');
126
+		$categstatic->id = $cat->id;
127
+		$categstatic->ref = $cat->label;
128
+		$categstatic->label = $cat->label;
129
+		$categstatic->type = $cat->type;
130
+		$categstatic->color = $cat->color;
131
+		print '<span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>';
132
+		print $categstatic->getNomUrl(1, '');
133 133
 		print '</span>';
134 134
 		print "</td>\n";
135 135
 		print "\t\t<td>";
@@ -152,24 +152,24 @@  discard block
 block discarded – undo
152 152
 $cate_arbo = $categstatic->get_full_arbo($typetext);
153 153
 
154 154
 // Define fulltree array
155
-$fulltree=$cate_arbo;
155
+$fulltree = $cate_arbo;
156 156
 
157 157
 // Define data (format for treeview)
158
-$data=array();
159
-$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
160
-foreach($fulltree as $key => $val)
158
+$data = array();
159
+$data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>'');
160
+foreach ($fulltree as $key => $val)
161 161
 {
162
-	$categstatic->id=$val['id'];
163
-	$categstatic->ref=$val['label'];
164
-	$categstatic->color=$val['color'];
165
-	$categstatic->type=$type;
166
-	$li=$categstatic->getNomUrl(1,'',60);
167
-	$desc=dol_htmlcleanlastbr($val['description']);
162
+	$categstatic->id = $val['id'];
163
+	$categstatic->ref = $val['label'];
164
+	$categstatic->color = $val['color'];
165
+	$categstatic->type = $type;
166
+	$li = $categstatic->getNomUrl(1, '', 60);
167
+	$desc = dol_htmlcleanlastbr($val['description']);
168 168
 
169 169
 	$data[] = array(
170 170
 	'rowid'=>$val['rowid'],
171 171
 	'fk_menu'=>$val['fk_parent'],
172
-	'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.'</span></td>'.
172
+	'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.'</span></td>'.
173 173
 	//'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
174 174
 	'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
175 175
 	'</tr></table>'
@@ -181,24 +181,24 @@  discard block
 block discarded – undo
181 181
 
182 182
 print '<table class="liste nohover" width="100%">';
183 183
 print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td></td><td align="right">';
184
-if (! empty($conf->use_javascript_ajax))
184
+if (!empty($conf->use_javascript_ajax))
185 185
 {
186
-	print '<div id="iddivjstreecontrol"><a class="notasortlink" href="#">'.img_picto('','object_category').' '.$langs->trans("UndoExpandAll").'</a> | <a class="notasortlink" href="#">'.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div>';
186
+	print '<div id="iddivjstreecontrol"><a class="notasortlink" href="#">'.img_picto('', 'object_category').' '.$langs->trans("UndoExpandAll").'</a> | <a class="notasortlink" href="#">'.img_picto('', 'object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div>';
187 187
 }
188 188
 print '</td></tr>';
189 189
 
190
-$nbofentries=(count($data) - 1);
190
+$nbofentries = (count($data) - 1);
191 191
 
192 192
 if ($nbofentries > 0)
193 193
 {
194 194
 	print '<tr class="pair"><td colspan="3">';
195
-	tree_recur($data,$data[0],0);
195
+	tree_recur($data, $data[0], 0);
196 196
 	print '</td></tr>';
197 197
 }
198 198
 else
199 199
 {
200 200
 	print '<tr class="pair">';
201
-	print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
201
+	print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
202 202
 	print '<td valign="middle">';
203 203
 	print $langs->trans("NoCategoryYet");
204 204
 	print '</td>';
Please login to merge, or discard this patch.
Braces   +12 added lines, -15 removed lines patch added patch discarded remove patch
@@ -35,13 +35,18 @@  discard block
 block discarded – undo
35 35
 // Load translation files required by the page
36 36
 $langs->load("categories");
37 37
 
38
-if (! $user->rights->categorie->lire) accessforbidden();
38
+if (! $user->rights->categorie->lire) {
39
+    accessforbidden();
40
+}
39 41
 
40 42
 $id=GETPOST('id','int');
41 43
 $type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
42 44
 $catname=GETPOST('catname','alpha');
43 45
 
44
-if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type];	// For backward compatibility
46
+if (is_numeric($type)) {
47
+    $type=Categorie::$MAP_ID_TO_CODE[$type];
48
+}
49
+// For backward compatibility
45 50
 
46 51
 
47 52
 /*
@@ -51,15 +56,7 @@  discard block
 block discarded – undo
51 56
 $categstatic = new Categorie($db);
52 57
 $form = new Form($db);
53 58
 
54
-if ($type == Categorie::TYPE_PRODUCT)       { $title=$langs->trans("ProductsCategoriesArea");  $typetext='product'; }
55
-elseif ($type == Categorie::TYPE_SUPPLIER)  { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; }
56
-elseif ($type == Categorie::TYPE_CUSTOMER)  { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
57
-elseif ($type == Categorie::TYPE_MEMBER)    { $title=$langs->trans("MembersCategoriesArea");   $typetext='member'; }
58
-elseif ($type == Categorie::TYPE_CONTACT)   { $title=$langs->trans("ContactsCategoriesArea");  $typetext='contact'; }
59
-elseif ($type == Categorie::TYPE_ACCOUNT)   { $title=$langs->trans("AccountsCategoriesArea");  $typetext='bank_account'; }
60
-elseif ($type == Categorie::TYPE_PROJECT)   { $title=$langs->trans("ProjectsCategoriesArea");  $typetext='project'; }
61
-elseif ($type == Categorie::TYPE_USER)      { $title=$langs->trans("UsersCategoriesArea");     $typetext='user'; }
62
-else                                        { $title=$langs->trans("CategoriesArea");          $typetext='unknown'; }
59
+if ($type == Categorie::TYPE_PRODUCT)       { $title=$langs->trans("ProductsCategoriesArea");  $typetext='product'; } elseif ($type == Categorie::TYPE_SUPPLIER)  { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; } elseif ($type == Categorie::TYPE_CUSTOMER)  { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; } elseif ($type == Categorie::TYPE_MEMBER)    { $title=$langs->trans("MembersCategoriesArea");   $typetext='member'; } elseif ($type == Categorie::TYPE_CONTACT)   { $title=$langs->trans("ContactsCategoriesArea");  $typetext='contact'; } elseif ($type == Categorie::TYPE_ACCOUNT)   { $title=$langs->trans("AccountsCategoriesArea");  $typetext='bank_account'; } elseif ($type == Categorie::TYPE_PROJECT)   { $title=$langs->trans("ProjectsCategoriesArea");  $typetext='project'; } elseif ($type == Categorie::TYPE_USER)      { $title=$langs->trans("UsersCategoriesArea");     $typetext='user'; } else                                        { $title=$langs->trans("CategoriesArea");          $typetext='unknown'; }
63 60
 
64 61
 $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
65 62
 $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
@@ -138,8 +135,9 @@  discard block
 block discarded – undo
138 135
 		print "\t</tr>\n";
139 136
 	}
140 137
 	print "</table>";
141
-}
142
-else print '&nbsp;';
138
+} else {
139
+    print '&nbsp;';
140
+}
143 141
 
144 142
 
145 143
 //print '</td></tr></table>';
@@ -194,8 +192,7 @@  discard block
 block discarded – undo
194 192
 	print '<tr class="pair"><td colspan="3">';
195 193
 	tree_recur($data,$data[0],0);
196 194
 	print '</td></tr>';
197
-}
198
-else
195
+} else
199 196
 {
200 197
 	print '<tr class="pair">';
201 198
 	print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
Please login to merge, or discard this patch.
dolibarr/htdocs/main.inc.php 1 patch
Spacing   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
         $inj += preg_match('/insert\s+into/i', $val);
102 102
         $inj += preg_match('/select\s+from/i', $val);
103 103
         $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val);
104
-        $inj += preg_match('/user\s*\(/i', $val);      // avoid to use function user() that return current database login
105
-        $inj += preg_match('/information_schema/i', $val);    // avoid to use request that read information_schema database
104
+        $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login
105
+        $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database
106 106
     }
107 107
     if ($type == 3) {
108 108
         $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val);
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
         $inj += preg_match('/<style/i', $val);
127 127
     }
128 128
     $inj += preg_match('/base[\s]+href/si', $val);
129
-    $inj += preg_match('/<.*onmouse/si', $val);       // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)>
130
-    $inj += preg_match('/onerror\s*=/i', $val);       // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)>
131
-    $inj += preg_match('/onfocus\s*=/i', $val);       // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)>
132
-    $inj += preg_match('/onload\s*=/i', $val);        // onload can be set on svg tag <svg/onload=alert(1)> or other tag like body <body onload=alert(1)>
133
-    $inj += preg_match('/onloadstart\s*=/i', $val);   // onload can be set on audio tag <audio onloadstart=alert(1)>
134
-    $inj += preg_match('/onclick\s*=/i', $val);       // onclick can be set on img text html tag like <img onclick = alert(1)>
135
-    $inj += preg_match('/onscroll\s*=/i', $val);      // onscroll can be on textarea
129
+    $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)>
130
+    $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)>
131
+    $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)>
132
+    $inj += preg_match('/onload\s*=/i', $val); // onload can be set on svg tag <svg/onload=alert(1)> or other tag like body <body onload=alert(1)>
133
+    $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)>
134
+    $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)>
135
+    $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea
136 136
     //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val);   // To lock event handlers onAbort(), ...
137
-    $inj += preg_match('/&#58;|&#0000058|&#x3A/i', $val);  // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...'
137
+    $inj += preg_match('/&#58;|&#0000058|&#x3A/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...'
138 138
     //if ($type == 1)
139 139
     //{
140 140
     $inj += preg_match('/javascript:/i', $val);
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
     //}
143 143
     // For XSS Injection done by adding javascript closing html tags like with onmousemove, etc... (closing a src or href tag with not cleaned param)
144 144
     if ($type == 1) {
145
-        $inj += preg_match('/"/i', $val);  // We refused " in GET parameters value
145
+        $inj += preg_match('/"/i', $val); // We refused " in GET parameters value
146 146
     }
147 147
     if ($type == 2) {
148
-        $inj += preg_match('/[;"]/', $val);  // PHP_SELF is a file system path. It can contains spaces.
148
+        $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces.
149 149
     }
150 150
     return $inj;
151 151
 }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             if (analyseVarsForSqlAndScriptsInjection($key, $type) && analyseVarsForSqlAndScriptsInjection($value, $type)) {
165 165
                 //$var[$key] = $value;	// This is useless
166 166
             } else {
167
-                print 'Access refused by SQL/Script injection protection in main.inc.php (type=' . htmlentities($type) . ' key=' . htmlentities($key) . ' value=' . htmlentities($value) . ' page=' . htmlentities($_SERVER["REQUEST_URI"]) . ')';
167
+                print 'Access refused by SQL/Script injection protection in main.inc.php (type='.htmlentities($type).' key='.htmlentities($key).' value='.htmlentities($value).' page='.htmlentities($_SERVER["REQUEST_URI"]).')';
168 168
                 exit;
169 169
             }
170 170
         }
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 
199 199
 // This is to make Dolibarr working with Plesk
200 200
 if (!empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') {
201
-    set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs');
201
+    set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
202 202
 }
203 203
 
204 204
 // Include the conf.php and functions.lib.php
205
-require_once DOL_BASE_PATH . '/filefunc.inc.php';
205
+require_once DOL_BASE_PATH.'/filefunc.inc.php';
206 206
 
207 207
 // If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it.
208 208
 // This is used for example by form of boxes to save personalization of some options.
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     $tmplist = explode(',', $tmpautoset[1]);
213 213
     $cookiearrayvalue = array();
214 214
     foreach ($tmplist as $tmpkey) {
215
-        $postkey = $tmpautoset[0] . '_' . $tmpkey;
215
+        $postkey = $tmpautoset[0].'_'.$tmpkey;
216 216
         //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
217 217
         if (!empty($_POST[$postkey]))
218 218
             $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
 // Note: the function dol_getprefix may have been redefined to return a different key to manage another area to protect.
231 231
 $prefix = dol_getprefix('');
232 232
 
233
-$sessionname = 'DOLSESSID_' . $prefix;
234
-$sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
233
+$sessionname = 'DOLSESSID_'.$prefix;
234
+$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
235 235
 if (!empty($_COOKIE[$sessiontimeout]))
236 236
     ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
237 237
 session_name($sessionname);
238
-session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
238
+session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
239 239
 // This create lock, released when session_write_close() or end of page.
240 240
 // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished.
241 241
 if (!defined('NOSESSION')) {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     $conf->browser->name = $tmp['browsername'];
262 262
     $conf->browser->os = $tmp['browseros'];
263 263
     $conf->browser->version = $tmp['browserversion'];
264
-    $conf->browser->layout = $tmp['layout'];     // 'classic', 'phone', 'tablet'
264
+    $conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet'
265 265
     //var_dump($conf->browser);
266 266
 
267 267
     if ($conf->browser->layout == 'phone')
@@ -280,16 +280,16 @@  discard block
 block discarded – undo
280 280
                 $newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]);
281 281
             }
282 282
         } else { // Check HTTPS environment variable (Apache/mod_ssl only)
283
-            $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT) . $_SERVER["REQUEST_URI"];
283
+            $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"];
284 284
         }
285 285
     } else {
286 286
         // Check HTTPS environment variable (Apache/mod_ssl only)
287
-        $newurl = $conf->file->main_force_https . $_SERVER["REQUEST_URI"];
287
+        $newurl = $conf->file->main_force_https.$_SERVER["REQUEST_URI"];
288 288
     }
289 289
     // Start redirect
290 290
     if ($newurl) {
291
-        dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to " . $newurl);
292
-        header("Location: " . $newurl);
291
+        dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl);
292
+        header("Location: ".$newurl);
293 293
         exit;
294 294
     } else {
295 295
         dol_syslog("main.inc: dolibarr_main_force_https is on but we failed to forge new https url so no redirect is done", LOG_WARNING);
@@ -314,28 +314,28 @@  discard block
 block discarded – undo
314 314
 
315 315
 // Loading of additional presentation includes
316 316
 if (!defined('NOREQUIREHTML'))
317
-    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';     // Need 660ko memory (800ko in 2.2)
317
+    require_once DOL_BASE_PATH.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2)
318 318
 if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax)
319
-    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory
319
+    require_once DOL_BASE_PATH.'/core/lib/ajax.lib.php'; // Need 22ko memory
320 320
 
321 321
 
322 322
     
323 323
 // If install or upgrade process not done or not completely finished, we call the install page.
324 324
 if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) {
325 325
     dol_syslog("main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING);
326
-    header("Location: " . BASE_URI . "?controller=install&method=index");
326
+    header("Location: ".BASE_URI."?controller=install&method=index");
327 327
     exit;
328 328
 }
329 329
 // If an upgrade process is required, we call the install page.
330 330
 if ((!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION)) || (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && !empty($conf->global->MAIN_VERSION_LAST_INSTALL) && ($conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION))) {
331 331
     $versiontocompare = empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE;
332
-    require_once DOL_BASE_PATH . '/core/lib/admin.lib.php';
332
+    require_once DOL_BASE_PATH.'/core/lib/admin.lib.php';
333 333
     $dolibarrversionlastupgrade = preg_split('/[.-]/', $versiontocompare);
334 334
     $dolibarrversionprogram = preg_split('/[.-]/', DOL_VERSION);
335 335
     $rescomp = versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade);
336 336
     if ($rescomp > 0) {   // Programs have a version higher than database. We did not add "&& $rescomp < 3" because we want upgrade process for build upgrades
337
-        dol_syslog("main.inc: database version " . $versiontocompare . " is lower than programs version " . DOL_VERSION . ". Redirect to install page.", LOG_WARNING);
338
-        header("Location: " . BASE_URI . "?controller=install&method=index");
337
+        dol_syslog("main.inc: database version ".$versiontocompare." is lower than programs version ".DOL_VERSION.". Redirect to install page.", LOG_WARNING);
338
+        header("Location: ".BASE_URI."?controller=install&method=index");
339 339
         exit;
340 340
     }
341 341
 }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     }
359 359
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {  // This test must be after loading $_SESSION['token'].
360 360
         if (GETPOST('token', 'alpha') != $_SESSION['token']) {
361
-            dol_syslog("Invalid token in " . $_SERVER['HTTP_REFERER'] . ", action=" . GETPOST('action', 'aZ09') . ", _POST['token']=" . GETPOST('token', 'alpha') . ", _SESSION['token']=" . $_SESSION['token'], LOG_WARNING);
361
+            dol_syslog("Invalid token in ".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING);
362 362
             //print 'Unset POST by CSRF protection in main.inc.php.';	// Do not output anything because this create problems when using the BACK button on browsers.
363 363
             unset($_POST);
364 364
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     $test = true;
419 419
     if (!isset($_SESSION["dol_login"])) {
420 420
         // It is not already authenticated and it requests the login / password
421
-        include_once DOL_BASE_PATH . '/core/lib/security2.lib.php';
421
+        include_once DOL_BASE_PATH.'/core/lib/security2.lib.php';
422 422
 
423 423
         $dol_dst_observed = GETPOST("dst_observed", 'int', 3);
424 424
         $dol_dst_first = GETPOST("dst_first", 'int', 3);
@@ -432,17 +432,17 @@  discard block
 block discarded – undo
432 432
         $dol_use_jmobile = GETPOST('dol_use_jmobile', 'int', 3);
433 433
         //dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,','));
434 434
         // If in demo mode, we check we go to home page through the public/demo/index.php page
435
-        if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI . '/index.php') {  // We ask index page
435
+        if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI.'/index.php') {  // We ask index page
436 436
             if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/public/', $_SERVER['HTTP_REFERER'])) {
437
-                dol_syslog("Call index page from another url than demo page (call is done from page " . $_SERVER['HTTP_REFERER'] . ")");
437
+                dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")");
438 438
                 $url = '';
439
-                $url .= ($url ? '&' : '') . ($dol_hide_topmenu ? 'dol_hide_topmenu=' . $dol_hide_topmenu : '');
440
-                $url .= ($url ? '&' : '') . ($dol_hide_leftmenu ? 'dol_hide_leftmenu=' . $dol_hide_leftmenu : '');
441
-                $url .= ($url ? '&' : '') . ($dol_optimize_smallscreen ? 'dol_optimize_smallscreen=' . $dol_optimize_smallscreen : '');
442
-                $url .= ($url ? '&' : '') . ($dol_no_mouse_hover ? 'dol_no_mouse_hover=' . $dol_no_mouse_hover : '');
443
-                $url .= ($url ? '&' : '') . ($dol_use_jmobile ? 'dol_use_jmobile=' . $dol_use_jmobile : '');
444
-                $url = DOL_BASE_URI . '/public/demo/index.php' . ($url ? '?' . $url : '');
445
-                header("Location: " . $url);
439
+                $url .= ($url ? '&' : '').($dol_hide_topmenu ? 'dol_hide_topmenu='.$dol_hide_topmenu : '');
440
+                $url .= ($url ? '&' : '').($dol_hide_leftmenu ? 'dol_hide_leftmenu='.$dol_hide_leftmenu : '');
441
+                $url .= ($url ? '&' : '').($dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$dol_optimize_smallscreen : '');
442
+                $url .= ($url ? '&' : '').($dol_no_mouse_hover ? 'dol_no_mouse_hover='.$dol_no_mouse_hover : '');
443
+                $url .= ($url ? '&' : '').($dol_use_jmobile ? 'dol_use_jmobile='.$dol_use_jmobile : '');
444
+                $url = DOL_BASE_URI.'/public/demo/index.php'.($url ? '?'.$url : '');
445
+                header("Location: ".$url);
446 446
                 exit;
447 447
             }
448 448
         }
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
                 $test = false;
463 463
 
464 464
                 // Call trigger for the "security events" log
465
-                $user->trigger_mesg = 'ErrorBadValueForCode - login=' . GETPOST("username", "alpha", 2);
465
+                $user->trigger_mesg = 'ErrorBadValueForCode - login='.GETPOST("username", "alpha", 2);
466 466
                 // Call of triggers
467
-                include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
467
+                include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
468 468
                 $interface = new Interfaces($db);
469 469
                 $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
470 470
                 if ($result < 0) {
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
                 $action = '';
476 476
                 $hookmanager->initHooks(array('login'));
477 477
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
478
-                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
478
+                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
479 479
                 if ($reshook < 0)
480 480
                     $error++;
481 481
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
             $goontestloop = true;
501 501
 
502 502
         if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
503
-            include_once DOL_BASE_PATH . '/core/class/translate.class.php';
503
+            include_once DOL_BASE_PATH.'/core/class/translate.class.php';
504 504
             $langs = new Translate("", $conf);
505 505
             $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT));
506 506
             if (defined('MAIN_LANG_DEFAULT'))
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
                 $dol_tz_string = preg_replace('/\s/', '_', $dol_tz_string);
523 523
                 $dol_dst = 0;
524 524
                 if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) {
525
-                    include_once DOL_BASE_PATH . '/core/lib/date.lib.php';
525
+                    include_once DOL_BASE_PATH.'/core/lib/date.lib.php';
526 526
                     $datenow = dol_now();
527 527
                     $datefirst = dol_stringtotime($_POST["dst_first"]);
528 528
                     $datesecond = dol_stringtotime($_POST["dst_second"]);
@@ -543,9 +543,9 @@  discard block
 block discarded – undo
543 543
                     $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
544 544
 
545 545
                 // Call trigger for the "security events" log
546
-                $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2);
546
+                $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username", "alpha", 2);
547 547
                 // Call of triggers
548
-                include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
548
+                include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
549 549
                 $interface = new Interfaces($db);
550 550
                 $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf, GETPOST("username", "alpha", 2));
551 551
                 if ($result < 0) {
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                 $action = '';
557 557
                 $hookmanager->initHooks(array('login'));
558 558
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
559
-                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
559
+                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
560 560
                 if ($reshook < 0)
561 561
                     $error++;
562 562
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
         // End test login / passwords
568 568
         if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
569 569
             // No data to test login, so we show the login page
570
-            dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit");
570
+            dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." showing the login form and exit");
571 571
             if (defined('NOREDIRECTBYMAINTOLOGIN'))
572 572
                 return 'ERROR_NOT_LOGGED';
573 573
             else
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
             dol_syslog('User not found, connexion refused');
581 581
             session_destroy();
582 582
             session_name($sessionname);
583
-            session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie
584
-            session_start();    // Fixing the bug of register_globals here is useless since session is empty
583
+            session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
584
+            session_start(); // Fixing the bug of register_globals here is useless since session is empty
585 585
 
586 586
             if ($resultFetchUser == 0) {
587 587
                 // Load translation files required by page
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
                 $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login);
591 591
 
592
-                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login;
592
+                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
593 593
             }
594 594
             if ($resultFetchUser < 0) {
595 595
                 $_SESSION["dol_loginmesg"] = $user->error;
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
             }
599 599
 
600 600
             // Call triggers for the "security events" log
601
-            include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
601
+            include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
602 602
             $interface = new Interfaces($db);
603 603
             $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
604 604
             if ($result < 0) {
@@ -609,18 +609,18 @@  discard block
 block discarded – undo
609 609
             $action = '';
610 610
             $hookmanager->initHooks(array('login'));
611 611
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
612
-            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
612
+            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
613 613
             if ($reshook < 0)
614 614
                 $error++;
615 615
 
616 616
             $paramsurl = array();
617 617
             if (GETPOST('textbrowser', 'int'))
618
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
618
+                $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int');
619 619
             if (GETPOST('nojs', 'int'))
620
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
620
+                $paramsurl[] = 'nojs='.GETPOST('nojs', 'int');
621 621
             if (GETPOST('lang', 'aZ09'))
622
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
623
-            header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
622
+                $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09');
623
+            header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''));
624 624
             exit;
625 625
         }
626 626
     }
@@ -628,16 +628,16 @@  discard block
 block discarded – undo
628 628
         // We are already into an authenticated session
629 629
         $login = $_SESSION["dol_login"];
630 630
         $entity = $_SESSION["dol_entity"];
631
-        dol_syslog("- This is an already logged session. _SESSION['dol_login']=" . $login . " _SESSION['dol_entity']=" . $entity, LOG_DEBUG);
631
+        dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG);
632 632
 
633 633
         $resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1));
634 634
         if ($resultFetchUser <= 0) {
635 635
             // Account has been removed after login
636
-            dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=" . $login, LOG_WARNING);
636
+            dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
637 637
             session_destroy();
638 638
             session_name($sessionname);
639
-            session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie
640
-            session_start();    // Fixing the bug of register_globals here is useless since session is empty
639
+            session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
640
+            session_start(); // Fixing the bug of register_globals here is useless since session is empty
641 641
 
642 642
             if ($resultFetchUser == 0) {
643 643
                 // Load translation files required by page
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
                 $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login);
647 647
 
648
-                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login;
648
+                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
649 649
             }
650 650
             if ($resultFetchUser < 0) {
651 651
                 $_SESSION["dol_loginmesg"] = $user->error;
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
             }
655 655
 
656 656
             // Call triggers for the "security events" log
657
-            include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
657
+            include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
658 658
             $interface = new Interfaces($db);
659 659
             $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
660 660
             if ($result < 0) {
@@ -665,18 +665,18 @@  discard block
 block discarded – undo
665 665
             $action = '';
666 666
             $hookmanager->initHooks(array('login'));
667 667
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
668
-            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
668
+            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
669 669
             if ($reshook < 0)
670 670
                 $error++;
671 671
 
672 672
             $paramsurl = array();
673 673
             if (GETPOST('textbrowser', 'int'))
674
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
674
+                $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int');
675 675
             if (GETPOST('nojs', 'int'))
676
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
676
+                $paramsurl[] = 'nojs='.GETPOST('nojs', 'int');
677 677
             if (GETPOST('lang', 'aZ09'))
678
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
679
-            header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
678
+                $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09');
679
+            header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''));
680 680
             exit;
681 681
         }
682 682
         else {
@@ -686,29 +686,29 @@  discard block
 block discarded – undo
686 686
             // Code for search criteria persistence.
687 687
             if (!empty($_GET['save_lastsearch_values'])) {    // We must use $_GET here
688 688
                 $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]);
689
-                $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring);     // Get full path except host server
689
+                $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server
690 690
                 // Clean $relativepathstring
691 691
                 if (constant('DOL_BASE_URI'))
692
-                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
692
+                    $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
693 693
                 $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
694 694
                 $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
695 695
                 //var_dump($relativepathstring);
696 696
                 // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. We save them from tmp to no tmp
697
-                if (!empty($_SESSION['lastsearch_values_tmp_' . $relativepathstring])) {
698
-                    $_SESSION['lastsearch_values_' . $relativepathstring] = $_SESSION['lastsearch_values_tmp_' . $relativepathstring];
699
-                    unset($_SESSION['lastsearch_values_tmp_' . $relativepathstring]);
697
+                if (!empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) {
698
+                    $_SESSION['lastsearch_values_'.$relativepathstring] = $_SESSION['lastsearch_values_tmp_'.$relativepathstring];
699
+                    unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
700 700
                 }
701
-                if (!empty($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring])) {
702
-                    $_SESSION['lastsearch_contextpage_' . $relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring];
703
-                    unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]);
701
+                if (!empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) {
702
+                    $_SESSION['lastsearch_contextpage_'.$relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring];
703
+                    unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
704 704
                 }
705
-                if (!empty($_SESSION['lastsearch_page_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_page_tmp_' . $relativepathstring] > 1) {
706
-                    $_SESSION['lastsearch_page_' . $relativepathstring] = $_SESSION['lastsearch_page_tmp_' . $relativepathstring];
707
-                    unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
705
+                if (!empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) {
706
+                    $_SESSION['lastsearch_page_'.$relativepathstring] = $_SESSION['lastsearch_page_tmp_'.$relativepathstring];
707
+                    unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
708 708
                 }
709
-                if (!empty($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] != $conf->liste_limit) {
710
-                    $_SESSION['lastsearch_limit_' . $relativepathstring] = $_SESSION['lastsearch_limit_tmp_' . $relativepathstring];
711
-                    unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
709
+                if (!empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) {
710
+                    $_SESSION['lastsearch_limit_'.$relativepathstring] = $_SESSION['lastsearch_limit_tmp_'.$relativepathstring];
711
+                    unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
712 712
                 }
713 713
             }
714 714
 
@@ -751,18 +751,18 @@  discard block
 block discarded – undo
751 751
         if (!empty($dol_use_jmobile))
752 752
             $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
753 753
 
754
-        dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id());
754
+        dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"]." Session id=".session_id());
755 755
 
756 756
         $db->begin();
757 757
 
758 758
         $user->update_last_login_date();
759 759
 
760
-        $loginfo = 'TZ=' . $_SESSION["dol_tz"] . ';TZString=' . $_SESSION["dol_tz_string"] . ';Screen=' . $_SESSION["dol_screenwidth"] . 'x' . $_SESSION["dol_screenheight"];
760
+        $loginfo = 'TZ='.$_SESSION["dol_tz"].';TZString='.$_SESSION["dol_tz_string"].';Screen='.$_SESSION["dol_screenwidth"].'x'.$_SESSION["dol_screenheight"];
761 761
 
762 762
         // Call triggers for the "security events" log
763 763
         $user->trigger_mesg = $loginfo;
764 764
         // Call triggers
765
-        include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
765
+        include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
766 766
         $interface = new Interfaces($db);
767 767
         $result = $interface->run_triggers('USER_LOGIN', $user, $user, $langs, $conf);
768 768
         if ($result < 0) {
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
         $action = '';
774 774
         $hookmanager->initHooks(array('login'));
775 775
         $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginfo' => $loginfo);
776
-        $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
776
+        $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
777 777
         if ($reshook < 0)
778 778
             $error++;
779 779
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         if (!empty($landingpage)) {    // Example: /index.php
792 792
             $newpath = dol_buildpath($landingpage, 1);
793 793
             if ($_SERVER["PHP_SELF"] != $newpath) {   // not already on landing page (avoid infinite loop)
794
-                header('Location: ' . $newpath);
794
+                header('Location: '.$newpath);
795 795
                 exit;
796 796
             }
797 797
         }
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
     if (empty($conf->global->MAIN_FORCETHEME) && !empty($user->conf->MAIN_THEME)) {
841 841
         $conf->theme = $user->conf->MAIN_THEME;
842 842
         // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
843
-        $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
843
+        $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
844 844
     }
845 845
 }
846 846
 
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 if (GETPOST('theme', 'alpha')) {
849 849
     $conf->theme = GETPOST('theme', 'alpha', 1);
850 850
     // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
851
-    $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
851
+    $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
852 852
 }
853 853
 
854 854
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) {
891 891
     $conf->theme = 'eldy';
892 892
     // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
893
-    $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
893
+    $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
894 894
 }
895 895
 
896 896
 if (!defined('NOREQUIRETRAN')) {
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 }
927 927
 
928 928
 
929
-dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . ' - action=' . GETPOST('action', 'az09') . ', massaction=' . GETPOST('massaction', 'az09'));
929
+dol_syslog("--- Access to ".$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'az09').', massaction='.GETPOST('massaction', 'az09'));
930 930
 //Another call for easy debugg
931 931
 //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST));
932 932
 // Load main languages files
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 // Define some constants used for style of arrays
939 939
 $bc = array(0 => 'class="impair"', 1 => 'class="pair"');
940 940
 $bcdd = array(0 => 'class="drag drop oddeven"', 1 => 'class="drag drop oddeven"');
941
-$bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"');  // Used for tr to add new lines
941
+$bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines
942 942
 $bctag = array(0 => 'class="impair tagtr"', 1 => 'class="pair tagtr"');
943 943
 
944 944
 // Define messages variables
@@ -986,19 +986,19 @@  discard block
 block discarded – undo
986 986
     // Load the menu manager (only if not already done)
987 987
     $file_menu = $conf->standard_menu;
988 988
     if (GETPOST('menu', 'alpha'))
989
-        $file_menu = GETPOST('menu', 'alpha');     // example: menu=eldy_menu.php
989
+        $file_menu = GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php
990 990
     if (!class_exists('MenuManager')) {
991 991
         $menufound = 0;
992 992
         $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
993 993
         foreach ($dirmenus as $dirmenu) {
994
-            $menufound = dol_include_once($dirmenu . "standard/" . $file_menu);
994
+            $menufound = dol_include_once($dirmenu."standard/".$file_menu);
995 995
             if (class_exists('MenuManager'))
996 996
                 break;
997 997
         }
998 998
         if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php
999
-            dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING);
999
+            dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
1000 1000
             $file_menu = 'eldy_menu.php';
1001
-            include_once DOL_DOCUMENT_ROOT . "/core/menus/standard/" . $file_menu;
1001
+            include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
1002 1002
         }
1003 1003
     }
1004 1004
     $menumanager = new MenuManager($db, empty($user->societe_id) ? 0 : 1);
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
         // html header
1037 1037
         top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
1038 1038
 
1039
-        print '<body id="mainbody"' . ($morecssonbody ? ' class="' . $morecssonbody . '"' : '') . '>' . "\n";
1039
+        print '<body id="mainbody"'.($morecssonbody ? ' class="'.$morecssonbody.'"' : '').'>'."\n";
1040 1040
 
1041 1041
         // top menu and left menu area
1042 1042
         if (empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) {
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
         }
1045 1045
 
1046 1046
         if (empty($conf->dol_hide_leftmenu)) {
1047
-            left_menu('', $help_url, '', '', 1, $title, 1);  // $menumanager is retreived with a global $menumanager inside this function
1047
+            left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function
1048 1048
         }
1049 1049
 
1050 1050
         // main area
@@ -1068,13 +1068,13 @@  discard block
 block discarded – undo
1068 1068
     global $db, $conf, $hookmanager;
1069 1069
 
1070 1070
     if ($contenttype == 'text/html') {
1071
-        header("Content-Type: text/html; charset=" . $conf->file->character_set_client);
1071
+        header("Content-Type: text/html; charset=".$conf->file->character_set_client);
1072 1072
     } else {
1073
-        header("Content-Type: " . $contenttype);
1073
+        header("Content-Type: ".$contenttype);
1074 1074
     }
1075 1075
     // Security options
1076
-    header("X-Content-Type-Options: nosniff");  // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on)
1077
-    header("X-Frame-Options: SAMEORIGIN");      // Frames allowed only if on same domain (stop some XSS attacks)
1076
+    header("X-Content-Type-Options: nosniff"); // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on)
1077
+    header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
1078 1078
     //header("X-XSS-Protection: 1");      		// XSS protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated.
1079 1079
     if (!defined('FORCECSP')) {
1080 1080
         //if (! isset($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY))
@@ -1091,11 +1091,11 @@  discard block
 block discarded – undo
1091 1091
         $hookmanager->initHooks("main");
1092 1092
 
1093 1093
         $parameters = array('contentsecuritypolicy' => $contentsecuritypolicy);
1094
-        $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters);    // Note that $action and $object may have been modified by some hooks
1094
+        $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters); // Note that $action and $object may have been modified by some hooks
1095 1095
         if ($result > 0) {
1096 1096
             $contentsecuritypolicy = $hookmanager->resPrint; // Replace CSP
1097 1097
         } else {
1098
-            $contentsecuritypolicy .= $hookmanager->resPrint;    // Concat CSP
1098
+            $contentsecuritypolicy .= $hookmanager->resPrint; // Concat CSP
1099 1099
         }
1100 1100
 
1101 1101
         if (!empty($contentsecuritypolicy)) {
@@ -1107,10 +1107,10 @@  discard block
 block discarded – undo
1107 1107
             // default-src 'self'; img-src *;
1108 1108
             // Pre-existing site that uses too much inline code to fix but wants to ensure resources are loaded only over https and disable plugins:
1109 1109
             // default-src http: https: 'unsafe-eval' 'unsafe-inline'; object-src 'none'
1110
-            header("Content-Security-Policy: " . $contentsecuritypolicy);
1110
+            header("Content-Security-Policy: ".$contentsecuritypolicy);
1111 1111
         }
1112 1112
     } elseif (constant('FORCECSP')) {
1113
-        header("Content-Security-Policy: " . constant('FORCECSP'));
1113
+        header("Content-Security-Policy: ".constant('FORCECSP'));
1114 1114
     }
1115 1115
     if ($forcenocache) {
1116 1116
         header("Cache-Control: no-cache, no-store, must-revalidate, max-age=0");
@@ -1141,33 +1141,33 @@  discard block
 block discarded – undo
1141 1141
         // $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default
1142 1142
         $conf->css = '?controller=theme/eldy&method=style.css';
1143 1143
     }
1144
-    print '<!doctype html>' . "\n";
1144
+    print '<!doctype html>'."\n";
1145 1145
 
1146 1146
     if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST))
1147
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1147
+        print '<html lang="'.substr($langs->defaultlang, 0, 2).'" manifest="'.DOL_BASE_URI.'/cache.manifest">'."\n";
1148 1148
     else
1149
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1149
+        print '<html lang="'.substr($langs->defaultlang, 0, 2).'">'."\n";
1150 1150
     //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n";
1151 1151
     if (empty($disablehead)) {
1152
-        $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
1152
+        $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
1153 1153
 
1154 1154
         print "<head>\n";
1155 1155
 
1156 1156
         if (GETPOST('dol_basehref', 'alpha'))
1157
-            print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1157
+            print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')).'">'."\n";
1158 1158
 
1159 1159
         // Displays meta
1160
-        print '<meta charset="UTF-8">' . "\n";
1161
-        print '<meta name="robots" content="noindex' . ($disablenofollow ? '' : ',nofollow') . '">' . "\n"; // Do not index
1162
-        print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n";  // Scale for mobile device
1163
-        print '<meta name="author" content="Dolibarr Development Team">' . "\n";
1160
+        print '<meta charset="UTF-8">'."\n";
1161
+        print '<meta name="robots" content="noindex'.($disablenofollow ? '' : ',nofollow').'">'."\n"; // Do not index
1162
+        print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Scale for mobile device
1163
+        print '<meta name="author" content="Dolibarr Development Team">'."\n";
1164 1164
 
1165 1165
         // Favicon
1166
-        $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1);
1166
+        $favicon = dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1);
1167 1167
         if (!empty($conf->global->MAIN_FAVICON_URL))
1168 1168
             $favicon = $conf->global->MAIN_FAVICON_URL;
1169 1169
         if (empty($conf->dol_use_jmobile))
1170
-            print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; // Not required into an Android webview
1170
+            print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; // Not required into an Android webview
1171 1171
 
1172 1172
 
1173 1173
 
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
         //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
1193 1193
         // Auto refresh page
1194 1194
         if (GETPOST('autorefresh', 'int') > 0)
1195
-            print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1195
+            print '<meta http-equiv="refresh" content="'.GETPOST('autorefresh', 'int').'">';
1196 1196
 
1197 1197
         // Displays title
1198 1198
         $appli = constant('DOL_APPLICATION_TITLE');
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
         if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE))
1205 1205
             $titletoshow = dol_htmlentities($title);
1206 1206
         else if ($title)
1207
-            $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1207
+            $titletoshow = dol_htmlentities($appli.' - '.$title);
1208 1208
         else
1209 1209
             $titletoshow = dol_htmlentities($appli);
1210 1210
 
@@ -1212,11 +1212,11 @@  discard block
 block discarded – undo
1212 1212
             $hookmanager = new HookManager($db);
1213 1213
         $hookmanager->initHooks("main");
1214 1214
         $parameters = array('title' => $titletoshow);
1215
-        $result = $hookmanager->executeHooks('setHtmlTitle', $parameters);  // Note that $action and $object may have been modified by some hooks
1215
+        $result = $hookmanager->executeHooks('setHtmlTitle', $parameters); // Note that $action and $object may have been modified by some hooks
1216 1216
         if ($result > 0)
1217
-            $titletoshow = $hookmanager->resPrint;    // Replace Title to show
1217
+            $titletoshow = $hookmanager->resPrint; // Replace Title to show
1218 1218
         else
1219
-            $titletoshow .= $hookmanager->resPrint;      // Concat to Title to show
1219
+            $titletoshow .= $hookmanager->resPrint; // Concat to Title to show
1220 1220
 
1221 1221
         print $titletoshow;
1222 1222
         print '</title>';
@@ -1224,69 +1224,69 @@  discard block
 block discarded – undo
1224 1224
         print "\n";
1225 1225
 
1226 1226
         if (GETPOST('version', 'int')) {
1227
-            $ext = 'version=' . GETPOST('version', 'int'); // usefull to force no cache on css/js
1227
+            $ext = 'version='.GETPOST('version', 'int'); // usefull to force no cache on css/js
1228 1228
         }
1229 1229
         if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) {
1230
-            $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1230
+            $ext .= '&testmenuhider='.(GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1231 1231
         }
1232
-        $themeparam = '&lang=' . $langs->defaultlang . '&amp;theme=' . $conf->theme . (GETPOST('optioncss', 'aZ09') ? '&amp;optioncss=' . GETPOST('optioncss', 'aZ09', 1) : '') . '&amp;userid=' . $user->id . '&amp;entity=' . $conf->entity;
1233
-        $themeparam .= ($ext ? '&amp;' . $ext : '');
1232
+        $themeparam = '&lang='.$langs->defaultlang.'&amp;theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&amp;optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').'&amp;userid='.$user->id.'&amp;entity='.$conf->entity;
1233
+        $themeparam .= ($ext ? '&amp;'.$ext : '');
1234 1234
         if (!empty($_SESSION['dol_resetcache'])) {
1235
-            $themeparam .= '&amp;dol_resetcache=' . $_SESSION['dol_resetcache'];
1235
+            $themeparam .= '&amp;dol_resetcache='.$_SESSION['dol_resetcache'];
1236 1236
         }
1237 1237
         if (GETPOST('dol_hide_topmenu', 'int')) {
1238
-            $themeparam .= '&amp;dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int');
1238
+            $themeparam .= '&amp;dol_hide_topmenu='.GETPOST('dol_hide_topmenu', 'int');
1239 1239
         }
1240 1240
         if (GETPOST('dol_hide_leftmenu', 'int')) {
1241
-            $themeparam .= '&amp;dol_hide_leftmenu=' . GETPOST('dol_hide_leftmenu', 'int');
1241
+            $themeparam .= '&amp;dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu', 'int');
1242 1242
         }
1243 1243
         if (GETPOST('dol_optimize_smallscreen', 'int')) {
1244
-            $themeparam .= '&amp;dol_optimize_smallscreen=' . GETPOST('dol_optimize_smallscreen', 'int');
1244
+            $themeparam .= '&amp;dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int');
1245 1245
         }
1246 1246
         if (GETPOST('dol_no_mouse_hover', 'int')) {
1247
-            $themeparam .= '&amp;dol_no_mouse_hover=' . GETPOST('dol_no_mouse_hover', 'int');
1247
+            $themeparam .= '&amp;dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int');
1248 1248
         }
1249 1249
         if (GETPOST('dol_use_jmobile', 'int')) {
1250
-            $themeparam .= '&amp;dol_use_jmobile=' . GETPOST('dol_use_jmobile', 'int');
1250
+            $themeparam .= '&amp;dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int');
1251 1251
             $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
1252 1252
         }
1253 1253
 
1254 1254
         if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
1255
-            print '<!-- Includes CSS for JQuery (Ajax library) -->' . "\n";
1255
+            print '<!-- Includes CSS for JQuery (Ajax library) -->'."\n";
1256 1256
             $jquerytheme = 'base';
1257 1257
             if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
1258 1258
                 $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1259 1259
             }
1260 1260
             if (constant('JS_JQUERY_UI')) {
1261
-                print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";  // JQuery
1261
+                print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery
1262 1262
             } else {
1263
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n";    // JQuery
1263
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery
1264 1264
             }
1265 1265
             if (!defined('DISABLE_JQUERY_JNOTIFY')) {
1266
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";          // JNotify
1266
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // JNotify
1267 1267
             }
1268 1268
             if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2"...
1269 1269
                 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1270
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/css/' . $tmpplugin . '.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1270
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/plugins/'.$tmpplugin.'/dist/css/'.$tmpplugin.'.css'.($ext ? '?'.$ext : '').'">'."\n";
1271 1271
             }
1272 1272
         }
1273 1273
 
1274 1274
         if (!defined('DISABLE_FONT_AWSOME')) {
1275
-            print '<!-- Includes CSS for font awesome -->' . "\n";
1275
+            print '<!-- Includes CSS for font awesome -->'."\n";
1276 1276
             // print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/theme/common/fontawesome/css/font-awesome.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1277 1277
             // TODO: Check the fontawesome version we are going to use
1278 1278
             //print '<link rel="stylesheet" type="text/css" href="' . BASE_URI . '/vendor/components/font-awesome/css/fontawesome.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1279
-            print '<link rel="stylesheet" type="text/css" href="' . BASE_URI . '/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1279
+            print '<link rel="stylesheet" type="text/css" href="'.BASE_URI.'/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css'.($ext ? '?'.$ext : '').'">'."\n";
1280 1280
         }
1281 1281
 
1282
-        print '<!-- Includes CSS for Dolibarr theme -->' . "\n";
1282
+        print '<!-- Includes CSS for Dolibarr theme -->'."\n";
1283 1283
         // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
1284 1284
         $themepath = dol_buildpath($conf->css, 3);
1285 1285
         $themesubdir = '';
1286 1286
         if (!empty($conf->modules_parts['theme'])) { // This slow down
1287 1287
             foreach ($conf->modules_parts['theme'] as $reldir) {
1288
-                if (file_exists(dol_buildpath($reldir . $conf->css, 0))) {
1289
-                    $themepath = dol_buildpath($reldir . $conf->css, 1);
1288
+                if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
1289
+                    $themepath = dol_buildpath($reldir.$conf->css, 1);
1290 1290
                     $themesubdir = $reldir;
1291 1291
                     break;
1292 1292
                 }
@@ -1294,9 +1294,9 @@  discard block
 block discarded – undo
1294 1294
         }
1295 1295
 
1296 1296
         //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
1297
-        print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1297
+        print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
1298 1298
         if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME))
1299
-            print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n";
1299
+            print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->'."\n".'<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">'."\n";
1300 1300
 
1301 1301
         // CSS forced by modules (relative url starting with /)
1302 1302
         if (!empty($conf->modules_parts['css'])) {
@@ -1305,122 +1305,122 @@  discard block
 block discarded – undo
1305 1305
                 $filescss = (array) $filescss; // To be sure filecss is an array
1306 1306
                 foreach ($filescss as $cssfile) {
1307 1307
                     if (empty($cssfile))
1308
-                        dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1308
+                        dol_syslog("Warning: module ".$modcss." declared a css path file into its descriptor that is empty.", LOG_WARNING);
1309 1309
                     // cssfile is a relative path
1310
-                    print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1);
1310
+                    print '<!-- Includes CSS added by module '.$modcss.' -->'."\n".'<link rel="stylesheet" type="text/css" href="'.dol_buildpath($cssfile, 1);
1311 1311
                     // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
1312 1312
                     if (!preg_match('/\.css$/i', $cssfile))
1313 1313
                         print $themeparam;
1314
-                    print '">' . "\n";
1314
+                    print '">'."\n";
1315 1315
                 }
1316 1316
             }
1317 1317
         }
1318 1318
         // CSS forced by page in top_htmlhead call (relative url starting with /)
1319 1319
         if (is_array($arrayofcss)) {
1320 1320
             foreach ($arrayofcss as $cssfile) {
1321
-                print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1);
1321
+                print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile, 1);
1322 1322
                 // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used.
1323 1323
                 if (!preg_match('/\.css$/i', $cssfile))
1324 1324
                     print $themeparam;
1325
-                print '">' . "\n";
1325
+                print '">'."\n";
1326 1326
             }
1327 1327
         }
1328 1328
 
1329 1329
         // Output standard javascript links
1330 1330
         if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) {
1331 1331
             // JQuery. Must be before other includes
1332
-            print '<!-- Includes JS for JQuery -->' . "\n";
1332
+            print '<!-- Includes JS for JQuery -->'."\n";
1333 1333
             if (defined('JS_JQUERY') && constant('JS_JQUERY')) {
1334
-                print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1334
+                print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1335 1335
             } else {
1336 1336
                 // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1337
-                print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1337
+                print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1338 1338
             }
1339 1339
             if (!empty($conf->global->MAIN_FEATURES_LEVEL) && !defined('JS_JQUERY_MIGRATE_DISABLED')) {
1340 1340
                 if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) {
1341
-                    print '<script type="text/javascript" src="' . JS_JQUERY_MIGRATE . 'jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1341
+                    print '<script type="text/javascript" src="'.JS_JQUERY_MIGRATE.'jquery-migrate.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1342 1342
                 } else {
1343 1343
                     // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1344
-                    print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1344
+                    print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery-migrate.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1345 1345
                 }
1346 1346
             }
1347 1347
             if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
1348
-                print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1348
+                print '<script type="text/javascript" src="'.JS_JQUERY_UI.'jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1349 1349
             } else {
1350 1350
                 // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1351
-                print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1351
+                print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1352 1352
             }
1353 1353
             if (!defined('DISABLE_JQUERY_TABLEDND')) {
1354
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/tablednd/jquery.tablednd.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1354
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1355 1355
             }
1356 1356
             // jQuery jnotify
1357 1357
             if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) {
1358
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1358
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1359 1359
             }
1360 1360
             // Flot
1361 1361
             if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) {
1362 1362
                 if (constant('JS_JQUERY_FLOT')) {
1363
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1364
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.pie.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1365
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.stack.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1363
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1364
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.pie.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1365
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.stack.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1366 1366
                 } else {
1367
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1368
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.pie.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1369
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.stack.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1367
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1368
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.pie.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1369
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.stack.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1370 1370
                 }
1371 1371
             }
1372 1372
             // jQuery jeditable
1373 1373
             if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) {
1374
-                print '<!-- JS to manage editInPlace feature -->' . "\n";
1375
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1376
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1377
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1378
-                print '<script type="text/javascript">' . "\n";
1379
-                print 'var urlSaveInPlace = \'' . DOL_BASE_URI . '/core/ajax/saveinplace.php\';' . "\n";
1380
-                print 'var urlLoadInPlace = \'' . DOL_BASE_URI . '/core/ajax/loadinplace.php\';' . "\n";
1381
-                print 'var tooltipInPlace = \'' . $langs->transnoentities('ClickToEdit') . '\';' . "\n"; // Added in title attribute of span
1382
-                print 'var placeholderInPlace = \'&nbsp;\';' . "\n"; // If we put another string than $langs->trans("ClickToEdit") here, nothing is shown. If we put empty string, there is error, Why ?
1383
-                print 'var cancelInPlace = \'' . $langs->trans('Cancel') . '\';' . "\n";
1384
-                print 'var submitInPlace = \'' . $langs->trans('Ok') . '\';' . "\n";
1385
-                print 'var indicatorInPlace = \'<img src="' . DOL_BASE_URI . "/theme/" . $conf->theme . "/img/working.gif" . '">\';' . "\n";
1386
-                print 'var withInPlace = 300;';  // width in pixel for default string edit
1387
-                print '</script>' . "\n";
1388
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/editinplace.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1374
+                print '<!-- JS to manage editInPlace feature -->'."\n";
1375
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1376
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1377
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1378
+                print '<script type="text/javascript">'."\n";
1379
+                print 'var urlSaveInPlace = \''.DOL_BASE_URI.'/core/ajax/saveinplace.php\';'."\n";
1380
+                print 'var urlLoadInPlace = \''.DOL_BASE_URI.'/core/ajax/loadinplace.php\';'."\n";
1381
+                print 'var tooltipInPlace = \''.$langs->transnoentities('ClickToEdit').'\';'."\n"; // Added in title attribute of span
1382
+                print 'var placeholderInPlace = \'&nbsp;\';'."\n"; // If we put another string than $langs->trans("ClickToEdit") here, nothing is shown. If we put empty string, there is error, Why ?
1383
+                print 'var cancelInPlace = \''.$langs->trans('Cancel').'\';'."\n";
1384
+                print 'var submitInPlace = \''.$langs->trans('Ok').'\';'."\n";
1385
+                print 'var indicatorInPlace = \'<img src="'.DOL_BASE_URI."/theme/".$conf->theme."/img/working.gif".'">\';'."\n";
1386
+                print 'var withInPlace = 300;'; // width in pixel for default string edit
1387
+                print '</script>'."\n";
1388
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/core/js/editinplace.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1389 1389
                 // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1390
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1390
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1391 1391
             }
1392 1392
             // jQuery Timepicker
1393 1393
             if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) {
1394 1394
                 // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1395
-                print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/ui/widgets/timepicker.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1396
-                print '<script type="text/javascript" src="' . BASE_PATH . '?controller=core/js/&method=timepicker.js&lang=' . $langs->defaultlang . ($ext ? '&amp;' . $ext : '') . '"></script>' . "\n";
1395
+                print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/ui/widgets/timepicker.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1396
+                print '<script type="text/javascript" src="'.BASE_PATH.'?controller=core/js/&method=timepicker.js&lang='.$langs->defaultlang.($ext ? '&amp;'.$ext : '').'"></script>'."\n";
1397 1397
             }
1398 1398
             if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2", ...
1399 1399
                 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1400
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/js/' . $tmpplugin . '.full.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; // We include full because we need the support of containerCssClass
1400
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; // We include full because we need the support of containerCssClass
1401 1401
             }
1402 1402
             if (!defined('DISABLE_MULTISELECT')) {     // jQuery plugin "mutiselect" to select with checkboxes
1403
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/multiselect/jquery.multi-select.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1403
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/multiselect/jquery.multi-select.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1404 1404
             }
1405 1405
         }
1406 1406
 
1407 1407
         if (!$disablejs && !empty($conf->use_javascript_ajax)) {
1408 1408
             // CKEditor
1409 1409
             if (!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) {
1410
-                print '<!-- Includes JS for CKEditor -->' . "\n";
1410
+                print '<!-- Includes JS for CKEditor -->'."\n";
1411 1411
                 // $pathckeditor = DOL_BASE_URI . '/includes/ckeditor/ckeditor/';
1412
-                $pathckeditor = BASE_URI . '/vendor/ckeditor/ckeditor/';
1412
+                $pathckeditor = BASE_URI.'/vendor/ckeditor/ckeditor/';
1413 1413
                 $jsckeditor = 'ckeditor.js';
1414 1414
                 if (constant('JS_CKEDITOR')) { // To use external ckeditor 4 js lib
1415 1415
                     $pathckeditor = constant('JS_CKEDITOR');
1416 1416
                 }
1417 1417
                 print '<script type="text/javascript">';
1418
-                print 'var CKEDITOR_BASEPATH = \'' . $pathckeditor . '\';' . "\n";
1419
-                print 'var ckeditorConfig = \'' . dol_buildpath($themesubdir . '/theme/' . $conf->theme . '/ckeditor/config.js' . ($ext ? '?' . $ext : ''), 1) . '\';' . "\n";  // $themesubdir='' in standard usage
1420
-                print 'var ckeditorFilebrowserBrowseUrl = \'' . DOL_BASE_URI . '/core/filemanagerdol/browser/default/browser.php?Connector=' . DOL_BASE_URI . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n";
1421
-                print 'var ckeditorFilebrowserImageBrowseUrl = \'' . DOL_BASE_URI . '/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector=' . DOL_BASE_URI . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n";
1422
-                print '</script>' . "\n";
1423
-                print '<script type="text/javascript" src="' . $pathckeditor . $jsckeditor . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1418
+                print 'var CKEDITOR_BASEPATH = \''.$pathckeditor.'\';'."\n";
1419
+                print 'var ckeditorConfig = \''.dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js'.($ext ? '?'.$ext : ''), 1).'\';'."\n"; // $themesubdir='' in standard usage
1420
+                print 'var ckeditorFilebrowserBrowseUrl = \''.DOL_BASE_URI.'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_BASE_URI.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1421
+                print 'var ckeditorFilebrowserImageBrowseUrl = \''.DOL_BASE_URI.'/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector='.DOL_BASE_URI.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1422
+                print '</script>'."\n";
1423
+                print '<script type="text/javascript" src="'.$pathckeditor.$jsckeditor.($ext ? '?'.$ext : '').'"></script>'."\n";
1424 1424
             }
1425 1425
 
1426 1426
             // Browser notifications
@@ -1431,16 +1431,16 @@  discard block
 block discarded – undo
1431 1431
                 if ($conf->browser->layout == 'phone')
1432 1432
                     $enablebrowsernotif = false;
1433 1433
                 if ($enablebrowsernotif) {
1434
-                    print '<!-- Includes JS of Dolibarr (brwoser layout = ' . $conf->browser->layout . ')-->' . "\n";
1434
+                    print '<!-- Includes JS of Dolibarr (brwoser layout = '.$conf->browser->layout.')-->'."\n";
1435 1435
                     //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_notification.js.php' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1436
-                    print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_notification.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1436
+                    print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_notification.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1437 1437
                 }
1438 1438
             }
1439 1439
 
1440 1440
             // Global js function
1441
-            print '<!-- Includes JS of Dolibarr -->' . "\n";
1441
+            print '<!-- Includes JS of Dolibarr -->'."\n";
1442 1442
             //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_head.js.php?lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
1443
-            print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_head.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
1443
+            print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_head.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
1444 1444
 
1445 1445
             // JS forced by modules (relative url starting with /)
1446 1446
             if (!empty($conf->modules_parts['js'])) {  // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))
@@ -1449,27 +1449,27 @@  discard block
 block discarded – undo
1449 1449
                     $filesjs = (array) $filesjs; // To be sure filejs is an array
1450 1450
                     foreach ($filesjs as $jsfile) {
1451 1451
                         // jsfile is a relative path
1452
-                        print '<!-- Include JS added by module ' . $modjs . '-->' . "\n" . '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n";
1452
+                        print '<!-- Include JS added by module '.$modjs.'-->'."\n".'<script type="text/javascript" src="'.dol_buildpath($jsfile, 1).'"></script>'."\n";
1453 1453
                     }
1454 1454
                 }
1455 1455
             }
1456 1456
             // JS forced by page in top_htmlhead (relative url starting with /)
1457 1457
             if (is_array($arrayofjs)) {
1458
-                print '<!-- Includes JS added by page -->' . "\n";
1458
+                print '<!-- Includes JS added by page -->'."\n";
1459 1459
                 foreach ($arrayofjs as $jsfile) {
1460 1460
                     if (preg_match('/^http/i', $jsfile)) {
1461
-                        print '<script type="text/javascript" src="' . $jsfile . '"></script>' . "\n";
1461
+                        print '<script type="text/javascript" src="'.$jsfile.'"></script>'."\n";
1462 1462
                     } else {
1463
-                        print '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n";
1463
+                        print '<script type="text/javascript" src="'.dol_buildpath($jsfile, 1).'"></script>'."\n";
1464 1464
                     }
1465 1465
                 }
1466 1466
             }
1467 1467
         }
1468 1468
 
1469 1469
         if (!empty($head))
1470
-            print $head . "\n";
1470
+            print $head."\n";
1471 1471
         if (!empty($conf->global->MAIN_HTML_HEADER))
1472
-            print $conf->global->MAIN_HTML_HEADER . "\n";
1472
+            print $conf->global->MAIN_HTML_HEADER."\n";
1473 1473
 
1474 1474
         print "<!-- Alixar debugBar header -->";
1475 1475
         print Debug::getRenderHeader(); // Includes Alixar debugBar header
@@ -1520,13 +1520,13 @@  discard block
 block discarded – undo
1520 1520
      * Top menu
1521 1521
      */
1522 1522
     if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
1523
-        print "\n" . '<!-- Start top horizontal -->' . "\n";
1523
+        print "\n".'<!-- Start top horizontal -->'."\n";
1524 1524
 
1525
-        print '<div class="side-nav-vert' . (GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '') . '"><div id="id-top">';  // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
1525
+        print '<div class="side-nav-vert'.(GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '').'"><div id="id-top">'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
1526 1526
         // Show menu entries
1527
-        print '<div id="tmenu_tooltip' . (empty($conf->global->MAIN_MENU_INVERT) ? '' : 'invert') . '" class="tmenu">' . "\n";
1527
+        print '<div id="tmenu_tooltip'.(empty($conf->global->MAIN_MENU_INVERT) ? '' : 'invert').'" class="tmenu">'."\n";
1528 1528
         $menumanager->atarget = $target;
1529
-        $menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks));      // This contains a \n
1529
+        $menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n
1530 1530
         print "</div>\n";
1531 1531
 
1532 1532
         // Define link to login card
@@ -1534,34 +1534,34 @@  discard block
 block discarded – undo
1534 1534
         if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1535 1535
             $appli = $conf->global->MAIN_APPLICATION_TITLE;
1536 1536
             if (preg_match('/\d\.\d/', $appli)) {
1537
-                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1538
-                    $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1537
+                if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
1538
+                    $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
1539 1539
             } else
1540
-                $appli .= " " . DOL_VERSION;
1540
+                $appli .= " ".DOL_VERSION;
1541 1541
         } else
1542
-            $appli .= " " . DOL_VERSION;
1542
+            $appli .= " ".DOL_VERSION;
1543 1543
 
1544 1544
         if (!empty($conf->global->MAIN_FEATURES_LEVEL))
1545
-            $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1545
+            $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
1546 1546
 
1547 1547
         $logouttext = '';
1548 1548
         if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1549 1549
             //$logouthtmltext=$appli.'<br>';
1550 1550
             if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
1551
-                $logouthtmltext .= $langs->trans("Logout") . '<br>';
1551
+                $logouthtmltext .= $langs->trans("Logout").'<br>';
1552 1552
 
1553 1553
                 //$logouttext .='<a accesskey="l" href="'.DOL_BASE_URI.'/user/logout.php">';
1554
-                $logouttext .= '<a accesskey="l" href="' . BASE_URI . '?controller=user&method=logout">';
1554
+                $logouttext .= '<a accesskey="l" href="'.BASE_URI.'?controller=user&method=logout">';
1555 1555
                 //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1556 1556
                 $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
1557 1557
                 $logouttext .= '</a>';
1558 1558
             } else {
1559 1559
                 $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
1560
-                $logouttext .= img_picto($langs->trans('Logout') . ":" . $langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1560
+                $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1561 1561
             }
1562 1562
         }
1563 1563
 
1564
-        print '<div class="login_block">' . "\n";
1564
+        print '<div class="login_block">'."\n";
1565 1565
 
1566 1566
         // Add login user link
1567 1567
         $toprightmenu .= '<div class="login_block_user">';
@@ -1572,18 +1572,18 @@  discard block
 block discarded – undo
1572 1572
         $toprightmenu .= $user->getNomUrl($mode, '', 1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin');
1573 1573
         $toprightmenu .= '</div></div>';
1574 1574
 
1575
-        $toprightmenu .= '</div>' . "\n";
1575
+        $toprightmenu .= '</div>'."\n";
1576 1576
 
1577 1577
         $toprightmenu .= '<div class="login_block_other">';
1578 1578
 
1579 1579
         // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
1580 1580
         $parameters = array();
1581
-        $result = $hookmanager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
1581
+        $result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
1582 1582
         if (is_numeric($result)) {
1583 1583
             if ($result == 0)
1584
-                $toprightmenu .= $hookmanager->resPrint;  // add
1584
+                $toprightmenu .= $hookmanager->resPrint; // add
1585 1585
             else
1586
-                $toprightmenu = $hookmanager->resPrint;      // replace
1586
+                $toprightmenu = $hookmanager->resPrint; // replace
1587 1587
         }
1588 1588
         else {
1589 1589
             $toprightmenu .= $result; // For backward compatibility
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
         // Link to module builder
1593 1593
         if (!empty($conf->modulebuilder->enabled)) {
1594 1594
             //$text = '<a href="' . DOL_BASE_URI . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1595
-            $text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1595
+            $text = '<a href="'.BASE_URI.'?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1596 1596
             //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
1597 1597
             $text .= '<span class="fa fa-bug atoplogin"></span>';
1598 1598
             $text .= '</a>';
@@ -1606,12 +1606,12 @@  discard block
 block discarded – undo
1606 1606
             if (is_array($_POST)) {
1607 1607
                 foreach ($_POST as $key => $value) {
1608 1608
                     if ($key !== 'action' && $key !== 'password' && !is_array($value)) {
1609
-                        $qs .= '&' . $key . '=' . urlencode($value);
1609
+                        $qs .= '&'.$key.'='.urlencode($value);
1610 1610
                     }
1611 1611
                 }
1612 1612
             }
1613
-            $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring;
1614
-            $text = '<a href="' . dol_escape_htmltag($_SERVER["PHP_SELF"]) . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">';
1613
+            $qs .= (($qs && $morequerystring) ? '&' : '').$morequerystring;
1614
+            $text = '<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs ? '&' : '').'optioncss=print" target="_blank">';
1615 1615
             //$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
1616 1616
             $text .= '<span class="fa fa-print atoplogin"></span>';
1617 1617
             $text .= '</a>';
@@ -1640,12 +1640,12 @@  discard block
 block discarded – undo
1640 1640
                 $text = '';
1641 1641
                 if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
1642 1642
                     $langs->load('admin');
1643
-                    $appli .= '<br>' . $langs->trans("Database") . ': ' . $db->database_name;
1643
+                    $appli .= '<br>'.$langs->trans("Database").': '.$db->database_name;
1644 1644
                 }
1645
-                $title = $appli . '<br>';
1645
+                $title = $appli.'<br>';
1646 1646
                 $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage');
1647 1647
                 if ($mode == 'wiki') {
1648
-                    $title .= ' - ' . $langs->trans("PageWiki") . ' &quot;' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
1648
+                    $title .= ' - '.$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'&quot;';
1649 1649
                 }
1650 1650
                 $text .= '<a class="help" target="_blank" rel="noopener" href="';
1651 1651
                 if ($mode == 'wiki') {
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 
1672 1672
         print $toprightmenu;
1673 1673
 
1674
-        print "</div>\n";  // end div class="login_block"
1674
+        print "</div>\n"; // end div class="login_block"
1675 1675
 
1676 1676
         print '</div></div>';
1677 1677
 
@@ -1680,7 +1680,7 @@  discard block
 block discarded – undo
1680 1680
     }
1681 1681
 
1682 1682
     if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
1683
-        print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1683
+        print '<!-- Begin div id-container --><div id="id-container" class="id-container'.($morecss ? ' '.$morecss : '').'">';
1684 1684
 }
1685 1685
 
1686 1686
 /**
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
         // Instantiate hooks of thirdparty module
1713 1713
         $hookmanager->initHooks(array('searchform', 'leftblock'));
1714 1714
 
1715
-        print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
1715
+        print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
1716 1716
 
1717 1717
         if ($conf->browser->layout == 'phone')
1718 1718
             $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
@@ -1724,7 +1724,7 @@  discard block
 block discarded – undo
1724 1724
         }
1725 1725
         $selected = -1;
1726 1726
         $usedbyinclude = 1;
1727
-        include_once DOL_BASE_PATH . '/core/ajax/selectsearchbox.php'; // This set $arrayresult
1727
+        include_once DOL_BASE_PATH.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
1728 1728
 
1729 1729
         if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
1730 1730
             //$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_BASE_URI.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
         // Execute hook printSearchForm
1740 1740
         $parameters = array('searchform' => $searchform);
1741 1741
 
1742
-        $reshook = $hookmanager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
1742
+        $reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
1743 1743
         if (empty($reshook)) {
1744 1744
             $searchform .= $hookmanager->resPrint;
1745 1745
         } else
@@ -1747,10 +1747,10 @@  discard block
 block discarded – undo
1747 1747
 
1748 1748
         // Force special value for $searchform
1749 1749
         if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
1750
-            $urltosearch = DOL_BASE_URI . '/core/search_page.php?showtitlebefore=1';
1751
-            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div></div>';
1750
+            $urltosearch = DOL_BASE_URI.'/core/search_page.php?showtitlebefore=1';
1751
+            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div></div>';
1752 1752
         } elseif ($conf->use_javascript_ajax && !empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
1753
-            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div><div id="divsearchforms2" style="display: none">' . $searchform . '</div>';
1753
+            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div><div id="divsearchforms2" style="display: none">'.$searchform.'</div>';
1754 1754
             $searchform .= '<script type="text/javascript">
1755 1755
             	jQuery(document).ready(function () {
1756 1756
             		jQuery("#divsearchforms1").click(function(){
@@ -1763,16 +1763,16 @@  discard block
 block discarded – undo
1763 1763
 
1764 1764
         // Define $bookmarks
1765 1765
         if (!empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) {
1766
-            include_once DOL_BASE_PATH . '/bookmarks/bookmarks.lib.php';
1766
+            include_once DOL_BASE_PATH.'/bookmarks/bookmarks.lib.php';
1767 1767
             $langs->load("bookmarks");
1768 1768
 
1769 1769
             $bookmarks = printBookmarksList($db, $langs);
1770 1770
         }
1771 1771
 
1772 1772
         // Left column
1773
-        print '<!-- Begin left menu -->' . "\n";
1773
+        print '<!-- Begin left menu -->'."\n";
1774 1774
 
1775
-        print '<div class="vmenu"' . (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"') . '>' . "\n\n";
1775
+        print '<div class="vmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"').'>'."\n\n";
1776 1776
 
1777 1777
         // Show left menu with other forms
1778 1778
         $menumanager->menu_array = $menu_array_before;
@@ -1781,7 +1781,7 @@  discard block
 block discarded – undo
1781 1781
         // Dolibarr version + help + bug report link
1782 1782
         print "\n";
1783 1783
         print "<!-- Begin Help Block-->\n";
1784
-        print '<div id="blockvmenuhelp" class="blockvmenuhelp">' . "\n";
1784
+        print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n";
1785 1785
 
1786 1786
         // Version
1787 1787
         if (empty($conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
@@ -1803,15 +1803,15 @@  discard block
 block discarded – undo
1803 1803
                 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1804 1804
                 $doliurl = '';
1805 1805
                 if (preg_match('/\d\.\d/', $appli)) {
1806
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1807
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1806
+                    if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
1807
+                        $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
1808 1808
                 } else
1809
-                    $appli .= " " . DOL_VERSION;
1809
+                    $appli .= " ".DOL_VERSION;
1810 1810
             } else
1811
-                $appli .= " " . DOL_VERSION;
1811
+                $appli .= " ".DOL_VERSION;
1812 1812
             print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
1813 1813
             if ($doliurl)
1814
-                print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1814
+                print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">';
1815 1815
             else
1816 1816
                 print '<span class="help">';
1817 1817
             print $appli;
@@ -1819,12 +1819,12 @@  discard block
 block discarded – undo
1819 1819
                 print '</a>';
1820 1820
             else
1821 1821
                 print '</span>';
1822
-            print '</div>' . "\n";
1822
+            print '</div>'."\n";
1823 1823
         }
1824 1824
 
1825 1825
         // Link to bugtrack
1826 1826
         if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
1827
-            require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php';
1827
+            require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php';
1828 1828
 
1829 1829
             $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new';
1830 1830
             $bugbaseurl .= '?title=';
@@ -1833,16 +1833,16 @@  discard block
 block discarded – undo
1833 1833
             $bugbaseurl .= urlencode("# Bug\n");
1834 1834
             $bugbaseurl .= urlencode("\n");
1835 1835
             $bugbaseurl .= urlencode("## Environment\n");
1836
-            $bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n");
1837
-            $bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n");
1838
-            $bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n");
1839
-            $bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n");
1840
-            $bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n");
1841
-            $bugbaseurl .= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n");
1836
+            $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n");
1837
+            $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n");
1838
+            $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n");
1839
+            $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n");
1840
+            $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n");
1841
+            $bugbaseurl .= urlencode("- **URL**: ".$_SERVER["REQUEST_URI"]."\n");
1842 1842
             $bugbaseurl .= urlencode("\n");
1843 1843
             $bugbaseurl .= urlencode("## Report\n");
1844 1844
             print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
1845
-            print '<a class="help" target="_blank" rel="noopener" href="' . $bugbaseurl . '">' . $langs->trans("FindBug") . '</a>';
1845
+            print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>';
1846 1846
             print '</div>';
1847 1847
         }
1848 1848
 
@@ -1856,14 +1856,14 @@  discard block
 block discarded – undo
1856 1856
 
1857 1857
         // Execute hook printLeftBlock
1858 1858
         $parameters = array();
1859
-        $reshook = $hookmanager->executeHooks('printLeftBlock', $parameters);    // Note that $action and $object may have been modified by some hooks
1859
+        $reshook = $hookmanager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks
1860 1860
         print $hookmanager->resPrint;
1861 1861
 
1862 1862
         print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left"
1863 1863
     }
1864 1864
 
1865 1865
     print "\n";
1866
-    print '<!-- Begin right area -->' . "\n";
1866
+    print '<!-- Begin right area -->'."\n";
1867 1867
 
1868 1868
     if (empty($leftmenuwithoutmainarea))
1869 1869
         main_area($title);
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 
1885 1885
     print "\n";
1886 1886
 
1887
-    print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
1887
+    print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n";
1888 1888
 
1889 1889
     if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
1890 1890
         print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
@@ -1950,17 +1950,17 @@  discard block
 block discarded – undo
1950 1950
     global $conf, $langs, $user;
1951 1951
 
1952 1952
     $ret = '';
1953
-    $ret .= '<form action="' . $urlaction . '" method="post" class="searchform">';
1954
-    $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1953
+    $ret .= '<form action="'.$urlaction.'" method="post" class="searchform">';
1954
+    $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
1955 1955
     $ret .= '<input type="hidden" name="mode" value="search">';
1956
-    $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag($user->login) . '">';
1956
+    $ret .= '<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).'">';
1957 1957
     if ($showtitlebefore)
1958
-        $ret .= $title . ' ';
1959
-    $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
1960
-    $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
1961
-    $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
1962
-    $ret .= ' placeholder="' . strip_tags($title) . '"';
1963
-    $ret .= ' name="' . $htmlinputname . '" id="' . $prefhtmlinputname . $htmlinputname . '" />';
1958
+        $ret .= $title.' ';
1959
+    $ret .= '<input type="text" class="flat '.$htmlmorecss.'"';
1960
+    $ret .= ' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"';
1961
+    $ret .= ($accesskey ? ' accesskey="'.$accesskey.'"' : '');
1962
+    $ret .= ' placeholder="'.strip_tags($title).'"';
1963
+    $ret .= ' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />';
1964 1964
     //$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.$langs->trans("Go").'">';
1965 1965
     $ret .= '<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
1966 1966
     $ret .= '<span class="fa fa-search"></span>';
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
         global $delayedhtmlcontent;
1987 1987
         global $contextpage, $page, $limit;
1988 1988
 
1989
-        $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
1989
+        $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
1990 1990
 
1991 1991
         // Global html output events ($mesgs, $errors, $warnings)
1992 1992
         dol_htmloutput_events($disabledoutputofmessages);
@@ -1996,15 +1996,15 @@  discard block
 block discarded – undo
1996 1996
         if (is_object($user) && !empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) {
1997 1997
             // Clean and save data
1998 1998
             foreach ($user->lastsearch_values_tmp as $key => $val) {
1999
-                unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
1999
+                unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after
2000 2000
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
2001 2001
                     if (empty($val['sortfield']))
2002 2002
                         unset($val['sortfield']);
2003 2003
                     if (empty($val['sortorder']))
2004 2004
                         unset($val['sortorder']);
2005
-                    dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
2006
-                    $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
2007
-                    unset($_SESSION['lastsearch_values_' . $key]);
2005
+                    dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)");
2006
+                    $_SESSION['lastsearch_values_tmp_'.$key] = json_encode($val);
2007
+                    unset($_SESSION['lastsearch_values_'.$key]);
2008 2008
                 }
2009 2009
             }
2010 2010
         }
@@ -2013,37 +2013,37 @@  discard block
 block discarded – undo
2013 2013
         $relativepathstring = $_SERVER["PHP_SELF"];
2014 2014
         // Clean $relativepathstring
2015 2015
         if (constant('DOL_BASE_URI'))
2016
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
2016
+            $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
2017 2017
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
2018 2018
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
2019 2019
         if (preg_match('/list\.php$/', $relativepathstring)) {
2020
-            unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]);
2021
-            unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
2022
-            unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
2020
+            unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
2021
+            unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
2022
+            unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
2023 2023
 
2024 2024
             if (!empty($contextpage))
2025
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
2025
+                $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
2026 2026
             if (!empty($page) && $page > 1)
2027
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
2027
+                $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page;
2028 2028
             if (!empty($limit) && $limit != $conf->limit)
2029
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
2029
+                $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit;
2030 2030
 
2031
-            unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
2032
-            unset($_SESSION['lastsearch_page_' . $relativepathstring]);
2033
-            unset($_SESSION['lastsearch_limit_' . $relativepathstring]);
2031
+            unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
2032
+            unset($_SESSION['lastsearch_page_'.$relativepathstring]);
2033
+            unset($_SESSION['lastsearch_limit_'.$relativepathstring]);
2034 2034
         }
2035 2035
 
2036 2036
         // Core error message
2037 2037
         if (!empty($conf->global->MAIN_CORE_ERROR)) {
2038 2038
             // Ajax version
2039 2039
             if ($conf->use_javascript_ajax) {
2040
-                $title = img_warning() . ' ' . $langs->trans('CoreErrorTitle');
2040
+                $title = img_warning().' '.$langs->trans('CoreErrorTitle');
2041 2041
                 print ajax_dialog($title, $langs->trans('CoreErrorMessage'));
2042 2042
             }
2043 2043
             // html version
2044 2044
             else {
2045
-                $msg = img_warning() . ' ' . $langs->trans('CoreErrorMessage');
2046
-                print '<div class="error">' . $msg . '</div>';
2045
+                $msg = img_warning().' '.$langs->trans('CoreErrorMessage');
2046
+                print '<div class="error">'.$msg.'</div>';
2047 2047
             }
2048 2048
 
2049 2049
             //define("MAIN_CORE_ERROR",0);      // Constant was defined and we can't change value of a constant
@@ -2051,17 +2051,17 @@  discard block
 block discarded – undo
2051 2051
 
2052 2052
         print "\n\n";
2053 2053
 
2054
-        print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
2054
+        print '</div> <!-- End div class="fiche" -->'."\n"; // End div fiche
2055 2055
 
2056 2056
         if (empty($conf->dol_hide_leftmenu))
2057
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
2057
+            print '</div> <!-- End div id-right -->'."\n"; // End div id-right
2058 2058
 
2059 2059
         if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
2060
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
2060
+            print '</div> <!-- End div id-container -->'."\n"; // End div container
2061 2061
 
2062 2062
         print "\n";
2063 2063
         if ($comment)
2064
-            print '<!-- ' . $comment . ' -->' . "\n";
2064
+            print '<!-- '.$comment.' -->'."\n";
2065 2065
 
2066 2066
         printCommonFooter($zone);
2067 2067
 
@@ -2069,8 +2069,8 @@  discard block
 block discarded – undo
2069 2069
             print $delayedhtmlcontent;
2070 2070
 
2071 2071
         if (!empty($conf->use_javascript_ajax)) {
2072
-            print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
2073
-            print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_foot.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
2072
+            print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
2073
+            print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_foot.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
2074 2074
         }
2075 2075
 
2076 2076
         // Wrapper to add log when clicking on download or preview
@@ -2082,7 +2082,7 @@  discard block
 block discarded – undo
2082 2082
                 <script type="text/javascript">
2083 2083
                     jQuery(document).ready(function () {
2084 2084
                         $('a.documentpreview').click(function () {
2085
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
2085
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
2086 2086
                                     , {
2087 2087
                                         id:<?php echo $object->id; ?>
2088 2088
                                         , element: '<?php echo $object->element ?>'
@@ -2091,7 +2091,7 @@  discard block
 block discarded – undo
2091 2091
                             );
2092 2092
                         });
2093 2093
                         $('a.documentdownload').click(function () {
2094
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
2094
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
2095 2095
                                     , {
2096 2096
                                         id:<?php echo $object->id; ?>
2097 2097
                                         , element: '<?php echo $object->element ?>'
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 
2108 2108
         // A div for the address popup
2109 2109
         print "\n<!-- A div to allow dialog popup -->\n";
2110
-        print '<div id="dialogforpopup" style="display: none;"></div>' . "\n";
2110
+        print '<div id="dialogforpopup" style="display: none;"></div>'."\n";
2111 2111
 
2112 2112
         print "</body>\n";
2113 2113
 
Please login to merge, or discard this patch.
dolibarr/htdocs/filefunc.inc.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 if (!defined('DOL_VERSION')) {
40
-    define('DOL_VERSION', '10.0.0-alpha');  // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
40
+    define('DOL_VERSION', '10.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
41 41
 }
42 42
 
43 43
 if (!defined('EURO')) {
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 $result = @include_once $conffile; // Keep @ because with some error reporting this break the redirect done when file not found
81 81
 
82 82
 if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) {    // If install not done and we are in a web session
83
-    header('Location: ' . BASE_URI . '?controller=install&method=index'); // Changed for Alixar
83
+    header('Location: '.BASE_URI.'?controller=install&method=index'); // Changed for Alixar
84 84
     exit;
85 85
 
86 86
     if (!empty($_SERVER["CONTEXT_PREFIX"])) {    // CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT are not defined on all apache versions
87
-        $path = $_SERVER["CONTEXT_PREFIX"];       // example '/dolibarr/' when using an apache alias.
87
+        $path = $_SERVER["CONTEXT_PREFIX"]; // example '/dolibarr/' when using an apache alias.
88 88
         if (!preg_match('/\/$/', $path))
89 89
             $path .= '/';
90 90
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         }
114 114
     }
115 115
 
116
-    header("Location: " . $path . "install/index.php");
116
+    header("Location: ".$path."install/index.php");
117 117
     exit;
118 118
 }
119 119
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 $dolibarr_main_document_root_alt = (empty($dolibarr_main_document_root_alt) ? '' : trim($dolibarr_main_document_root_alt));
138 138
 
139 139
 if (empty($dolibarr_main_db_port)) {
140
-    $dolibarr_main_db_port = 3306;  // For compatibility with old configs, if not defined, we take 'mysql' type
140
+    $dolibarr_main_db_port = 3306; // For compatibility with old configs, if not defined, we take 'mysql' type
141 141
 }
142 142
 
143 143
 if (empty($dolibarr_main_db_type)) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     $dolibarr_main_db_prefix = 'llx_';
153 153
 }
154 154
 if (empty($dolibarr_main_db_character_set)) {
155
-    $dolibarr_main_db_character_set = ($dolibarr_main_db_type == 'mysqli' ? 'utf8' : '');  // Old installation
155
+    $dolibarr_main_db_character_set = ($dolibarr_main_db_type == 'mysqli' ? 'utf8' : ''); // Old installation
156 156
 }
157 157
 if (empty($dolibarr_main_db_collation)) {
158 158
     $dolibarr_main_db_collation = ($dolibarr_main_db_type == 'mysqli' ? 'utf8_unicode_ci' : ''); // Old installation
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 }
203 203
 
204 204
 if (empty($dolibarr_main_db_host)) {
205
-    print '<div align="center">Dolibarr setup is not yet complete.<br><br>' . "\n";
206
-    print '<a href="?controller=install&method=index">Click here to finish Dolibarr install process</a> ...</div>' . "\n";
205
+    print '<div align="center">Dolibarr setup is not yet complete.<br><br>'."\n";
206
+    print '<a href="?controller=install&method=index">Click here to finish Dolibarr install process</a> ...</div>'."\n";
207 207
     die;
208 208
 }
209 209
 if (empty($dolibarr_main_url_root)) {
210
-    print 'Value for parameter \'dolibarr_main_url_root\' is not defined in your \'htdocs\conf\conf.php\' file.<br>' . "\n";
211
-    print 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)' . "\n";
210
+    print 'Value for parameter \'dolibarr_main_url_root\' is not defined in your \'htdocs\conf\conf.php\' file.<br>'."\n";
211
+    print 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)'."\n";
212 212
     die;
213 213
 }
214 214
 if (empty($dolibarr_main_data_root)) {
@@ -218,30 +218,30 @@  discard block
 block discarded – undo
218 218
 }
219 219
 
220 220
 // Define some constants
221
-define('DOL_CLASS_PATH', 'class/');         // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
222
-define('DOL_DATA_ROOT', $dolibarr_main_data_root);     // Filesystem data (documents)
223
-define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);   // Filesystem core php (htdocs)
221
+define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
222
+define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
223
+define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
224 224
 // Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT.
225 225
 // Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
226 226
 $tmp = '';
227 227
 $found = 0;
228 228
 $real_dolibarr_main_document_root = str_replace('\\', '/', realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
229 229
 if (!empty($_SERVER["DOCUMENT_ROOT"])) {
230
-    $pathroot = $_SERVER["DOCUMENT_ROOT"];                                                      // B) Value reported by web server setup (not defined on CLI mode), to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
230
+    $pathroot = $_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup (not defined on CLI mode), to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
231 231
 } else {
232 232
     $pathroot = 'NOTDEFINED';
233 233
 }
234
-$paths = explode('/', str_replace('\\', '/', $_SERVER["SCRIPT_NAME"]));        // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
234
+$paths = explode('/', str_replace('\\', '/', $_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
235 235
 // Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part.
236 236
 $concatpath = '';
237 237
 foreach ($paths as $tmppath) { // We check to find (B+start of C)=A
238 238
     if (empty($tmppath)) {
239 239
         continue;
240 240
     }
241
-    $concatpath .= '/' . $tmppath;
241
+    $concatpath .= '/'.$tmppath;
242 242
     //if ($tmppath) $concatpath.='/'.$tmppath;
243 243
     //print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'<br>';
244
-    if ($real_dolibarr_main_document_root == @realpath($pathroot . $concatpath)) {    // @ avoid warning when safe_mode is on.
244
+    if ($real_dolibarr_main_document_root == @realpath($pathroot.$concatpath)) {    // @ avoid warning when safe_mode is on.
245 245
         //print "Found relative url = ".$concatpath;
246 246
         $tmp3 = $concatpath;
247 247
         $found = 1;
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
 if (!$found) {
254 254
     $tmp = $dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
255 255
 } else {
256
-    $tmp = 'http' . (((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's') . '://' . $_SERVER["SERVER_NAME"] . ((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':' . $_SERVER["SERVER_PORT"]) . ($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/') . $tmp3 : '');
256
+    $tmp = 'http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : '');
257 257
 }
258 258
 //print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n";
259 259
 if (!empty($dolibarr_main_force_https)) {
260 260
     $tmp = preg_replace('/^http:/i', 'https:', $tmp);
261 261
 }
262
-define('DOL_MAIN_URL_ROOT', $tmp);           // URL absolute root (https://sss/dolibarr, ...)
262
+define('DOL_MAIN_URL_ROOT', $tmp); // URL absolute root (https://sss/dolibarr, ...)
263 263
 $uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
264
-$suburi = strstr($uri, '/');            // $suburi contains url without domain:port
264
+$suburi = strstr($uri, '/'); // $suburi contains url without domain:port
265 265
 if ($suburi == '/') {
266
-    $suburi = '';           // If $suburi is /, it is now ''
266
+    $suburi = ''; // If $suburi is /, it is now ''
267 267
 }
268
-define('DOL_URL_ROOT', $suburi);           // URL relative root ('', '/dolibarr', ...)
268
+define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
269 269
 //print DOL_MAIN_URL_ROOT.'-'.DOL_URL_ROOT."\n";
270 270
 // Define prefix MAIN_DB_PREFIX
271 271
 define('MAIN_DB_PREFIX', $dolibarr_main_db_prefix);
@@ -289,50 +289,50 @@  discard block
 block discarded – undo
289 289
 
290 290
  */
291 291
 if (!defined('ADODB_PATH')) {
292
-    define('ADODB_PATH', BASE_PATH . '/vendor/adodb/adodb-php');
292
+    define('ADODB_PATH', BASE_PATH.'/vendor/adodb/adodb-php');
293 293
 }
294 294
 if (!defined('ADODB_DATE_VERSION')) {
295
-    include_once ADODB_PATH . '/adodb-time.inc.php';
295
+    include_once ADODB_PATH.'/adodb-time.inc.php';
296 296
 }
297 297
 
298 298
 if (!defined('FPDF_PATH')) {
299
-    define('FPDF_PATH', (empty($dolibarr_lib_FPDF_PATH)) ? DOL_BASE_PATH . '/includes/fpdf/' : $dolibarr_lib_FPDF_PATH . '/');
299
+    define('FPDF_PATH', (empty($dolibarr_lib_FPDF_PATH)) ? DOL_BASE_PATH . '/includes/fpdf/' : $dolibarr_lib_FPDF_PATH.'/');
300 300
 } // Used only for package that can't include tcpdf
301 301
 if (!defined('TCPDF_PATH')) {
302
-    define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ? DOL_BASE_PATH . '/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH . '/');
302
+    define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ? DOL_BASE_PATH . '/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/');
303 303
 }
304 304
 if (!defined('FPDI_PATH')) {
305
-    define('FPDI_PATH', (empty($dolibarr_lib_FPDI_PATH)) ? DOL_BASE_PATH . '/includes/fpdfi/' : $dolibarr_lib_FPDI_PATH . '/');
305
+    define('FPDI_PATH', (empty($dolibarr_lib_FPDI_PATH)) ? DOL_BASE_PATH . '/includes/fpdfi/' : $dolibarr_lib_FPDI_PATH.'/');
306 306
 }
307 307
 if (!defined('TCPDI_PATH')) {
308
-    define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ? DOL_BASE_PATH . '/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH . '/');
308
+    define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ? DOL_BASE_PATH . '/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH.'/');
309 309
 }
310 310
 if (!defined('NUSOAP_PATH')) {
311
-    define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ? DOL_BASE_PATH . '/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH . '/'));
311
+    define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ? DOL_BASE_PATH . '/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH.'/'));
312 312
 }
313 313
 if (!defined('PHPEXCEL_PATH')) {
314
-    define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH)) ? DOL_BASE_PATH . '/includes/phpoffice/phpexcel/Classes/' : (empty($dolibarr_lib_PHPEXCEL_PATH) ? '' : $dolibarr_lib_PHPEXCEL_PATH . '/'));
314
+    define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH)) ? DOL_BASE_PATH . '/includes/phpoffice/phpexcel/Classes/' : (empty($dolibarr_lib_PHPEXCEL_PATH) ? '' : $dolibarr_lib_PHPEXCEL_PATH.'/'));
315 315
 }
316 316
 if (!defined('GEOIP_PATH')) {
317
-    define('GEOIP_PATH', (!isset($dolibarr_lib_GEOIP_PATH)) ? DOL_BASE_PATH . '/includes/geoip/' : (empty($dolibarr_lib_GEOIP_PATH) ? '' : $dolibarr_lib_GEOIP_PATH . '/'));
317
+    define('GEOIP_PATH', (!isset($dolibarr_lib_GEOIP_PATH)) ? DOL_BASE_PATH . '/includes/geoip/' : (empty($dolibarr_lib_GEOIP_PATH) ? '' : $dolibarr_lib_GEOIP_PATH.'/'));
318 318
 }
319 319
 if (!defined('ODTPHP_PATH')) {
320
-    define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ? DOL_BASE_PATH . '/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH . '/'));
320
+    define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ? DOL_BASE_PATH . '/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH.'/'));
321 321
 }
322 322
 if (!defined('ODTPHP_PATHTOPCLZIP')) {
323
-    define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ? DOL_BASE_PATH . '/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP . '/'));
323
+    define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ? DOL_BASE_PATH . '/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/'));
324 324
 }
325 325
 if (!defined('JS_CKEDITOR')) {
326
-    define('JS_CKEDITOR', (!isset($dolibarr_js_CKEDITOR)) ? '' : (empty($dolibarr_js_CKEDITOR) ? '' : $dolibarr_js_CKEDITOR . '/'));
326
+    define('JS_CKEDITOR', (!isset($dolibarr_js_CKEDITOR)) ? '' : (empty($dolibarr_js_CKEDITOR) ? '' : $dolibarr_js_CKEDITOR.'/'));
327 327
 }
328 328
 if (!defined('JS_JQUERY')) {
329
-    define('JS_JQUERY', (!isset($dolibarr_js_JQUERY)) ? '' : (empty($dolibarr_js_JQUERY) ? '' : $dolibarr_js_JQUERY . '/'));
329
+    define('JS_JQUERY', (!isset($dolibarr_js_JQUERY)) ? '' : (empty($dolibarr_js_JQUERY) ? '' : $dolibarr_js_JQUERY.'/'));
330 330
 }
331 331
 if (!defined('JS_JQUERY_UI')) {
332
-    define('JS_JQUERY_UI', (!isset($dolibarr_js_JQUERY_UI)) ? '' : (empty($dolibarr_js_JQUERY_UI) ? '' : $dolibarr_js_JQUERY_UI . '/'));
332
+    define('JS_JQUERY_UI', (!isset($dolibarr_js_JQUERY_UI)) ? '' : (empty($dolibarr_js_JQUERY_UI) ? '' : $dolibarr_js_JQUERY_UI.'/'));
333 333
 }
334 334
 if (!defined('JS_JQUERY_FLOT')) {
335
-    define('JS_JQUERY_FLOT', (!isset($dolibarr_js_JQUERY_FLOT)) ? '' : (empty($dolibarr_js_JQUERY_FLOT) ? '' : $dolibarr_js_JQUERY_FLOT . '/'));
335
+    define('JS_JQUERY_FLOT', (!isset($dolibarr_js_JQUERY_FLOT)) ? '' : (empty($dolibarr_js_JQUERY_FLOT) ? '' : $dolibarr_js_JQUERY_FLOT.'/'));
336 336
 }
337 337
 // Other required path
338 338
 if (!defined('DOL_DEFAULT_TTF')) {
@@ -346,15 +346,15 @@  discard block
 block discarded – undo
346 346
  * Include functions
347 347
  */
348 348
 
349
-if (!file_exists(DOL_BASE_PATH . "/core/lib/functions.lib.php")) {
349
+if (!file_exists(DOL_BASE_PATH."/core/lib/functions.lib.php")) {
350 350
     print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
351 351
     print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
352 352
     exit;
353 353
 }
354 354
 
355 355
 // Included by default
356
-include_once DOL_BASE_PATH . '/core/lib/functions.lib.php';
357
-include_once DOL_BASE_PATH . '/core/lib/security.lib.php';
356
+include_once DOL_BASE_PATH.'/core/lib/functions.lib.php';
357
+include_once DOL_BASE_PATH.'/core/lib/security.lib.php';
358 358
 
359 359
 //print memory_get_usage();
360 360
 // If password is encoded, we decode it
Please login to merge, or discard this patch.
dolibarr/htdocs/home/home.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 define('NOCSRFCHECK', 1); // This is main home and login page. We must be able to go on it from another web site.
31 31
 
32 32
 echo "13";
33
-require DOL_BASE_PATH . '/main.inc.php';
33
+require DOL_BASE_PATH.'/main.inc.php';
34 34
 die('2');
35 35
 
36
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
37 37
 
38 38
 // If not defined, we select menu "home"
39 39
 $_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home';
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 // Check if company name is defined (first install)
49 49
 if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) {
50 50
     //header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
51
-    header('Location: ' . BASE_URI . '?controller=admin&method=index&mainmenu=home&leftmenu=setup&mesg=setupnotcomplete');
51
+    header('Location: '.BASE_URI.'?controller=admin&method=index&mainmenu=home&leftmenu=setup&mesg=setupnotcomplete');
52 52
     exit;
53 53
 }
54 54
 /*
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
   }
63 63
  */
64 64
 if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled)
65
-    require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
65
+    require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
66 66
     $zone = GETPOST('areacode', 'aZ09');
67 67
     $userid = GETPOST('userid', 'int');
68 68
     $boxorder = GETPOST('boxorder', 'aZ09');
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 // Title
89
-$title = $langs->trans("HomeArea") . ' - Dolibarr ' . DOL_VERSION;
89
+$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
90 90
 if (!empty($conf->global->MAIN_APPLICATION_TITLE))
91 91
  {
92
-    $title = $langs->trans("HomeArea") . ' - ' . $conf->global->MAIN_APPLICATION_TITLE;
92
+    $title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
93 93
 }
94 94
 
95 95
 llxHeader('', $title);
96 96
 
97
-$resultboxes = FormOther::getBoxesArea($user, "0");    // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
97
+$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
98 98
 
99 99
 print load_fiche_titre($langs->trans("HomeArea"), $resultboxes['selectboxlist'], 'title_home');
100 100
 
@@ -128,16 +128,16 @@  discard block
 block discarded – undo
128 128
 
129 129
 if (empty($user->societe_id)) {
130 130
     $boxstat .= '<div class="box">';
131
-    $boxstat .= '<table summary="' . dol_escape_htmltag($langs->trans("DolibarrStateBoard")) . '" class="noborder boxtable boxtablenobottom nohover" width="100%">';
131
+    $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
132 132
     $boxstat .= '<tr class="liste_titre">';
133
-    $boxstat .= '<th class="liste_titre">' . $langs->trans("DolibarrStateBoard") . '</th>';
133
+    $boxstat .= '<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>';
134 134
     $boxstat .= '</tr>';
135 135
     $boxstat .= '<tr class="impair"><td class="tdboxstats nohover flexcontainer">';
136 136
 
137 137
     $object = new stdClass();
138 138
     $parameters = array();
139 139
     $action = '';
140
-    $reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action);    // Note that $action and $object may have been modified by some hooks
140
+    $reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
141 141
     $boxstat .= $hookmanager->resPrint;
142 142
 
143 143
     if (empty($reshook)) {
@@ -165,25 +165,25 @@  discard block
 block discarded – undo
165 165
         );
166 166
         // Class file containing the method load_state_board for each line
167 167
         $includes = array(
168
-            DOL_DOCUMENT_ROOT . "/user/class/user.class.php",
169
-            DOL_DOCUMENT_ROOT . "/societe/class/client.class.php",
170
-            DOL_DOCUMENT_ROOT . "/societe/class/client.class.php",
171
-            DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.class.php",
172
-            DOL_DOCUMENT_ROOT . "/contact/class/contact.class.php",
173
-            DOL_DOCUMENT_ROOT . "/adherents/class/adherent.class.php",
174
-            DOL_DOCUMENT_ROOT . "/product/class/product.class.php",
175
-            DOL_DOCUMENT_ROOT . "/product/class/product.class.php",
176
-            DOL_DOCUMENT_ROOT . "/comm/propal/class/propal.class.php",
177
-            DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php",
178
-            DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php",
179
-            DOL_DOCUMENT_ROOT . "/contrat/class/contrat.class.php",
180
-            DOL_DOCUMENT_ROOT . "/fichinter/class/fichinter.class.php",
181
-            DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php",
182
-            DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.facture.class.php",
183
-            DOL_DOCUMENT_ROOT . "/supplier_proposal/class/supplier_proposal.class.php",
184
-            DOL_DOCUMENT_ROOT . "/projet/class/project.class.php",
185
-            DOL_DOCUMENT_ROOT . "/expensereport/class/expensereport.class.php",
186
-            DOL_DOCUMENT_ROOT . "/don/class/don.class.php"
168
+            DOL_DOCUMENT_ROOT."/user/class/user.class.php",
169
+            DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
170
+            DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
171
+            DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
172
+            DOL_DOCUMENT_ROOT."/contact/class/contact.class.php",
173
+            DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
174
+            DOL_DOCUMENT_ROOT."/product/class/product.class.php",
175
+            DOL_DOCUMENT_ROOT."/product/class/product.class.php",
176
+            DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php",
177
+            DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
178
+            DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
179
+            DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
180
+            DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php",
181
+            DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
182
+            DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
183
+            DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
184
+            DOL_DOCUMENT_ROOT."/projet/class/project.class.php",
185
+            DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
186
+            DOL_DOCUMENT_ROOT."/don/class/don.class.php"
187 187
         );
188 188
         // Name class containing the method load_state_board for each line
189 189
         $classes = array('User',
@@ -294,25 +294,25 @@  discard block
 block discarded – undo
294 294
           );
295 295
          */
296 296
         $links = array(
297
-            BASE_URI . '/?controller=user&method=list',
298
-            BASE_URI . '/?controller=societe&method=list&type=c&mainmenu=companies',
299
-            BASE_URI . '/?controller=societe&method=list&type=p&mainmenu=companies',
300
-            BASE_URI . '/?controller=societe&method=list&type=f&mainmenu=companies',
301
-            BASE_URI . '/?controller=contact&method=list&mainmenu=companies',
302
-            BASE_URI . '/?controller=adherents&method=list&statut=1&mainmenu=members',
303
-            BASE_URI . '/?controller=product&method=list&type=0&mainmenu=products',
304
-            BASE_URI . '/?controller=product&method=list&type=1&mainmenu=products',
305
-            BASE_URI . '/?controller=comm/propal&method=list&mainmenu=commercial&leftmenu=propals',
306
-            BASE_URI . '/?controller=commande&method=list&mainmenu=commercial&leftmenu=orders',
307
-            BASE_URI . '/?controller=compta/facture&method=list&mainmenu=billing&leftmenu=customers_bills',
308
-            BASE_URI . '/?controller=contrat&method=list&mainmenu=commercial&leftmenu=contracts',
309
-            BASE_URI . '/?controller=fichinter&method=list&mainmenu=commercial&leftmenu=ficheinter',
310
-            BASE_URI . '/?controller=fourn/commande&method=list&mainmenu=commercial&leftmenu=orders_suppliers',
311
-            BASE_URI . '/?controller=fourn/facture&method=list&mainmenu=billing&leftmenu=suppliers_bills',
312
-            BASE_URI . '/?controller=supplier_proposal&method=list&mainmenu=commercial&leftmenu=',
313
-            BASE_URI . '/?controller=projet&method=list&mainmenu=project',
314
-            BASE_URI . '/?controller=expensereport&method=list&mainmenu=hrm&leftmenu=expensereport',
315
-            BASE_URI . '/?controller=don&method=list&leftmenu=donations'
297
+            BASE_URI.'/?controller=user&method=list',
298
+            BASE_URI.'/?controller=societe&method=list&type=c&mainmenu=companies',
299
+            BASE_URI.'/?controller=societe&method=list&type=p&mainmenu=companies',
300
+            BASE_URI.'/?controller=societe&method=list&type=f&mainmenu=companies',
301
+            BASE_URI.'/?controller=contact&method=list&mainmenu=companies',
302
+            BASE_URI.'/?controller=adherents&method=list&statut=1&mainmenu=members',
303
+            BASE_URI.'/?controller=product&method=list&type=0&mainmenu=products',
304
+            BASE_URI.'/?controller=product&method=list&type=1&mainmenu=products',
305
+            BASE_URI.'/?controller=comm/propal&method=list&mainmenu=commercial&leftmenu=propals',
306
+            BASE_URI.'/?controller=commande&method=list&mainmenu=commercial&leftmenu=orders',
307
+            BASE_URI.'/?controller=compta/facture&method=list&mainmenu=billing&leftmenu=customers_bills',
308
+            BASE_URI.'/?controller=contrat&method=list&mainmenu=commercial&leftmenu=contracts',
309
+            BASE_URI.'/?controller=fichinter&method=list&mainmenu=commercial&leftmenu=ficheinter',
310
+            BASE_URI.'/?controller=fourn/commande&method=list&mainmenu=commercial&leftmenu=orders_suppliers',
311
+            BASE_URI.'/?controller=fourn/facture&method=list&mainmenu=billing&leftmenu=suppliers_bills',
312
+            BASE_URI.'/?controller=supplier_proposal&method=list&mainmenu=commercial&leftmenu=',
313
+            BASE_URI.'/?controller=projet&method=list&mainmenu=project',
314
+            BASE_URI.'/?controller=expensereport&method=list&mainmenu=hrm&leftmenu=expensereport',
315
+            BASE_URI.'/?controller=don&method=list&leftmenu=donations'
316 316
         );
317 317
         // Translation lang files
318 318
         $langfile = array("users",
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
                     $langs->load($langfile[$key]);
358 358
                 $text = $langs->trans($titres[$key]);
359 359
                 //$sep=($conf->dol_use_jmobile?'<br>':' ');
360
-                $boxstat .= '<a href="' . $links[$key] . '" class="boxstatsindicator thumbstat nobold nounderline">';
360
+                $boxstat .= '<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">';
361 361
                 $boxstat .= '<div class="boxstats">';
362
-                $boxstat .= '<span class="boxstatstext" title="' . dol_escape_htmltag($text) . '">' . $text . '</span><br>';
363
-                $boxstat .= '<span class="boxstatsindicator">' . img_object("", $icons[$key], 'class="inline-block"') . ' ' . ($board->nb[$val] ? $board->nb[$val] : 0) . '</span>';
362
+                $boxstat .= '<span class="boxstatstext" title="'.dol_escape_htmltag($text).'">'.$text.'</span><br>';
363
+                $boxstat .= '<span class="boxstatsindicator">'.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).'</span>';
364 364
                 $boxstat .= '</div>';
365 365
                 $boxstat .= '</a>';
366 366
             }
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
 $dashboardlines = array();
395 395
 
396 396
 // Do not include sections without management permission
397
-require_once DOL_DOCUMENT_ROOT . '/core/class/workboardresponse.class.php';
397
+require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
398 398
 
399 399
 // Number of actions to do (late)
400 400
 if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) {
401
-    include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
401
+    include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
402 402
     $board = new ActionComm($db);
403 403
 
404 404
     $dashboardlines[] = $board->load_board($user);
@@ -406,21 +406,21 @@  discard block
 block discarded – undo
406 406
 
407 407
 // Number of project opened
408 408
 if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
409
-    include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
409
+    include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
410 410
     $board = new Project($db);
411 411
     $dashboardlines[] = $board->load_board($user);
412 412
 }
413 413
 
414 414
 // Number of tasks to do (late)
415 415
 if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) {
416
-    include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
416
+    include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
417 417
     $board = new Task($db);
418 418
     $dashboardlines[] = $board->load_board($user);
419 419
 }
420 420
 
421 421
 // Number of commercial proposals opened (expired)
422 422
 if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
423
-    include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
423
+    include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
424 424
     $board = new Propal($db);
425 425
     $dashboardlines[] = $board->load_board($user, "opened");
426 426
     // Number of commercial proposals CLOSED signed (billed)
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 
430 430
 // Number of commercial proposals opened (expired)
431 431
 if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
432
-    include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
432
+    include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
433 433
     $board = new SupplierProposal($db);
434 434
     $dashboardlines[] = $board->load_board($user, "opened");
435 435
     // Number of commercial proposals CLOSED signed (billed)
@@ -438,21 +438,21 @@  discard block
 block discarded – undo
438 438
 
439 439
 // Number of customer orders a deal
440 440
 if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
441
-    include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
441
+    include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
442 442
     $board = new Commande($db);
443 443
     $dashboardlines[] = $board->load_board($user);
444 444
 }
445 445
 
446 446
 // Number of suppliers orders a deal
447 447
 if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
448
-    include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
448
+    include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
449 449
     $board = new CommandeFournisseur($db);
450 450
     $dashboardlines[] = $board->load_board($user);
451 451
 }
452 452
 
453 453
 // Number of services enabled (delayed)
454 454
 if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
455
-    include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
455
+    include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
456 456
     $board = new Contrat($db);
457 457
     $dashboardlines[] = $board->load_board($user, "inactives");
458 458
     // Number of active services (expired)
@@ -460,23 +460,23 @@  discard block
 block discarded – undo
460 460
 }
461 461
 // Number of invoices customers (has paid)
462 462
 if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
463
-    include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
463
+    include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
464 464
     $board = new Facture($db);
465 465
     $dashboardlines[] = $board->load_board($user);
466 466
 }
467 467
 
468 468
 // Number of supplier invoices (has paid)
469 469
 if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
470
-    include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
470
+    include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
471 471
     $board = new FactureFournisseur($db);
472 472
     $dashboardlines[] = $board->load_board($user);
473 473
 }
474 474
 
475 475
 // Number of transactions to conciliate
476 476
 if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id) {
477
-    include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
477
+    include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
478 478
     $board = new Account($db);
479
-    $nb = $board::countAccountToReconcile();    // Get nb of account to reconciliate
479
+    $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
480 480
     if ($nb > 0) {
481 481
         $dashboardlines[] = $board->load_board($user);
482 482
     }
@@ -484,28 +484,28 @@  discard block
 block discarded – undo
484 484
 
485 485
 // Number of cheque to send
486 486
 if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
487
-    include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php';
487
+    include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
488 488
     $board = new RemiseCheque($db);
489 489
     $dashboardlines[] = $board->load_board($user);
490 490
 }
491 491
 
492 492
 // Number of foundation members
493 493
 if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->societe_id) {
494
-    include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
494
+    include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
495 495
     $board = new Adherent($db);
496 496
     $dashboardlines[] = $board->load_board($user);
497 497
 }
498 498
 
499 499
 // Number of expense reports to approve
500 500
 if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
501
-    include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
501
+    include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
502 502
     $board = new ExpenseReport($db);
503 503
     $dashboardlines[] = $board->load_board($user, 'toapprove');
504 504
 }
505 505
 
506 506
 // Number of expense reports to pay
507 507
 if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
508
-    include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
508
+    include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
509 509
     $board = new ExpenseReport($db);
510 510
     $dashboardlines[] = $board->load_board($user, 'topay');
511 511
 }
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 $object = new stdClass();
514 514
 $parameters = array();
515 515
 $action = '';
516
-$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action);    // Note that $action and $object may have been modified by some hooks
516
+$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
517 517
 if ($reshook == 0) {
518 518
     $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray);
519 519
 }
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
 //var_dump($totallate);
544 544
 $boxwork = '';
545 545
 $boxwork .= '<div class="box">';
546
-$boxwork .= '<table summary="' . dol_escape_htmltag($langs->trans("WorkingBoard")) . '" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">' . "\n";
546
+$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">'."\n";
547 547
 $boxwork .= '<tr class="liste_titre">';
548
-$boxwork .= '<th class="liste_titre">' . $langs->trans("DolibarrWorkBoard") . '</th>';
549
-$boxwork .= '</tr>' . "\n";
548
+$boxwork .= '<th class="liste_titre">'.$langs->trans("DolibarrWorkBoard").'</th>';
549
+$boxwork .= '</tr>'."\n";
550 550
 
551 551
 if ($showweather) {
552 552
     $boxwork .= '<tr class="nohover">';
553
-    $boxwork .= '<td class="nohover' . ($conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '') . ' center valignmiddle">';
553
+    $boxwork .= '<td class="nohover'.($conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '').' center valignmiddle">';
554 554
     $text = '';
555 555
     if ($totallate > 0)
556 556
     {
557
-        $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv("NActionsLate", $totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')) . ')';
557
+        $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate", $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
558 558
     } else {
559 559
         $text = $langs->transnoentitiesnoconv("NoItemLate");
560 560
     }
561
-    $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc");
561
+    $text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
562 562
     //$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
563 563
     $options = 'height="64px"';
564 564
     $boxwork .= showWeather($totallate, $text, $options);
@@ -578,23 +578,23 @@  discard block
 block discarded – undo
578 578
         }
579 579
 
580 580
         $textlate = $langs->trans("NActionsLate", $board->nbtodolate);
581
-        $textlate .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')';
581
+        $textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
582 582
 
583 583
         $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">';
584 584
         $boxwork .= '<div class="boxstatscontent">';
585 585
         $sep = ($conf->dol_use_jmobile ? '<br>' : ' ');
586
-        $boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag($board->label) . '">' . $board->img . ' ' . $board->label . '</span><br>';
587
-        $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . $board->nbtodo . '</span></a>';
586
+        $boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' '.$board->label.'</span><br>';
587
+        $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.$board->nbtodo.'</span></a>';
588 588
         if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
589
-            $boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . price($board->total) . '</span></a>';
589
+            $boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.price($board->total).'</span></a>';
590 590
         }
591 591
         $boxwork .= '</div>';
592 592
         if ($board->nbtodolate > 0) {
593 593
             $boxwork .= '<div class="dashboardlinelatecoin nowrap">';
594
-            $boxwork .= '<a title="' . dol_escape_htmltag($textlate) . '" class="valignmiddle dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '" href="' . ((!$board->url_late) ? $board->url : $board->url_late ) . '">';
594
+            $boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
595 595
             //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
596
-            $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"') . '';
597
-            $boxwork .= '<span class="dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '">';
596
+            $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"').'';
597
+            $boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
598 598
             $boxwork .= $board->nbtodolate;
599 599
             $boxwork .= '</span>';
600 600
             $boxwork .= '</a>';
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 
624 624
 $boxwork .= '</td></tr>';
625 625
 
626
-$boxwork .= '</table>';   // End table array of working board
626
+$boxwork .= '</table>'; // End table array of working board
627 627
 $boxwork .= '</div>';
628 628
 
629 629
 print '</div></div></div><div class="clearboth"></div>';
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
     $message = '';
670 670
 
671 671
     // Check if install lock file is present
672
-    $lockfile = DOL_DATA_ROOT . '/install.lock';
673
-    if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT . "/install")) {
672
+    $lockfile = DOL_DATA_ROOT.'/install.lock';
673
+    if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) {
674 674
         $langs->load("errors");
675 675
         //if (! empty($message)) $message.='<br>';
676
-        $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT) . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth');
676
+        $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
677 677
     }
678 678
 
679 679
     // Conf files must be in read only mode
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
         $langs->load("errors");
682 682
         //$langs->load("other");
683 683
         //if (! empty($message)) $message.='<br>';
684
-        $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly") . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth');
684
+        $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
685 685
     }
686 686
 
687 687
     if ($message) {
@@ -716,20 +716,20 @@  discard block
 block discarded – undo
716 716
     $used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL';
717 717
 
718 718
     $level0 = $offset;
719
-    if (!empty($conf->global->{$used_conf . '0'})) {
720
-        $level0 = $conf->global->{$used_conf . '0'};
719
+    if (!empty($conf->global->{$used_conf.'0'})) {
720
+        $level0 = $conf->global->{$used_conf.'0'};
721 721
     }
722 722
     $level1 = $offset + 1 * $factor;
723
-    if (!empty($conf->global->{$used_conf . '1'})) {
724
-        $level1 = $conf->global->{$used_conf . '1'};
723
+    if (!empty($conf->global->{$used_conf.'1'})) {
724
+        $level1 = $conf->global->{$used_conf.'1'};
725 725
     }
726 726
     $level2 = $offset + 2 * $factor;
727
-    if (!empty($conf->global->{$used_conf . '2'})) {
728
-        $level2 = $conf->global->{$used_conf . '2'};
727
+    if (!empty($conf->global->{$used_conf.'2'})) {
728
+        $level2 = $conf->global->{$used_conf.'2'};
729 729
     }
730 730
     $level3 = $offset + 3 * $factor;
731
-    if (!empty($conf->global->{$used_conf . '3'})) {
732
-        $level3 = $conf->global->{$used_conf . '3'};
731
+    if (!empty($conf->global->{$used_conf.'3'})) {
732
+        $level3 = $conf->global->{$used_conf.'3'};
733 733
     }
734 734
 
735 735
     if ($totallate <= $level0)
Please login to merge, or discard this patch.
dolibarr/htdocs/install/index.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  * 					 For a reinstall this page redirect to page check.php
29 29
  */
30 30
 include_once 'inc.php';
31
-include_once DOL_BASE_PATH . '/core/class/html.form.class.php';
32
-include_once DOL_BASE_PATH . '/core/class/html.formadmin.class.php';
31
+include_once DOL_BASE_PATH.'/core/class/html.form.class.php';
32
+include_once DOL_BASE_PATH.'/core/class/html.formadmin.class.php';
33 33
 
34 34
 global $langs;
35 35
 
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
  * View
51 51
  */
52 52
 
53
-$formadmin=new FormAdmin('');	// Note: $db does not exist yet but we don't need it, so we put ''.
53
+$formadmin = new FormAdmin(''); // Note: $db does not exist yet but we don't need it, so we put ''.
54 54
 
55
-pHeader("", "check");   // Next step = check
55
+pHeader("", "check"); // Next step = check
56 56
 
57 57
 
58 58
 // Ask installation language
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 print '<tr>';
63 63
 print '<td>'.$langs->trans("DefaultLanguage").' : </td><td>';
64
-print $formadmin->select_language('auto','selectlang',1,0,0,1);
64
+print $formadmin->select_language('auto', 'selectlang', 1, 0, 0, 1);
65 65
 print '</td>';
66 66
 print '</tr>';
67 67
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,5 +70,7 @@
 block discarded – undo
70 70
 print '<br><br>'.$langs->trans("SomeTranslationAreUncomplete");
71 71
 
72 72
 // If there's no error, we display the next step button
73
-if ($err == 0) pFooter(0);
73
+if ($err == 0) {
74
+    pFooter(0);
75
+}
74 76
 
Please login to merge, or discard this patch.