@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | // Note: the function dol_getprefix may have been redefined to return a different key to manage another area to protect. |
51 | 51 | $prefix = DolUtils::dol_getprefix(''); |
52 | 52 | |
53 | - $sessionname = 'DOLSESSID_' . $prefix; |
|
54 | - $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix; |
|
53 | + $sessionname = 'DOLSESSID_'.$prefix; |
|
54 | + $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; |
|
55 | 55 | if (!empty($_COOKIE[$sessiontimeout])) { |
56 | 56 | ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); |
57 | 57 | } |
58 | 58 | session_name($sessionname); |
59 | - 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. |
|
59 | + 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. |
|
60 | 60 | // This create lock, released when session_write_close() or end of page. |
61 | 61 | // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished. |
62 | 62 | if (!defined('NOSESSION')) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | Globals::$conf->browser->name = $tmp['browsername']; |
81 | 81 | Globals::$conf->browser->os = $tmp['browseros']; |
82 | 82 | Globals::$conf->browser->version = $tmp['browserversion']; |
83 | - Globals::$conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet' |
|
83 | + Globals::$conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet' |
|
84 | 84 | //var_dump(Globals::$conf->browser); |
85 | 85 | |
86 | 86 | if (Globals::$conf->browser->layout == 'phone') { |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | $newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]); |
102 | 102 | } |
103 | 103 | } else { // Check HTTPS environment variable (Apache/mod_ssl only) |
104 | - $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT) . $_SERVER["REQUEST_URI"]; |
|
104 | + $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"]; |
|
105 | 105 | } |
106 | 106 | } else { |
107 | 107 | // Check HTTPS environment variable (Apache/mod_ssl only) |
108 | - $newurl = Globals::$conf->file->main_force_https . $_SERVER["REQUEST_URI"]; |
|
108 | + $newurl = Globals::$conf->file->main_force_https.$_SERVER["REQUEST_URI"]; |
|
109 | 109 | } |
110 | 110 | // Start redirect |
111 | 111 | if ($newurl) { |
112 | - DolUtils::dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to " . $newurl); |
|
112 | + DolUtils::dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl); |
|
113 | 113 | echo $newurl; |
114 | 114 | throw Exception('x'); |
115 | - header("Location: " . $newurl); |
|
115 | + header("Location: ".$newurl); |
|
116 | 116 | exit; |
117 | 117 | } else { |
118 | 118 | DolUtils::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); |
@@ -137,29 +137,29 @@ discard block |
||
137 | 137 | |
138 | 138 | // Loading of additional presentation includes |
139 | 139 | if (!defined('NOREQUIREHTML')) { |
140 | - require_once DOL_BASE_PATH . '/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) |
|
140 | + require_once DOL_BASE_PATH.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) |
|
141 | 141 | } |
142 | 142 | if (!defined('NOREQUIREAJAX') && Globals::$conf->use_javascript_ajax) { |
143 | - require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory |
|
143 | + require_once DOL_BASE_PATH.'/core/lib/ajax.lib.php'; // Need 22ko memory |
|
144 | 144 | } |
145 | 145 | // If install or upgrade process not done or not completely finished, we call the install page. |
146 | 146 | if (!empty(Globals::$conf->global->MAIN_NOT_INSTALLED) || !empty(Globals::$conf->global->MAIN_NOT_UPGRADED)) { |
147 | 147 | DolUtils::dol_syslog("main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING); |
148 | 148 | throw Exception('x'); |
149 | - header("Location: " . DOL_BASE_URI . "/install/index.php"); |
|
149 | + header("Location: ".DOL_BASE_URI."/install/index.php"); |
|
150 | 150 | exit; |
151 | 151 | } |
152 | 152 | // If an upgrade process is required, we call the install page. |
153 | 153 | if ((!empty(Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE) && (Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION)) || (empty(Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE) && !empty(Globals::$conf->global->MAIN_VERSION_LAST_INSTALL) && (Globals::$conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION))) { |
154 | 154 | $versiontocompare = empty(Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE) ? Globals::$conf->global->MAIN_VERSION_LAST_INSTALL : Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE; |
155 | - require_once DOL_BASE_PATH . '/core/lib/admin.lib.php'; |
|
155 | + require_once DOL_BASE_PATH.'/core/lib/admin.lib.php'; |
|
156 | 156 | $dolibarrversionlastupgrade = preg_split('/[.-]/', $versiontocompare); |
157 | 157 | $dolibarrversionprogram = preg_split('/[.-]/', DOL_VERSION); |
158 | 158 | $rescomp = versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade); |
159 | 159 | if ($rescomp > 0) { // Programs have a version higher than database. We did not add "&& $rescomp < 3" because we want upgrade process for build upgrades |
160 | - DolUtils::dol_syslog("main.inc: database version " . $versiontocompare . " is lower than programs version " . DOL_VERSION . ". Redirect to install page.", LOG_WARNING); |
|
160 | + DolUtils::dol_syslog("main.inc: database version ".$versiontocompare." is lower than programs version ".DOL_VERSION.". Redirect to install page.", LOG_WARNING); |
|
161 | 161 | throw Exception('x'); |
162 | - header("Location: " . DOL_BASE_URI . "/install/index.php"); |
|
162 | + header("Location: ".DOL_BASE_URI."/install/index.php"); |
|
163 | 163 | exit; |
164 | 164 | } |
165 | 165 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { // This test must be after loading $_SESSION['token']. |
185 | 185 | if (DolUtils::GETPOST('token', 'alpha') != $_SESSION['token']) { |
186 | - DolUtils::dol_syslog("Invalid token in " . $_SERVER['HTTP_REFERER'] . ", action=" . DolUtils::GETPOST('action', 'aZ09') . ", _POST['token']=" . DolUtils::GETPOST('token', 'alpha') . ", _SESSION['token']=" . $_SESSION['token'], LOG_WARNING); |
|
186 | + DolUtils::dol_syslog("Invalid token in ".$_SERVER['HTTP_REFERER'].", action=".DolUtils::GETPOST('action', 'aZ09').", _POST['token']=".DolUtils::GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); |
|
187 | 187 | //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. |
188 | 188 | unset($_POST); |
189 | 189 | } |
@@ -261,19 +261,19 @@ discard block |
||
261 | 261 | $dol_use_jmobile = DolUtils::GETPOST('dol_use_jmobile', 'int', 3); |
262 | 262 | //dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,',')); |
263 | 263 | // If in demo mode, we check we go to home page through the public/demo/index.php page |
264 | - if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI . '/index.php') { // We ask index page |
|
264 | + if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI.'/index.php') { // We ask index page |
|
265 | 265 | if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/public/', $_SERVER['HTTP_REFERER'])) { |
266 | - DolUtils::dol_syslog("Call index page from another url than demo page (call is done from page " . $_SERVER['HTTP_REFERER'] . ")"); |
|
266 | + DolUtils::dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")"); |
|
267 | 267 | $url = ''; |
268 | - $url .= ($url ? '&' : '') . ($dol_hide_topmenu ? 'dol_hide_topmenu=' . $dol_hide_topmenu : ''); |
|
269 | - $url .= ($url ? '&' : '') . ($dol_hide_leftmenu ? 'dol_hide_leftmenu=' . $dol_hide_leftmenu : ''); |
|
270 | - $url .= ($url ? '&' : '') . ($dol_optimize_smallscreen ? 'dol_optimize_smallscreen=' . $dol_optimize_smallscreen : ''); |
|
271 | - $url .= ($url ? '&' : '') . ($dol_no_mouse_hover ? 'dol_no_mouse_hover=' . $dol_no_mouse_hover : ''); |
|
272 | - $url .= ($url ? '&' : '') . ($dol_use_jmobile ? 'dol_use_jmobile=' . $dol_use_jmobile : ''); |
|
273 | - $url = DOL_BASE_URI . '/public/demo/index.php' . ($url ? '?' . $url : ''); |
|
268 | + $url .= ($url ? '&' : '').($dol_hide_topmenu ? 'dol_hide_topmenu='.$dol_hide_topmenu : ''); |
|
269 | + $url .= ($url ? '&' : '').($dol_hide_leftmenu ? 'dol_hide_leftmenu='.$dol_hide_leftmenu : ''); |
|
270 | + $url .= ($url ? '&' : '').($dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$dol_optimize_smallscreen : ''); |
|
271 | + $url .= ($url ? '&' : '').($dol_no_mouse_hover ? 'dol_no_mouse_hover='.$dol_no_mouse_hover : ''); |
|
272 | + $url .= ($url ? '&' : '').($dol_use_jmobile ? 'dol_use_jmobile='.$dol_use_jmobile : ''); |
|
273 | + $url = DOL_BASE_URI.'/public/demo/index.php'.($url ? '?'.$url : ''); |
|
274 | 274 | echo $url; |
275 | 275 | throw Exception('x'); |
276 | - header("Location: " . $url); |
|
276 | + header("Location: ".$url); |
|
277 | 277 | exit; |
278 | 278 | } |
279 | 279 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $test = false; |
294 | 294 | |
295 | 295 | // Call trigger for the "security events" log |
296 | - Globals::$user->trigger_mesg = 'ErrorBadValueForCode - login=' . DolUtils::GETPOST("username", "alpha", 2); |
|
296 | + Globals::$user->trigger_mesg = 'ErrorBadValueForCode - login='.DolUtils::GETPOST("username", "alpha", 2); |
|
297 | 297 | // Call of triggers |
298 | 298 | //include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
299 | 299 | $interface = new Interfaces($db); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $action = ''; |
307 | 307 | Globals::$hookManager->initHooks(array('login')); |
308 | 308 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
309 | - $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
309 | + $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
310 | 310 | if ($reshook < 0) |
311 | 311 | $error++; |
312 | 312 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | } |
382 | 382 | |
383 | 383 | // Call trigger for the "security events" log |
384 | - Globals::$user->trigger_mesg = Globals::$langs->trans("ErrorBadLoginPassword") . ' - login=' . DolUtils::GETPOST("username", "alpha", 2); |
|
384 | + Globals::$user->trigger_mesg = Globals::$langs->trans("ErrorBadLoginPassword").' - login='.DolUtils::GETPOST("username", "alpha", 2); |
|
385 | 385 | |
386 | 386 | // Call of triggers |
387 | 387 | //include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $action = ''; |
396 | 396 | Globals::$hookManager->initHooks(array('login')); |
397 | 397 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
398 | - $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
398 | + $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
399 | 399 | if ($reshook < 0) { |
400 | 400 | $error++; |
401 | 401 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | // End test login / passwords |
408 | 408 | if (!$login || (in_array('ldap', $this->authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success. |
409 | 409 | // No data to test login, so we show the login page |
410 | - DolUtils::dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit"); |
|
410 | + DolUtils::dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." showing the login form and exit"); |
|
411 | 411 | if (defined('NOREDIRECTBYMAINTOLOGIN')) { |
412 | 412 | return 'ERROR_NOT_LOGGED'; |
413 | 413 | } else { |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | DolUtils::dol_syslog('User not found, connexion refused'); |
423 | 423 | session_destroy(); |
424 | 424 | session_name($sessionname); |
425 | - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
426 | - session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
425 | + session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
426 | + session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
427 | 427 | |
428 | 428 | if ($resultFetchUser == 0) { |
429 | 429 | // Load translation files required by page |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | |
432 | 432 | $_SESSION["dol_loginmesg"] = Globals::$langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login); |
433 | 433 | |
434 | - Globals::$user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login; |
|
434 | + Globals::$user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; |
|
435 | 435 | } |
436 | 436 | if ($resultFetchUser < 0) { |
437 | 437 | $_SESSION["dol_loginmesg"] = Globals::$user->error; |
@@ -451,40 +451,40 @@ discard block |
||
451 | 451 | $action = ''; |
452 | 452 | Globals::$hookManager->initHooks(array('login')); |
453 | 453 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
454 | - $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
454 | + $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
455 | 455 | if ($reshook < 0) { |
456 | 456 | $error++; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $paramsurl = array(); |
460 | 460 | if (DolUtils::GETPOST('textbrowser', 'int')) { |
461 | - $paramsurl[] = 'textbrowser=' . DolUtils::GETPOST('textbrowser', 'int'); |
|
461 | + $paramsurl[] = 'textbrowser='.DolUtils::GETPOST('textbrowser', 'int'); |
|
462 | 462 | } |
463 | 463 | if (DolUtils::GETPOST('nojs', 'int')) { |
464 | - $paramsurl[] = 'nojs=' . DolUtils::GETPOST('nojs', 'int'); |
|
464 | + $paramsurl[] = 'nojs='.DolUtils::GETPOST('nojs', 'int'); |
|
465 | 465 | } |
466 | 466 | if (DolUtils::GETPOST('lang', 'aZ09')) { |
467 | - $paramsurl[] = 'lang=' . DolUtils::GETPOST('lang', 'aZ09'); |
|
467 | + $paramsurl[] = 'lang='.DolUtils::GETPOST('lang', 'aZ09'); |
|
468 | 468 | } |
469 | - echo 'Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''); |
|
469 | + echo 'Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''); |
|
470 | 470 | throw Exception('x'); |
471 | - header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : '')); |
|
471 | + header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); |
|
472 | 472 | exit; |
473 | 473 | } |
474 | 474 | } else { |
475 | 475 | // We are already into an authenticated session |
476 | 476 | $login = $_SESSION["dol_login"]; |
477 | 477 | $entity = $_SESSION["dol_entity"]; |
478 | - DolUtils::dol_syslog("- This is an already logged session. _SESSION['dol_login']=" . $login . " _SESSION['dol_entity']=" . $entity, LOG_DEBUG); |
|
478 | + DolUtils::dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); |
|
479 | 479 | |
480 | 480 | $resultFetchUser = Globals::$user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1)); |
481 | 481 | if ($resultFetchUser <= 0) { |
482 | 482 | // Account has been removed after login |
483 | - DolUtils::dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=" . $login, LOG_WARNING); |
|
483 | + DolUtils::dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); |
|
484 | 484 | session_destroy(); |
485 | 485 | session_name($sessionname); |
486 | - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
487 | - session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
486 | + session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
487 | + session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
488 | 488 | |
489 | 489 | if ($resultFetchUser == 0) { |
490 | 490 | // Load translation files required by page |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | |
493 | 493 | $_SESSION["dol_loginmesg"] = Globals::$langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login); |
494 | 494 | |
495 | - Globals::$user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login; |
|
495 | + Globals::$user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; |
|
496 | 496 | } |
497 | 497 | if ($resultFetchUser < 0) { |
498 | 498 | $_SESSION["dol_loginmesg"] = Globals::$user->error; |
@@ -512,24 +512,24 @@ discard block |
||
512 | 512 | $action = ''; |
513 | 513 | Globals::$hookManager->initHooks(array('login')); |
514 | 514 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
515 | - $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
515 | + $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
516 | 516 | if ($reshook < 0) { |
517 | 517 | $error++; |
518 | 518 | } |
519 | 519 | |
520 | 520 | $paramsurl = array(); |
521 | 521 | if (DolUtils::GETPOST('textbrowser', 'int')) { |
522 | - $paramsurl[] = 'textbrowser=' . DolUtils::GETPOST('textbrowser', 'int'); |
|
522 | + $paramsurl[] = 'textbrowser='.DolUtils::GETPOST('textbrowser', 'int'); |
|
523 | 523 | } |
524 | 524 | if (DolUtils::GETPOST('nojs', 'int')) { |
525 | - $paramsurl[] = 'nojs=' . DolUtils::GETPOST('nojs', 'int'); |
|
525 | + $paramsurl[] = 'nojs='.DolUtils::GETPOST('nojs', 'int'); |
|
526 | 526 | } |
527 | 527 | if (DolUtils::GETPOST('lang', 'aZ09')) { |
528 | - $paramsurl[] = 'lang=' . DolUtils::GETPOST('lang', 'aZ09'); |
|
528 | + $paramsurl[] = 'lang='.DolUtils::GETPOST('lang', 'aZ09'); |
|
529 | 529 | } |
530 | - echo 'Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''); |
|
530 | + echo 'Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''); |
|
531 | 531 | throw Exception('x'); |
532 | - header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : '')); |
|
532 | + header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); |
|
533 | 533 | exit; |
534 | 534 | } else { |
535 | 535 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
@@ -538,30 +538,30 @@ discard block |
||
538 | 538 | // Code for search criteria persistence. |
539 | 539 | if (!empty($_GET['save_lastsearch_values'])) { // We must use $_GET here |
540 | 540 | $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]); |
541 | - $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server |
|
541 | + $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server |
|
542 | 542 | // Clean $relativepathstring |
543 | 543 | if (constant('DOL_BASE_URI')) { |
544 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
544 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring); |
|
545 | 545 | } |
546 | 546 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
547 | 547 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
548 | 548 | //var_dump($relativepathstring); |
549 | 549 | // 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 |
550 | - if (!empty($_SESSION['lastsearch_values_tmp_' . $relativepathstring])) { |
|
551 | - $_SESSION['lastsearch_values_' . $relativepathstring] = $_SESSION['lastsearch_values_tmp_' . $relativepathstring]; |
|
552 | - unset($_SESSION['lastsearch_values_tmp_' . $relativepathstring]); |
|
550 | + if (!empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) { |
|
551 | + $_SESSION['lastsearch_values_'.$relativepathstring] = $_SESSION['lastsearch_values_tmp_'.$relativepathstring]; |
|
552 | + unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); |
|
553 | 553 | } |
554 | - if (!empty($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring])) { |
|
555 | - $_SESSION['lastsearch_contextpage_' . $relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]; |
|
556 | - unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]); |
|
554 | + if (!empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) { |
|
555 | + $_SESSION['lastsearch_contextpage_'.$relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; |
|
556 | + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); |
|
557 | 557 | } |
558 | - if (!empty($_SESSION['lastsearch_page_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_page_tmp_' . $relativepathstring] > 1) { |
|
559 | - $_SESSION['lastsearch_page_' . $relativepathstring] = $_SESSION['lastsearch_page_tmp_' . $relativepathstring]; |
|
560 | - unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]); |
|
558 | + if (!empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) { |
|
559 | + $_SESSION['lastsearch_page_'.$relativepathstring] = $_SESSION['lastsearch_page_tmp_'.$relativepathstring]; |
|
560 | + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); |
|
561 | 561 | } |
562 | - if (!empty($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] != Globals::$conf->liste_limit) { |
|
563 | - $_SESSION['lastsearch_limit_' . $relativepathstring] = $_SESSION['lastsearch_limit_tmp_' . $relativepathstring]; |
|
564 | - unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]); |
|
562 | + if (!empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != Globals::$conf->liste_limit) { |
|
563 | + $_SESSION['lastsearch_limit_'.$relativepathstring] = $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]; |
|
564 | + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); |
|
565 | 565 | } |
566 | 566 | } |
567 | 567 | |
@@ -609,13 +609,13 @@ discard block |
||
609 | 609 | $_SESSION['dol_use_jmobile'] = $dol_use_jmobile; |
610 | 610 | } |
611 | 611 | |
612 | - DolUtils::dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id()); |
|
612 | + DolUtils::dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"]." Session id=".session_id()); |
|
613 | 613 | |
614 | 614 | $db->begin(); |
615 | 615 | |
616 | 616 | Globals::$user->update_last_login_date(); |
617 | 617 | |
618 | - $loginfo = 'TZ=' . $_SESSION["dol_tz"] . ';TZString=' . $_SESSION["dol_tz_string"] . ';Screen=' . $_SESSION["dol_screenwidth"] . 'x' . $_SESSION["dol_screenheight"]; |
|
618 | + $loginfo = 'TZ='.$_SESSION["dol_tz"].';TZString='.$_SESSION["dol_tz_string"].';Screen='.$_SESSION["dol_screenwidth"].'x'.$_SESSION["dol_screenheight"]; |
|
619 | 619 | |
620 | 620 | // Call triggers for the "security events" log |
621 | 621 | Globals::$user->trigger_mesg = $loginfo; |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | $action = ''; |
632 | 632 | Globals::$hookManager->initHooks(array('login')); |
633 | 633 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginfo' => $loginfo); |
634 | - $reshook = Globals::$hookManager->executeHooks('afterLogin', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
634 | + $reshook = Globals::$hookManager->executeHooks('afterLogin', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
635 | 635 | if ($reshook < 0) { |
636 | 636 | $error++; |
637 | 637 | } |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | if ($_SERVER["PHP_SELF"] != $newpath) { // not already on landing page (avoid infinite loop) |
653 | 653 | echo $newpath; |
654 | 654 | throw Exception('x'); |
655 | - header('Location: ' . $newpath); |
|
655 | + header('Location: '.$newpath); |
|
656 | 656 | exit; |
657 | 657 | } |
658 | 658 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | if (empty(Globals::$conf->global->MAIN_FORCETHEME) && !empty(Globals::$user->conf->MAIN_THEME)) { |
685 | 685 | Globals::$conf->theme = Globals::$user->conf->MAIN_THEME; |
686 | 686 | // Globals::$conf->css = "/theme/" . Globals::$conf->theme . "/style.css.php"; |
687 | - Globals::$conf->css = '?controller=theme/' . Globals::$conf->theme . '&method=style.css'; |
|
687 | + Globals::$conf->css = '?controller=theme/'.Globals::$conf->theme.'&method=style.css'; |
|
688 | 688 | } |
689 | 689 | } |
690 | 690 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | if (DolUtils::GETPOST('theme', 'alpha')) { |
693 | 693 | Globals::$conf->theme = DolUtils::GETPOST('theme', 'alpha', 1); |
694 | 694 | // Globals::$conf->css = "/theme/" . Globals::$conf->theme . "/style.css.php"; |
695 | - Globals::$conf->css = '?controller=theme/' . Globals::$conf->theme . '&method=style.css'; |
|
695 | + Globals::$conf->css = '?controller=theme/'.Globals::$conf->theme.'&method=style.css'; |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | if (!empty(Globals::$conf->dol_use_jmobile) && in_array(Globals::$conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) { |
743 | 743 | Globals::$conf->theme = 'eldy'; |
744 | 744 | // Globals::$conf->css = "/theme/" . Globals::$conf->theme . "/style.css.php"; |
745 | - Globals::$conf->css = '?controller=theme/' . Globals::$conf->theme . '&method=style.css'; |
|
745 | + Globals::$conf->css = '?controller=theme/'.Globals::$conf->theme.'&method=style.css'; |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | if (!defined('NOREQUIRETRAN')) { |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | } |
780 | 780 | |
781 | 781 | |
782 | - DolUtils::dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . ' - action=' . DolUtils::GETPOST('action', 'az09') . ', massaction=' . DolUtils::GETPOST('massaction', 'az09')); |
|
782 | + DolUtils::dol_syslog("--- Access to ".$_SERVER["PHP_SELF"].' - action='.DolUtils::GETPOST('action', 'az09').', massaction='.DolUtils::GETPOST('massaction', 'az09')); |
|
783 | 783 | //Another call for easy debugg |
784 | 784 | //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST)); |
785 | 785 | // Load main languages files |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | // Define some constants used for style of arrays |
792 | 792 | $bc = array(0 => 'class="impair"', 1 => 'class="pair"'); |
793 | 793 | $bcdd = array(0 => 'class="drag drop oddeven"', 1 => 'class="drag drop oddeven"'); |
794 | - $bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines |
|
794 | + $bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines |
|
795 | 795 | $bctag = array(0 => 'class="impair tagtr"', 1 => 'class="pair tagtr"'); |
796 | 796 | |
797 | 797 | // Define messages variables |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | // Load the menu manager (only if not already done) |
840 | 840 | $file_menu = Globals::$conf->standard_menu; |
841 | 841 | if (DolUtils::GETPOST('menu', 'alpha')) { |
842 | - $file_menu = DolUtils::GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php |
|
842 | + $file_menu = DolUtils::GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php |
|
843 | 843 | } |
844 | 844 | if (!class_exists('MenuManager')) { |
845 | 845 | $menufound = 0; |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | } |
852 | 852 | } |
853 | 853 | if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php |
854 | - DolUtils::dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING); |
|
854 | + DolUtils::dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING); |
|
855 | 855 | $file_menu = 'eldy_menu.php'; |
856 | 856 | // include_once DOL_DOCUMENT_ROOT . "/core/menus/standard/" . $file_menu; |
857 | 857 | } |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | |
896 | 896 | // This is to make Dolibarr working with Plesk |
897 | 897 | if (!empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') { |
898 | - set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs'); |
|
898 | + set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | // If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it. |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | $tmplist = explode(',', $tmpautoset[1]); |
907 | 907 | $cookiearrayvalue = array(); |
908 | 908 | foreach ($tmplist as $tmpkey) { |
909 | - $postkey = $tmpautoset[0] . '_' . $tmpkey; |
|
909 | + $postkey = $tmpautoset[0].'_'.$tmpkey; |
|
910 | 910 | //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]); |
911 | 911 | if (!empty($_POST[$postkey])) { |
912 | 912 | $cookiearrayvalue[$tmpkey] = $_POST[$postkey]; |
@@ -967,8 +967,8 @@ discard block |
||
967 | 967 | $inj += preg_match('/insert\s+into/i', $val); |
968 | 968 | $inj += preg_match('/select\s+from/i', $val); |
969 | 969 | $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val); |
970 | - $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login |
|
971 | - $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database |
|
970 | + $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login |
|
971 | + $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database |
|
972 | 972 | } |
973 | 973 | if ($type == 3) { |
974 | 974 | $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val); |
@@ -992,15 +992,15 @@ discard block |
||
992 | 992 | $inj += preg_match('/<style/i', $val); |
993 | 993 | } |
994 | 994 | $inj += preg_match('/base[\s]+href/si', $val); |
995 | - $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)> |
|
996 | - $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)> |
|
997 | - $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)> |
|
998 | - $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)> |
|
999 | - $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)> |
|
1000 | - $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)> |
|
1001 | - $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea |
|
995 | + $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)> |
|
996 | + $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)> |
|
997 | + $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)> |
|
998 | + $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)> |
|
999 | + $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)> |
|
1000 | + $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)> |
|
1001 | + $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea |
|
1002 | 1002 | //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val); // To lock event handlers onAbort(), ... |
1003 | - $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' |
|
1003 | + $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' |
|
1004 | 1004 | //if ($type == 1) |
1005 | 1005 | //{ |
1006 | 1006 | $inj += preg_match('/javascript:/i', $val); |
@@ -1008,10 +1008,10 @@ discard block |
||
1008 | 1008 | //} |
1009 | 1009 | // For XSS Injection done by adding javascript closing html tags like with onmousemove, etc... (closing a src or href tag with not cleaned param) |
1010 | 1010 | if ($type == 1) { |
1011 | - $inj += preg_match('/"/i', $val); // We refused " in GET parameters value |
|
1011 | + $inj += preg_match('/"/i', $val); // We refused " in GET parameters value |
|
1012 | 1012 | } |
1013 | 1013 | if ($type == 2) { |
1014 | - $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces. |
|
1014 | + $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces. |
|
1015 | 1015 | } |
1016 | 1016 | return $inj; |
1017 | 1017 | } |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | if ($this->analyseVarsForSqlAndScriptsInjection($key, $type) && $this->analyseVarsForSqlAndScriptsInjection($value, $type)) { |
1031 | 1031 | //$var[$key] = $value; // This is useless |
1032 | 1032 | } else { |
1033 | - 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"]) . ')'; |
|
1033 | + 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"]).')'; |
|
1034 | 1034 | exit; |
1035 | 1035 | } |
1036 | 1036 | } |
@@ -307,8 +307,9 @@ |
||
307 | 307 | Globals::$hookManager->initHooks(array('login')); |
308 | 308 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
309 | 309 | $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
310 | - if ($reshook < 0) |
|
311 | - $error++; |
|
310 | + if ($reshook < 0) { |
|
311 | + $error++; |
|
312 | + } |
|
312 | 313 | |
313 | 314 | // Note: exit is done later |
314 | 315 | } |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | // private $db; |
42 | 42 | |
43 | 43 | /** |
44 | - * @var string Error code (or message) |
|
45 | - */ |
|
46 | - public $error; |
|
44 | + * @var string Error code (or message) |
|
45 | + */ |
|
46 | + public $error; |
|
47 | 47 | |
48 | 48 | |
49 | 49 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $sql = "SELECT rowid, label"; |
75 | 75 | $sql.= " FROM ".MAIN_DB_PREFIX."export_model"; |
76 | 76 | $sql.= " WHERE type = '".$type."'"; |
77 | - if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user; |
|
77 | + if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user; |
|
78 | 78 | $sql.= " ORDER BY rowid"; |
79 | 79 | $result = $this->db->query($sql); |
80 | 80 | if ($result) |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $sql.= " WHERE e.active = 1 AND e.fk_pays = c.rowid"; |
181 | 181 | $sql.= " ORDER BY country, e.organization ASC, e.code ASC"; |
182 | 182 | |
183 | - dol_syslog(get_class($this).'::select_ecotaxes', LOG_DEBUG); |
|
183 | + dol_syslog(get_class($this).'::select_ecotaxes', LOG_DEBUG); |
|
184 | 184 | $resql=$this->db->query($sql); |
185 | 185 | if ($resql) |
186 | 186 | { |
@@ -231,50 +231,50 @@ discard block |
||
231 | 231 | function select_revenue_stamp($selected='', $htmlname='revenuestamp', $country_code='') |
232 | 232 | { |
233 | 233 | // phpcs:enable |
234 | - global $langs; |
|
235 | - |
|
236 | - $out=''; |
|
237 | - |
|
238 | - $sql = "SELECT r.taux, r.revenuestamp_type"; |
|
239 | - $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c"; |
|
240 | - $sql.= " WHERE r.active = 1 AND r.fk_pays = c.rowid"; |
|
241 | - $sql.= " AND c.code = '".$country_code."'"; |
|
242 | - |
|
243 | - dol_syslog(get_class($this).'::select_revenue_stamp', LOG_DEBUG); |
|
244 | - $resql=$this->db->query($sql); |
|
245 | - if ($resql) |
|
246 | - { |
|
247 | - $out.='<select class="flat" name="'.$htmlname.'">'; |
|
248 | - $num = $this->db->num_rows($resql); |
|
249 | - $i = 0; |
|
250 | - $out.='<option value="0"> </option>'."\n"; |
|
251 | - if ($num) |
|
252 | - { |
|
253 | - while ($i < $num) |
|
254 | - { |
|
255 | - $obj = $this->db->fetch_object($resql); |
|
256 | - if (($selected && $selected == $obj->taux) || $num == 1) |
|
257 | - { |
|
258 | - $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>'; |
|
259 | - } |
|
260 | - else |
|
261 | - { |
|
262 | - $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>'; |
|
263 | - //print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">'; |
|
264 | - } |
|
265 | - $out.=$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : ''); |
|
266 | - $out.='</option>'; |
|
267 | - $i++; |
|
268 | - } |
|
269 | - } |
|
270 | - $out.='</select>'; |
|
271 | - return $out; |
|
272 | - } |
|
273 | - else |
|
274 | - { |
|
275 | - dol_print_error($this->db); |
|
276 | - return ''; |
|
277 | - } |
|
234 | + global $langs; |
|
235 | + |
|
236 | + $out=''; |
|
237 | + |
|
238 | + $sql = "SELECT r.taux, r.revenuestamp_type"; |
|
239 | + $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c"; |
|
240 | + $sql.= " WHERE r.active = 1 AND r.fk_pays = c.rowid"; |
|
241 | + $sql.= " AND c.code = '".$country_code."'"; |
|
242 | + |
|
243 | + dol_syslog(get_class($this).'::select_revenue_stamp', LOG_DEBUG); |
|
244 | + $resql=$this->db->query($sql); |
|
245 | + if ($resql) |
|
246 | + { |
|
247 | + $out.='<select class="flat" name="'.$htmlname.'">'; |
|
248 | + $num = $this->db->num_rows($resql); |
|
249 | + $i = 0; |
|
250 | + $out.='<option value="0"> </option>'."\n"; |
|
251 | + if ($num) |
|
252 | + { |
|
253 | + while ($i < $num) |
|
254 | + { |
|
255 | + $obj = $this->db->fetch_object($resql); |
|
256 | + if (($selected && $selected == $obj->taux) || $num == 1) |
|
257 | + { |
|
258 | + $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>'; |
|
259 | + } |
|
260 | + else |
|
261 | + { |
|
262 | + $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>'; |
|
263 | + //print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">'; |
|
264 | + } |
|
265 | + $out.=$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : ''); |
|
266 | + $out.='</option>'; |
|
267 | + $i++; |
|
268 | + } |
|
269 | + } |
|
270 | + $out.='</select>'; |
|
271 | + return $out; |
|
272 | + } |
|
273 | + else |
|
274 | + { |
|
275 | + dol_print_error($this->db); |
|
276 | + return ''; |
|
277 | + } |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | } |
370 | 370 | if ($nocateg) |
371 | 371 | { |
372 | - $langs->load("categories"); |
|
373 | - $moreforfilter.='<option value="-2"'.($selected == -2 ? ' selected':'').'>- '.$langs->trans("NotCategorized").' -</option>'; |
|
372 | + $langs->load("categories"); |
|
373 | + $moreforfilter.='<option value="-2"'.($selected == -2 ? ' selected':'').'>- '.$langs->trans("NotCategorized").' -</option>'; |
|
374 | 374 | } |
375 | 375 | $moreforfilter.='</select>'; |
376 | 376 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $comboenhancement = ajax_combobox($htmlname); |
406 | 406 | if ($comboenhancement) |
407 | 407 | { |
408 | - $out.=$comboenhancement; |
|
408 | + $out.=$comboenhancement; |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | // Select each sales and print them in a select input |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")"; |
428 | 428 | $sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id; |
429 | 429 | } |
430 | - $sql_usr.= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. |
|
430 | + $sql_usr.= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. |
|
431 | 431 | //print $sql_usr;exit; |
432 | 432 | |
433 | 433 | $resql_usr = $this->db->query($sql_usr); |
@@ -451,18 +451,18 @@ discard block |
||
451 | 451 | } |
452 | 452 | if ($showstatus >= 0) |
453 | 453 | { |
454 | - if ($obj_usr->statut == 1 && $showstatus == 1) |
|
455 | - { |
|
456 | - $out.=($moreinfo?' - ':' (').$langs->trans('Enabled'); |
|
457 | - $moreinfo++; |
|
458 | - } |
|
459 | - if ($obj_usr->statut == 0) |
|
460 | - { |
|
461 | - $out.=($moreinfo?' - ':' (').$langs->trans('Disabled'); |
|
462 | - $moreinfo++; |
|
463 | - } |
|
464 | - } |
|
465 | - $out.=($moreinfo?')':''); |
|
454 | + if ($obj_usr->statut == 1 && $showstatus == 1) |
|
455 | + { |
|
456 | + $out.=($moreinfo?' - ':' (').$langs->trans('Enabled'); |
|
457 | + $moreinfo++; |
|
458 | + } |
|
459 | + if ($obj_usr->statut == 0) |
|
460 | + { |
|
461 | + $out.=($moreinfo?' - ':' (').$langs->trans('Disabled'); |
|
462 | + $moreinfo++; |
|
463 | + } |
|
464 | + } |
|
465 | + $out.=($moreinfo?')':''); |
|
466 | 466 | $out.='</option>'; |
467 | 467 | } |
468 | 468 | $this->db->free($resql_usr); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists |
488 | 488 | * @param int $useempty 0=Allow empty values |
489 | 489 | * @param int $disablechildoftaskid 1=Disable task that are child of the provided task id |
490 | - * @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated status) |
|
490 | + * @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated status) |
|
491 | 491 | * @param string $morecss More css |
492 | 492 | * @return void |
493 | 493 | */ |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode, '', $filteronprojstatus); |
503 | 503 | if ($tasksarray) |
504 | 504 | { |
505 | - print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
505 | + print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
506 | 506 | if ($useempty) print '<option value="0"> </option>'; |
507 | 507 | $j=0; |
508 | 508 | $level=0; |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | $numlines=count($lines); |
539 | 539 | for ($i = 0 ; $i < $numlines ; $i++) |
540 | 540 | { |
541 | - if ($lines[$i]->fk_parent == $parent) |
|
541 | + if ($lines[$i]->fk_parent == $parent) |
|
542 | 542 | { |
543 | 543 | $var = !$var; |
544 | 544 | |
545 | - //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines |
|
545 | + //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines |
|
546 | 546 | |
547 | 547 | // Break on a new project |
548 | 548 | if ($parent == 0) // We are on a task at first level |
@@ -575,13 +575,13 @@ discard block |
||
575 | 575 | // Print task |
576 | 576 | if (isset($lines[$i]->id)) // We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0 |
577 | 577 | { |
578 | - // Check if we must disable entry |
|
579 | - $disabled=0; |
|
580 | - if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid))) |
|
581 | - { |
|
582 | - $disabled++; |
|
583 | - if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid=$lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too |
|
584 | - } |
|
578 | + // Check if we must disable entry |
|
579 | + $disabled=0; |
|
580 | + if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid))) |
|
581 | + { |
|
582 | + $disabled++; |
|
583 | + if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid=$lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too |
|
584 | + } |
|
585 | 585 | |
586 | 586 | print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"'; |
587 | 587 | if (($lines[$i]->id == $selectedtask) || ($lines[$i]->fk_project.'_'.$lines[$i]->id == $selectedtask)) print ' selected'; |
@@ -624,14 +624,14 @@ discard block |
||
624 | 624 | */ |
625 | 625 | static function showColor($color, $textifnotdefined='') |
626 | 626 | { |
627 | - $textcolor='FFF'; |
|
628 | - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
629 | - if(colorIsLight($color)) $textcolor='000'; |
|
627 | + $textcolor='FFF'; |
|
628 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
629 | + if(colorIsLight($color)) $textcolor='000'; |
|
630 | 630 | |
631 | - $color = colorArrayToHex(colorStringToArray($color,array()),''); |
|
631 | + $color = colorArrayToHex(colorStringToArray($color,array()),''); |
|
632 | 632 | |
633 | - if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">'; |
|
634 | - else print $textifnotdefined; |
|
633 | + if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">'; |
|
634 | + else print $textifnotdefined; |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='') |
651 | 651 | { |
652 | 652 | // phpcs:enable |
653 | - print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors); |
|
653 | + print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | /** |
@@ -667,10 +667,10 @@ discard block |
||
667 | 667 | */ |
668 | 668 | static function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='') |
669 | 669 | { |
670 | - // Deprecation warning |
|
671 | - if ($form_name) { |
|
672 | - dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING); |
|
673 | - } |
|
670 | + // Deprecation warning |
|
671 | + if ($form_name) { |
|
672 | + dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING); |
|
673 | + } |
|
674 | 674 | |
675 | 675 | global $langs,$conf; |
676 | 676 | |
@@ -681,9 +681,9 @@ discard block |
||
681 | 681 | $langs->load("other"); |
682 | 682 | if (empty($conf->dol_use_jmobile)) |
683 | 683 | { |
684 | - $out.= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />'; |
|
685 | - $out.= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>'; |
|
686 | - $out.= '<script type="text/javascript"> |
|
684 | + $out.= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />'; |
|
685 | + $out.= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>'; |
|
686 | + $out.= '<script type="text/javascript"> |
|
687 | 687 | jQuery(document).ready(function(){ |
688 | 688 | $(\'#colorpicker'.$prefix.'\').jPicker( { |
689 | 689 | window: { |
@@ -727,9 +727,9 @@ discard block |
||
727 | 727 | { |
728 | 728 | if (empty($conf->dol_use_jmobile)) |
729 | 729 | { |
730 | - $out.= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />'; |
|
731 | - $out.= '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>'; |
|
732 | - $out.= '<script type="text/javascript"> |
|
730 | + $out.= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />'; |
|
731 | + $out.= '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>'; |
|
732 | + $out.= '<script type="text/javascript"> |
|
733 | 733 | jQuery(document).ready(function(){ |
734 | 734 | jQuery(\'#colorpicker'.$prefix.'\').colorpicker({ |
735 | 735 | size: 14, |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >'; |
931 | 931 | if($useempty) |
932 | 932 | { |
933 | - $selected_html=''; |
|
933 | + $selected_html=''; |
|
934 | 934 | if ($selected == '') $selected_html = ' selected'; |
935 | 935 | $out.= '<option value=""' . $selected_html . '> </option>'; |
936 | 936 | } |
@@ -1029,55 +1029,55 @@ discard block |
||
1029 | 1029 | $boxidactivatedforuser=array(); |
1030 | 1030 | foreach($boxactivated as $box) |
1031 | 1031 | { |
1032 | - if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user |
|
1032 | + if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | // Define selectboxlist |
1036 | 1036 | $arrayboxtoactivatelabel=array(); |
1037 | 1037 | if (! empty($user->conf->$confuserzone)) |
1038 | 1038 | { |
1039 | - $boxorder=''; |
|
1040 | - $langs->load("boxes"); // Load label of boxes |
|
1041 | - foreach($boxactivated as $box) |
|
1042 | - { |
|
1043 | - if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user |
|
1044 | - $label=$langs->transnoentitiesnoconv($box->boxlabel); |
|
1045 | - //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; |
|
1046 | - if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone') |
|
1047 | - { |
|
1048 | - $label=$label.' <span class="fa fa-bar-chart"></span>'; |
|
1049 | - } |
|
1050 | - $arrayboxtoactivatelabel[$box->id]=$label; // We keep only boxes not shown for user, to show into combo list |
|
1051 | - } |
|
1039 | + $boxorder=''; |
|
1040 | + $langs->load("boxes"); // Load label of boxes |
|
1041 | + foreach($boxactivated as $box) |
|
1042 | + { |
|
1043 | + if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user |
|
1044 | + $label=$langs->transnoentitiesnoconv($box->boxlabel); |
|
1045 | + //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; |
|
1046 | + if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone') |
|
1047 | + { |
|
1048 | + $label=$label.' <span class="fa fa-bar-chart"></span>'; |
|
1049 | + } |
|
1050 | + $arrayboxtoactivatelabel[$box->id]=$label; // We keep only boxes not shown for user, to show into combo list |
|
1051 | + } |
|
1052 | 1052 | foreach($boxidactivatedforuser as $boxid) |
1053 | - { |
|
1054 | - if (empty($boxorder)) $boxorder.='A:'; |
|
1055 | - $boxorder.=$boxid.','; |
|
1056 | - } |
|
1057 | - |
|
1058 | - //var_dump($boxidactivatedforuser); |
|
1059 | - |
|
1060 | - // Class Form must have been already loaded |
|
1061 | - $selectboxlist.='<!-- Form with select box list -->'."\n"; |
|
1062 | - $selectboxlist.='<form id="addbox" name="addbox" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
1063 | - $selectboxlist.='<input type="hidden" name="addbox" value="addbox">'; |
|
1064 | - $selectboxlist.='<input type="hidden" name="userid" value="'.$user->id.'">'; |
|
1065 | - $selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">'; |
|
1066 | - $selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">'; |
|
1067 | - $selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1); |
|
1053 | + { |
|
1054 | + if (empty($boxorder)) $boxorder.='A:'; |
|
1055 | + $boxorder.=$boxid.','; |
|
1056 | + } |
|
1057 | + |
|
1058 | + //var_dump($boxidactivatedforuser); |
|
1059 | + |
|
1060 | + // Class Form must have been already loaded |
|
1061 | + $selectboxlist.='<!-- Form with select box list -->'."\n"; |
|
1062 | + $selectboxlist.='<form id="addbox" name="addbox" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
1063 | + $selectboxlist.='<input type="hidden" name="addbox" value="addbox">'; |
|
1064 | + $selectboxlist.='<input type="hidden" name="userid" value="'.$user->id.'">'; |
|
1065 | + $selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">'; |
|
1066 | + $selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">'; |
|
1067 | + $selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1); |
|
1068 | 1068 | if (empty($conf->use_javascript_ajax)) $selectboxlist.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">'; |
1069 | 1069 | $selectboxlist.='</form>'; |
1070 | 1070 | if (! empty($conf->use_javascript_ajax)) |
1071 | 1071 | { |
1072 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1073 | - $selectboxlist.=ajax_combobox("boxcombo"); |
|
1072 | + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1073 | + $selectboxlist.=ajax_combobox("boxcombo"); |
|
1074 | 1074 | } |
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | // Javascript code for dynamic actions |
1078 | 1078 | if (! empty($conf->use_javascript_ajax)) |
1079 | 1079 | { |
1080 | - $selectboxlist.='<script type="text/javascript" language="javascript"> |
|
1080 | + $selectboxlist.='<script type="text/javascript" language="javascript"> |
|
1081 | 1081 | |
1082 | 1082 | // To update list of activated boxes |
1083 | 1083 | function updateBoxOrder(closing) { |
@@ -1116,8 +1116,8 @@ discard block |
||
1116 | 1116 | window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=addbox&boxid=\'+boxid; |
1117 | 1117 | } |
1118 | 1118 | });'; |
1119 | - if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();'; |
|
1120 | - $selectboxlist.=' |
|
1119 | + if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();'; |
|
1120 | + $selectboxlist.=' |
|
1121 | 1121 | |
1122 | 1122 | jQuery("#boxhalfleft, #boxhalfright").sortable({ |
1123 | 1123 | handle: \'.boxhandle\', |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | |
1143 | 1143 | });'."\n"; |
1144 | 1144 | |
1145 | - $selectboxlist.='</script>'."\n"; |
|
1145 | + $selectboxlist.='</script>'."\n"; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | // Define boxlista and boxlistb |
@@ -1150,10 +1150,10 @@ discard block |
||
1150 | 1150 | |
1151 | 1151 | if ($nbboxactivated) |
1152 | 1152 | { |
1153 | - // Load translation files required by the page |
|
1153 | + // Load translation files required by the page |
|
1154 | 1154 | $langs->loadLangs(array("boxes","projects")); |
1155 | 1155 | |
1156 | - $emptybox=new ModeleBoxes($db); |
|
1156 | + $emptybox=new ModeleBoxes($db); |
|
1157 | 1157 | |
1158 | 1158 | $boxlista.="\n<!-- Box left container -->\n"; |
1159 | 1159 | |
@@ -1164,9 +1164,9 @@ discard block |
||
1164 | 1164 | $ii=0; |
1165 | 1165 | foreach ($boxactivated as $key => $box) |
1166 | 1166 | { |
1167 | - if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1168 | - if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='A'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1169 | - if (preg_match('/^A/i',$box->box_order)) // column A |
|
1167 | + if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1168 | + if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='A'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1169 | + if (preg_match('/^A/i',$box->box_order)) // column A |
|
1170 | 1170 | { |
1171 | 1171 | $ii++; |
1172 | 1172 | //print 'box_id '.$boxactivated[$ii]->box_id.' '; |
@@ -1179,10 +1179,10 @@ discard block |
||
1179 | 1179 | |
1180 | 1180 | if ($conf->browser->layout != 'phone') |
1181 | 1181 | { |
1182 | - $emptybox->box_id='A'; |
|
1183 | - $emptybox->info_box_head=array(); |
|
1184 | - $emptybox->info_box_contents=array(); |
|
1185 | - $boxlista.= $emptybox->outputBox(array(),array()); |
|
1182 | + $emptybox->box_id='A'; |
|
1183 | + $emptybox->info_box_head=array(); |
|
1184 | + $emptybox->info_box_contents=array(); |
|
1185 | + $boxlista.= $emptybox->outputBox(array(),array()); |
|
1186 | 1186 | } |
1187 | 1187 | $boxlista.= "<!-- End box left container -->\n"; |
1188 | 1188 | |
@@ -1191,9 +1191,9 @@ discard block |
||
1191 | 1191 | $ii=0; |
1192 | 1192 | foreach ($boxactivated as $key => $box) |
1193 | 1193 | { |
1194 | - if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1195 | - if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1196 | - if (preg_match('/^B/i',$box->box_order)) // colonne B |
|
1194 | + if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1195 | + if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1196 | + if (preg_match('/^B/i',$box->box_order)) // colonne B |
|
1197 | 1197 | { |
1198 | 1198 | $ii++; |
1199 | 1199 | //print 'box_id '.$boxactivated[$ii]->box_id.' '; |
@@ -1206,10 +1206,10 @@ discard block |
||
1206 | 1206 | |
1207 | 1207 | if ($conf->browser->layout != 'phone') |
1208 | 1208 | { |
1209 | - $emptybox->box_id='B'; |
|
1210 | - $emptybox->info_box_head=array(); |
|
1211 | - $emptybox->info_box_contents=array(); |
|
1212 | - $boxlistb.= $emptybox->outputBox(array(),array()); |
|
1209 | + $emptybox->box_id='B'; |
|
1210 | + $emptybox->info_box_head=array(); |
|
1211 | + $emptybox->info_box_contents=array(); |
|
1212 | + $boxlistb.= $emptybox->outputBox(array(),array()); |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | $boxlistb.= "<!-- End box right container -->\n"; |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | print "</select>"; |
1276 | 1276 | } |
1277 | 1277 | else |
1278 | - { |
|
1278 | + { |
|
1279 | 1279 | print $langs->trans("DictionaryEmpty"); |
1280 | 1280 | } |
1281 | 1281 | } |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | * @param int $fk_user Utilisateur créant le modèle |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - function select_export_model($selected='', $htmlname='exportmodelid', $type='', $useempty=0, $fk_user=null) |
|
71 | + function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null) |
|
72 | 72 | { |
73 | 73 | // phpcs:enable |
74 | 74 | $sql = "SELECT rowid, label"; |
75 | - $sql.= " FROM ".MAIN_DB_PREFIX."export_model"; |
|
76 | - $sql.= " WHERE type = '".$type."'"; |
|
77 | - if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user; |
|
78 | - $sql.= " ORDER BY rowid"; |
|
75 | + $sql .= " FROM ".MAIN_DB_PREFIX."export_model"; |
|
76 | + $sql .= " WHERE type = '".$type."'"; |
|
77 | + if (!empty($fk_user)) $sql .= " AND fk_user=".$fk_user; |
|
78 | + $sql .= " ORDER BY rowid"; |
|
79 | 79 | $result = $this->db->query($sql); |
80 | 80 | if ($result) |
81 | 81 | { |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | * @param int $useempty Affiche valeur vide dans liste |
121 | 121 | * @return void |
122 | 122 | */ |
123 | - function select_import_model($selected='', $htmlname='importmodelid', $type='', $useempty=0) |
|
123 | + function select_import_model($selected = '', $htmlname = 'importmodelid', $type = '', $useempty = 0) |
|
124 | 124 | { |
125 | 125 | // phpcs:enable |
126 | 126 | $sql = "SELECT rowid, label"; |
127 | - $sql.= " FROM ".MAIN_DB_PREFIX."import_model"; |
|
128 | - $sql.= " WHERE type = '".$type."'"; |
|
129 | - $sql.= " ORDER BY rowid"; |
|
127 | + $sql .= " FROM ".MAIN_DB_PREFIX."import_model"; |
|
128 | + $sql .= " WHERE type = '".$type."'"; |
|
129 | + $sql .= " ORDER BY rowid"; |
|
130 | 130 | $result = $this->db->query($sql); |
131 | 131 | if ($result) |
132 | 132 | { |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | * @param string $htmlname Name of combo list |
170 | 170 | * @return integer |
171 | 171 | */ |
172 | - function select_ecotaxes($selected='', $htmlname='ecotaxe_id') |
|
172 | + function select_ecotaxes($selected = '', $htmlname = 'ecotaxe_id') |
|
173 | 173 | { |
174 | 174 | // phpcs:enable |
175 | 175 | global $langs; |
176 | 176 | |
177 | 177 | $sql = "SELECT e.rowid, e.code, e.label, e.price, e.organization,"; |
178 | - $sql.= " c.label as country"; |
|
179 | - $sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c"; |
|
180 | - $sql.= " WHERE e.active = 1 AND e.fk_pays = c.rowid"; |
|
181 | - $sql.= " ORDER BY country, e.organization ASC, e.code ASC"; |
|
178 | + $sql .= " c.label as country"; |
|
179 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c"; |
|
180 | + $sql .= " WHERE e.active = 1 AND e.fk_pays = c.rowid"; |
|
181 | + $sql .= " ORDER BY country, e.organization ASC, e.code ASC"; |
|
182 | 182 | |
183 | 183 | dol_syslog(get_class($this).'::select_ecotaxes', LOG_DEBUG); |
184 | - $resql=$this->db->query($sql); |
|
184 | + $resql = $this->db->query($sql); |
|
185 | 185 | if ($resql) |
186 | 186 | { |
187 | 187 | print '<select class="flat" name="'.$htmlname.'">'; |
@@ -228,26 +228,26 @@ discard block |
||
228 | 228 | * @param string $country_code Country Code |
229 | 229 | * @return string HTML select list |
230 | 230 | */ |
231 | - function select_revenue_stamp($selected='', $htmlname='revenuestamp', $country_code='') |
|
231 | + function select_revenue_stamp($selected = '', $htmlname = 'revenuestamp', $country_code = '') |
|
232 | 232 | { |
233 | 233 | // phpcs:enable |
234 | 234 | global $langs; |
235 | 235 | |
236 | - $out=''; |
|
236 | + $out = ''; |
|
237 | 237 | |
238 | 238 | $sql = "SELECT r.taux, r.revenuestamp_type"; |
239 | - $sql.= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c"; |
|
240 | - $sql.= " WHERE r.active = 1 AND r.fk_pays = c.rowid"; |
|
241 | - $sql.= " AND c.code = '".$country_code."'"; |
|
239 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_revenuestamp as r,".MAIN_DB_PREFIX."c_country as c"; |
|
240 | + $sql .= " WHERE r.active = 1 AND r.fk_pays = c.rowid"; |
|
241 | + $sql .= " AND c.code = '".$country_code."'"; |
|
242 | 242 | |
243 | 243 | dol_syslog(get_class($this).'::select_revenue_stamp', LOG_DEBUG); |
244 | - $resql=$this->db->query($sql); |
|
244 | + $resql = $this->db->query($sql); |
|
245 | 245 | if ($resql) |
246 | 246 | { |
247 | - $out.='<select class="flat" name="'.$htmlname.'">'; |
|
247 | + $out .= '<select class="flat" name="'.$htmlname.'">'; |
|
248 | 248 | $num = $this->db->num_rows($resql); |
249 | 249 | $i = 0; |
250 | - $out.='<option value="0"> </option>'."\n"; |
|
250 | + $out .= '<option value="0"> </option>'."\n"; |
|
251 | 251 | if ($num) |
252 | 252 | { |
253 | 253 | while ($i < $num) |
@@ -255,19 +255,19 @@ discard block |
||
255 | 255 | $obj = $this->db->fetch_object($resql); |
256 | 256 | if (($selected && $selected == $obj->taux) || $num == 1) |
257 | 257 | { |
258 | - $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>'; |
|
258 | + $out .= '<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>'; |
|
259 | 259 | } |
260 | 260 | else |
261 | 261 | { |
262 | - $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>'; |
|
262 | + $out .= '<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>'; |
|
263 | 263 | //print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">'; |
264 | 264 | } |
265 | - $out.=$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : ''); |
|
266 | - $out.='</option>'; |
|
265 | + $out .= $obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : ''); |
|
266 | + $out .= '</option>'; |
|
267 | 267 | $i++; |
268 | 268 | } |
269 | 269 | } |
270 | - $out.='</select>'; |
|
270 | + $out .= '</select>'; |
|
271 | 271 | return $out; |
272 | 272 | } |
273 | 273 | else |
@@ -291,27 +291,27 @@ discard block |
||
291 | 291 | * @param int $showempty Add also an empty line |
292 | 292 | * @return string HTML select string |
293 | 293 | */ |
294 | - function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100,$showempty=0) |
|
294 | + function select_percent($selected = 0, $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0) |
|
295 | 295 | { |
296 | 296 | // phpcs:enable |
297 | - $return = '<select class="flat" name="'.$htmlname.'" '.($disabled?'disabled':'').'>'; |
|
298 | - if ($showempty) $return.='<option value="-1"'.(($selected == -1 || $selected == '')?' selected':'').'> </option>'; |
|
297 | + $return = '<select class="flat" name="'.$htmlname.'" '.($disabled ? 'disabled' : '').'>'; |
|
298 | + if ($showempty) $return .= '<option value="-1"'.(($selected == -1 || $selected == '') ? ' selected' : '').'> </option>'; |
|
299 | 299 | |
300 | - for ($i = $start ; $i <= $end ; $i += $increment) |
|
300 | + for ($i = $start; $i <= $end; $i += $increment) |
|
301 | 301 | { |
302 | 302 | if ($selected != '' && (int) $selected == $i) |
303 | 303 | { |
304 | - $return.= '<option value="'.$i.'" selected>'; |
|
304 | + $return .= '<option value="'.$i.'" selected>'; |
|
305 | 305 | } |
306 | 306 | else |
307 | 307 | { |
308 | - $return.= '<option value="'.$i.'">'; |
|
308 | + $return .= '<option value="'.$i.'">'; |
|
309 | 309 | } |
310 | - $return.= $i.' % '; |
|
311 | - $return.= '</option>'; |
|
310 | + $return .= $i.' % '; |
|
311 | + $return .= '</option>'; |
|
312 | 312 | } |
313 | 313 | |
314 | - $return.= '</select>'; |
|
314 | + $return .= '</select>'; |
|
315 | 315 | |
316 | 316 | return $return; |
317 | 317 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return string Html combo list code |
330 | 330 | * @see select_all_categories |
331 | 331 | */ |
332 | - function select_categories($type, $selected=0, $htmlname='search_categ', $nocateg=0, $showempty=1, $morecss='') |
|
332 | + function select_categories($type, $selected = 0, $htmlname = 'search_categ', $nocateg = 0, $showempty = 1, $morecss = '') |
|
333 | 333 | { |
334 | 334 | // phpcs:enable |
335 | 335 | global $conf, $langs; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | // For backward compatibility |
339 | 339 | if (is_numeric($type)) |
340 | 340 | { |
341 | - dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
341 | + dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | // Load list of "categories" |
@@ -349,30 +349,30 @@ discard block |
||
349 | 349 | // Enhance with select2 |
350 | 350 | if ($conf->use_javascript_ajax) |
351 | 351 | { |
352 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
352 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
353 | 353 | $comboenhancement = ajax_combobox('select_categ_'.$htmlname); |
354 | - $moreforfilter.=$comboenhancement; |
|
354 | + $moreforfilter .= $comboenhancement; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | // Print a select with each of them |
358 | - $moreforfilter.='<select class="flat minwidth100'.($morecss?' '.$morecss:'').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">'; |
|
359 | - if ($showempty) $moreforfilter.='<option value="0"> </option>'; // Should use -1 to say nothing |
|
358 | + $moreforfilter .= '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">'; |
|
359 | + if ($showempty) $moreforfilter .= '<option value="0"> </option>'; // Should use -1 to say nothing |
|
360 | 360 | |
361 | 361 | if (is_array($tab_categs)) |
362 | 362 | { |
363 | 363 | foreach ($tab_categs as $categ) |
364 | 364 | { |
365 | - $moreforfilter.='<option value="'.$categ['id'].'"'; |
|
366 | - if ($categ['id'] == $selected) $moreforfilter.=' selected'; |
|
367 | - $moreforfilter.='>'.dol_trunc($categ['fulllabel'],50,'middle').'</option>'; |
|
365 | + $moreforfilter .= '<option value="'.$categ['id'].'"'; |
|
366 | + if ($categ['id'] == $selected) $moreforfilter .= ' selected'; |
|
367 | + $moreforfilter .= '>'.dol_trunc($categ['fulllabel'], 50, 'middle').'</option>'; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | if ($nocateg) |
371 | 371 | { |
372 | 372 | $langs->load("categories"); |
373 | - $moreforfilter.='<option value="-2"'.($selected == -2 ? ' selected':'').'>- '.$langs->trans("NotCategorized").' -</option>'; |
|
373 | + $moreforfilter .= '<option value="-2"'.($selected == -2 ? ' selected' : '').'>- '.$langs->trans("NotCategorized").' -</option>'; |
|
374 | 374 | } |
375 | - $moreforfilter.='</select>'; |
|
375 | + $moreforfilter .= '</select>'; |
|
376 | 376 | |
377 | 377 | return $moreforfilter; |
378 | 378 | } |
@@ -390,44 +390,44 @@ discard block |
||
390 | 390 | * @param string $morecss More CSS |
391 | 391 | * @return string Html combo list code |
392 | 392 | */ |
393 | - function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0,$showempty=1,$morecss='') |
|
393 | + function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '') |
|
394 | 394 | { |
395 | 395 | // phpcs:enable |
396 | - global $conf,$langs; |
|
396 | + global $conf, $langs; |
|
397 | 397 | $langs->load('users'); |
398 | 398 | |
399 | 399 | $out = ''; |
400 | 400 | // Enhance with select2 |
401 | 401 | if ($conf->use_javascript_ajax) |
402 | 402 | { |
403 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
403 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
404 | 404 | |
405 | 405 | $comboenhancement = ajax_combobox($htmlname); |
406 | 406 | if ($comboenhancement) |
407 | 407 | { |
408 | - $out.=$comboenhancement; |
|
408 | + $out .= $comboenhancement; |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | // Select each sales and print them in a select input |
412 | - $out.='<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
413 | - if ($showempty) $out.='<option value="0"> </option>'; |
|
412 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
|
413 | + if ($showempty) $out .= '<option value="0"> </option>'; |
|
414 | 414 | |
415 | 415 | // Get list of users allowed to be viewed |
416 | 416 | $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; |
417 | - $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
418 | - $sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")"; |
|
419 | - if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id; |
|
420 | - if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_soc = ".$user->societe_id; |
|
417 | + $sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
418 | + $sql_usr .= " WHERE u.entity IN (0,".$conf->entity.")"; |
|
419 | + if (empty($user->rights->user->user->lire)) $sql_usr .= " AND u.rowid = ".$user->id; |
|
420 | + if (!empty($user->societe_id)) $sql_usr .= " AND u.fk_soc = ".$user->societe_id; |
|
421 | 421 | // Add existing sales representatives of thirdparty of external user |
422 | 422 | if (empty($user->rights->user->user->lire) && $user->societe_id) |
423 | 423 | { |
424 | - $sql_usr.=" UNION "; |
|
425 | - $sql_usr.= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login"; |
|
426 | - $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
427 | - $sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")"; |
|
428 | - $sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id; |
|
424 | + $sql_usr .= " UNION "; |
|
425 | + $sql_usr .= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login"; |
|
426 | + $sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
427 | + $sql_usr .= " WHERE u2.entity IN (0,".$conf->entity.")"; |
|
428 | + $sql_usr .= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id; |
|
429 | 429 | } |
430 | - $sql_usr.= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. |
|
430 | + $sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION. |
|
431 | 431 | //print $sql_usr;exit; |
432 | 432 | |
433 | 433 | $resql_usr = $this->db->query($sql_usr); |
@@ -436,34 +436,34 @@ discard block |
||
436 | 436 | while ($obj_usr = $this->db->fetch_object($resql_usr)) |
437 | 437 | { |
438 | 438 | |
439 | - $out.='<option value="'.$obj_usr->rowid.'"'; |
|
439 | + $out .= '<option value="'.$obj_usr->rowid.'"'; |
|
440 | 440 | |
441 | - if ($obj_usr->rowid == $selected) $out.=' selected'; |
|
441 | + if ($obj_usr->rowid == $selected) $out .= ' selected'; |
|
442 | 442 | |
443 | - $out.='>'; |
|
444 | - $out.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->lastname); |
|
443 | + $out .= '>'; |
|
444 | + $out .= dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname); |
|
445 | 445 | // Complete name with more info |
446 | - $moreinfo=0; |
|
447 | - if (! empty($conf->global->MAIN_SHOW_LOGIN)) |
|
446 | + $moreinfo = 0; |
|
447 | + if (!empty($conf->global->MAIN_SHOW_LOGIN)) |
|
448 | 448 | { |
449 | - $out.=($moreinfo?' - ':' (').$obj_usr->login; |
|
449 | + $out .= ($moreinfo ? ' - ' : ' (').$obj_usr->login; |
|
450 | 450 | $moreinfo++; |
451 | 451 | } |
452 | 452 | if ($showstatus >= 0) |
453 | 453 | { |
454 | 454 | if ($obj_usr->statut == 1 && $showstatus == 1) |
455 | 455 | { |
456 | - $out.=($moreinfo?' - ':' (').$langs->trans('Enabled'); |
|
456 | + $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); |
|
457 | 457 | $moreinfo++; |
458 | 458 | } |
459 | 459 | if ($obj_usr->statut == 0) |
460 | 460 | { |
461 | - $out.=($moreinfo?' - ':' (').$langs->trans('Disabled'); |
|
461 | + $out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); |
|
462 | 462 | $moreinfo++; |
463 | 463 | } |
464 | 464 | } |
465 | - $out.=($moreinfo?')':''); |
|
466 | - $out.='</option>'; |
|
465 | + $out .= ($moreinfo ? ')' : ''); |
|
466 | + $out .= '</option>'; |
|
467 | 467 | } |
468 | 468 | $this->db->free($resql_usr); |
469 | 469 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | { |
472 | 472 | dol_print_error($this->db); |
473 | 473 | } |
474 | - $out.='</select>'; |
|
474 | + $out .= '</select>'; |
|
475 | 475 | |
476 | 476 | return $out; |
477 | 477 | } |
@@ -491,21 +491,21 @@ discard block |
||
491 | 491 | * @param string $morecss More css |
492 | 492 | * @return void |
493 | 493 | */ |
494 | - function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0, $filteronprojstatus='', $morecss='') |
|
494 | + function selectProjectTasks($selectedtask = '', $projectid = 0, $htmlname = 'task_parent', $modeproject = 0, $modetask = 0, $mode = 0, $useempty = 0, $disablechildoftaskid = 0, $filteronprojstatus = '', $morecss = '') |
|
495 | 495 | { |
496 | 496 | global $user, $langs; |
497 | 497 | |
498 | 498 | require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
499 | 499 | |
500 | 500 | //print $modeproject.'-'.$modetask; |
501 | - $task=new Task($this->db); |
|
502 | - $tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode, '', $filteronprojstatus); |
|
501 | + $task = new Task($this->db); |
|
502 | + $tasksarray = $task->getTasksArray($modetask ? $user : 0, $modeproject ? $user : 0, $projectid, 0, $mode, '', $filteronprojstatus); |
|
503 | 503 | if ($tasksarray) |
504 | 504 | { |
505 | - print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
505 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
506 | 506 | if ($useempty) print '<option value="0"> </option>'; |
507 | - $j=0; |
|
508 | - $level=0; |
|
507 | + $j = 0; |
|
508 | + $level = 0; |
|
509 | 509 | $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid, $disablechildoftaskid); |
510 | 510 | print '</select>'; |
511 | 511 | |
@@ -529,14 +529,14 @@ discard block |
||
529 | 529 | * @param int $disablechildoftaskid 1=Disable task that are child of the provided task id |
530 | 530 | * @return void |
531 | 531 | */ |
532 | - private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0, $disablechildoftaskid=0) |
|
532 | + private function _pLineSelect(&$inc, $parent, $lines, $level = 0, $selectedtask = 0, $selectedproject = 0, $disablechildoftaskid = 0) |
|
533 | 533 | { |
534 | 534 | global $langs, $user, $conf; |
535 | 535 | |
536 | - $lastprojectid=0; |
|
536 | + $lastprojectid = 0; |
|
537 | 537 | |
538 | - $numlines=count($lines); |
|
539 | - for ($i = 0 ; $i < $numlines ; $i++) |
|
538 | + $numlines = count($lines); |
|
539 | + for ($i = 0; $i < $numlines; $i++) |
|
540 | 540 | { |
541 | 541 | if ($lines[$i]->fk_parent == $parent) |
542 | 542 | { |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | if ($i > 0) print '<option value="0" disabled>----------</option>'; |
553 | 553 | print '<option value="'.$lines[$i]->fk_project.'_0"'; |
554 | 554 | if ($selectedproject == $lines[$i]->fk_project) print ' selected'; |
555 | - print '>'; // Project -> Task |
|
555 | + print '>'; // Project -> Task |
|
556 | 556 | print $langs->trans("Project").' '.$lines[$i]->projectref; |
557 | 557 | if (empty($lines[$i]->public)) |
558 | 558 | { |
@@ -565,22 +565,22 @@ discard block |
||
565 | 565 | //print '-'.$parent.'-'.$lines[$i]->fk_project.'-'.$lastprojectid; |
566 | 566 | print "</option>\n"; |
567 | 567 | |
568 | - $lastprojectid=$lines[$i]->fk_project; |
|
568 | + $lastprojectid = $lines[$i]->fk_project; |
|
569 | 569 | $inc++; |
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
573 | - $newdisablechildoftaskid=$disablechildoftaskid; |
|
573 | + $newdisablechildoftaskid = $disablechildoftaskid; |
|
574 | 574 | |
575 | 575 | // Print task |
576 | 576 | if (isset($lines[$i]->id)) // We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0 |
577 | 577 | { |
578 | 578 | // Check if we must disable entry |
579 | - $disabled=0; |
|
579 | + $disabled = 0; |
|
580 | 580 | if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid))) |
581 | 581 | { |
582 | 582 | $disabled++; |
583 | - if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid=$lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too |
|
583 | + if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid = $lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"'; |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')'; |
599 | 599 | } |
600 | 600 | if ($lines[$i]->id) print ' > '; |
601 | - for ($k = 0 ; $k < $level ; $k++) |
|
601 | + for ($k = 0; $k < $level; $k++) |
|
602 | 602 | { |
603 | 603 | print " "; |
604 | 604 | } |
@@ -622,13 +622,13 @@ discard block |
||
622 | 622 | * @return string HTML code for color thumb |
623 | 623 | * @see selectColor |
624 | 624 | */ |
625 | - static function showColor($color, $textifnotdefined='') |
|
625 | + static function showColor($color, $textifnotdefined = '') |
|
626 | 626 | { |
627 | - $textcolor='FFF'; |
|
627 | + $textcolor = 'FFF'; |
|
628 | 628 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
629 | - if(colorIsLight($color)) $textcolor='000'; |
|
629 | + if (colorIsLight($color)) $textcolor = '000'; |
|
630 | 630 | |
631 | - $color = colorArrayToHex(colorStringToArray($color,array()),''); |
|
631 | + $color = colorArrayToHex(colorStringToArray($color, array()), ''); |
|
632 | 632 | |
633 | 633 | if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">'; |
634 | 634 | else print $textifnotdefined; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @deprecated Use instead selectColor |
648 | 648 | * @see selectColor() |
649 | 649 | */ |
650 | - function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='') |
|
650 | + function select_color($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '') |
|
651 | 651 | { |
652 | 652 | // phpcs:enable |
653 | 653 | print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors); |
@@ -665,25 +665,25 @@ discard block |
||
665 | 665 | * @return string |
666 | 666 | * @see showColor |
667 | 667 | */ |
668 | - static function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='') |
|
668 | + static function selectColor($set_color = '', $prefix = 'f_color', $form_name = '', $showcolorbox = 1, $arrayofcolors = '', $morecss = '') |
|
669 | 669 | { |
670 | 670 | // Deprecation warning |
671 | 671 | if ($form_name) { |
672 | - dol_syslog(__METHOD__ . ": form_name parameter is deprecated", LOG_WARNING); |
|
672 | + dol_syslog(__METHOD__.": form_name parameter is deprecated", LOG_WARNING); |
|
673 | 673 | } |
674 | 674 | |
675 | - global $langs,$conf; |
|
675 | + global $langs, $conf; |
|
676 | 676 | |
677 | - $out=''; |
|
677 | + $out = ''; |
|
678 | 678 | |
679 | - if (! is_array($arrayofcolors) || count($arrayofcolors) < 1) |
|
679 | + if (!is_array($arrayofcolors) || count($arrayofcolors) < 1) |
|
680 | 680 | { |
681 | 681 | $langs->load("other"); |
682 | 682 | if (empty($conf->dol_use_jmobile)) |
683 | 683 | { |
684 | - $out.= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />'; |
|
685 | - $out.= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>'; |
|
686 | - $out.= '<script type="text/javascript"> |
|
684 | + $out .= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />'; |
|
685 | + $out .= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>'; |
|
686 | + $out .= '<script type="text/javascript"> |
|
687 | 687 | jQuery(document).ready(function(){ |
688 | 688 | $(\'#colorpicker'.$prefix.'\').jPicker( { |
689 | 689 | window: { |
@@ -721,15 +721,15 @@ discard block |
||
721 | 721 | } ); }); |
722 | 722 | </script>'; |
723 | 723 | } |
724 | - $out.= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss?' '.$morecss:'').'" type="text" value="'.$set_color.'" />'; |
|
724 | + $out .= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss ? ' '.$morecss : '').'" type="text" value="'.$set_color.'" />'; |
|
725 | 725 | } |
726 | 726 | else // In most cases, this is not used. We used instead function with no specific list of colors |
727 | 727 | { |
728 | 728 | if (empty($conf->dol_use_jmobile)) |
729 | 729 | { |
730 | - $out.= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />'; |
|
731 | - $out.= '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>'; |
|
732 | - $out.= '<script type="text/javascript"> |
|
730 | + $out .= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />'; |
|
731 | + $out .= '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>'; |
|
732 | + $out .= '<script type="text/javascript"> |
|
733 | 733 | jQuery(document).ready(function(){ |
734 | 734 | jQuery(\'#colorpicker'.$prefix.'\').colorpicker({ |
735 | 735 | size: 14, |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | }); |
740 | 740 | </script>'; |
741 | 741 | } |
742 | - $out.= '<select id="colorpicker'.$prefix.'" class="flat'.($morecss?' '.$morecss:'').'" name="'.$prefix.'">'; |
|
742 | + $out .= '<select id="colorpicker'.$prefix.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$prefix.'">'; |
|
743 | 743 | //print '<option value="-1"> </option>'; |
744 | 744 | foreach ($arrayofcolors as $val) |
745 | 745 | { |
746 | - $out.= '<option value="'.$val.'"'; |
|
747 | - if ($set_color == $val) $out.= ' selected'; |
|
748 | - $out.= '>'.$val.'</option>'; |
|
746 | + $out .= '<option value="'.$val.'"'; |
|
747 | + if ($set_color == $val) $out .= ' selected'; |
|
748 | + $out .= '>'.$val.'</option>'; |
|
749 | 749 | } |
750 | - $out.= '</select>'; |
|
750 | + $out .= '</select>'; |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | return $out; |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | * @param int $y Hauteur de l'image en pixels |
765 | 765 | * @return void |
766 | 766 | */ |
767 | - function CreateColorIcon($color,$module,$name,$x='12',$y='12') |
|
767 | + function CreateColorIcon($color, $module, $name, $x = '12', $y = '12') |
|
768 | 768 | { |
769 | 769 | // phpcs:enable |
770 | 770 | global $conf; |
@@ -772,25 +772,25 @@ discard block |
||
772 | 772 | $file = $conf->$module->dir_temp.'/'.$name.'.png'; |
773 | 773 | |
774 | 774 | // On cree le repertoire contenant les icones |
775 | - if (! file_exists($conf->$module->dir_temp)) |
|
775 | + if (!file_exists($conf->$module->dir_temp)) |
|
776 | 776 | { |
777 | 777 | dol_mkdir($conf->$module->dir_temp); |
778 | 778 | } |
779 | 779 | |
780 | 780 | // On cree l'image en vraies couleurs |
781 | - $image = imagecreatetruecolor($x,$y); |
|
781 | + $image = imagecreatetruecolor($x, $y); |
|
782 | 782 | |
783 | - $color = substr($color,1,6); |
|
783 | + $color = substr($color, 1, 6); |
|
784 | 784 | |
785 | - $rouge = hexdec(substr($color,0,2)); //conversion du canal rouge |
|
786 | - $vert = hexdec(substr($color,2,2)); //conversion du canal vert |
|
787 | - $bleu = hexdec(substr($color,4,2)); //conversion du canal bleu |
|
785 | + $rouge = hexdec(substr($color, 0, 2)); //conversion du canal rouge |
|
786 | + $vert = hexdec(substr($color, 2, 2)); //conversion du canal vert |
|
787 | + $bleu = hexdec(substr($color, 4, 2)); //conversion du canal bleu |
|
788 | 788 | |
789 | - $couleur = imagecolorallocate($image,$rouge,$vert,$bleu); |
|
789 | + $couleur = imagecolorallocate($image, $rouge, $vert, $bleu); |
|
790 | 790 | //print $rouge.$vert.$bleu; |
791 | - imagefill($image,0,0,$couleur); //on remplit l'image |
|
791 | + imagefill($image, 0, 0, $couleur); //on remplit l'image |
|
792 | 792 | // On cree la couleur et on l'attribue a une variable pour ne pas la perdre |
793 | - ImagePng($image,$file); //renvoie une image sous format png |
|
793 | + ImagePng($image, $file); //renvoie une image sous format png |
|
794 | 794 | ImageDestroy($image); |
795 | 795 | } |
796 | 796 | |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | * @param int $useempty Affiche valeur vide dans liste |
804 | 804 | * @return string |
805 | 805 | */ |
806 | - function select_dayofweek($selected='',$htmlname='weekid',$useempty=0) |
|
806 | + function select_dayofweek($selected = '', $htmlname = 'weekid', $useempty = 0) |
|
807 | 807 | { |
808 | 808 | // phpcs:enable |
809 | 809 | global $langs; |
@@ -851,17 +851,17 @@ discard block |
||
851 | 851 | * @param string $morecss More Css |
852 | 852 | * @return string |
853 | 853 | */ |
854 | - function select_month($selected='', $htmlname='monthid', $useempty=0, $longlabel=0, $morecss='') |
|
854 | + function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = '') |
|
855 | 855 | { |
856 | 856 | // phpcs:enable |
857 | 857 | global $langs; |
858 | 858 | |
859 | 859 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
860 | 860 | |
861 | - if ($longlabel) $montharray = monthArray($langs, 0); // Get array |
|
861 | + if ($longlabel) $montharray = monthArray($langs, 0); // Get array |
|
862 | 862 | else $montharray = monthArray($langs, 1); |
863 | 863 | |
864 | - $select_month = '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
864 | + $select_month = '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
|
865 | 865 | if ($useempty) |
866 | 866 | { |
867 | 867 | $select_month .= '<option value="0"> </option>'; |
@@ -898,10 +898,10 @@ discard block |
||
898 | 898 | * @param string $morecss More CSS |
899 | 899 | * @return string |
900 | 900 | */ |
901 | - function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto') |
|
901 | + function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto') |
|
902 | 902 | { |
903 | 903 | // phpcs:enable |
904 | - print $this->selectyear($selected,$htmlname,$useempty,$min_year,$max_year,$offset,$invert,$option,$morecss); |
|
904 | + print $this->selectyear($selected, $htmlname, $useempty, $min_year, $max_year, $offset, $invert, $option, $morecss); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | /** |
@@ -918,41 +918,41 @@ discard block |
||
918 | 918 | * @param string $morecss More css |
919 | 919 | * @return string |
920 | 920 | */ |
921 | - function selectyear($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto') |
|
921 | + function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle widthauto') |
|
922 | 922 | { |
923 | - $out=''; |
|
923 | + $out = ''; |
|
924 | 924 | |
925 | - $currentyear = date("Y")+$offset; |
|
926 | - $max_year = $currentyear+$max_year; |
|
927 | - $min_year = $currentyear-$min_year; |
|
928 | - if(empty($selected) && empty($useempty)) $selected = $currentyear; |
|
925 | + $currentyear = date("Y") + $offset; |
|
926 | + $max_year = $currentyear + $max_year; |
|
927 | + $min_year = $currentyear - $min_year; |
|
928 | + if (empty($selected) && empty($useempty)) $selected = $currentyear; |
|
929 | 929 | |
930 | - $out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >'; |
|
931 | - if($useempty) |
|
930 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$option.' >'; |
|
931 | + if ($useempty) |
|
932 | 932 | { |
933 | - $selected_html=''; |
|
933 | + $selected_html = ''; |
|
934 | 934 | if ($selected == '') $selected_html = ' selected'; |
935 | - $out.= '<option value=""' . $selected_html . '> </option>'; |
|
935 | + $out .= '<option value=""'.$selected_html.'> </option>'; |
|
936 | 936 | } |
937 | - if (! $invert) |
|
937 | + if (!$invert) |
|
938 | 938 | { |
939 | 939 | for ($y = $max_year; $y >= $min_year; $y--) |
940 | 940 | { |
941 | - $selected_html=''; |
|
941 | + $selected_html = ''; |
|
942 | 942 | if ($selected > 0 && $y == $selected) $selected_html = ' selected'; |
943 | - $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>'; |
|
943 | + $out .= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>'; |
|
944 | 944 | } |
945 | 945 | } |
946 | 946 | else |
947 | 947 | { |
948 | 948 | for ($y = $min_year; $y <= $max_year; $y++) |
949 | 949 | { |
950 | - $selected_html=''; |
|
950 | + $selected_html = ''; |
|
951 | 951 | if ($selected > 0 && $y == $selected) $selected_html = ' selected'; |
952 | - $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>'; |
|
952 | + $out .= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>'; |
|
953 | 953 | } |
954 | 954 | } |
955 | - $out.= "</select>\n"; |
|
955 | + $out .= "</select>\n"; |
|
956 | 956 | |
957 | 957 | return $out; |
958 | 958 | } |
@@ -969,10 +969,10 @@ discard block |
||
969 | 969 | * @param int $originid Id de l'origine |
970 | 970 | * @return void |
971 | 971 | */ |
972 | - function form_address($page, $selected, $socid, $htmlname='address_id', $origin='', $originid='') |
|
972 | + function form_address($page, $selected, $socid, $htmlname = 'address_id', $origin = '', $originid = '') |
|
973 | 973 | { |
974 | 974 | // phpcs:enable |
975 | - global $langs,$conf; |
|
975 | + global $langs, $conf; |
|
976 | 976 | global $form; |
977 | 977 | |
978 | 978 | if ($htmlname != "none") |
@@ -990,9 +990,9 @@ discard block |
||
990 | 990 | { |
991 | 991 | if ($selected) |
992 | 992 | { |
993 | - require_once DOL_DOCUMENT_ROOT .'/societe/class/address.class.php'; |
|
994 | - $address=new Address($this->db); |
|
995 | - $result=$address->fetch_address($selected); |
|
993 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/address.class.php'; |
|
994 | + $address = new Address($this->db); |
|
995 | + $result = $address->fetch_address($selected); |
|
996 | 996 | print '<a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$address->socid.'&id='.$address->id.'&action=edit&origin='.$origin.'&originid='.$originid.'>'.$address->label.'</a>'; |
997 | 997 | } |
998 | 998 | else |
@@ -1012,72 +1012,72 @@ discard block |
||
1012 | 1012 | * @param String $areacode Code of area for pages ('0'=value for Home page) |
1013 | 1013 | * @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlista'=>, 'boxlistb'=>) |
1014 | 1014 | */ |
1015 | - static function getBoxesArea($user,$areacode) |
|
1015 | + static function getBoxesArea($user, $areacode) |
|
1016 | 1016 | { |
1017 | - global $conf,$langs,$db; |
|
1017 | + global $conf, $langs, $db; |
|
1018 | 1018 | |
1019 | 1019 | include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; |
1020 | 1020 | |
1021 | - $confuserzone='MAIN_BOXES_'.$areacode; |
|
1021 | + $confuserzone = 'MAIN_BOXES_'.$areacode; |
|
1022 | 1022 | |
1023 | 1023 | // $boxactivated will be array of boxes enabled into global setup |
1024 | 1024 | // $boxidactivatedforuser will be array of boxes choosed by user |
1025 | 1025 | |
1026 | - $selectboxlist=''; |
|
1027 | - $boxactivated=InfoBox::listBoxes($db, 'activated', $areacode, (empty($user->conf->$confuserzone)?null:$user), array(), 0); // Search boxes of common+user (or common only if user has no specific setup) |
|
1026 | + $selectboxlist = ''; |
|
1027 | + $boxactivated = InfoBox::listBoxes($db, 'activated', $areacode, (empty($user->conf->$confuserzone) ?null:$user), array(), 0); // Search boxes of common+user (or common only if user has no specific setup) |
|
1028 | 1028 | |
1029 | - $boxidactivatedforuser=array(); |
|
1030 | - foreach($boxactivated as $box) |
|
1029 | + $boxidactivatedforuser = array(); |
|
1030 | + foreach ($boxactivated as $box) |
|
1031 | 1031 | { |
1032 | - if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user |
|
1032 | + if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id] = $box->id; // We keep only boxes to show for user |
|
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | // Define selectboxlist |
1036 | - $arrayboxtoactivatelabel=array(); |
|
1037 | - if (! empty($user->conf->$confuserzone)) |
|
1036 | + $arrayboxtoactivatelabel = array(); |
|
1037 | + if (!empty($user->conf->$confuserzone)) |
|
1038 | 1038 | { |
1039 | - $boxorder=''; |
|
1040 | - $langs->load("boxes"); // Load label of boxes |
|
1041 | - foreach($boxactivated as $box) |
|
1039 | + $boxorder = ''; |
|
1040 | + $langs->load("boxes"); // Load label of boxes |
|
1041 | + foreach ($boxactivated as $box) |
|
1042 | 1042 | { |
1043 | - if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user |
|
1044 | - $label=$langs->transnoentitiesnoconv($box->boxlabel); |
|
1043 | + if (!empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user |
|
1044 | + $label = $langs->transnoentitiesnoconv($box->boxlabel); |
|
1045 | 1045 | //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; |
1046 | - if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone') |
|
1046 | + if (preg_match('/graph/', $box->class) && $conf->browser->layout != 'phone') |
|
1047 | 1047 | { |
1048 | - $label=$label.' <span class="fa fa-bar-chart"></span>'; |
|
1048 | + $label = $label.' <span class="fa fa-bar-chart"></span>'; |
|
1049 | 1049 | } |
1050 | - $arrayboxtoactivatelabel[$box->id]=$label; // We keep only boxes not shown for user, to show into combo list |
|
1050 | + $arrayboxtoactivatelabel[$box->id] = $label; // We keep only boxes not shown for user, to show into combo list |
|
1051 | 1051 | } |
1052 | - foreach($boxidactivatedforuser as $boxid) |
|
1052 | + foreach ($boxidactivatedforuser as $boxid) |
|
1053 | 1053 | { |
1054 | - if (empty($boxorder)) $boxorder.='A:'; |
|
1055 | - $boxorder.=$boxid.','; |
|
1054 | + if (empty($boxorder)) $boxorder .= 'A:'; |
|
1055 | + $boxorder .= $boxid.','; |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | //var_dump($boxidactivatedforuser); |
1059 | 1059 | |
1060 | 1060 | // Class Form must have been already loaded |
1061 | - $selectboxlist.='<!-- Form with select box list -->'."\n"; |
|
1062 | - $selectboxlist.='<form id="addbox" name="addbox" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
1063 | - $selectboxlist.='<input type="hidden" name="addbox" value="addbox">'; |
|
1064 | - $selectboxlist.='<input type="hidden" name="userid" value="'.$user->id.'">'; |
|
1065 | - $selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">'; |
|
1066 | - $selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">'; |
|
1067 | - $selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1); |
|
1068 | - if (empty($conf->use_javascript_ajax)) $selectboxlist.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">'; |
|
1069 | - $selectboxlist.='</form>'; |
|
1070 | - if (! empty($conf->use_javascript_ajax)) |
|
1061 | + $selectboxlist .= '<!-- Form with select box list -->'."\n"; |
|
1062 | + $selectboxlist .= '<form id="addbox" name="addbox" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
1063 | + $selectboxlist .= '<input type="hidden" name="addbox" value="addbox">'; |
|
1064 | + $selectboxlist .= '<input type="hidden" name="userid" value="'.$user->id.'">'; |
|
1065 | + $selectboxlist .= '<input type="hidden" name="areacode" value="'.$areacode.'">'; |
|
1066 | + $selectboxlist .= '<input type="hidden" name="boxorder" value="'.$boxorder.'">'; |
|
1067 | + $selectboxlist .= Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1); |
|
1068 | + if (empty($conf->use_javascript_ajax)) $selectboxlist .= ' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">'; |
|
1069 | + $selectboxlist .= '</form>'; |
|
1070 | + if (!empty($conf->use_javascript_ajax)) |
|
1071 | 1071 | { |
1072 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; |
|
1073 | - $selectboxlist.=ajax_combobox("boxcombo"); |
|
1072 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; |
|
1073 | + $selectboxlist .= ajax_combobox("boxcombo"); |
|
1074 | 1074 | } |
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | // Javascript code for dynamic actions |
1078 | - if (! empty($conf->use_javascript_ajax)) |
|
1078 | + if (!empty($conf->use_javascript_ajax)) |
|
1079 | 1079 | { |
1080 | - $selectboxlist.='<script type="text/javascript" language="javascript"> |
|
1080 | + $selectboxlist .= '<script type="text/javascript" language="javascript"> |
|
1081 | 1081 | |
1082 | 1082 | // To update list of activated boxes |
1083 | 1083 | function updateBoxOrder(closing) { |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | async: false |
1092 | 1092 | }); |
1093 | 1093 | // We force reload to be sure to get all boxes into list |
1094 | - window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=delbox\'; |
|
1094 | + window.location.search=\'mainmenu='.GETPOST("mainmenu", "aZ09").'&leftmenu='.GETPOST('leftmenu', "aZ09").'&action=delbox\'; |
|
1095 | 1095 | } |
1096 | 1096 | else |
1097 | 1097 | { |
@@ -1113,11 +1113,11 @@ discard block |
||
1113 | 1113 | url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&boxid=\'+boxid+\'&zone='.$areacode.'&userid='.$user->id.'\', |
1114 | 1114 | async: false |
1115 | 1115 | }); |
1116 | - window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=addbox&boxid=\'+boxid; |
|
1116 | + window.location.search=\'mainmenu='.GETPOST("mainmenu", "aZ09").'&leftmenu='.GETPOST('leftmenu', "aZ09").'&action=addbox&boxid=\'+boxid; |
|
1117 | 1117 | } |
1118 | 1118 | });'; |
1119 | - if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();'; |
|
1120 | - $selectboxlist.=' |
|
1119 | + if (!count($arrayboxtoactivatelabel)) $selectboxlist .= 'jQuery("#boxcombo").hide();'; |
|
1120 | + $selectboxlist .= ' |
|
1121 | 1121 | |
1122 | 1122 | jQuery("#boxhalfleft, #boxhalfright").sortable({ |
1123 | 1123 | handle: \'.boxhandle\', |
@@ -1142,80 +1142,80 @@ discard block |
||
1142 | 1142 | |
1143 | 1143 | });'."\n"; |
1144 | 1144 | |
1145 | - $selectboxlist.='</script>'."\n"; |
|
1145 | + $selectboxlist .= '</script>'."\n"; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | // Define boxlista and boxlistb |
1149 | - $nbboxactivated=count($boxidactivatedforuser); |
|
1149 | + $nbboxactivated = count($boxidactivatedforuser); |
|
1150 | 1150 | |
1151 | 1151 | if ($nbboxactivated) |
1152 | 1152 | { |
1153 | 1153 | // Load translation files required by the page |
1154 | - $langs->loadLangs(array("boxes","projects")); |
|
1154 | + $langs->loadLangs(array("boxes", "projects")); |
|
1155 | 1155 | |
1156 | - $emptybox=new ModeleBoxes($db); |
|
1156 | + $emptybox = new ModeleBoxes($db); |
|
1157 | 1157 | |
1158 | - $boxlista.="\n<!-- Box left container -->\n"; |
|
1158 | + $boxlista .= "\n<!-- Box left container -->\n"; |
|
1159 | 1159 | |
1160 | 1160 | // Define $box_max_lines |
1161 | - $box_max_lines=5; |
|
1162 | - if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES; |
|
1161 | + $box_max_lines = 5; |
|
1162 | + if (!empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines = $conf->global->MAIN_BOXES_MAXLINES; |
|
1163 | 1163 | |
1164 | - $ii=0; |
|
1164 | + $ii = 0; |
|
1165 | 1165 | foreach ($boxactivated as $key => $box) |
1166 | 1166 | { |
1167 | - if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1168 | - if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='A'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1169 | - if (preg_match('/^A/i',$box->box_order)) // column A |
|
1167 | + if ((!empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1168 | + if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order = 'A'.sprintf("%02d", ($ii + 1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1169 | + if (preg_match('/^A/i', $box->box_order)) // column A |
|
1170 | 1170 | { |
1171 | 1171 | $ii++; |
1172 | 1172 | //print 'box_id '.$boxactivated[$ii]->box_id.' '; |
1173 | 1173 | //print 'box_order '.$boxactivated[$ii]->box_order.'<br>'; |
1174 | 1174 | // Show box |
1175 | 1175 | $box->loadBox($box_max_lines); |
1176 | - $boxlista.= $box->outputBox(); |
|
1176 | + $boxlista .= $box->outputBox(); |
|
1177 | 1177 | } |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | if ($conf->browser->layout != 'phone') |
1181 | 1181 | { |
1182 | - $emptybox->box_id='A'; |
|
1183 | - $emptybox->info_box_head=array(); |
|
1184 | - $emptybox->info_box_contents=array(); |
|
1185 | - $boxlista.= $emptybox->outputBox(array(),array()); |
|
1182 | + $emptybox->box_id = 'A'; |
|
1183 | + $emptybox->info_box_head = array(); |
|
1184 | + $emptybox->info_box_contents = array(); |
|
1185 | + $boxlista .= $emptybox->outputBox(array(), array()); |
|
1186 | 1186 | } |
1187 | - $boxlista.= "<!-- End box left container -->\n"; |
|
1187 | + $boxlista .= "<!-- End box left container -->\n"; |
|
1188 | 1188 | |
1189 | - $boxlistb.= "\n<!-- Box right container -->\n"; |
|
1189 | + $boxlistb .= "\n<!-- Box right container -->\n"; |
|
1190 | 1190 | |
1191 | - $ii=0; |
|
1191 | + $ii = 0; |
|
1192 | 1192 | foreach ($boxactivated as $key => $box) |
1193 | 1193 | { |
1194 | - if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1195 | - if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1196 | - if (preg_match('/^B/i',$box->box_order)) // colonne B |
|
1194 | + if ((!empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1195 | + if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order = 'B'.sprintf("%02d", ($ii + 1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1196 | + if (preg_match('/^B/i', $box->box_order)) // colonne B |
|
1197 | 1197 | { |
1198 | 1198 | $ii++; |
1199 | 1199 | //print 'box_id '.$boxactivated[$ii]->box_id.' '; |
1200 | 1200 | //print 'box_order '.$boxactivated[$ii]->box_order.'<br>'; |
1201 | 1201 | // Show box |
1202 | 1202 | $box->loadBox($box_max_lines); |
1203 | - $boxlistb.= $box->outputBox(); |
|
1203 | + $boxlistb .= $box->outputBox(); |
|
1204 | 1204 | } |
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | if ($conf->browser->layout != 'phone') |
1208 | 1208 | { |
1209 | - $emptybox->box_id='B'; |
|
1210 | - $emptybox->info_box_head=array(); |
|
1211 | - $emptybox->info_box_contents=array(); |
|
1212 | - $boxlistb.= $emptybox->outputBox(array(),array()); |
|
1209 | + $emptybox->box_id = 'B'; |
|
1210 | + $emptybox->info_box_head = array(); |
|
1211 | + $emptybox->info_box_contents = array(); |
|
1212 | + $boxlistb .= $emptybox->outputBox(array(), array()); |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | - $boxlistb.= "<!-- End box right container -->\n"; |
|
1215 | + $boxlistb .= "<!-- End box right container -->\n"; |
|
1216 | 1216 | } |
1217 | 1217 | |
1218 | - return array('selectboxlist'=>count($boxactivated)?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb); |
|
1218 | + return array('selectboxlist'=>count($boxactivated) ? $selectboxlist : '', 'boxactivated'=>$boxactivated, 'boxlista'=>$boxlista, 'boxlistb'=>$boxlistb); |
|
1219 | 1219 | } |
1220 | 1220 | |
1221 | 1221 | |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | * @param string $moreattrib More attributes on HTML select tag |
1233 | 1233 | * @return void |
1234 | 1234 | */ |
1235 | - function select_dictionary($htmlname,$dictionarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0,$moreattrib='') |
|
1235 | + function select_dictionary($htmlname, $dictionarytable, $keyfield = 'code', $labelfield = 'label', $selected = '', $useempty = 0, $moreattrib = '') |
|
1236 | 1236 | { |
1237 | 1237 | // phpcs:enable |
1238 | 1238 | global $langs, $conf; |
@@ -1240,8 +1240,8 @@ discard block |
||
1240 | 1240 | $langs->load("admin"); |
1241 | 1241 | |
1242 | 1242 | $sql = "SELECT rowid, ".$keyfield.", ".$labelfield; |
1243 | - $sql.= " FROM ".MAIN_DB_PREFIX.$dictionarytable; |
|
1244 | - $sql.= " ORDER BY ".$labelfield; |
|
1243 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dictionarytable; |
|
1244 | + $sql .= " ORDER BY ".$labelfield; |
|
1245 | 1245 | |
1246 | 1246 | dol_syslog(get_class($this)."::select_dictionary", LOG_DEBUG); |
1247 | 1247 | $result = $this->db->query($sql); |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | $i = 0; |
1252 | 1252 | if ($num) |
1253 | 1253 | { |
1254 | - print '<select id="select'.$htmlname.'" class="flat selectdictionary" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>'; |
|
1254 | + print '<select id="select'.$htmlname.'" class="flat selectdictionary" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>'; |
|
1255 | 1255 | if ($useempty == 1 || ($useempty == 2 && $num > 1)) |
1256 | 1256 | { |
1257 | 1257 | print '<option value="-1"> </option>'; |
@@ -74,7 +74,9 @@ discard block |
||
74 | 74 | $sql = "SELECT rowid, label"; |
75 | 75 | $sql.= " FROM ".MAIN_DB_PREFIX."export_model"; |
76 | 76 | $sql.= " WHERE type = '".$type."'"; |
77 | - if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user; |
|
77 | + if (!empty($fk_user)) { |
|
78 | + $sql.=" AND fk_user=".$fk_user; |
|
79 | + } |
|
78 | 80 | $sql.= " ORDER BY rowid"; |
79 | 81 | $result = $this->db->query($sql); |
80 | 82 | if ($result) |
@@ -93,8 +95,7 @@ discard block |
||
93 | 95 | if ($selected == $obj->rowid) |
94 | 96 | { |
95 | 97 | print '<option value="'.$obj->rowid.'" selected>'; |
96 | - } |
|
97 | - else |
|
98 | + } else |
|
98 | 99 | { |
99 | 100 | print '<option value="'.$obj->rowid.'">'; |
100 | 101 | } |
@@ -103,8 +104,7 @@ discard block |
||
103 | 104 | $i++; |
104 | 105 | } |
105 | 106 | print "</select>"; |
106 | - } |
|
107 | - else { |
|
107 | + } else { |
|
108 | 108 | dol_print_error($this->db); |
109 | 109 | } |
110 | 110 | } |
@@ -144,8 +144,7 @@ discard block |
||
144 | 144 | if ($selected == $obj->rowid) |
145 | 145 | { |
146 | 146 | print '<option value="'.$obj->rowid.'" selected>'; |
147 | - } |
|
148 | - else |
|
147 | + } else |
|
149 | 148 | { |
150 | 149 | print '<option value="'.$obj->rowid.'">'; |
151 | 150 | } |
@@ -154,8 +153,7 @@ discard block |
||
154 | 153 | $i++; |
155 | 154 | } |
156 | 155 | print "</select>"; |
157 | - } |
|
158 | - else { |
|
156 | + } else { |
|
159 | 157 | dol_print_error($this->db); |
160 | 158 | } |
161 | 159 | } |
@@ -196,8 +194,7 @@ discard block |
||
196 | 194 | if ($selected && $selected == $obj->rowid) |
197 | 195 | { |
198 | 196 | print '<option value="'.$obj->rowid.'" selected>'; |
199 | - } |
|
200 | - else |
|
197 | + } else |
|
201 | 198 | { |
202 | 199 | print '<option value="'.$obj->rowid.'">'; |
203 | 200 | //print '<option onmouseover="showtip(\''.$obj->label.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">'; |
@@ -210,8 +207,7 @@ discard block |
||
210 | 207 | } |
211 | 208 | print '</select>'; |
212 | 209 | return 0; |
213 | - } |
|
214 | - else |
|
210 | + } else |
|
215 | 211 | { |
216 | 212 | dol_print_error($this->db); |
217 | 213 | return 1; |
@@ -256,8 +252,7 @@ discard block |
||
256 | 252 | if (($selected && $selected == $obj->taux) || $num == 1) |
257 | 253 | { |
258 | 254 | $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').' selected>'; |
259 | - } |
|
260 | - else |
|
255 | + } else |
|
261 | 256 | { |
262 | 257 | $out.='<option value="'.$obj->taux.($obj->revenuestamp_type == 'percent' ? '%' : '').'"'.($obj->revenuestamp_type == 'percent' ? ' data-type="percent"' : '').'>'; |
263 | 258 | //print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">'; |
@@ -269,8 +264,7 @@ discard block |
||
269 | 264 | } |
270 | 265 | $out.='</select>'; |
271 | 266 | return $out; |
272 | - } |
|
273 | - else |
|
267 | + } else |
|
274 | 268 | { |
275 | 269 | dol_print_error($this->db); |
276 | 270 | return ''; |
@@ -295,15 +289,16 @@ discard block |
||
295 | 289 | { |
296 | 290 | // phpcs:enable |
297 | 291 | $return = '<select class="flat" name="'.$htmlname.'" '.($disabled?'disabled':'').'>'; |
298 | - if ($showempty) $return.='<option value="-1"'.(($selected == -1 || $selected == '')?' selected':'').'> </option>'; |
|
292 | + if ($showempty) { |
|
293 | + $return.='<option value="-1"'.(($selected == -1 || $selected == '')?' selected':'').'> </option>'; |
|
294 | + } |
|
299 | 295 | |
300 | 296 | for ($i = $start ; $i <= $end ; $i += $increment) |
301 | 297 | { |
302 | 298 | if ($selected != '' && (int) $selected == $i) |
303 | 299 | { |
304 | 300 | $return.= '<option value="'.$i.'" selected>'; |
305 | - } |
|
306 | - else |
|
301 | + } else |
|
307 | 302 | { |
308 | 303 | $return.= '<option value="'.$i.'">'; |
309 | 304 | } |
@@ -356,14 +351,19 @@ discard block |
||
356 | 351 | |
357 | 352 | // Print a select with each of them |
358 | 353 | $moreforfilter.='<select class="flat minwidth100'.($morecss?' '.$morecss:'').'" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">'; |
359 | - if ($showempty) $moreforfilter.='<option value="0"> </option>'; // Should use -1 to say nothing |
|
354 | + if ($showempty) { |
|
355 | + $moreforfilter.='<option value="0"> </option>'; |
|
356 | + } |
|
357 | + // Should use -1 to say nothing |
|
360 | 358 | |
361 | 359 | if (is_array($tab_categs)) |
362 | 360 | { |
363 | 361 | foreach ($tab_categs as $categ) |
364 | 362 | { |
365 | 363 | $moreforfilter.='<option value="'.$categ['id'].'"'; |
366 | - if ($categ['id'] == $selected) $moreforfilter.=' selected'; |
|
364 | + if ($categ['id'] == $selected) { |
|
365 | + $moreforfilter.=' selected'; |
|
366 | + } |
|
367 | 367 | $moreforfilter.='>'.dol_trunc($categ['fulllabel'],50,'middle').'</option>'; |
368 | 368 | } |
369 | 369 | } |
@@ -410,14 +410,20 @@ discard block |
||
410 | 410 | } |
411 | 411 | // Select each sales and print them in a select input |
412 | 412 | $out.='<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">'; |
413 | - if ($showempty) $out.='<option value="0"> </option>'; |
|
413 | + if ($showempty) { |
|
414 | + $out.='<option value="0"> </option>'; |
|
415 | + } |
|
414 | 416 | |
415 | 417 | // Get list of users allowed to be viewed |
416 | 418 | $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; |
417 | 419 | $sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u"; |
418 | 420 | $sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")"; |
419 | - if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id; |
|
420 | - if (! empty($user->societe_id)) $sql_usr.=" AND u.fk_soc = ".$user->societe_id; |
|
421 | + if (empty($user->rights->user->user->lire)) { |
|
422 | + $sql_usr.=" AND u.rowid = ".$user->id; |
|
423 | + } |
|
424 | + if (! empty($user->societe_id)) { |
|
425 | + $sql_usr.=" AND u.fk_soc = ".$user->societe_id; |
|
426 | + } |
|
421 | 427 | // Add existing sales representatives of thirdparty of external user |
422 | 428 | if (empty($user->rights->user->user->lire) && $user->societe_id) |
423 | 429 | { |
@@ -438,7 +444,9 @@ discard block |
||
438 | 444 | |
439 | 445 | $out.='<option value="'.$obj_usr->rowid.'"'; |
440 | 446 | |
441 | - if ($obj_usr->rowid == $selected) $out.=' selected'; |
|
447 | + if ($obj_usr->rowid == $selected) { |
|
448 | + $out.=' selected'; |
|
449 | + } |
|
442 | 450 | |
443 | 451 | $out.='>'; |
444 | 452 | $out.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->lastname); |
@@ -466,8 +474,7 @@ discard block |
||
466 | 474 | $out.='</option>'; |
467 | 475 | } |
468 | 476 | $this->db->free($resql_usr); |
469 | - } |
|
470 | - else |
|
477 | + } else |
|
471 | 478 | { |
472 | 479 | dol_print_error($this->db); |
473 | 480 | } |
@@ -503,15 +510,16 @@ discard block |
||
503 | 510 | if ($tasksarray) |
504 | 511 | { |
505 | 512 | print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
506 | - if ($useempty) print '<option value="0"> </option>'; |
|
513 | + if ($useempty) { |
|
514 | + print '<option value="0"> </option>'; |
|
515 | + } |
|
507 | 516 | $j=0; |
508 | 517 | $level=0; |
509 | 518 | $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid, $disablechildoftaskid); |
510 | 519 | print '</select>'; |
511 | 520 | |
512 | 521 | print ajax_combobox($htmlname); |
513 | - } |
|
514 | - else |
|
522 | + } else |
|
515 | 523 | { |
516 | 524 | print '<div class="warning">'.$langs->trans("NoProject").'</div>'; |
517 | 525 | } |
@@ -545,20 +553,23 @@ discard block |
||
545 | 553 | //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // $lines[$i]->id may be empty if project has no lines |
546 | 554 | |
547 | 555 | // Break on a new project |
548 | - if ($parent == 0) // We are on a task at first level |
|
556 | + if ($parent == 0) { |
|
557 | + // We are on a task at first level |
|
549 | 558 | { |
550 | 559 | if ($lines[$i]->fk_project != $lastprojectid) // Break found on project |
551 | 560 | { |
552 | - if ($i > 0) print '<option value="0" disabled>----------</option>'; |
|
561 | + if ($i > 0) print '<option value="0" disabled>----------</option>'; |
|
562 | + } |
|
553 | 563 | print '<option value="'.$lines[$i]->fk_project.'_0"'; |
554 | - if ($selectedproject == $lines[$i]->fk_project) print ' selected'; |
|
564 | + if ($selectedproject == $lines[$i]->fk_project) { |
|
565 | + print ' selected'; |
|
566 | + } |
|
555 | 567 | print '>'; // Project -> Task |
556 | 568 | print $langs->trans("Project").' '.$lines[$i]->projectref; |
557 | 569 | if (empty($lines[$i]->public)) |
558 | 570 | { |
559 | 571 | print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')'; |
560 | - } |
|
561 | - else |
|
572 | + } else |
|
562 | 573 | { |
563 | 574 | print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')'; |
564 | 575 | } |
@@ -573,31 +584,41 @@ discard block |
||
573 | 584 | $newdisablechildoftaskid=$disablechildoftaskid; |
574 | 585 | |
575 | 586 | // Print task |
576 | - if (isset($lines[$i]->id)) // We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0 |
|
587 | + if (isset($lines[$i]->id)) { |
|
588 | + // We use isset because $lines[$i]->id may be null if project has no task and are on root project (tasks may be caught by a left join). We enter here only if '0' or >0 |
|
577 | 589 | { |
578 | 590 | // Check if we must disable entry |
579 | - $disabled=0; |
|
591 | + $disabled=0; |
|
592 | + } |
|
580 | 593 | if ($disablechildoftaskid && (($lines[$i]->id == $disablechildoftaskid || $lines[$i]->fk_parent == $disablechildoftaskid))) |
581 | 594 | { |
582 | 595 | $disabled++; |
583 | - if ($lines[$i]->fk_parent == $disablechildoftaskid) $newdisablechildoftaskid=$lines[$i]->id; // If task is child of a disabled parent, we will propagate id to disable next child too |
|
596 | + if ($lines[$i]->fk_parent == $disablechildoftaskid) { |
|
597 | + $newdisablechildoftaskid=$lines[$i]->id; |
|
598 | + } |
|
599 | + // If task is child of a disabled parent, we will propagate id to disable next child too |
|
584 | 600 | } |
585 | 601 | |
586 | 602 | print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"'; |
587 | - if (($lines[$i]->id == $selectedtask) || ($lines[$i]->fk_project.'_'.$lines[$i]->id == $selectedtask)) print ' selected'; |
|
588 | - if ($disabled) print ' disabled'; |
|
603 | + if (($lines[$i]->id == $selectedtask) || ($lines[$i]->fk_project.'_'.$lines[$i]->id == $selectedtask)) { |
|
604 | + print ' selected'; |
|
605 | + } |
|
606 | + if ($disabled) { |
|
607 | + print ' disabled'; |
|
608 | + } |
|
589 | 609 | print '>'; |
590 | 610 | print $langs->trans("Project").' '.$lines[$i]->projectref; |
591 | 611 | print ' '.$lines[$i]->projectlabel; |
592 | 612 | if (empty($lines[$i]->public)) |
593 | 613 | { |
594 | 614 | print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')'; |
595 | - } |
|
596 | - else |
|
615 | + } else |
|
597 | 616 | { |
598 | 617 | print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')'; |
599 | 618 | } |
600 | - if ($lines[$i]->id) print ' > '; |
|
619 | + if ($lines[$i]->id) { |
|
620 | + print ' > '; |
|
621 | + } |
|
601 | 622 | for ($k = 0 ; $k < $level ; $k++) |
602 | 623 | { |
603 | 624 | print " "; |
@@ -607,7 +628,9 @@ discard block |
||
607 | 628 | } |
608 | 629 | |
609 | 630 | $level++; |
610 | - if ($lines[$i]->id) $this->_pLineSelect($inc, $lines[$i]->id, $lines, $level, $selectedtask, $selectedproject, $newdisablechildoftaskid); |
|
631 | + if ($lines[$i]->id) { |
|
632 | + $this->_pLineSelect($inc, $lines[$i]->id, $lines, $level, $selectedtask, $selectedproject, $newdisablechildoftaskid); |
|
633 | + } |
|
611 | 634 | $level--; |
612 | 635 | } |
613 | 636 | } |
@@ -626,12 +649,17 @@ discard block |
||
626 | 649 | { |
627 | 650 | $textcolor='FFF'; |
628 | 651 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
629 | - if(colorIsLight($color)) $textcolor='000'; |
|
652 | + if(colorIsLight($color)) { |
|
653 | + $textcolor='000'; |
|
654 | + } |
|
630 | 655 | |
631 | 656 | $color = colorArrayToHex(colorStringToArray($color,array()),''); |
632 | 657 | |
633 | - if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">'; |
|
634 | - else print $textifnotdefined; |
|
658 | + if ($color) { |
|
659 | + print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #'.$textcolor.'; background-color: #'.$color.'" value="'.$color.'">'; |
|
660 | + } else { |
|
661 | + print $textifnotdefined; |
|
662 | + } |
|
635 | 663 | } |
636 | 664 | |
637 | 665 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -722,8 +750,7 @@ discard block |
||
722 | 750 | </script>'; |
723 | 751 | } |
724 | 752 | $out.= '<input id="colorpicker'.$prefix.'" name="'.$prefix.'" size="6" maxlength="7" class="flat'.($morecss?' '.$morecss:'').'" type="text" value="'.$set_color.'" />'; |
725 | - } |
|
726 | - else // In most cases, this is not used. We used instead function with no specific list of colors |
|
753 | + } else // In most cases, this is not used. We used instead function with no specific list of colors |
|
727 | 754 | { |
728 | 755 | if (empty($conf->dol_use_jmobile)) |
729 | 756 | { |
@@ -744,7 +771,9 @@ discard block |
||
744 | 771 | foreach ($arrayofcolors as $val) |
745 | 772 | { |
746 | 773 | $out.= '<option value="'.$val.'"'; |
747 | - if ($set_color == $val) $out.= ' selected'; |
|
774 | + if ($set_color == $val) { |
|
775 | + $out.= ' selected'; |
|
776 | + } |
|
748 | 777 | $out.= '>'.$val.'</option>'; |
749 | 778 | } |
750 | 779 | $out.= '</select>'; |
@@ -828,8 +857,7 @@ discard block |
||
828 | 857 | if ($selected == $key) |
829 | 858 | { |
830 | 859 | $select_week .= '<option value="'.$key.'" selected>'; |
831 | - } |
|
832 | - else |
|
860 | + } else |
|
833 | 861 | { |
834 | 862 | $select_week .= '<option value="'.$key.'">'; |
835 | 863 | } |
@@ -858,8 +886,13 @@ discard block |
||
858 | 886 | |
859 | 887 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
860 | 888 | |
861 | - if ($longlabel) $montharray = monthArray($langs, 0); // Get array |
|
862 | - else $montharray = monthArray($langs, 1); |
|
889 | + if ($longlabel) { |
|
890 | + $montharray = monthArray($langs, 0); |
|
891 | + } |
|
892 | + // Get array |
|
893 | + else { |
|
894 | + $montharray = monthArray($langs, 1); |
|
895 | + } |
|
863 | 896 | |
864 | 897 | $select_month = '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">'; |
865 | 898 | if ($useempty) |
@@ -871,8 +904,7 @@ discard block |
||
871 | 904 | if ($selected == $key) |
872 | 905 | { |
873 | 906 | $select_month .= '<option value="'.$key.'" selected>'; |
874 | - } |
|
875 | - else |
|
907 | + } else |
|
876 | 908 | { |
877 | 909 | $select_month .= '<option value="'.$key.'">'; |
878 | 910 | } |
@@ -925,13 +957,17 @@ discard block |
||
925 | 957 | $currentyear = date("Y")+$offset; |
926 | 958 | $max_year = $currentyear+$max_year; |
927 | 959 | $min_year = $currentyear-$min_year; |
928 | - if(empty($selected) && empty($useempty)) $selected = $currentyear; |
|
960 | + if(empty($selected) && empty($useempty)) { |
|
961 | + $selected = $currentyear; |
|
962 | + } |
|
929 | 963 | |
930 | 964 | $out.= '<select class="flat'.($morecss?' '.$morecss:'').'" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >'; |
931 | 965 | if($useempty) |
932 | 966 | { |
933 | 967 | $selected_html=''; |
934 | - if ($selected == '') $selected_html = ' selected'; |
|
968 | + if ($selected == '') { |
|
969 | + $selected_html = ' selected'; |
|
970 | + } |
|
935 | 971 | $out.= '<option value=""' . $selected_html . '> </option>'; |
936 | 972 | } |
937 | 973 | if (! $invert) |
@@ -939,16 +975,19 @@ discard block |
||
939 | 975 | for ($y = $max_year; $y >= $min_year; $y--) |
940 | 976 | { |
941 | 977 | $selected_html=''; |
942 | - if ($selected > 0 && $y == $selected) $selected_html = ' selected'; |
|
978 | + if ($selected > 0 && $y == $selected) { |
|
979 | + $selected_html = ' selected'; |
|
980 | + } |
|
943 | 981 | $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>'; |
944 | 982 | } |
945 | - } |
|
946 | - else |
|
983 | + } else |
|
947 | 984 | { |
948 | 985 | for ($y = $min_year; $y <= $max_year; $y++) |
949 | 986 | { |
950 | 987 | $selected_html=''; |
951 | - if ($selected > 0 && $y == $selected) $selected_html = ' selected'; |
|
988 | + if ($selected > 0 && $y == $selected) { |
|
989 | + $selected_html = ' selected'; |
|
990 | + } |
|
952 | 991 | $out.= '<option value="'.$y.'"'.$selected_html.' >'.$y.'</option>'; |
953 | 992 | } |
954 | 993 | } |
@@ -985,8 +1024,7 @@ discard block |
||
985 | 1024 | $langs->load("companies"); |
986 | 1025 | print ' <a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$socid.'&action=create&origin='.$origin.'&originid='.$originid.'>'.$langs->trans("AddAddress").'</a>'; |
987 | 1026 | print '</form>'; |
988 | - } |
|
989 | - else |
|
1027 | + } else |
|
990 | 1028 | { |
991 | 1029 | if ($selected) |
992 | 1030 | { |
@@ -994,8 +1032,7 @@ discard block |
||
994 | 1032 | $address=new Address($this->db); |
995 | 1033 | $result=$address->fetch_address($selected); |
996 | 1034 | print '<a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$address->socid.'&id='.$address->id.'&action=edit&origin='.$origin.'&originid='.$originid.'>'.$address->label.'</a>'; |
997 | - } |
|
998 | - else |
|
1035 | + } else |
|
999 | 1036 | { |
1000 | 1037 | print " "; |
1001 | 1038 | } |
@@ -1029,7 +1066,10 @@ discard block |
||
1029 | 1066 | $boxidactivatedforuser=array(); |
1030 | 1067 | foreach($boxactivated as $box) |
1031 | 1068 | { |
1032 | - if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user |
|
1069 | + if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) { |
|
1070 | + $boxidactivatedforuser[$box->id]=$box->id; |
|
1071 | + } |
|
1072 | + // We keep only boxes to show for user |
|
1033 | 1073 | } |
1034 | 1074 | |
1035 | 1075 | // Define selectboxlist |
@@ -1040,7 +1080,10 @@ discard block |
||
1040 | 1080 | $langs->load("boxes"); // Load label of boxes |
1041 | 1081 | foreach($boxactivated as $box) |
1042 | 1082 | { |
1043 | - if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user |
|
1083 | + if (! empty($boxidactivatedforuser[$box->id])) { |
|
1084 | + continue; |
|
1085 | + } |
|
1086 | + // Already visible for user |
|
1044 | 1087 | $label=$langs->transnoentitiesnoconv($box->boxlabel); |
1045 | 1088 | //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; |
1046 | 1089 | if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone') |
@@ -1051,7 +1094,9 @@ discard block |
||
1051 | 1094 | } |
1052 | 1095 | foreach($boxidactivatedforuser as $boxid) |
1053 | 1096 | { |
1054 | - if (empty($boxorder)) $boxorder.='A:'; |
|
1097 | + if (empty($boxorder)) { |
|
1098 | + $boxorder.='A:'; |
|
1099 | + } |
|
1055 | 1100 | $boxorder.=$boxid.','; |
1056 | 1101 | } |
1057 | 1102 | |
@@ -1065,7 +1110,9 @@ discard block |
||
1065 | 1110 | $selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">'; |
1066 | 1111 | $selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">'; |
1067 | 1112 | $selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1); |
1068 | - if (empty($conf->use_javascript_ajax)) $selectboxlist.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">'; |
|
1113 | + if (empty($conf->use_javascript_ajax)) { |
|
1114 | + $selectboxlist.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">'; |
|
1115 | + } |
|
1069 | 1116 | $selectboxlist.='</form>'; |
1070 | 1117 | if (! empty($conf->use_javascript_ajax)) |
1071 | 1118 | { |
@@ -1116,7 +1163,9 @@ discard block |
||
1116 | 1163 | window.location.search=\'mainmenu='.GETPOST("mainmenu","aZ09").'&leftmenu='.GETPOST('leftmenu',"aZ09").'&action=addbox&boxid=\'+boxid; |
1117 | 1164 | } |
1118 | 1165 | });'; |
1119 | - if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();'; |
|
1166 | + if (! count($arrayboxtoactivatelabel)) { |
|
1167 | + $selectboxlist.='jQuery("#boxcombo").hide();'; |
|
1168 | + } |
|
1120 | 1169 | $selectboxlist.=' |
1121 | 1170 | |
1122 | 1171 | jQuery("#boxhalfleft, #boxhalfright").sortable({ |
@@ -1159,16 +1208,25 @@ discard block |
||
1159 | 1208 | |
1160 | 1209 | // Define $box_max_lines |
1161 | 1210 | $box_max_lines=5; |
1162 | - if (! empty($conf->global->MAIN_BOXES_MAXLINES)) $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES; |
|
1211 | + if (! empty($conf->global->MAIN_BOXES_MAXLINES)) { |
|
1212 | + $box_max_lines=$conf->global->MAIN_BOXES_MAXLINES; |
|
1213 | + } |
|
1163 | 1214 | |
1164 | 1215 | $ii=0; |
1165 | 1216 | foreach ($boxactivated as $key => $box) |
1166 | 1217 | { |
1167 | - if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1168 | - if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='A'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1169 | - if (preg_match('/^A/i',$box->box_order)) // column A |
|
1218 | + if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) { |
|
1219 | + continue; |
|
1220 | + } |
|
1221 | + if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) { |
|
1222 | + $box->box_order='A'.sprintf("%02d",($ii+1)); |
|
1223 | + } |
|
1224 | + // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1225 | + if (preg_match('/^A/i',$box->box_order)) { |
|
1226 | + // column A |
|
1170 | 1227 | { |
1171 | - $ii++; |
|
1228 | + $ii++; |
|
1229 | + } |
|
1172 | 1230 | //print 'box_id '.$boxactivated[$ii]->box_id.' '; |
1173 | 1231 | //print 'box_order '.$boxactivated[$ii]->box_order.'<br>'; |
1174 | 1232 | // Show box |
@@ -1191,11 +1249,18 @@ discard block |
||
1191 | 1249 | $ii=0; |
1192 | 1250 | foreach ($boxactivated as $key => $box) |
1193 | 1251 | { |
1194 | - if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) continue; |
|
1195 | - if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) $box->box_order='B'.sprintf("%02d",($ii+1)); // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1196 | - if (preg_match('/^B/i',$box->box_order)) // colonne B |
|
1252 | + if ((! empty($user->conf->$confuserzone) && $box->fk_user == 0) || (empty($user->conf->$confuserzone) && $box->fk_user != 0)) { |
|
1253 | + continue; |
|
1254 | + } |
|
1255 | + if (empty($box->box_order) && $ii < ($nbboxactivated / 2)) { |
|
1256 | + $box->box_order='B'.sprintf("%02d",($ii+1)); |
|
1257 | + } |
|
1258 | + // When box_order was not yet set to Axx or Bxx and is still 0 |
|
1259 | + if (preg_match('/^B/i',$box->box_order)) { |
|
1260 | + // colonne B |
|
1197 | 1261 | { |
1198 | - $ii++; |
|
1262 | + $ii++; |
|
1263 | + } |
|
1199 | 1264 | //print 'box_id '.$boxactivated[$ii]->box_id.' '; |
1200 | 1265 | //print 'box_order '.$boxactivated[$ii]->box_order.'<br>'; |
1201 | 1266 | // Show box |
@@ -1263,8 +1328,7 @@ discard block |
||
1263 | 1328 | if ($selected == $obj->rowid || $selected == $obj->$keyfield) |
1264 | 1329 | { |
1265 | 1330 | print '<option value="'.$obj->$keyfield.'" selected>'; |
1266 | - } |
|
1267 | - else |
|
1331 | + } else |
|
1268 | 1332 | { |
1269 | 1333 | print '<option value="'.$obj->$keyfield.'">'; |
1270 | 1334 | } |
@@ -1273,13 +1337,11 @@ discard block |
||
1273 | 1337 | $i++; |
1274 | 1338 | } |
1275 | 1339 | print "</select>"; |
1276 | - } |
|
1277 | - else |
|
1340 | + } else |
|
1278 | 1341 | { |
1279 | 1342 | print $langs->trans("DictionaryEmpty"); |
1280 | 1343 | } |
1281 | - } |
|
1282 | - else { |
|
1344 | + } else { |
|
1283 | 1345 | dol_print_error($this->db); |
1284 | 1346 | } |
1285 | 1347 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | // html header |
117 | 117 | $this->top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); |
118 | 118 | |
119 | - print '<body id="mainbody"' . ($morecssonbody ? ' class="' . $morecssonbody . '"' : '') . '>' . "\n"; |
|
119 | + print '<body id="mainbody"'.($morecssonbody ? ' class="'.$morecssonbody.'"' : '').'>'."\n"; |
|
120 | 120 | |
121 | 121 | // top menu and left menu area |
122 | 122 | if (empty(Globals::$conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | if (empty(Globals::$conf->dol_hide_leftmenu)) { |
127 | - $this->left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function |
|
127 | + $this->left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | // main area |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | * Top menu |
176 | 176 | */ |
177 | 177 | if ((empty(Globals::$conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { |
178 | - print "\n" . '<!-- Start top horizontal -->' . "\n"; |
|
178 | + print "\n".'<!-- Start top horizontal -->'."\n"; |
|
179 | 179 | |
180 | - print '<div class="side-nav-vert' . (DolUtils::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. |
|
180 | + print '<div class="side-nav-vert'.(DolUtils::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. |
|
181 | 181 | // Show menu entries |
182 | - print '<div id="tmenu_tooltip' . (empty(Globals::$conf->global->MAIN_MENU_INVERT) ? '' : 'invert') . '" class="tmenu">' . "\n"; |
|
182 | + print '<div id="tmenu_tooltip'.(empty(Globals::$conf->global->MAIN_MENU_INVERT) ? '' : 'invert').'" class="tmenu">'."\n"; |
|
183 | 183 | $this->menumanager->atarget = $target; |
184 | - $this->menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n |
|
184 | + $this->menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n |
|
185 | 185 | print "</div>\n"; |
186 | 186 | |
187 | 187 | // Define link to login card |
@@ -189,34 +189,34 @@ discard block |
||
189 | 189 | if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) { |
190 | 190 | $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE; |
191 | 191 | if (preg_match('/\d\.\d/', $appli)) { |
192 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
|
193 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
|
192 | + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) |
|
193 | + $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
194 | 194 | } else |
195 | - $appli .= " " . DOL_VERSION; |
|
195 | + $appli .= " ".DOL_VERSION; |
|
196 | 196 | } else |
197 | - $appli .= " " . DOL_VERSION; |
|
197 | + $appli .= " ".DOL_VERSION; |
|
198 | 198 | |
199 | 199 | if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL)) |
200 | - $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL; |
|
200 | + $appli .= "<br>".Globals::$langs->trans("LevelOfFeature").': '.Globals::$conf->global->MAIN_FEATURES_LEVEL; |
|
201 | 201 | |
202 | 202 | $logouttext = ''; |
203 | 203 | if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
204 | 204 | //$logouthtmltext=$appli.'<br>'; |
205 | 205 | if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { |
206 | - $logouthtmltext .= Globals::$langs->trans("Logout") . '<br>'; |
|
206 | + $logouthtmltext .= Globals::$langs->trans("Logout").'<br>'; |
|
207 | 207 | |
208 | 208 | //$logouttext .='<a accesskey="l" href="'.DOL_BASE_URI.'/user/logout.php">'; |
209 | - $logouttext .= '<a accesskey="l" href="' . BASE_URI . '?controller=user&method=logout">'; |
|
209 | + $logouttext .= '<a accesskey="l" href="'.BASE_URI.'?controller=user&method=logout">'; |
|
210 | 210 | //$logouttext .= img_picto(Globals::$langs->trans('Logout').":".Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); |
211 | 211 | $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>'; |
212 | 212 | $logouttext .= '</a>'; |
213 | 213 | } else { |
214 | 214 | $logouthtmltext .= Globals::$langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); |
215 | - $logouttext .= img_picto(Globals::$langs->trans('Logout') . ":" . Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); |
|
215 | + $logouttext .= img_picto(Globals::$langs->trans('Logout').":".Globals::$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
219 | - print '<div class="login_block">' . "\n"; |
|
219 | + print '<div class="login_block">'."\n"; |
|
220 | 220 | |
221 | 221 | // Add login user link |
222 | 222 | $toprightmenu .= '<div class="login_block_user">'; |
@@ -227,18 +227,18 @@ discard block |
||
227 | 227 | $toprightmenu .= Globals::$user->getNomUrl($mode, '', 1, 0, 11, 0, (Globals::$user->firstname ? 'firstname' : -1), 'atoplogin'); |
228 | 228 | $toprightmenu .= '</div></div>'; |
229 | 229 | |
230 | - $toprightmenu .= '</div>' . "\n"; |
|
230 | + $toprightmenu .= '</div>'."\n"; |
|
231 | 231 | |
232 | 232 | $toprightmenu .= '<div class="login_block_other">'; |
233 | 233 | |
234 | 234 | // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>') |
235 | 235 | $parameters = array(); |
236 | - $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks |
|
236 | + $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks |
|
237 | 237 | if (is_numeric($result)) { |
238 | 238 | if ($result == 0) |
239 | - $toprightmenu .= Globals::$hookManager->resPrint; // add |
|
239 | + $toprightmenu .= Globals::$hookManager->resPrint; // add |
|
240 | 240 | else |
241 | - $toprightmenu = Globals::$hookManager->resPrint; // replace |
|
241 | + $toprightmenu = Globals::$hookManager->resPrint; // replace |
|
242 | 242 | } |
243 | 243 | else { |
244 | 244 | $toprightmenu .= $result; // For backward compatibility |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | // Link to module builder |
248 | 248 | if (!empty(Globals::$conf->modulebuilder->enabled)) { |
249 | 249 | //$text = '<a href="' . DOL_BASE_URI . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
250 | - $text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
|
250 | + $text = '<a href="'.BASE_URI.'?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
|
251 | 251 | //$text.= img_picto(":".Globals::$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"'); |
252 | 252 | $text .= '<span class="fa fa-bug atoplogin"></span>'; |
253 | 253 | $text .= '</a>'; |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | if (is_array($_POST)) { |
262 | 262 | foreach ($_POST as $key => $value) { |
263 | 263 | if ($key !== 'action' && $key !== 'password' && !is_array($value)) { |
264 | - $qs .= '&' . $key . '=' . urlencode($value); |
|
264 | + $qs .= '&'.$key.'='.urlencode($value); |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | } |
268 | - $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring; |
|
269 | - $text = '<a href="' . dol_escape_htmltag($_SERVER["PHP_SELF"]) . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">'; |
|
268 | + $qs .= (($qs && $morequerystring) ? '&' : '').$morequerystring; |
|
269 | + $text = '<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs ? '&' : '').'optioncss=print" target="_blank">'; |
|
270 | 270 | //$text.= img_picto(":".Globals::$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"'); |
271 | 271 | $text .= '<span class="fa fa-print atoplogin"></span>'; |
272 | 272 | $text .= '</a>'; |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | $text = ''; |
296 | 296 | if (!empty(Globals::$conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) { |
297 | 297 | Globals::$langs->load('admin'); |
298 | -$appli .= '<br>' . Globals::$langs->trans("Database") . ': ' . $db->database_name; |
|
298 | +$appli .= '<br>'.Globals::$langs->trans("Database").': '.$db->database_name; |
|
299 | 299 | } |
300 | - $title = $appli . '<br>'; |
|
300 | + $title = $appli.'<br>'; |
|
301 | 301 | $title .= Globals::$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage'); |
302 | 302 | if ($mode == 'wiki') { |
303 | - $title .= ' - ' . Globals::$langs->trans("PageWiki") . ' "' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '"'; |
|
303 | + $title .= ' - '.Globals::$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'"'; |
|
304 | 304 | } |
305 | 305 | $text .= '<a class="help" target="_blank" rel="noopener" href="'; |
306 | 306 | if ($mode == 'wiki') { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | |
327 | 327 | print $toprightmenu; |
328 | 328 | |
329 | - print "</div>\n"; // end div class="login_block" |
|
329 | + print "</div>\n"; // end div class="login_block" |
|
330 | 330 | |
331 | 331 | print '</div></div>'; |
332 | 332 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) |
338 | - print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">'; |
|
338 | + print '<!-- Begin div id-container --><div id="id-container" class="id-container'.($morecss ? ' '.$morecss : '').'">'; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | // Instantiate hooks of thirdparty module |
368 | 368 | Globals::$hookManager->initHooks(array('searchform', 'leftblock')); |
369 | 369 | |
370 | - print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n"; |
|
370 | + print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n"; |
|
371 | 371 | |
372 | 372 | if (Globals::$conf->browser->layout == 'phone') |
373 | 373 | Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | } |
380 | 380 | $selected = -1; |
381 | 381 | $usedbyinclude = 1; |
382 | - include_once DOL_BASE_PATH . '/core/ajax/selectsearchbox.php'; // This set $arrayresult |
|
382 | + include_once DOL_BASE_PATH.'/core/ajax/selectsearchbox.php'; // This set $arrayresult |
|
383 | 383 | |
384 | 384 | if (Globals::$conf->use_javascript_ajax && empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) { |
385 | 385 | //$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_BASE_URI.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, Globals::$langs->trans("Search"), 1); |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // Execute hook printSearchForm |
395 | 395 | $parameters = array('searchform' => $searchform); |
396 | 396 | |
397 | - $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks |
|
397 | + $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks |
|
398 | 398 | if (empty($reshook)) { |
399 | 399 | $searchform .= Globals::$hookManager->resPrint; |
400 | 400 | } else |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | |
403 | 403 | // Force special value for $searchform |
404 | 404 | if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty(Globals::$conf->use_javascript_ajax)) { |
405 | - $urltosearch = DOL_BASE_URI . '/core/search_page.php?showtitlebefore=1'; |
|
406 | - $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" alt="' . dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")) . '">' . Globals::$langs->trans("Search") . '...</a></div></div>'; |
|
407 | - } elseif (Globals::$conf->use_javascript_ajax &&!empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) { |
|
408 | -$searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="' . dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")) . '">' . Globals::$langs->trans("Search") . '...</a></div><div id="divsearchforms2" style="display: none">' . $searchform . '</div>'; |
|
405 | + $urltosearch = DOL_BASE_URI.'/core/search_page.php?showtitlebefore=1'; |
|
406 | + $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" alt="'.dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")).'">'.Globals::$langs->trans("Search").'...</a></div></div>'; |
|
407 | + } elseif (Globals::$conf->use_javascript_ajax && !empty(Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM)) { |
|
408 | +$searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="'.dol_escape_htmltag(Globals::$langs->trans("ShowSearchFields")).'">'.Globals::$langs->trans("Search").'...</a></div><div id="divsearchforms2" style="display: none">'.$searchform.'</div>'; |
|
409 | 409 | $searchform .= '<script type="text/javascript"> |
410 | 410 | jQuery(document).ready(function () { |
411 | 411 | jQuery("#divsearchforms1").click(function(){ |
@@ -418,16 +418,16 @@ discard block |
||
418 | 418 | |
419 | 419 | // Define $bookmarks |
420 | 420 | if (!empty(Globals::$conf->bookmark->enabled) && Globals::$user->rights->bookmark->lire) { |
421 | - include_once DOL_BASE_PATH . '/bookmarks/bookmarks.lib.php'; |
|
421 | + include_once DOL_BASE_PATH.'/bookmarks/bookmarks.lib.php'; |
|
422 | 422 | Globals::$langs->load("bookmarks"); |
423 | 423 | |
424 | 424 | $bookmarks = printBookmarksList($db, Globals::$langs); |
425 | 425 | } |
426 | 426 | |
427 | 427 | // Left column |
428 | - print '<!-- Begin left menu -->' . "\n"; |
|
428 | + print '<!-- Begin left menu -->'."\n"; |
|
429 | 429 | |
430 | - print '<div class="vmenu"' . (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"') . '>' . "\n\n"; |
|
430 | + print '<div class="vmenu"'.(empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"').'>'."\n\n"; |
|
431 | 431 | |
432 | 432 | // Show left menu with other forms |
433 | 433 | $this->menumanager->menu_array = $menu_array_before; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | // Dolibarr version + help + bug report link |
437 | 437 | print "\n"; |
438 | 438 | print "<!-- Begin Help Block-->\n"; |
439 | - print '<div id="blockvmenuhelp" class="blockvmenuhelp">' . "\n"; |
|
439 | + print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n"; |
|
440 | 440 | |
441 | 441 | // Version |
442 | 442 | if (empty(Globals::$conf->global->MAIN_HIDE_VERSION)) { // Version is already on help picto and on login page. |
@@ -458,15 +458,15 @@ discard block |
||
458 | 458 | $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE; |
459 | 459 | $doliurl = ''; |
460 | 460 | if (preg_match('/\d\.\d/', $appli)) { |
461 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
|
462 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
|
461 | + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) |
|
462 | + $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
463 | 463 | } else |
464 | - $appli .= " " . DOL_VERSION; |
|
464 | + $appli .= " ".DOL_VERSION; |
|
465 | 465 | } else |
466 | - $appli .= " " . DOL_VERSION; |
|
466 | + $appli .= " ".DOL_VERSION; |
|
467 | 467 | print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">'; |
468 | 468 | if ($doliurl) |
469 | - print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">'; |
|
469 | + print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">'; |
|
470 | 470 | else |
471 | 471 | print '<span class="help">'; |
472 | 472 | print $appli; |
@@ -474,12 +474,12 @@ discard block |
||
474 | 474 | print '</a>'; |
475 | 475 | else |
476 | 476 | print '</span>'; |
477 | - print '</div>' . "\n"; |
|
477 | + print '</div>'."\n"; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | // Link to bugtrack |
481 | 481 | if (!empty(Globals::$conf->global->MAIN_BUGTRACK_ENABLELINK)) { |
482 | - require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php'; |
|
482 | + require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php'; |
|
483 | 483 | |
484 | 484 | $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new'; |
485 | 485 | $bugbaseurl .= '?title='; |
@@ -488,16 +488,16 @@ discard block |
||
488 | 488 | $bugbaseurl .= urlencode("# Bug\n"); |
489 | 489 | $bugbaseurl .= urlencode("\n"); |
490 | 490 | $bugbaseurl .= urlencode("## Environment\n"); |
491 | - $bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n"); |
|
492 | - $bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n"); |
|
493 | - $bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n"); |
|
494 | - $bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n"); |
|
495 | - $bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n"); |
|
496 | - $bugbaseurl .= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n"); |
|
491 | + $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n"); |
|
492 | + $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n"); |
|
493 | + $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n"); |
|
494 | + $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n"); |
|
495 | + $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n"); |
|
496 | + $bugbaseurl .= urlencode("- **URL**: ".$_SERVER["REQUEST_URI"]."\n"); |
|
497 | 497 | $bugbaseurl .= urlencode("\n"); |
498 | 498 | $bugbaseurl .= urlencode("## Report\n"); |
499 | 499 | print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">'; |
500 | - print '<a class="help" target="_blank" rel="noopener" href="' . $bugbaseurl . '">' . Globals::$langs->trans("FindBug") . '</a>'; |
|
500 | + print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.Globals::$langs->trans("FindBug").'</a>'; |
|
501 | 501 | print '</div>'; |
502 | 502 | } |
503 | 503 | |
@@ -511,14 +511,14 @@ discard block |
||
511 | 511 | |
512 | 512 | // Execute hook printLeftBlock |
513 | 513 | $parameters = array(); |
514 | - $reshook = Globals::$hookManager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks |
|
514 | + $reshook = Globals::$hookManager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks |
|
515 | 515 | print Globals::$hookManager->resPrint; |
516 | 516 | |
517 | 517 | print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left" |
518 | 518 | } |
519 | 519 | |
520 | 520 | print "\n"; |
521 | - print '<!-- Begin right area -->' . "\n"; |
|
521 | + print '<!-- Begin right area -->'."\n"; |
|
522 | 522 | |
523 | 523 | if (empty($leftmenuwithoutmainarea)) |
524 | 524 | main_area($title); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | |
540 | 540 | print "\n"; |
541 | 541 | |
542 | - print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n"; |
|
542 | + print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n"; |
|
543 | 543 | |
544 | 544 | if (!empty(Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)) |
545 | 545 | print info_admin(Globals::$langs->trans("WarningYouAreInMaintenanceMode", Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)); |
@@ -605,17 +605,17 @@ discard block |
||
605 | 605 | // global Globals::$conf, Globals::$langs, Globals::$user; |
606 | 606 | |
607 | 607 | $ret = ''; |
608 | - $ret .= '<form action="' . $urlaction . '" method="post" class="searchform">'; |
|
609 | - $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
608 | + $ret .= '<form action="'.$urlaction.'" method="post" class="searchform">'; |
|
609 | + $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
610 | 610 | $ret .= '<input type="hidden" name="mode" value="search">'; |
611 | - $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag(Globals::$user->login) . '">'; |
|
611 | + $ret .= '<input type="hidden" name="savelogin" value="'.dol_escape_htmltag(Globals::$user->login).'">'; |
|
612 | 612 | if ($showtitlebefore) |
613 | - $ret .= $title . ' '; |
|
614 | - $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"'; |
|
615 | - $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"'; |
|
616 | - $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : ''); |
|
617 | - $ret .= ' placeholder="' . strip_tags($title) . '"'; |
|
618 | - $ret .= ' name="' . $htmlinputname . '" id="' . $prefhtmlinputname . $htmlinputname . '" />'; |
|
613 | + $ret .= $title.' '; |
|
614 | + $ret .= '<input type="text" class="flat '.$htmlmorecss.'"'; |
|
615 | + $ret .= ' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"'; |
|
616 | + $ret .= ($accesskey ? ' accesskey="'.$accesskey.'"' : ''); |
|
617 | + $ret .= ' placeholder="'.strip_tags($title).'"'; |
|
618 | + $ret .= ' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />'; |
|
619 | 619 | //$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.Globals::$langs->trans("Go").'">'; |
620 | 620 | $ret .= '<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">'; |
621 | 621 | $ret .= '<span class="fa fa-search"></span>'; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | // global $delayedhtmlcontent; |
641 | 641 | // global $contextpage, $page, $limit; |
642 | 642 | |
643 | - $ext = 'layout=' . Globals::$conf->browser->layout . '&version=' . urlencode(DOL_VERSION); |
|
643 | + $ext = 'layout='.Globals::$conf->browser->layout.'&version='.urlencode(DOL_VERSION); |
|
644 | 644 | |
645 | 645 | // Global html output events ($mesgs, $errors, $warnings) |
646 | 646 | dol_htmloutput_events($disabledoutputofmessages); |
@@ -650,15 +650,15 @@ discard block |
||
650 | 650 | if (is_object(Globals::$user) && !empty(Globals::$user->lastsearch_values_tmp) && is_array(Globals::$user->lastsearch_values_tmp)) { |
651 | 651 | // Clean and save data |
652 | 652 | foreach (Globals::$user->lastsearch_values_tmp as $key => $val) { |
653 | - unset($_SESSION['lastsearch_values_tmp_' . $key]); // Clean array to rebuild it just after |
|
653 | + unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after |
|
654 | 654 | if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button |
655 | 655 | if (empty($val['sortfield'])) |
656 | 656 | unset($val['sortfield']); |
657 | 657 | if (empty($val['sortorder'])) |
658 | 658 | unset($val['sortorder']); |
659 | - dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)"); |
|
660 | - $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val); |
|
661 | - unset($_SESSION['lastsearch_values_' . $key]); |
|
659 | + dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)"); |
|
660 | + $_SESSION['lastsearch_values_tmp_'.$key] = json_encode($val); |
|
661 | + unset($_SESSION['lastsearch_values_'.$key]); |
|
662 | 662 | } |
663 | 663 | } |
664 | 664 | } |
@@ -667,37 +667,37 @@ discard block |
||
667 | 667 | $relativepathstring = $_SERVER["PHP_SELF"]; |
668 | 668 | // Clean $relativepathstring |
669 | 669 | if (constant('DOL_BASE_URI')) |
670 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
670 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring); |
|
671 | 671 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
672 | 672 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
673 | 673 | if (preg_match('/list\.php$/', $relativepathstring)) { |
674 | - unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]); |
|
675 | - unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]); |
|
676 | - unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]); |
|
674 | + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); |
|
675 | + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); |
|
676 | + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); |
|
677 | 677 | |
678 | 678 | if (!empty($contextpage)) |
679 | - $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage; |
|
679 | + $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage; |
|
680 | 680 | if (!empty($page) && $page > 1) |
681 | - $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page; |
|
681 | + $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page; |
|
682 | 682 | if (!empty($limit) && $limit != Globals::$conf->limit) |
683 | - $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit; |
|
683 | + $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit; |
|
684 | 684 | |
685 | - unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]); |
|
686 | - unset($_SESSION['lastsearch_page_' . $relativepathstring]); |
|
687 | - unset($_SESSION['lastsearch_limit_' . $relativepathstring]); |
|
685 | + unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); |
|
686 | + unset($_SESSION['lastsearch_page_'.$relativepathstring]); |
|
687 | + unset($_SESSION['lastsearch_limit_'.$relativepathstring]); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | // Core error message |
691 | 691 | if (!empty(Globals::$conf->global->MAIN_CORE_ERROR)) { |
692 | 692 | // Ajax version |
693 | 693 | if (Globals::$conf->use_javascript_ajax) { |
694 | - $title = img_warning() . ' ' . Globals::$langs->trans('CoreErrorTitle'); |
|
694 | + $title = img_warning().' '.Globals::$langs->trans('CoreErrorTitle'); |
|
695 | 695 | print ajax_dialog($title, Globals::$langs->trans('CoreErrorMessage')); |
696 | 696 | } |
697 | 697 | // html version |
698 | 698 | else { |
699 | - $msg = img_warning() . ' ' . Globals::$langs->trans('CoreErrorMessage'); |
|
700 | - print '<div class="error">' . $msg . '</div>'; |
|
699 | + $msg = img_warning().' '.Globals::$langs->trans('CoreErrorMessage'); |
|
700 | + print '<div class="error">'.$msg.'</div>'; |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | //define("MAIN_CORE_ERROR",0); // Constant was defined and we can't change value of a constant |
@@ -705,17 +705,17 @@ discard block |
||
705 | 705 | |
706 | 706 | print "\n\n"; |
707 | 707 | |
708 | - print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche |
|
708 | + print '</div> <!-- End div class="fiche" -->'."\n"; // End div fiche |
|
709 | 709 | |
710 | 710 | if (empty(Globals::$conf->dol_hide_leftmenu)) |
711 | - print '</div> <!-- End div id-right -->' . "\n"; // End div id-right |
|
711 | + print '</div> <!-- End div id-right -->'."\n"; // End div id-right |
|
712 | 712 | |
713 | 713 | if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) |
714 | - print '</div> <!-- End div id-container -->' . "\n"; // End div container |
|
714 | + print '</div> <!-- End div id-container -->'."\n"; // End div container |
|
715 | 715 | |
716 | 716 | print "\n"; |
717 | 717 | if ($comment) |
718 | - print '<!-- ' . $comment . ' -->' . "\n"; |
|
718 | + print '<!-- '.$comment.' -->'."\n"; |
|
719 | 719 | |
720 | 720 | printCommonFooter($zone); |
721 | 721 | |
@@ -723,8 +723,8 @@ discard block |
||
723 | 723 | print $delayedhtmlcontent; |
724 | 724 | |
725 | 725 | if (!empty(Globals::$conf->use_javascript_ajax)) { |
726 | - print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n"; |
|
727 | - print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_foot.js&lang=' . Globals::$langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n"; |
|
726 | + print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n"; |
|
727 | + print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_foot.js&lang='.Globals::$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n"; |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | // Wrapper to add log when clicking on download or preview |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | <script type="text/javascript"> |
737 | 737 | jQuery(document).ready(function () { |
738 | 738 | $('a.documentpreview').click(function () { |
739 | - $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>' |
|
739 | + $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>' |
|
740 | 740 | , { |
741 | 741 | id:<?php echo $object->id; ?> |
742 | 742 | , element: '<?php echo $object->element ?>' |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | ); |
746 | 746 | }); |
747 | 747 | $('a.documentdownload').click(function () { |
748 | - $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>' |
|
748 | + $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>' |
|
749 | 749 | , { |
750 | 750 | id:<?php echo $object->id; ?> |
751 | 751 | , element: '<?php echo $object->element ?>' |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | |
762 | 762 | // A div for the address popup |
763 | 763 | print "\n<!-- A div to allow dialog popup -->\n"; |
764 | - print '<div id="dialogforpopup" style="display: none;"></div>' . "\n"; |
|
764 | + print '<div id="dialogforpopup" style="display: none;"></div>'."\n"; |
|
765 | 765 | |
766 | 766 | print "</body>\n"; |
767 | 767 |
@@ -189,15 +189,20 @@ discard block |
||
189 | 189 | if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) { |
190 | 190 | $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE; |
191 | 191 | if (preg_match('/\d\.\d/', $appli)) { |
192 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
|
193 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
|
194 | - } else |
|
195 | - $appli .= " " . DOL_VERSION; |
|
196 | - } else |
|
197 | - $appli .= " " . DOL_VERSION; |
|
192 | + if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) { |
|
193 | + $appli .= " (" . DOL_VERSION . ")"; |
|
194 | + } |
|
195 | + // If new title contains a version that is different than core |
|
196 | + } else { |
|
197 | + $appli .= " " . DOL_VERSION; |
|
198 | + } |
|
199 | + } else { |
|
200 | + $appli .= " " . DOL_VERSION; |
|
201 | + } |
|
198 | 202 | |
199 | - if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL)) |
|
200 | - $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL; |
|
203 | + if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL)) { |
|
204 | + $appli .= "<br>" . Globals::$langs->trans("LevelOfFeature") . ': ' . Globals::$conf->global->MAIN_FEATURES_LEVEL; |
|
205 | + } |
|
201 | 206 | |
202 | 207 | $logouttext = ''; |
203 | 208 | if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
@@ -235,12 +240,15 @@ discard block |
||
235 | 240 | $parameters = array(); |
236 | 241 | $result = Globals::$hookManager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks |
237 | 242 | if (is_numeric($result)) { |
238 | - if ($result == 0) |
|
239 | - $toprightmenu .= Globals::$hookManager->resPrint; // add |
|
240 | - else |
|
241 | - $toprightmenu = Globals::$hookManager->resPrint; // replace |
|
242 | - } |
|
243 | - else { |
|
243 | + if ($result == 0) { |
|
244 | + $toprightmenu .= Globals::$hookManager->resPrint; |
|
245 | + } |
|
246 | + // add |
|
247 | + else { |
|
248 | + $toprightmenu = Globals::$hookManager->resPrint; |
|
249 | + } |
|
250 | + // replace |
|
251 | + } else { |
|
244 | 252 | $toprightmenu .= $result; // For backward compatibility |
245 | 253 | } |
246 | 254 | |
@@ -334,8 +342,9 @@ discard block |
||
334 | 342 | print "<!-- End top horizontal menu -->\n\n"; |
335 | 343 | } |
336 | 344 | |
337 | - if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) |
|
338 | - print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">'; |
|
345 | + if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) { |
|
346 | + print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">'; |
|
347 | + } |
|
339 | 348 | } |
340 | 349 | |
341 | 350 | /** |
@@ -360,8 +369,9 @@ discard block |
||
360 | 369 | $searchform = ''; |
361 | 370 | $bookmarks = ''; |
362 | 371 | |
363 | - if (!empty($menu_array_before)) |
|
364 | - dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING); |
|
372 | + if (!empty($menu_array_before)) { |
|
373 | + dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING); |
|
374 | + } |
|
365 | 375 | |
366 | 376 | if (empty(Globals::$conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { |
367 | 377 | // Instantiate hooks of thirdparty module |
@@ -369,8 +379,10 @@ discard block |
||
369 | 379 | |
370 | 380 | print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n"; |
371 | 381 | |
372 | - if (Globals::$conf->browser->layout == 'phone') |
|
373 | - Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? |
|
382 | + if (Globals::$conf->browser->layout == 'phone') { |
|
383 | + Globals::$conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; |
|
384 | + } |
|
385 | + // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? |
|
374 | 386 | |
375 | 387 | print "\n"; |
376 | 388 | |
@@ -397,8 +409,9 @@ discard block |
||
397 | 409 | $reshook = Globals::$hookManager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks |
398 | 410 | if (empty($reshook)) { |
399 | 411 | $searchform .= Globals::$hookManager->resPrint; |
400 | - } else |
|
401 | - $searchform = Globals::$hookManager->resPrint; |
|
412 | + } else { |
|
413 | + $searchform = Globals::$hookManager->resPrint; |
|
414 | + } |
|
402 | 415 | |
403 | 416 | // Force special value for $searchform |
404 | 417 | if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty(Globals::$conf->use_javascript_ajax)) { |
@@ -442,38 +455,49 @@ discard block |
||
442 | 455 | if (empty(Globals::$conf->global->MAIN_HIDE_VERSION)) { // Version is already on help picto and on login page. |
443 | 456 | $doliurl = 'https://www.dolibarr.org'; |
444 | 457 | //local communities |
445 | - if (preg_match('/fr/i', Globals::$langs->defaultlang)) |
|
446 | - $doliurl = 'https://www.dolibarr.fr'; |
|
447 | - if (preg_match('/es/i', Globals::$langs->defaultlang)) |
|
448 | - $doliurl = 'https://www.dolibarr.es'; |
|
449 | - if (preg_match('/de/i', Globals::$langs->defaultlang)) |
|
450 | - $doliurl = 'https://www.dolibarr.de'; |
|
451 | - if (preg_match('/it/i', Globals::$langs->defaultlang)) |
|
452 | - $doliurl = 'https://www.dolibarr.it'; |
|
453 | - if (preg_match('/gr/i', Globals::$langs->defaultlang)) |
|
454 | - $doliurl = 'https://www.dolibarr.gr'; |
|
458 | + if (preg_match('/fr/i', Globals::$langs->defaultlang)) { |
|
459 | + $doliurl = 'https://www.dolibarr.fr'; |
|
460 | + } |
|
461 | + if (preg_match('/es/i', Globals::$langs->defaultlang)) { |
|
462 | + $doliurl = 'https://www.dolibarr.es'; |
|
463 | + } |
|
464 | + if (preg_match('/de/i', Globals::$langs->defaultlang)) { |
|
465 | + $doliurl = 'https://www.dolibarr.de'; |
|
466 | + } |
|
467 | + if (preg_match('/it/i', Globals::$langs->defaultlang)) { |
|
468 | + $doliurl = 'https://www.dolibarr.it'; |
|
469 | + } |
|
470 | + if (preg_match('/gr/i', Globals::$langs->defaultlang)) { |
|
471 | + $doliurl = 'https://www.dolibarr.gr'; |
|
472 | + } |
|
455 | 473 | |
456 | 474 | $appli = constant('DOL_APPLICATION_TITLE'); |
457 | 475 | if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) { |
458 | 476 | $appli = Globals::$conf->global->MAIN_APPLICATION_TITLE; |
459 | 477 | $doliurl = ''; |
460 | 478 | if (preg_match('/\d\.\d/', $appli)) { |
461 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
|
462 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
|
463 | - } else |
|
464 | - $appli .= " " . DOL_VERSION; |
|
465 | - } else |
|
466 | - $appli .= " " . DOL_VERSION; |
|
479 | + if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) { |
|
480 | + $appli .= " (" . DOL_VERSION . ")"; |
|
481 | + } |
|
482 | + // If new title contains a version that is different than core |
|
483 | + } else { |
|
484 | + $appli .= " " . DOL_VERSION; |
|
485 | + } |
|
486 | + } else { |
|
487 | + $appli .= " " . DOL_VERSION; |
|
488 | + } |
|
467 | 489 | print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">'; |
468 | - if ($doliurl) |
|
469 | - print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">'; |
|
470 | - else |
|
471 | - print '<span class="help">'; |
|
490 | + if ($doliurl) { |
|
491 | + print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">'; |
|
492 | + } else { |
|
493 | + print '<span class="help">'; |
|
494 | + } |
|
472 | 495 | print $appli; |
473 | - if ($doliurl) |
|
474 | - print '</a>'; |
|
475 | - else |
|
476 | - print '</span>'; |
|
496 | + if ($doliurl) { |
|
497 | + print '</a>'; |
|
498 | + } else { |
|
499 | + print '</span>'; |
|
500 | + } |
|
477 | 501 | print '</div>' . "\n"; |
478 | 502 | } |
479 | 503 | |
@@ -520,8 +544,9 @@ discard block |
||
520 | 544 | print "\n"; |
521 | 545 | print '<!-- Begin right area -->' . "\n"; |
522 | 546 | |
523 | - if (empty($leftmenuwithoutmainarea)) |
|
524 | - main_area($title); |
|
547 | + if (empty($leftmenuwithoutmainarea)) { |
|
548 | + main_area($title); |
|
549 | + } |
|
525 | 550 | } |
526 | 551 | |
527 | 552 | /** |
@@ -534,16 +559,18 @@ discard block |
||
534 | 559 | { |
535 | 560 | // global Globals::$conf, Globals::$langs; |
536 | 561 | |
537 | - if (empty(Globals::$conf->dol_hide_leftmenu)) |
|
538 | - print '<div id="id-right">'; |
|
562 | + if (empty(Globals::$conf->dol_hide_leftmenu)) { |
|
563 | + print '<div id="id-right">'; |
|
564 | + } |
|
539 | 565 | |
540 | 566 | print "\n"; |
541 | 567 | |
542 | 568 | print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n"; |
543 | 569 | |
544 | - if (!empty(Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)) |
|
545 | - print info_admin(Globals::$langs->trans("WarningYouAreInMaintenanceMode", Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)); |
|
546 | -} |
|
570 | + if (!empty(Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { |
|
571 | + print info_admin(Globals::$langs->trans("WarningYouAreInMaintenanceMode", Globals::$conf->global->MAIN_ONLY_LOGIN_ALLOWED)); |
|
572 | + } |
|
573 | + } |
|
547 | 574 | |
548 | 575 | /** |
549 | 576 | * Return helpbaseurl, helppage and mode |
@@ -567,18 +594,21 @@ discard block |
||
567 | 594 | // If WIKI URL |
568 | 595 | if (preg_match('/^es/i', Globals::$langs->defaultlang)) { |
569 | 596 | $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
570 | - if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) |
|
571 | - $helppage = $reg[1]; |
|
597 | + if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) { |
|
598 | + $helppage = $reg[1]; |
|
599 | + } |
|
572 | 600 | } |
573 | 601 | if (preg_match('/^fr/i', Globals::$langs->defaultlang)) { |
574 | 602 | $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
575 | - if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) |
|
576 | - $helppage = $reg[1]; |
|
603 | + if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) { |
|
604 | + $helppage = $reg[1]; |
|
605 | + } |
|
577 | 606 | } |
578 | 607 | if (empty($helppage)) { // If help page not already found |
579 | 608 | $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
580 | - if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) |
|
581 | - $helppage = $reg[1]; |
|
609 | + if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) { |
|
610 | + $helppage = $reg[1]; |
|
611 | + } |
|
582 | 612 | } |
583 | 613 | $mode = 'wiki'; |
584 | 614 | } |
@@ -609,8 +639,9 @@ discard block |
||
609 | 639 | $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
610 | 640 | $ret .= '<input type="hidden" name="mode" value="search">'; |
611 | 641 | $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag(Globals::$user->login) . '">'; |
612 | - if ($showtitlebefore) |
|
613 | - $ret .= $title . ' '; |
|
642 | + if ($showtitlebefore) { |
|
643 | + $ret .= $title . ' '; |
|
644 | + } |
|
614 | 645 | $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"'; |
615 | 646 | $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"'; |
616 | 647 | $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : ''); |
@@ -652,10 +683,12 @@ discard block |
||
652 | 683 | foreach (Globals::$user->lastsearch_values_tmp as $key => $val) { |
653 | 684 | unset($_SESSION['lastsearch_values_tmp_' . $key]); // Clean array to rebuild it just after |
654 | 685 | if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button |
655 | - if (empty($val['sortfield'])) |
|
656 | - unset($val['sortfield']); |
|
657 | - if (empty($val['sortorder'])) |
|
658 | - unset($val['sortorder']); |
|
686 | + if (empty($val['sortfield'])) { |
|
687 | + unset($val['sortfield']); |
|
688 | + } |
|
689 | + if (empty($val['sortorder'])) { |
|
690 | + unset($val['sortorder']); |
|
691 | + } |
|
659 | 692 | dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)"); |
660 | 693 | $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val); |
661 | 694 | unset($_SESSION['lastsearch_values_' . $key]); |
@@ -666,8 +699,9 @@ discard block |
||
666 | 699 | |
667 | 700 | $relativepathstring = $_SERVER["PHP_SELF"]; |
668 | 701 | // Clean $relativepathstring |
669 | - if (constant('DOL_BASE_URI')) |
|
670 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
702 | + if (constant('DOL_BASE_URI')) { |
|
703 | + $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
704 | + } |
|
671 | 705 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
672 | 706 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
673 | 707 | if (preg_match('/list\.php$/', $relativepathstring)) { |
@@ -675,12 +709,15 @@ discard block |
||
675 | 709 | unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]); |
676 | 710 | unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]); |
677 | 711 | |
678 | - if (!empty($contextpage)) |
|
679 | - $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage; |
|
680 | - if (!empty($page) && $page > 1) |
|
681 | - $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page; |
|
682 | - if (!empty($limit) && $limit != Globals::$conf->limit) |
|
683 | - $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit; |
|
712 | + if (!empty($contextpage)) { |
|
713 | + $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage; |
|
714 | + } |
|
715 | + if (!empty($page) && $page > 1) { |
|
716 | + $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page; |
|
717 | + } |
|
718 | + if (!empty($limit) && $limit != Globals::$conf->limit) { |
|
719 | + $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit; |
|
720 | + } |
|
684 | 721 | |
685 | 722 | unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]); |
686 | 723 | unset($_SESSION['lastsearch_page_' . $relativepathstring]); |
@@ -707,20 +744,26 @@ discard block |
||
707 | 744 | |
708 | 745 | print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche |
709 | 746 | |
710 | - if (empty(Globals::$conf->dol_hide_leftmenu)) |
|
711 | - print '</div> <!-- End div id-right -->' . "\n"; // End div id-right |
|
747 | + if (empty(Globals::$conf->dol_hide_leftmenu)) { |
|
748 | + print '</div> <!-- End div id-right -->' . "\n"; |
|
749 | + } |
|
750 | + // End div id-right |
|
712 | 751 | |
713 | - if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) |
|
714 | - print '</div> <!-- End div id-container -->' . "\n"; // End div container |
|
752 | + if (empty(Globals::$conf->dol_hide_leftmenu) && empty(Globals::$conf->dol_use_jmobile)) { |
|
753 | + print '</div> <!-- End div id-container -->' . "\n"; |
|
754 | + } |
|
755 | + // End div container |
|
715 | 756 | |
716 | 757 | print "\n"; |
717 | - if ($comment) |
|
718 | - print '<!-- ' . $comment . ' -->' . "\n"; |
|
758 | + if ($comment) { |
|
759 | + print '<!-- ' . $comment . ' -->' . "\n"; |
|
760 | + } |
|
719 | 761 | |
720 | 762 | printCommonFooter($zone); |
721 | 763 | |
722 | - if (!empty($delayedhtmlcontent)) |
|
723 | - print $delayedhtmlcontent; |
|
764 | + if (!empty($delayedhtmlcontent)) { |
|
765 | + print $delayedhtmlcontent; |
|
766 | + } |
|
724 | 767 | |
725 | 768 | if (!empty(Globals::$conf->use_javascript_ajax)) { |
726 | 769 | print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n"; |