@@ -35,24 +35,24 @@ |
||
35 | 35 | global $stripearrayofkeysbyenv; |
36 | 36 | |
37 | 37 | $stripearrayofkeysbyenv = array( |
38 | - 0=>array( |
|
39 | - "secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY, |
|
40 | - "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY |
|
41 | - ), |
|
42 | - 1=>array( |
|
43 | - "secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY, |
|
44 | - "publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY |
|
45 | - ) |
|
38 | + 0=>array( |
|
39 | + "secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY, |
|
40 | + "publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY |
|
41 | + ), |
|
42 | + 1=>array( |
|
43 | + "secret_key" => $conf->global->STRIPE_LIVE_SECRET_KEY, |
|
44 | + "publishable_key" => $conf->global->STRIPE_LIVE_PUBLISHABLE_KEY |
|
45 | + ) |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | $stripearrayofkeys = array(); |
49 | 49 | if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')) |
50 | 50 | { |
51 | - $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test |
|
51 | + $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test |
|
52 | 52 | } |
53 | 53 | else |
54 | 54 | { |
55 | - $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live |
|
55 | + $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * \brief Page to move config in api |
28 | 28 | */ |
29 | 29 | |
30 | -require_once BASE_PATH . '/vendor/stripe/stripe-php/init.php'; |
|
31 | -require_once BASE_PATH . '/vendor/stripe/stripe-php/lib/Stripe.php'; |
|
30 | +require_once BASE_PATH.'/vendor/stripe/stripe-php/init.php'; |
|
31 | +require_once BASE_PATH.'/vendor/stripe/stripe-php/lib/Stripe.php'; |
|
32 | 32 | |
33 | 33 | global $stripe; |
34 | 34 | global $conf; |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | ); |
47 | 47 | |
48 | 48 | $stripearrayofkeys = array(); |
49 | -if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')) |
|
49 | +if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) |
|
50 | 50 | { |
51 | - $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test |
|
51 | + $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test |
|
52 | 52 | } |
53 | 53 | else |
54 | 54 | { |
55 | - $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live |
|
55 | + $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); |
@@ -49,8 +49,7 @@ |
||
49 | 49 | if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')) |
50 | 50 | { |
51 | 51 | $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test |
52 | -} |
|
53 | -else |
|
52 | +} else |
|
54 | 53 | { |
55 | 54 | $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live |
56 | 55 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * \brief A set of functions for Dolibarr |
38 | 38 | * This file contains all frequently used functions. |
39 | 39 | */ |
40 | -include_once DOL_BASE_PATH . '/core/lib/json.lib.php'; |
|
40 | +include_once DOL_BASE_PATH.'/core/lib/json.lib.php'; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Function to return value of a static property when class |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function getStaticMember($class, $member) |
54 | 54 | { |
55 | - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
55 | + dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
56 | 56 | |
57 | 57 | // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member |
58 | 58 | /* if (version_compare(phpversion(), '5.3.0', '<')) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | if (isset($class::$member)) |
79 | 79 | return $class::$member; |
80 | - dol_print_error('', 'Try to get a static member "' . $member . '" in class "' . $class . '" that does not exists or is not static.'); |
|
80 | + dol_print_error('', 'Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); |
|
81 | 81 | return null; |
82 | 82 | } |
83 | 83 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function getDoliDBInstance($type, $host, $user, $pass, $name, $port) |
96 | 96 | { |
97 | - require_once DOL_BASE_PATH . "/core/db/" . $type . '.class.php'; |
|
97 | + require_once DOL_BASE_PATH."/core/db/".$type.'.class.php'; |
|
98 | 98 | |
99 | - $class = 'DoliDB' . ucfirst($type); |
|
99 | + $class = 'DoliDB'.ucfirst($type); |
|
100 | 100 | $dolidb = new $class($type, $host, $user, $pass, $name, $port); |
101 | 101 | return $dolidb; |
102 | 102 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | function getBrowserInfo($user_agent) |
154 | 154 | { |
155 | - include_once BASE_PATH . '/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php'; |
|
155 | + include_once BASE_PATH.'/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php'; |
|
156 | 156 | |
157 | 157 | $name = 'unknown'; |
158 | 158 | $version = ''; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $depth = $db->transaction_opened; |
266 | 266 | $disconnectdone = $db->close(); |
267 | 267 | } |
268 | - dol_syslog("--- End access to " . $_SERVER["PHP_SELF"] . (($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was ' . $depth . ')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO)); |
|
268 | + dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO)); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if (empty($paramname)) |
311 | 311 | return 'BadFirstParameterForGETPOST'; |
312 | 312 | if (empty($check)) { |
313 | - dol_syslog("Deprecated use of GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING); |
|
313 | + dol_syslog("Deprecated use of GETPOST, called with 1st param = ".$paramname." and 2nd param is '', when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING); |
|
314 | 314 | // Enable this line to know who call the GETPOST with '' $check parameter. |
315 | 315 | //var_dump(debug_backtrace()[0]); |
316 | 316 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $relativepathstring = $_SERVER["PHP_SELF"]; |
333 | 333 | // Clean $relativepathstring |
334 | 334 | if (constant('DOL_URL_ROOT')) |
335 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
335 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring); |
|
336 | 336 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
337 | 337 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
338 | 338 | //var_dump($relativepathstring); |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | // Code for search criteria persistence. |
341 | 341 | // Retrieve values if restore_lastsearch_values |
342 | 342 | if (!empty($_GET['restore_lastsearch_values'])) { // Use $_GET here and not GETPOST |
343 | - if (!empty($_SESSION['lastsearch_values_' . $relativepathstring])) { // If there is saved values |
|
344 | - $tmp = json_decode($_SESSION['lastsearch_values_' . $relativepathstring], true); |
|
343 | + if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) { // If there is saved values |
|
344 | + $tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); |
|
345 | 345 | if (is_array($tmp)) { |
346 | 346 | foreach ($tmp as $key => $val) { |
347 | 347 | if ($key == $paramname) { // We are on the requested parameter |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | } |
353 | 353 | } |
354 | 354 | // If there is saved contextpage, page or limit |
355 | - if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_' . $relativepathstring])) { |
|
356 | - $out = $_SESSION['lastsearch_contextpage_' . $relativepathstring]; |
|
357 | - } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_' . $relativepathstring])) { |
|
358 | - $out = $_SESSION['lastsearch_page_' . $relativepathstring]; |
|
359 | - } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_' . $relativepathstring])) { |
|
360 | - $out = $_SESSION['lastsearch_limit_' . $relativepathstring]; |
|
355 | + if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) { |
|
356 | + $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; |
|
357 | + } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) { |
|
358 | + $out = $_SESSION['lastsearch_page_'.$relativepathstring]; |
|
359 | + } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) { |
|
360 | + $out = $_SESSION['lastsearch_limit_'.$relativepathstring]; |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | // Else, retreive default values if we are not doing a sort |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | $qualified = 1; |
426 | 426 | |
427 | 427 | if ($qualified) { |
428 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
428 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
429 | 429 | foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) { |
430 | 430 | if ($out) |
431 | 431 | $out .= ', '; |
@@ -461,11 +461,11 @@ discard block |
||
461 | 461 | if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) { |
462 | 462 | // We made a search from quick search menu, do we still use default filter ? |
463 | 463 | if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) { |
464 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
464 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
465 | 465 | $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace); |
466 | 466 | } |
467 | 467 | } else { |
468 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
468 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
469 | 469 | $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace); |
470 | 470 | } |
471 | 471 | break; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. |
484 | 484 | if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) { |
485 | 485 | $maxloop = 20; |
486 | - $loopnb = 0; // Protection against infinite loop |
|
486 | + $loopnb = 0; // Protection against infinite loop |
|
487 | 487 | while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) { // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. |
488 | 488 | $loopnb++; |
489 | 489 | $newout = ''; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') { |
529 | 529 | $newout = $conf->entity; |
530 | 530 | } else |
531 | - $newout = ''; // Key not found, we replace with empty string |
|
531 | + $newout = ''; // Key not found, we replace with empty string |
|
532 | 532 | |
533 | 533 | |
534 | 534 | |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | |
551 | 551 | |
552 | 552 | //var_dump('__'.$reg[1].'__ -> '.$newout); |
553 | - $out = preg_replace('/__' . preg_quote($reg[1], '/') . '__/', $newout, $out); |
|
553 | + $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | |
@@ -668,15 +668,15 @@ discard block |
||
668 | 668 | else if (isset($_SERVER["SERVER_NAME"])) |
669 | 669 | return $_SERVER["SERVER_NAME"]; |
670 | 670 | } |
671 | - return dol_hash(DOL_DOCUMENT_ROOT . DOL_URL_ROOT); |
|
671 | + return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { |
675 | - return dol_hash($_SERVER["SERVER_NAME"] . $_SERVER["DOCUMENT_ROOT"] . DOL_DOCUMENT_ROOT . DOL_URL_ROOT); |
|
675 | + return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); |
|
676 | 676 | // Use this for a "readable" cookie name |
677 | 677 | //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); |
678 | 678 | } |
679 | - return dol_hash(DOL_DOCUMENT_ROOT . DOL_URL_ROOT); |
|
679 | + return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); |
|
680 | 680 | } |
681 | 681 | } |
682 | 682 | |
@@ -692,12 +692,12 @@ discard block |
||
692 | 692 | */ |
693 | 693 | function dol_include_once($relpath, $classname = '') |
694 | 694 | { |
695 | - global $conf, $langs, $user, $mysoc; // Do not remove this. They must be defined for files we include. Other globals var must be retreived with $GLOBALS['var'] |
|
695 | + global $conf, $langs, $user, $mysoc; // Do not remove this. They must be defined for files we include. Other globals var must be retreived with $GLOBALS['var'] |
|
696 | 696 | |
697 | 697 | $fullpath = dol_buildpath($relpath); |
698 | 698 | |
699 | 699 | if (!file_exists($fullpath)) { |
700 | - dol_syslog('functions::dol_include_once Tried to load unexisting file: ' . $relpath, LOG_ERR); |
|
700 | + dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR); |
|
701 | 701 | return false; |
702 | 702 | } |
703 | 703 | |
@@ -726,14 +726,14 @@ discard block |
||
726 | 726 | |
727 | 727 | if ($type == 0 /* empty($type) */) { // For a filesystem path |
728 | 728 | //$res = DOL_BASE_PATH . '' . $path; // Standard default path |
729 | - $res = DOL_BASE_PATH . '/' . $path; // Standard default path |
|
729 | + $res = DOL_BASE_PATH.'/'.$path; // Standard default path |
|
730 | 730 | if (isset($conf->file->dol_document_root)) { |
731 | 731 | foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) |
732 | 732 | if ($key == 'main') { |
733 | 733 | continue; |
734 | 734 | } |
735 | - if (file_exists($dirroot . '/' . $path)) { |
|
736 | - $res = $dirroot . '/' . $path; |
|
735 | + if (file_exists($dirroot.'/'.$path)) { |
|
736 | + $res = $dirroot.'/'.$path; |
|
737 | 737 | return $res; |
738 | 738 | } |
739 | 739 | } |
@@ -750,11 +750,11 @@ discard block |
||
750 | 750 | // using proxy, rewriting, virtual path, etc... |
751 | 751 | $res = ''; |
752 | 752 | if ($type == 1) |
753 | - $res = /* DOL_URL_ROOT */ DOL_BASE_URI . '/' . $path; // Standard value |
|
753 | + $res = /* DOL_URL_ROOT */ DOL_BASE_URI.'/'.$path; // Standard value |
|
754 | 754 | if ($type == 2) |
755 | - $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH . '/' . $path; // Standard value |
|
755 | + $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH.'/'.$path; // Standard value |
|
756 | 756 | if ($type == 3) |
757 | - $res = DOL_URL_ROOT . '/' . $path; |
|
757 | + $res = DOL_URL_ROOT.'/'.$path; |
|
758 | 758 | |
759 | 759 | foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) |
760 | 760 | if ($key == 'main') { |
@@ -762,33 +762,33 @@ discard block |
||
762 | 762 | global $dolibarr_main_url_root; |
763 | 763 | |
764 | 764 | // Define $urlwithroot |
765 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root)); |
|
766 | - $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT; // This is to use external domain name found into config file |
|
765 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
766 | + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
767 | 767 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
768 | 768 | |
769 | - $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . '/' . $path; // Test on start with http is for old conf syntax |
|
769 | + $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot).'/'.$path; // Test on start with http is for old conf syntax |
|
770 | 770 | } |
771 | 771 | continue; |
772 | 772 | } |
773 | - preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?' |
|
773 | + preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?' |
|
774 | 774 | if (!empty($regs[1])) { |
775 | 775 | //print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'<br>'."\n"; |
776 | - if (file_exists($dirroot . '/' . $regs[1])) { |
|
776 | + if (file_exists($dirroot.'/'.$regs[1])) { |
|
777 | 777 | if ($type == 1) { |
778 | - $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_URL_ROOT) . $conf->file->dol_url_root[$key] . '/' . $path; |
|
778 | + $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path; |
|
779 | 779 | } |
780 | 780 | if ($type == 2) { |
781 | - $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT) . $conf->file->dol_url_root[$key] . '/' . $path; |
|
781 | + $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path; |
|
782 | 782 | } |
783 | 783 | if ($type == 3) { |
784 | 784 | global $dolibarr_main_url_root; |
785 | 785 | |
786 | 786 | // Define $urlwithroot |
787 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root)); |
|
788 | - $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT; // This is to use external domain name found into config file |
|
787 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
788 | + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
789 | 789 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
790 | 790 | |
791 | - $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . $conf->file->dol_url_root[$key] . '/' . $path; // Test on start with http is for old conf syntax |
|
791 | + $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax |
|
792 | 792 | } |
793 | 793 | break; |
794 | 794 | } |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | if (empty($native)) { |
817 | 817 | $myclone = unserialize(serialize($object)); |
818 | 818 | } else { |
819 | - $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable) |
|
819 | + $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable) |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | return $myclone; |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | */ |
938 | 938 | function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '') |
939 | 939 | { |
940 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName |
|
940 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName |
|
941 | 941 | $forbidden_chars_to_remove = array(); |
942 | 942 | if (is_array($badcharstoreplace)) |
943 | 943 | $forbidden_chars_to_replace = $badcharstoreplace; |
@@ -1000,12 +1000,12 @@ discard block |
||
1000 | 1000 | function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0) |
1001 | 1001 | { |
1002 | 1002 | // escape quotes and backslashes, newlines, etc. |
1003 | - $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags |
|
1003 | + $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags |
|
1004 | 1004 | if (!$keepb) |
1005 | 1005 | $tmp = strtr($tmp, array("<b>" => '', '</b>' => '')); |
1006 | 1006 | if (!$keepn) |
1007 | 1007 | $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n')); |
1008 | - return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags |
|
1008 | + return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | /** |
@@ -1076,14 +1076,14 @@ discard block |
||
1076 | 1076 | $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log |
1077 | 1077 | // If adding log inside HTML page is required |
1078 | 1078 | if (!empty($_REQUEST['logtohtml']) && (!empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || !empty($conf->global->MAIN_LOGTOHTML))) { // MAIN_LOGTOHTML kept for backward compatibility |
1079 | - $conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S") . " " . $message; |
|
1079 | + $conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$message; |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output |
1083 | 1083 | // If html log tag enabled and url parameter log defined, we show output log on HTML comments |
1084 | 1084 | if (!empty($conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && !empty($_GET["log"])) { |
1085 | 1085 | print "\n\n<!-- Log start\n"; |
1086 | - print $message . "\n"; |
|
1086 | + print $message."\n"; |
|
1087 | 1087 | print "Log end -->\n"; |
1088 | 1088 | } |
1089 | 1089 | |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | // This is when server run behind a reverse proxy |
1099 | 1099 | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) |
1100 | - $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']); |
|
1100 | + $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].(empty($_SERVER["REMOTE_ADDR"]) ? '' : '->'.$_SERVER['REMOTE_ADDR']); |
|
1101 | 1101 | // This is when server run normally on a server |
1102 | 1102 | else if (!empty($_SERVER["REMOTE_ADDR"])) |
1103 | 1103 | $data['ip'] = $_SERVER['REMOTE_ADDR']; |
@@ -1106,10 +1106,10 @@ discard block |
||
1106 | 1106 | $data['ip'] = $_SERVER['SERVER_ADDR']; |
1107 | 1107 | // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). |
1108 | 1108 | else if (!empty($_SERVER['COMPUTERNAME'])) |
1109 | - $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']); |
|
1109 | + $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME']) ? '' : '@'.$_SERVER['USERNAME']); |
|
1110 | 1110 | // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). |
1111 | 1111 | else if (!empty($_SERVER['LOGNAME'])) |
1112 | - $data['ip'] = '???@' . $_SERVER['LOGNAME']; |
|
1112 | + $data['ip'] = '???@'.$_SERVER['LOGNAME']; |
|
1113 | 1113 | // Loop on each log handler and send output |
1114 | 1114 | foreach ($conf->loghandlers as $loghandlerinstance) { |
1115 | 1115 | if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) |
@@ -1161,10 +1161,10 @@ discard block |
||
1161 | 1161 | { |
1162 | 1162 | global $conf, $langs, $hookmanager; |
1163 | 1163 | |
1164 | - $out = "\n" . '<div class="tabs" data-role="controlgroup" data-type="horizontal">' . "\n"; |
|
1164 | + $out = "\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n"; |
|
1165 | 1165 | |
1166 | 1166 | if ($morehtmlright) { |
1167 | - $out .= '<div class="inline-block floatright tabsElem">' . $morehtmlright . '</div>'; // Output right area first so when space is missing, text is in front of tabs and not under. |
|
1167 | + $out .= '<div class="inline-block floatright tabsElem">'.$morehtmlright.'</div>'; // Output right area first so when space is missing, text is in front of tabs and not under. |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | // Show title |
@@ -1175,8 +1175,8 @@ discard block |
||
1175 | 1175 | $limittitle = 30; |
1176 | 1176 | $out .= '<a class="tabTitle">'; |
1177 | 1177 | if ($picto) |
1178 | - $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' '; |
|
1179 | - $out .= '<span class="tabTitleText">' . dol_trunc($title, $limittitle) . '</span>'; |
|
1178 | + $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath).' '; |
|
1179 | + $out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>'; |
|
1180 | 1180 | $out .= '</a>'; |
1181 | 1181 | } |
1182 | 1182 | |
@@ -1216,23 +1216,23 @@ discard block |
||
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | if ($i < $limittoshow || $isactive) { |
1219 | - $out .= '<div class="inline-block tabsElem' . ($isactive ? ' tabsElemActive' : '') . ((!$isactive && !empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '') . '"><!-- id tab = ' . (empty($links[$i][2]) ? '' : $links[$i][2]) . ' -->'; |
|
1219 | + $out .= '<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((!$isactive && !empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '').'"><!-- id tab = '.(empty($links[$i][2]) ? '' : $links[$i][2]).' -->'; |
|
1220 | 1220 | if (isset($links[$i][2]) && $links[$i][2] == 'image') { |
1221 | 1221 | if (!empty($links[$i][0])) { |
1222 | - $out .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
1222 | + $out .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
|
1223 | 1223 | } else { |
1224 | - $out .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
1224 | + $out .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n"; |
|
1225 | 1225 | } |
1226 | 1226 | } else if (!empty($links[$i][1])) { |
1227 | 1227 | //print "x $i $active ".$links[$i][2]." z"; |
1228 | 1228 | if ($isactive) { |
1229 | - $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
1229 | + $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
1230 | 1230 | $out .= $links[$i][1]; |
1231 | - $out .= '</a>' . "\n"; |
|
1231 | + $out .= '</a>'."\n"; |
|
1232 | 1232 | } else { |
1233 | - $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabunactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
1233 | + $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabunactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
1234 | 1234 | $out .= $links[$i][1]; |
1235 | - $out .= '</a>' . "\n"; |
|
1235 | + $out .= '</a>'."\n"; |
|
1236 | 1236 | } |
1237 | 1237 | } |
1238 | 1238 | $out .= '</div>'; |
@@ -1245,14 +1245,14 @@ discard block |
||
1245 | 1245 | $outmore .= '<div class="popuptab wordwrap" style="display:inherit;">'; |
1246 | 1246 | if (isset($links[$i][2]) && $links[$i][2] == 'image') { |
1247 | 1247 | if (!empty($links[$i][0])) |
1248 | - $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
1248 | + $outmore .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
|
1249 | 1249 | else |
1250 | - $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
1250 | + $outmore .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n"; |
|
1251 | 1251 | } |
1252 | 1252 | else if (!empty($links[$i][1])) { |
1253 | - $outmore .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="wordwrap inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
1253 | + $outmore .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="wordwrap inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
1254 | 1254 | $outmore .= preg_replace('/([a-z])\/([a-z])/i', '\\1 / \\2', $links[$i][1]); // Replace x/y with x / y to allow wrap on long composed texts. |
1255 | - $outmore .= '</a>' . "\n"; |
|
1255 | + $outmore .= '</a>'."\n"; |
|
1256 | 1256 | } |
1257 | 1257 | $outmore .= '</div>'; |
1258 | 1258 | |
@@ -1268,24 +1268,24 @@ discard block |
||
1268 | 1268 | $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); |
1269 | 1269 | |
1270 | 1270 | $tabsname = str_replace("@", "", $picto); |
1271 | - $out .= '<div id="moretabs' . $tabsname . '" class="inline-block tabsElem">'; |
|
1272 | - $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">' . $langs->trans("More") . '... (' . $nbintab . ')</a>'; |
|
1273 | - $out .= '<div id="moretabsList' . $tabsname . '" style="position: absolute; ' . $left . ': -999em; text-align: ' . $left . '; margin:0px; padding:2px">'; |
|
1271 | + $out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">'; |
|
1272 | + $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">'.$langs->trans("More").'... ('.$nbintab.')</a>'; |
|
1273 | + $out .= '<div id="moretabsList'.$tabsname.'" style="position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px">'; |
|
1274 | 1274 | $out .= $outmore; |
1275 | 1275 | $out .= '</div>'; |
1276 | 1276 | $out .= '<div></div>'; |
1277 | 1277 | $out .= "</div>\n"; |
1278 | 1278 | |
1279 | 1279 | $out .= "<script>"; |
1280 | - $out .= "$('#moretabs" . $tabsname . "').mouseenter( function() { console.log('mouseenter " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','auto');});"; |
|
1281 | - $out .= "$('#moretabs" . $tabsname . "').mouseleave( function() { console.log('mouseleave " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','-999em');});"; |
|
1280 | + $out .= "$('#moretabs".$tabsname."').mouseenter( function() { console.log('mouseenter ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','auto');});"; |
|
1281 | + $out .= "$('#moretabs".$tabsname."').mouseleave( function() { console.log('mouseleave ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','-999em');});"; |
|
1282 | 1282 | $out .= "</script>"; |
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | $out .= "</div>\n"; |
1286 | 1286 | |
1287 | 1287 | if (!$notab || $notab == -1) |
1288 | - $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n"; |
|
1288 | + $out .= "\n".'<div class="tabBar'.($notab == -1 ? '' : ' tabBarWithBottom').'">'."\n"; |
|
1289 | 1289 | |
1290 | 1290 | $parameters = array('tabname' => $active, 'out' => $out); |
1291 | 1291 | $reshook = $hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead" |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | if ($conf->browser->layout == 'phone') |
1395 | 1395 | $maxvisiblephotos = 1; |
1396 | 1396 | if ($showimage) |
1397 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>'; |
|
1397 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>'; |
|
1398 | 1398 | else { |
1399 | 1399 | if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { |
1400 | 1400 | $nophoto = ''; |
@@ -1403,18 +1403,18 @@ discard block |
||
1403 | 1403 | //elseif ($conf->browser->layout != 'phone') { // Show no photo link |
1404 | 1404 | $nophoto = '/public/theme/common/nophoto.png'; |
1405 | 1405 | // $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '"></div>'; |
1406 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
|
1406 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'"></div>'; |
|
1407 | 1407 | //} |
1408 | 1408 | } |
1409 | 1409 | } elseif ($object->element == 'ticket') { |
1410 | 1410 | $width = 80; |
1411 | 1411 | $cssclass = 'photoref'; |
1412 | - $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity] . '/' . $object->track_id); |
|
1412 | + $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->track_id); |
|
1413 | 1413 | $maxvisiblephotos = (isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO) ? $conf->global->TICKETSUP_MAX_VISIBLE_PHOTO : 2); |
1414 | 1414 | if ($conf->browser->layout == 'phone') |
1415 | 1415 | $maxvisiblephotos = 1; |
1416 | 1416 | if ($showimage) |
1417 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('ticket', $conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>'; |
|
1417 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticket', $conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>'; |
|
1418 | 1418 | else { |
1419 | 1419 | if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) { |
1420 | 1420 | $nophoto = ''; |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | //elseif ($conf->browser->layout != 'phone') { // Show no photo link |
1424 | 1424 | $nophoto = '/public/theme/common/nophoto.png'; |
1425 | 1425 | //$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '"></div>'; |
1426 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
|
1426 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'"></div>'; |
|
1427 | 1427 | //} |
1428 | 1428 | } |
1429 | 1429 | } else { |
@@ -1433,25 +1433,25 @@ discard block |
||
1433 | 1433 | // Check if a preview file is available |
1434 | 1434 | if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick")) { |
1435 | 1435 | $objectref = dol_sanitizeFileName($object->ref); |
1436 | - $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity]) . "/"; |
|
1436 | + $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity])."/"; |
|
1437 | 1437 | if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) { |
1438 | 1438 | $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart); |
1439 | - $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '') . $objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end |
|
1439 | + $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '').$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end |
|
1440 | 1440 | } else { |
1441 | 1441 | $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart); |
1442 | 1442 | } |
1443 | 1443 | if (empty($subdir)) |
1444 | 1444 | $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path |
1445 | 1445 | |
1446 | - $filepath = $dir_output . $subdir . "/"; |
|
1446 | + $filepath = $dir_output.$subdir."/"; |
|
1447 | 1447 | |
1448 | - $file = $filepath . $objectref . ".pdf"; |
|
1449 | - $relativepath = $subdir . '/' . $objectref . '.pdf'; |
|
1448 | + $file = $filepath.$objectref.".pdf"; |
|
1449 | + $relativepath = $subdir.'/'.$objectref.'.pdf'; |
|
1450 | 1450 | |
1451 | 1451 | // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") |
1452 | - $fileimage = $file . '_preview.png'; // If PDF has 1 page |
|
1453 | - $fileimagebis = $file . '_preview-0.png'; // If PDF has more than one page |
|
1454 | - $relativepathimage = $relativepath . '_preview.png'; |
|
1452 | + $fileimage = $file.'_preview.png'; // If PDF has 1 page |
|
1453 | + $fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page |
|
1454 | + $relativepathimage = $relativepath.'_preview.png'; |
|
1455 | 1455 | |
1456 | 1456 | // Si fichier PDF existe |
1457 | 1457 | if (file_exists($file)) { |
@@ -1460,7 +1460,7 @@ discard block |
||
1460 | 1460 | if ((!file_exists($fileimage) || (filemtime($fileimage) < filemtime($file))) && (!file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) |
1461 | 1461 | ) { |
1462 | 1462 | if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) { // If you experienc trouble with pdf thumb generation and imagick, you can disable here. |
1463 | - include_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
1463 | + include_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
1464 | 1464 | $ret = dol_convert_file($file, 'png', $fileimage); |
1465 | 1465 | if ($ret < 0) |
1466 | 1466 | $error++; |
@@ -1473,14 +1473,14 @@ discard block |
||
1473 | 1473 | // Si fichier png PDF d'1 page trouve |
1474 | 1474 | if (file_exists($fileimage)) { |
1475 | 1475 | $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; |
1476 | - $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=apercu' . $modulepart . '&file=' . urlencode($relativepathimage) . '">'; |
|
1476 | + $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($relativepathimage).'">'; |
|
1477 | 1477 | $phototoshow .= '</div></div>'; |
1478 | 1478 | } |
1479 | 1479 | // Si fichier png PDF de plus d'1 page trouve |
1480 | 1480 | elseif (file_exists($fileimagebis)) { |
1481 | - $preview = preg_replace('/\.png/', '', $relativepathimage) . "-0.png"; |
|
1481 | + $preview = preg_replace('/\.png/', '', $relativepathimage)."-0.png"; |
|
1482 | 1482 | $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; |
1483 | - $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=apercu' . $modulepart . '&file=' . urlencode($preview) . '"><p>'; |
|
1483 | + $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($preview).'"><p>'; |
|
1484 | 1484 | $phototoshow .= '</div></div>'; |
1485 | 1485 | } |
1486 | 1486 | } |
@@ -1507,10 +1507,10 @@ discard block |
||
1507 | 1507 | $picto = $object->picto; |
1508 | 1508 | if ($object->element == 'project' && !$object->public) |
1509 | 1509 | $picto = 'project'; // instead of projectpub |
1510 | - $nophoto = img_picto('', 'object_' . $picto, '', false, 1); |
|
1510 | + $nophoto = img_picto('', 'object_'.$picto, '', false, 1); |
|
1511 | 1511 | } |
1512 | 1512 | $morehtmlleft .= '<!-- No photo to show -->'; |
1513 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . $nophoto . '"></div></div>'; |
|
1513 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.$nophoto.'"></div></div>'; |
|
1514 | 1514 | |
1515 | 1515 | $morehtmlleft .= '</div>'; |
1516 | 1516 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | if ($showbarcode) |
1521 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>'; |
|
1521 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>'; |
|
1522 | 1522 | |
1523 | 1523 | if ($object->element == 'societe') { |
1524 | 1524 | if (!empty($conf->use_javascript_ajax) && $user->rights->societe->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { |
@@ -1531,14 +1531,14 @@ discard block |
||
1531 | 1531 | if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { |
1532 | 1532 | $morehtmlstatus .= ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); |
1533 | 1533 | } else { |
1534 | - $morehtmlstatus .= '<span class="statusrefsell">' . $object->getLibStatut(5, 0) . '</span>'; |
|
1534 | + $morehtmlstatus .= '<span class="statusrefsell">'.$object->getLibStatut(5, 0).'</span>'; |
|
1535 | 1535 | } |
1536 | 1536 | $morehtmlstatus .= ' '; |
1537 | 1537 | //$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Buy").') '; |
1538 | 1538 | if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { |
1539 | 1539 | $morehtmlstatus .= ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); |
1540 | 1540 | } else { |
1541 | - $morehtmlstatus .= '<span class="statusrefbuy">' . $object->getLibStatut(5, 1) . '</span>'; |
|
1541 | + $morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(5, 1).'</span>'; |
|
1542 | 1542 | } |
1543 | 1543 | } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) { |
1544 | 1544 | $tmptxt = $object->getLibStatut(6, $object->totalpaye); |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | if ($object->progress >= 100) |
1566 | 1566 | $object->fk_statut = 3; |
1567 | 1567 | $tmptxt = $object->getLibStatut(5); |
1568 | - $morehtmlstatus .= $tmptxt; // No status on task |
|
1568 | + $morehtmlstatus .= $tmptxt; // No status on task |
|
1569 | 1569 | } |
1570 | 1570 | else { // Generic case |
1571 | 1571 | $tmptxt = $object->getLibStatut(6); |
@@ -1579,18 +1579,18 @@ discard block |
||
1579 | 1579 | if (method_exists($object, 'getVentilExportCompta')) { |
1580 | 1580 | $accounted = $object->getVentilExportCompta(); |
1581 | 1581 | $langs->load("accountancy"); |
1582 | - $morehtmlstatus .= '</div><div class="statusref statusrefbis">' . ($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted")); |
|
1582 | + $morehtmlstatus .= '</div><div class="statusref statusrefbis">'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted")); |
|
1583 | 1583 | } |
1584 | 1584 | } |
1585 | 1585 | |
1586 | 1586 | // Add alias for thirdparty |
1587 | 1587 | if (!empty($object->name_alias)) |
1588 | - $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>'; |
|
1588 | + $morehtmlref .= '<div class="refidno">'.$object->name_alias.'</div>'; |
|
1589 | 1589 | |
1590 | 1590 | // Add label |
1591 | 1591 | if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task') { |
1592 | 1592 | if (!empty($object->label)) |
1593 | - $morehtmlref .= '<div class="refidno">' . $object->label . '</div>'; |
|
1593 | + $morehtmlref .= '<div class="refidno">'.$object->label.'</div>'; |
|
1594 | 1594 | } |
1595 | 1595 | |
1596 | 1596 | if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') { |
@@ -1600,11 +1600,11 @@ discard block |
||
1600 | 1600 | } |
1601 | 1601 | if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product'))) { |
1602 | 1602 | $morehtmlref .= '<div style="clear: both;"></div><div class="refidno">'; |
1603 | - $morehtmlref .= $langs->trans("TechnicalID") . ': ' . $object->id; |
|
1603 | + $morehtmlref .= $langs->trans("TechnicalID").': '.$object->id; |
|
1604 | 1604 | $morehtmlref .= '</div>'; |
1605 | 1605 | } |
1606 | 1606 | |
1607 | - print '<div class="' . ($onlybanner ? 'arearefnobottom ' : 'arearef ') . 'heightref valignmiddle" width="100%">'; |
|
1607 | + print '<div class="'.($onlybanner ? 'arearefnobottom ' : 'arearef ').'heightref valignmiddle" width="100%">'; |
|
1608 | 1608 | print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); |
1609 | 1609 | print '</div>'; |
1610 | 1610 | print '<div class="underrefbanner clearboth"></div>'; |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | if ($fieldrequired) |
1627 | 1627 | $ret .= '<span class="fieldrequired">'; |
1628 | 1628 | if (($conf->dol_use_jmobile != 4)) |
1629 | - $ret .= '<label for="' . $fieldkey . '">'; |
|
1629 | + $ret .= '<label for="'.$fieldkey.'">'; |
|
1630 | 1630 | $ret .= $langs->trans($langkey); |
1631 | 1631 | if (($conf->dol_use_jmobile != 4)) |
1632 | 1632 | $ret .= '</label>'; |
@@ -1645,9 +1645,9 @@ discard block |
||
1645 | 1645 | function dol_bc($var, $moreclass = '') |
1646 | 1646 | { |
1647 | 1647 | global $bc; |
1648 | - $ret = ' ' . $bc[$var]; |
|
1648 | + $ret = ' '.$bc[$var]; |
|
1649 | 1649 | if ($moreclass) |
1650 | - $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret); |
|
1650 | + $ret = preg_replace('/class=\"/', 'class="'.$moreclass.' ', $ret); |
|
1651 | 1651 | return $ret; |
1652 | 1652 | } |
1653 | 1653 | |
@@ -1667,50 +1667,50 @@ discard block |
||
1667 | 1667 | global $conf, $langs; |
1668 | 1668 | |
1669 | 1669 | $ret = ''; |
1670 | - $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS |
|
1670 | + $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS |
|
1671 | 1671 | // Address |
1672 | 1672 | if (empty($mode)) { |
1673 | 1673 | $ret .= $object->address; |
1674 | 1674 | } |
1675 | 1675 | // Zip/Town/State |
1676 | 1676 | if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country |
1677 | - $ret .= ($ret ? $sep : '' ) . $object->town; |
|
1677 | + $ret .= ($ret ? $sep : '').$object->town; |
|
1678 | 1678 | if ($object->state) { |
1679 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
1679 | + $ret .= ($ret ? ", " : '').$object->state; |
|
1680 | 1680 | } |
1681 | 1681 | if ($object->zip) |
1682 | - $ret .= ($ret ? ", " : '') . $object->zip; |
|
1682 | + $ret .= ($ret ? ", " : '').$object->zip; |
|
1683 | 1683 | } |
1684 | 1684 | else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country |
1685 | - $ret .= ($ret ? $sep : '' ) . $object->town; |
|
1685 | + $ret .= ($ret ? $sep : '').$object->town; |
|
1686 | 1686 | if ($object->state) { |
1687 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
1687 | + $ret .= ($ret ? ", " : '').$object->state; |
|
1688 | 1688 | } |
1689 | 1689 | if ($object->zip) |
1690 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
1690 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
1691 | 1691 | } |
1692 | 1692 | else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country |
1693 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
1694 | - $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : ''); |
|
1693 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
1694 | + $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : ''); |
|
1695 | 1695 | if ($object->state) { |
1696 | - $ret .= "\n" . $object->state; |
|
1696 | + $ret .= "\n".$object->state; |
|
1697 | 1697 | } |
1698 | 1698 | } else if (in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country |
1699 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
1700 | - $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : ''); |
|
1701 | - $ret .= ($object->departement_id ? (' (' . ($object->departement_id) . ')') : ''); |
|
1699 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
1700 | + $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : ''); |
|
1701 | + $ret .= ($object->departement_id ? (' ('.($object->departement_id).')') : ''); |
|
1702 | 1702 | } else { // Other: title firstname name \n address lines \n zip town \n country |
1703 | - $ret .= $object->zip ? (($ret ? $sep : '' ) . $object->zip) : ''; |
|
1704 | - $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '' )) . $object->town) : ''); |
|
1703 | + $ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : ''; |
|
1704 | + $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$object->town) : ''); |
|
1705 | 1705 | if ($object->state && in_array($object->country_code, $countriesusingstate)) { |
1706 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
1706 | + $ret .= ($ret ? ", " : '').$object->state; |
|
1707 | 1707 | } |
1708 | 1708 | } |
1709 | 1709 | if (!is_object($outputlangs)) |
1710 | 1710 | $outputlangs = $langs; |
1711 | 1711 | if ($withcountry) { |
1712 | 1712 | $langs->load("dict"); |
1713 | - $ret .= ($object->country_code ? ($ret ? $sep : '') . $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country" . $object->country_code)) : ''); |
|
1713 | + $ret .= ($object->country_code ? ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)) : ''); |
|
1714 | 1714 | } |
1715 | 1715 | |
1716 | 1716 | return $ret; |
@@ -1765,13 +1765,13 @@ discard block |
||
1765 | 1765 | if (is_string($tzoutput)) { |
1766 | 1766 | if ($tzoutput == 'tzserver') { |
1767 | 1767 | $to_gmt = false; |
1768 | - $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' |
|
1768 | + $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' |
|
1769 | 1769 | $offsettz = 0; |
1770 | 1770 | $offsetdst = 0; |
1771 | 1771 | } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { |
1772 | 1772 | $to_gmt = true; |
1773 | 1773 | $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' |
1774 | - $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore |
|
1774 | + $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore |
|
1775 | 1775 | $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore |
1776 | 1776 | } |
1777 | 1777 | } |
@@ -1817,9 +1817,9 @@ discard block |
||
1817 | 1817 | else if ($format == 'dayxcard') |
1818 | 1818 | $format = '%Y%m%d'; |
1819 | 1819 | else if ($format == 'dayrfc') |
1820 | - $format = '%Y-%m-%d'; // DATE_RFC3339 |
|
1820 | + $format = '%Y-%m-%d'; // DATE_RFC3339 |
|
1821 | 1821 | else if ($format == 'dayhourrfc') |
1822 | - $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 |
|
1822 | + $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 |
|
1823 | 1823 | else if ($format == 'standard') |
1824 | 1824 | $format = '%Y-%m-%d %H:%M:%S'; |
1825 | 1825 | |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | |
1831 | 1831 | // If date undefined or "", we return "" |
1832 | 1832 | if (dol_strlen($time) == 0) |
1833 | - return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
1833 | + return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
1834 | 1834 | |
1835 | 1835 | |
1836 | 1836 | |
@@ -1868,7 +1868,7 @@ discard block |
||
1868 | 1868 | if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg) || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 |
1869 | 1869 | // TODO Remove this. |
1870 | 1870 | // This part of code should not be used. |
1871 | - dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page " . $_SERVER["PHP_SELF"], LOG_ERR); |
|
1871 | + dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR); |
|
1872 | 1872 | // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS' |
1873 | 1873 | $syear = (!empty($reg[1]) ? $reg[1] : ''); |
1874 | 1874 | $smonth = (!empty($reg[2]) ? $reg[2] : ''); |
@@ -1886,7 +1886,7 @@ discard block |
||
1886 | 1886 | |
1887 | 1887 | $ret = adodb_strftime($format, $timetouse, $to_gmt); |
1888 | 1888 | } else |
1889 | - $ret = 'Bad value ' . $time . ' for date'; |
|
1889 | + $ret = 'Bad value '.$time.' for date'; |
|
1890 | 1890 | } |
1891 | 1891 | |
1892 | 1892 | if (preg_match('/__b__/i', $format)) { |
@@ -1895,11 +1895,11 @@ discard block |
||
1895 | 1895 | $month = adodb_strftime('%m', $timetouse); |
1896 | 1896 | $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'. |
1897 | 1897 | if ($encodetooutput) { |
1898 | - $monthtext = $outputlangs->transnoentities('Month' . $month); |
|
1899 | - $monthtextshort = $outputlangs->transnoentities('MonthShort' . $month); |
|
1898 | + $monthtext = $outputlangs->transnoentities('Month'.$month); |
|
1899 | + $monthtextshort = $outputlangs->transnoentities('MonthShort'.$month); |
|
1900 | 1900 | } else { |
1901 | - $monthtext = $outputlangs->transnoentitiesnoconv('Month' . $month); |
|
1902 | - $monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort' . $month); |
|
1901 | + $monthtext = $outputlangs->transnoentitiesnoconv('Month'.$month); |
|
1902 | + $monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort'.$month); |
|
1903 | 1903 | } |
1904 | 1904 | //print 'monthtext='.$monthtext.' monthtextshort='.$monthtextshort; |
1905 | 1905 | $ret = str_replace('__b__', $monthtextshort, $ret); |
@@ -1910,8 +1910,8 @@ discard block |
||
1910 | 1910 | if (preg_match('/__a__/i', $format)) { |
1911 | 1911 | $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
1912 | 1912 | |
1913 | - $w = adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
|
1914 | - $dayweek = $outputlangs->transnoentitiesnoconv('Day' . $w); |
|
1913 | + $w = adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
|
1914 | + $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w); |
|
1915 | 1915 | $ret = str_replace('__A__', $dayweek, $ret); |
1916 | 1916 | $ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret); |
1917 | 1917 | } |
@@ -1958,9 +1958,9 @@ discard block |
||
1958 | 1958 | |
1959 | 1959 | $usealternatemethod = false; |
1960 | 1960 | if ($timestamp <= 0) |
1961 | - $usealternatemethod = true; // <= 1970 |
|
1961 | + $usealternatemethod = true; // <= 1970 |
|
1962 | 1962 | if ($timestamp >= 2145913200) |
1963 | - $usealternatemethod = true; // >= 2038 |
|
1963 | + $usealternatemethod = true; // >= 2038 |
|
1964 | 1964 | |
1965 | 1965 | if ($usealternatemethod) { |
1966 | 1966 | $arrayinfo = adodb_getdate($timestamp, $fast); |
@@ -2020,23 +2020,23 @@ discard block |
||
2020 | 2020 | |
2021 | 2021 | if (method_exists('DateTime', 'getTimestamp')) { |
2022 | 2022 | if (empty($gm) || $gm === 'server') { |
2023 | - $default_timezone = @date_default_timezone_get(); // Example 'Europe/Berlin' |
|
2023 | + $default_timezone = @date_default_timezone_get(); // Example 'Europe/Berlin' |
|
2024 | 2024 | $localtz = new DateTimeZone($default_timezone); |
2025 | 2025 | } else if ($gm === 'user') { |
2026 | 2026 | // We use dol_tz_string first because it is more reliable. |
2027 | - $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' |
|
2027 | + $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' |
|
2028 | 2028 | try { |
2029 | 2029 | $localtz = new DateTimeZone($default_timezone); |
2030 | 2030 | } catch (Exception $e) { |
2031 | - dol_syslog("Warning dol_tz_string contains an invalid value " . $_SESSION["dol_tz_string"], LOG_WARNING); |
|
2031 | + dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING); |
|
2032 | 2032 | $default_timezone = @date_default_timezone_get(); |
2033 | 2033 | } |
2034 | 2034 | } else if (strrpos($gm, "tz,") !== false) { |
2035 | - $timezone = str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin' |
|
2035 | + $timezone = str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin' |
|
2036 | 2036 | try { |
2037 | 2037 | $localtz = new DateTimeZone($timezone); |
2038 | 2038 | } catch (Exception $e) { |
2039 | - dol_syslog("Warning passed timezone contains an invalid value " . $timezone, LOG_WARNING); |
|
2039 | + dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING); |
|
2040 | 2040 | } |
2041 | 2041 | } |
2042 | 2042 | |
@@ -2075,8 +2075,8 @@ discard block |
||
2075 | 2075 | if ($mode == 'gmt') |
2076 | 2076 | $ret = time(); // Time for now at greenwich. |
2077 | 2077 | else if ($mode == 'tzserver') { // Time for now with PHP server timezone added |
2078 | - require_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
|
2079 | - $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time |
|
2078 | + require_once DOL_BASE_PATH.'/core/lib/date.lib.php'; |
|
2079 | + $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time |
|
2080 | 2080 | $ret = (int) (dol_now('gmt') + ($tzsecond * 3600)); |
2081 | 2081 | } |
2082 | 2082 | /* else if ($mode == 'tzref') // Time for now with parent company timezone is added |
@@ -2122,9 +2122,9 @@ discard block |
||
2122 | 2122 | } |
2123 | 2123 | // Use long or short text unit |
2124 | 2124 | if (empty($shortunit)) { |
2125 | - $ret .= ' ' . $textunitlong; |
|
2125 | + $ret .= ' '.$textunitlong; |
|
2126 | 2126 | } else { |
2127 | - $ret .= ' ' . $textunitshort; |
|
2127 | + $ret .= ' '.$textunitshort; |
|
2128 | 2128 | } |
2129 | 2129 | |
2130 | 2130 | return $ret; |
@@ -2152,13 +2152,13 @@ discard block |
||
2152 | 2152 | $link .= $url; |
2153 | 2153 | $link .= '"'; |
2154 | 2154 | if ($target) |
2155 | - $link .= ' target="' . $target . '"'; |
|
2155 | + $link .= ' target="'.$target.'"'; |
|
2156 | 2156 | $link .= '>'; |
2157 | 2157 | if (!preg_match('/^http/i', $url)) |
2158 | 2158 | $link .= 'http://'; |
2159 | 2159 | $link .= dol_trunc($url, $max); |
2160 | 2160 | $link .= '</a>'; |
2161 | - return '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto($langs->trans("Url"), 'object_globe.png') . ' ' : '') . $link . '</div>'; |
|
2161 | + return '<div class="nospan float" style="margin-right: 10px">'.($withpicto ? img_picto($langs->trans("Url"), 'object_globe.png').' ' : '').$link.'</div>'; |
|
2162 | 2162 | } |
2163 | 2163 | |
2164 | 2164 | /** |
@@ -2199,9 +2199,9 @@ discard block |
||
2199 | 2199 | $type = 'AC_EMAIL'; |
2200 | 2200 | $link = ''; |
2201 | 2201 | if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) |
2202 | - $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2202 | + $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$type.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>'; |
|
2203 | 2203 | if ($link) |
2204 | - $newemail = '<div>' . $newemail . ' ' . $link . '</div>'; |
|
2204 | + $newemail = '<div>'.$newemail.' '.$link.'</div>'; |
|
2205 | 2205 | } |
2206 | 2206 | } |
2207 | 2207 | else { |
@@ -2211,7 +2211,7 @@ discard block |
||
2211 | 2211 | } |
2212 | 2212 | } |
2213 | 2213 | |
2214 | - $rep = '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto($langs->trans("EMail"), 'object_email.png') . ' ' : '') . $newemail . '</div>'; |
|
2214 | + $rep = '<div class="nospan float" style="margin-right: 10px">'.($withpicto ? img_picto($langs->trans("EMail"), 'object_email.png').' ' : '').$newemail.'</div>'; |
|
2215 | 2215 | if ($hookmanager) { |
2216 | 2216 | $parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto); |
2217 | 2217 | $reshook = $hookmanager->executeHooks('printEmail', $parameters, $email); |
@@ -2241,26 +2241,26 @@ discard block |
||
2241 | 2241 | |
2242 | 2242 | if (!empty($type)) { |
2243 | 2243 | $newskype = '<div class="divsocialnetwork inline-block valignmiddle">'; |
2244 | - $newskype .= img_picto($langs->trans(strtoupper($type)), $type . '.png', '', false, 0, 0, '', 'paddingright'); |
|
2244 | + $newskype .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright'); |
|
2245 | 2245 | $newskype .= $value; |
2246 | 2246 | if ($type == 'skype') { |
2247 | 2247 | $newskype .= ' '; |
2248 | 2248 | $newskype .= '<a href="skype:'; |
2249 | 2249 | $newskype .= $value; |
2250 | - $newskype .= '?call" alt="' . $langs->trans("Call") . ' ' . $value . '" title="' . $langs->trans("Call") . ' ' . $value . '">'; |
|
2251 | - $newskype .= '<img src="' . DOL_URL_ROOT . '/theme/common/skype_callbutton.png" border="0">'; |
|
2250 | + $newskype .= '?call" alt="'.$langs->trans("Call").' '.$value.'" title="'.$langs->trans("Call").' '.$value.'">'; |
|
2251 | + $newskype .= '<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">'; |
|
2252 | 2252 | $newskype .= '</a><a href="skype:'; |
2253 | 2253 | $newskype .= $value; |
2254 | - $newskype .= '?chat" alt="' . $langs->trans("Chat") . ' ' . $value . '" title="' . $langs->trans("Chat") . ' ' . $value . '">'; |
|
2255 | - $newskype .= '<img class="paddingleft" src="' . DOL_URL_ROOT . '/theme/common/skype_chatbutton.png" border="0">'; |
|
2254 | + $newskype .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">'; |
|
2255 | + $newskype .= '<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">'; |
|
2256 | 2256 | $newskype .= '</a>'; |
2257 | 2257 | } |
2258 | 2258 | if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type == 'skype') { |
2259 | 2259 | $addlink = 'AC_SKYPE'; |
2260 | 2260 | $link = ''; |
2261 | 2261 | if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) |
2262 | - $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $addlink . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2263 | - $newskype .= ($link ? ' ' . $link : ''); |
|
2262 | + $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$addlink.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>'; |
|
2263 | + $newskype .= ($link ? ' '.$link : ''); |
|
2264 | 2264 | } |
2265 | 2265 | $newskype .= '</div>'; |
2266 | 2266 | } |
@@ -2305,165 +2305,165 @@ discard block |
||
2305 | 2305 | if (strtoupper($countrycode) == "FR") { |
2306 | 2306 | // France |
2307 | 2307 | if (dol_strlen($phone) == 10) { |
2308 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 2) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2); |
|
2308 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 2).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2); |
|
2309 | 2309 | } elseif (dol_strlen($phone) == 7) { |
2310 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2); |
|
2310 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2); |
|
2311 | 2311 | } elseif (dol_strlen($phone) == 9) { |
2312 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 3) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2); |
|
2312 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2); |
|
2313 | 2313 | } elseif (dol_strlen($phone) == 11) { |
2314 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
2314 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
2315 | 2315 | } elseif (dol_strlen($phone) == 12) { |
2316 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2316 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2317 | 2317 | } |
2318 | 2318 | } elseif (strtoupper($countrycode) == "CA") { |
2319 | 2319 | if (dol_strlen($phone) == 10) { |
2320 | - $newphone = ($separ != '' ? '(' : '') . substr($newphone, 0, 3) . ($separ != '' ? ')' : '') . $separ . substr($newphone, 3, 3) . ($separ != '' ? '-' : '') . substr($newphone, 6, 4); |
|
2320 | + $newphone = ($separ != '' ? '(' : '').substr($newphone, 0, 3).($separ != '' ? ')' : '').$separ.substr($newphone, 3, 3).($separ != '' ? '-' : '').substr($newphone, 6, 4); |
|
2321 | 2321 | } |
2322 | 2322 | } elseif (strtoupper($countrycode) == "PT") {//Portugal |
2323 | 2323 | if (dol_strlen($phone) == 13) {//ex: +351_ABC_DEF_GHI |
2324 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
2324 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
2325 | 2325 | } |
2326 | 2326 | } elseif (strtoupper($countrycode) == "SR") {//Suriname |
2327 | 2327 | if (dol_strlen($phone) == 10) {//ex: +597_ABC_DEF |
2328 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3); |
|
2328 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3); |
|
2329 | 2329 | } elseif (dol_strlen($phone) == 11) {//ex: +597_ABC_DEFG |
2330 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 4); |
|
2330 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 4); |
|
2331 | 2331 | } |
2332 | 2332 | } elseif (strtoupper($countrycode) == "DE") {//Allemagne |
2333 | 2333 | if (dol_strlen($phone) == 14) {//ex: +49_ABCD_EFGH_IJK |
2334 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 4) . $separ . substr($newphone, 11, 3); |
|
2334 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 4).$separ.substr($newphone, 11, 3); |
|
2335 | 2335 | } elseif (dol_strlen($phone) == 13) {//ex: +49_ABC_DEFG_HIJ |
2336 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 4) . $separ . substr($newphone, 10, 3); |
|
2336 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 4).$separ.substr($newphone, 10, 3); |
|
2337 | 2337 | } |
2338 | 2338 | } elseif (strtoupper($countrycode) == "ES") {//Espagne |
2339 | 2339 | if (dol_strlen($phone) == 12) {//ex: +34_ABC_DEF_GHI |
2340 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
2340 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
2341 | 2341 | } |
2342 | 2342 | } elseif (strtoupper($countrycode) == "BF") {// Burkina Faso |
2343 | 2343 | if (dol_strlen($phone) == 12) {//ex : +22 A BC_DE_FG_HI |
2344 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2344 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2345 | 2345 | } |
2346 | 2346 | } elseif (strtoupper($countrycode) == "RO") {// Roumanie |
2347 | 2347 | if (dol_strlen($phone) == 12) {//ex : +40 AB_CDE_FG_HI |
2348 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2348 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2349 | 2349 | } |
2350 | 2350 | } elseif (strtoupper($countrycode) == "TR") {//Turquie |
2351 | 2351 | if (dol_strlen($phone) == 13) {//ex : +90 ABC_DEF_GHIJ |
2352 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 4); |
|
2352 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4); |
|
2353 | 2353 | } |
2354 | 2354 | } elseif (strtoupper($countrycode) == "US") {//Etat-Unis |
2355 | 2355 | if (dol_strlen($phone) == 12) {//ex: +1 ABC_DEF_GHIJ |
2356 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 3) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 4); |
|
2356 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4); |
|
2357 | 2357 | } |
2358 | 2358 | } elseif (strtoupper($countrycode) == "MX") {//Mexique |
2359 | 2359 | if (dol_strlen($phone) == 12) {//ex: +52 ABCD_EFG_HI |
2360 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 2); |
|
2360 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2); |
|
2361 | 2361 | } elseif (dol_strlen($phone) == 11) {//ex: +52 AB_CD_EF_GH |
2362 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
2362 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
2363 | 2363 | } elseif (dol_strlen($phone) == 13) {//ex: +52 ABC_DEF_GHIJ |
2364 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 4); |
|
2364 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4); |
|
2365 | 2365 | } |
2366 | 2366 | } elseif (strtoupper($countrycode) == "ML") {//Mali |
2367 | 2367 | if (dol_strlen($phone) == 12) {//ex: +223 AB_CD_EF_GH |
2368 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2368 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2369 | 2369 | } |
2370 | 2370 | } elseif (strtoupper($countrycode) == "TH") {//Thaïlande |
2371 | 2371 | if (dol_strlen($phone) == 11) {//ex: +66_ABC_DE_FGH |
2372 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 3); |
|
2372 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3); |
|
2373 | 2373 | } elseif (dol_strlen($phone) == 12) {//ex: +66_A_BCD_EF_GHI |
2374 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 3); |
|
2374 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 3); |
|
2375 | 2375 | } |
2376 | 2376 | } elseif (strtoupper($countrycode) == "MU") {//Maurice |
2377 | 2377 | if (dol_strlen($phone) == 11) {//ex: +230_ABC_DE_FG |
2378 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
2378 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
2379 | 2379 | } elseif (dol_strlen($phone) == 12) {//ex: +230_ABCD_EF_GH |
2380 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 4) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2380 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2381 | 2381 | } |
2382 | 2382 | } elseif (strtoupper($countrycode) == "ZA") {//Afrique du sud |
2383 | 2383 | if (dol_strlen($phone) == 12) {//ex: +27_AB_CDE_FG_HI |
2384 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2384 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2385 | 2385 | } |
2386 | 2386 | } elseif (strtoupper($countrycode) == "SY") {//Syrie |
2387 | 2387 | if (dol_strlen($phone) == 12) {//ex: +963_AB_CD_EF_GH |
2388 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2388 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2389 | 2389 | } elseif (dol_strlen($phone) == 13) {//ex: +963_AB_CD_EF_GHI |
2390 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 3); |
|
2390 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 3); |
|
2391 | 2391 | } |
2392 | 2392 | } elseif (strtoupper($countrycode) == "AE") {//Emirats Arabes Unis |
2393 | 2393 | if (dol_strlen($phone) == 12) {//ex: +971_ABC_DEF_GH |
2394 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 2); |
|
2394 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2); |
|
2395 | 2395 | } elseif (dol_strlen($phone) == 13) {//ex: +971_ABC_DEF_GHI |
2396 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
2396 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
2397 | 2397 | } elseif (dol_strlen($phone) == 14) {//ex: +971_ABC_DEF_GHIK |
2398 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 4); |
|
2398 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 4); |
|
2399 | 2399 | } |
2400 | 2400 | } elseif (strtoupper($countrycode) == "DZ") {//Algérie |
2401 | 2401 | if (dol_strlen($phone) == 13) {//ex: +213_ABC_DEF_GHI |
2402 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
2402 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
2403 | 2403 | } |
2404 | 2404 | } elseif (strtoupper($countrycode) == "BE") {//Belgique |
2405 | 2405 | if (dol_strlen($phone) == 11) {//ex: +32_ABC_DE_FGH |
2406 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 3); |
|
2406 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3); |
|
2407 | 2407 | } elseif (dol_strlen($phone) == 12) {//ex: +32_ABC_DEF_GHI |
2408 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
2408 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
2409 | 2409 | } |
2410 | 2410 | } elseif (strtoupper($countrycode) == "PF") {//Polynésie française |
2411 | 2411 | if (dol_strlen($phone) == 12) {//ex: +689_AB_CD_EF_GH |
2412 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2412 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2413 | 2413 | } |
2414 | 2414 | } elseif (strtoupper($countrycode) == "CO") {//Colombie |
2415 | 2415 | if (dol_strlen($phone) == 13) {//ex: +57_ABC_DEF_GH_IJ |
2416 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2416 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2417 | 2417 | } |
2418 | 2418 | } elseif (strtoupper($countrycode) == "JO") {//Jordanie |
2419 | 2419 | if (dol_strlen($phone) == 12) {//ex: +962_A_BCD_EF_GH |
2420 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 1) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
2420 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 1).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
2421 | 2421 | } |
2422 | 2422 | } elseif (strtoupper($countrycode) == "MG") {//Madagascar |
2423 | 2423 | if (dol_strlen($phone) == 13) {//ex: +261_AB_CD_EF_GHI |
2424 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 3); |
|
2424 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 3); |
|
2425 | 2425 | } |
2426 | 2426 | } elseif (strtoupper($countrycode) == "GB") {//Royaume uni |
2427 | 2427 | if (dol_strlen($phone) == 13) {//ex: +44_ABCD_EFG_HIJ |
2428 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
2428 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
2429 | 2429 | } |
2430 | 2430 | } elseif (strtoupper($countrycode) == "CH") {//Suisse |
2431 | 2431 | if (dol_strlen($phone) == 12) {//ex: +41_AB_CDE_FG_HI |
2432 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2432 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2433 | 2433 | } elseif (dol_strlen($phone) == 15) {// +41_AB_CDE_FGH_IJKL |
2434 | - $newphone = $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 3) . $separ . substr($newphone, 11, 4); |
|
2434 | + $newphone = $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 3).$separ.substr($newphone, 11, 4); |
|
2435 | 2435 | } |
2436 | 2436 | } elseif (strtoupper($countrycode) == "TN") {//Tunisie |
2437 | 2437 | if (dol_strlen($phone) == 12) {//ex: +216_AB_CDE_FGH |
2438 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
2438 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
2439 | 2439 | } |
2440 | 2440 | } elseif (strtoupper($countrycode) == "GF") {//Guyane francaise |
2441 | 2441 | if (dol_strlen($phone) == 13) {//ex: +594_ABC_DE_FG_HI (ABC=594 de nouveau) |
2442 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2442 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2443 | 2443 | } |
2444 | 2444 | } elseif (strtoupper($countrycode) == "GP") {//Guadeloupe |
2445 | 2445 | if (dol_strlen($phone) == 13) {//ex: +590_ABC_DE_FG_HI (ABC=590 de nouveau) |
2446 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2446 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2447 | 2447 | } |
2448 | 2448 | } elseif (strtoupper($countrycode) == "MQ") {//Martinique |
2449 | 2449 | if (dol_strlen($phone) == 13) {//ex: +596_ABC_DE_FG_HI (ABC=596 de nouveau) |
2450 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2450 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2451 | 2451 | } |
2452 | 2452 | } elseif (strtoupper($countrycode) == "IT") {//Italie |
2453 | 2453 | if (dol_strlen($phone) == 12) {//ex: +39_ABC_DEF_GHI |
2454 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
2454 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
2455 | 2455 | } elseif (dol_strlen($phone) == 13) {//ex: +39_ABC_DEF_GH_IJ |
2456 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2456 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2457 | 2457 | } |
2458 | 2458 | } elseif (strtoupper($countrycode) == "AU") {//Australie |
2459 | 2459 | if (dol_strlen($phone) == 12) {//ex: +61_A_BCDE_FGHI |
2460 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 4) . $separ . substr($newphone, 8, 4); |
|
2460 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4); |
|
2461 | 2461 | } |
2462 | 2462 | } |
2463 | 2463 | if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set) |
2464 | 2464 | if ($conf->browser->layout == 'phone' || (!empty($conf->clicktodial->enabled) && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone |
2465 | - $newphone = '<a href="tel:' . $phone . '"'; |
|
2466 | - $newphone .= '>' . $phone . '</a>'; |
|
2465 | + $newphone = '<a href="tel:'.$phone.'"'; |
|
2466 | + $newphone .= '>'.$phone.'</a>'; |
|
2467 | 2467 | } else if (!empty($conf->clicktodial->enabled) && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url |
2468 | 2468 | if (empty($user->clicktodial_loaded)) |
2469 | 2469 | $user->fetch_clicktodial(); |
@@ -2487,10 +2487,10 @@ discard block |
||
2487 | 2487 | '__PASS__' => $clicktodial_password); |
2488 | 2488 | $url = make_substitutions($url, $substitarray); |
2489 | 2489 | $newphonesav = $newphone; |
2490 | - $newphone = '<a href="' . $url . '"'; |
|
2490 | + $newphone = '<a href="'.$url.'"'; |
|
2491 | 2491 | if (!empty($conf->global->CLICKTODIAL_FORCENEWTARGET)) |
2492 | 2492 | $newphone .= ' target="_blank"'; |
2493 | - $newphone .= '>' . $newphonesav . '</a>'; |
|
2493 | + $newphone .= '>'.$newphonesav.'</a>'; |
|
2494 | 2494 | } |
2495 | 2495 | |
2496 | 2496 | //if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) |
@@ -2500,9 +2500,9 @@ discard block |
||
2500 | 2500 | if ($addlink == 'AC_FAX') |
2501 | 2501 | $type = 'AC_FAX'; |
2502 | 2502 | if (!empty($conf->global->AGENDA_ADDACTIONFORPHONE)) |
2503 | - $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . ($cid ? '&contactid=' . $cid : '') . ($socid ? '&socid=' . $socid : '') . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2503 | + $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$type.($cid ? '&contactid='.$cid : '').($socid ? '&socid='.$socid : '').'">'.img_object($langs->trans("AddAction"), "calendar").'</a>'; |
|
2504 | 2504 | if ($link) |
2505 | - $newphone = '<div>' . $newphone . ' ' . $link . '</div>'; |
|
2505 | + $newphone = '<div>'.$newphone.' '.$link.'</div>'; |
|
2506 | 2506 | } |
2507 | 2507 | } |
2508 | 2508 | |
@@ -2533,7 +2533,7 @@ discard block |
||
2533 | 2533 | $rep .= '<div class="nospan float" style="margin-right: 10px">'; |
2534 | 2534 | else |
2535 | 2535 | $rep .= '<span style="margin-right: 10px;">'; |
2536 | - $rep .= ($withpicto ? img_picto($titlealt, 'object_' . $picto . '.png') . ' ' : '') . $newphone; |
|
2536 | + $rep .= ($withpicto ? img_picto($titlealt, 'object_'.$picto.'.png').' ' : '').$newphone; |
|
2537 | 2537 | if ($adddivfloat) |
2538 | 2538 | $rep .= '</div>'; |
2539 | 2539 | else |
@@ -2561,15 +2561,15 @@ discard block |
||
2561 | 2561 | $ret .= $ip; |
2562 | 2562 | } |
2563 | 2563 | |
2564 | - echo ('<p>DOL_BASE_PATH: ' . DOL_BASE_PATH . '/DOL_BASE_URI: ' . DOL_BASE_URI . '</p>'); |
|
2564 | + echo ('<p>DOL_BASE_PATH: '.DOL_BASE_PATH.'/DOL_BASE_URI: '.DOL_BASE_URI.'</p>'); |
|
2565 | 2565 | |
2566 | 2566 | if ($mode != 2) { |
2567 | 2567 | $countrycode = dolGetCountryCodeFromIp($ip); |
2568 | 2568 | if ($countrycode) { // If success, countrycode is us, fr, ... |
2569 | - if (file_exists(DOL_BASE_PATH . '/theme/common/flags/' . $countrycode . '.png')) { |
|
2570 | - $ret .= ' ' . img_picto($countrycode . ' ' . $langs->trans("AccordingToGeoIPDatabase"), DOL_BASE_URI . '/theme/common/flags/' . $countrycode . '.png', '', 1); |
|
2569 | + if (file_exists(DOL_BASE_PATH.'/theme/common/flags/'.$countrycode.'.png')) { |
|
2570 | + $ret .= ' '.img_picto($countrycode.' '.$langs->trans("AccordingToGeoIPDatabase"), DOL_BASE_URI.'/theme/common/flags/'.$countrycode.'.png', '', 1); |
|
2571 | 2571 | } else |
2572 | - $ret .= ' (' . $countrycode . ')'; |
|
2572 | + $ret .= ' ('.$countrycode.')'; |
|
2573 | 2573 | } |
2574 | 2574 | } |
2575 | 2575 | |
@@ -2607,7 +2607,7 @@ discard block |
||
2607 | 2607 | //$ip='24.24.24.24'; |
2608 | 2608 | //$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages) |
2609 | 2609 | |
2610 | - include_once DOL_BASE_PATH . '/core/class/dolgeoip.class.php'; |
|
2610 | + include_once DOL_BASE_PATH.'/core/class/dolgeoip.class.php'; |
|
2611 | 2611 | $geoip = new DolGeoIP('country', $datafile); |
2612 | 2612 | //print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n"; |
2613 | 2613 | //print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n"; |
@@ -2634,7 +2634,7 @@ discard block |
||
2634 | 2634 | $datafile = $conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE; |
2635 | 2635 | //$ip='24.24.24.24'; |
2636 | 2636 | //$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; |
2637 | - include_once DOL_BASE_PATH . '/core/class/dolgeoip.class.php'; |
|
2637 | + include_once DOL_BASE_PATH.'/core/class/dolgeoip.class.php'; |
|
2638 | 2638 | $geoip = new DolGeoIP('country', $datafile); |
2639 | 2639 | $countrycode = $geoip->getCountryCodeFromIP($ip); |
2640 | 2640 | $ret = $countrycode; |
@@ -2689,12 +2689,12 @@ discard block |
||
2689 | 2689 | $showomap = 1; |
2690 | 2690 | |
2691 | 2691 | if ($showgmap) { |
2692 | - $url = dol_buildpath('/google/gmaps.php?mode=' . $mode . '&id=' . $id, 1); |
|
2693 | - $out .= ' <a href="' . $url . '" target="_gmaps"><img id="' . $htmlid . '" class="valigntextbottom" src="' . DOL_URL_ROOT . '/theme/common/gmap.png"></a>'; |
|
2692 | + $url = dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id, 1); |
|
2693 | + $out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" class="valigntextbottom" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>'; |
|
2694 | 2694 | } |
2695 | 2695 | if ($showomap) { |
2696 | - $url = dol_buildpath('/openstreetmap/maps.php?mode=' . $mode . '&id=' . $id, 1); |
|
2697 | - $out .= ' <a href="' . $url . '" target="_gmaps"><img id="' . $htmlid . '_openstreetmap" class="valigntextbottom" src="' . DOL_URL_ROOT . '/theme/common/gmap.png"></a>'; |
|
2696 | + $url = dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id, 1); |
|
2697 | + $out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'_openstreetmap" class="valigntextbottom" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>'; |
|
2698 | 2698 | } |
2699 | 2699 | } |
2700 | 2700 | } |
@@ -2840,7 +2840,7 @@ discard block |
||
2840 | 2840 | if ($trunc == 'right') { |
2841 | 2841 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2842 | 2842 | if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
2843 | - return dol_substr($newstring, 0, $size, $stringencoding) . ($nodot ? '' : '...'); |
|
2843 | + return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '...'); |
|
2844 | 2844 | else |
2845 | 2845 | //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string; |
2846 | 2846 | return $string; |
@@ -2850,21 +2850,21 @@ discard block |
||
2850 | 2850 | if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1)) { |
2851 | 2851 | $size1 = round($size / 2); |
2852 | 2852 | $size2 = round($size / 2); |
2853 | - return dol_substr($newstring, 0, $size1, $stringencoding) . '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); |
|
2853 | + return dol_substr($newstring, 0, $size1, $stringencoding).'...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); |
|
2854 | 2854 | } else |
2855 | 2855 | return $string; |
2856 | 2856 | } |
2857 | 2857 | elseif ($trunc == 'left') { |
2858 | 2858 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2859 | 2859 | if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
2860 | - return '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
2860 | + return '...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
2861 | 2861 | else |
2862 | 2862 | return $string; |
2863 | 2863 | } |
2864 | 2864 | elseif ($trunc == 'wrap') { |
2865 | 2865 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2866 | 2866 | if (dol_strlen($newstring, $stringencoding) > ($size + 1)) |
2867 | - return dol_substr($newstring, 0, $size, $stringencoding) . "\n" . dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
2867 | + return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
2868 | 2868 | else |
2869 | 2869 | return $string; |
2870 | 2870 | } else |
@@ -2898,7 +2898,7 @@ discard block |
||
2898 | 2898 | $url = DOL_BASE_URI; |
2899 | 2899 | |
2900 | 2900 | $theme = $conf->theme; |
2901 | - $path = 'theme/' . $theme; |
|
2901 | + $path = 'theme/'.$theme; |
|
2902 | 2902 | |
2903 | 2903 | // Define fullpathpicto to use into src |
2904 | 2904 | if ($pictoisfullpath) { |
@@ -2947,7 +2947,7 @@ discard block |
||
2947 | 2947 | $fakey = 'fa-pencil'; |
2948 | 2948 | $facolor = '#444'; |
2949 | 2949 | } elseif ($pictowithoutext == 'filter') { |
2950 | - $fakey = 'fa-' . $pictowithoutext; |
|
2950 | + $fakey = 'fa-'.$pictowithoutext; |
|
2951 | 2951 | } elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') { |
2952 | 2952 | $fakey = 'fa-arrows'; |
2953 | 2953 | } elseif ($pictowithoutext == 'listlight') { |
@@ -2986,15 +2986,15 @@ discard block |
||
2986 | 2986 | } elseif ($pictowithoutext == 'jabber') { |
2987 | 2987 | $fakey = 'fa-comment-o'; |
2988 | 2988 | } else { |
2989 | - $fakey = 'fa-' . $pictowithoutext; |
|
2989 | + $fakey = 'fa-'.$pictowithoutext; |
|
2990 | 2990 | $facolor = '#444'; |
2991 | 2991 | $marginleftonlyshort = 0; |
2992 | 2992 | } |
2993 | 2993 | |
2994 | 2994 | if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { |
2995 | - $morecss .= ($morecss ? ' ' : '') . $reg[1]; |
|
2995 | + $morecss .= ($morecss ? ' ' : '').$reg[1]; |
|
2996 | 2996 | } |
2997 | - $enabledisablehtml = '<span class="fa ' . $fakey . ' ' . ($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '') . ' valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" style="' . ($fasize ? ('font-size: ' . $fasize . ';') : '') . ($facolor ? (' color: ' . $facolor . ';') : '') . '" alt="' . dol_escape_htmltag($titlealt) . '"' . (($notitle || empty($title)) ? '' : ' title="' . dol_escape_htmltag($title) . '"') . ($moreatt ? ' ' . $moreatt : '') . '>'; |
|
2997 | + $enabledisablehtml = '<span class="fa '.$fakey.' '.($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '').' valignmiddle'.($morecss ? ' '.$morecss : '').'" style="'.($fasize ? ('font-size: '.$fasize.';') : '').($facolor ? (' color: '.$facolor.';') : '').'" alt="'.dol_escape_htmltag($titlealt).'"'.(($notitle || empty($title)) ? '' : ' title="'.dol_escape_htmltag($title).'"').($moreatt ? ' '.$moreatt : '').'>'; |
|
2998 | 2998 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
2999 | 2999 | $enabledisablehtml .= $titlealt; |
3000 | 3000 | } |
@@ -3004,11 +3004,11 @@ discard block |
||
3004 | 3004 | } |
3005 | 3005 | |
3006 | 3006 | if (!empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) { |
3007 | - $path = $conf->global->MAIN_OVERWRITE_THEME_PATH . '/theme/' . $theme; // If the theme does not have the same name as the module |
|
3007 | + $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module |
|
3008 | 3008 | } else if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { |
3009 | - $path = $conf->global->MAIN_OVERWRITE_THEME_RES . '/theme/' . $conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme |
|
3009 | + $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme |
|
3010 | 3010 | } else if (!empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) { |
3011 | - $path = $theme . '/theme/' . $theme; // If the theme have the same name as the module |
|
3011 | + $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module |
|
3012 | 3012 | } |
3013 | 3013 | |
3014 | 3014 | // If we ask an image into $url/$mymodule/img (instead of default path) |
@@ -3028,15 +3028,15 @@ discard block |
||
3028 | 3028 | continue; |
3029 | 3029 | } |
3030 | 3030 | // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded |
3031 | - if (file_exists($dirroot . '/' . $path . '/img/' . $picto)) { |
|
3031 | + if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) { |
|
3032 | 3032 | //$url = DOL_URL_ROOT . $conf->file->dol_url_root[$type]; |
3033 | - $url = DOL_BASE_URI . $conf->file->dol_url_root[$type]; |
|
3033 | + $url = DOL_BASE_URI.$conf->file->dol_url_root[$type]; |
|
3034 | 3034 | break; |
3035 | 3035 | } |
3036 | 3036 | } |
3037 | 3037 | |
3038 | 3038 | // $url is '' or '/custom', $path is current theme or |
3039 | - $fullpathpicto = $url . '/' . $path . '/img/' . $picto; |
|
3039 | + $fullpathpicto = $url.'/'.$path.'/img/'.$picto; |
|
3040 | 3040 | } |
3041 | 3041 | |
3042 | 3042 | if ($srconly) { |
@@ -3044,7 +3044,7 @@ discard block |
||
3044 | 3044 | } |
3045 | 3045 | |
3046 | 3046 | // tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people |
3047 | - return '<img src="' . $fullpathpicto . '" alt="' . dol_escape_htmltag($alt) . '"' . (($notitle || empty($titlealt)) ? '' : ' title="' . dol_escape_htmltag($titlealt) . '"') . ($moreatt ? ' ' . $moreatt : ' class="inline-block' . ($morecss ? ' ' . $morecss : '') . '"') . '>'; // Alt is used for accessibility, title for popup |
|
3047 | + return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup |
|
3048 | 3048 | } |
3049 | 3049 | |
3050 | 3050 | /** |
@@ -3062,7 +3062,7 @@ discard block |
||
3062 | 3062 | */ |
3063 | 3063 | function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0) |
3064 | 3064 | { |
3065 | - return img_picto($titlealt, 'object_' . $picto, $moreatt, $pictoisfullpath, $srconly, $notitle); |
|
3065 | + return img_picto($titlealt, 'object_'.$picto, $moreatt, $pictoisfullpath, $srconly, $notitle); |
|
3066 | 3066 | } |
3067 | 3067 | |
3068 | 3068 | /** |
@@ -3083,7 +3083,7 @@ discard block |
||
3083 | 3083 | $picto .= '.png'; |
3084 | 3084 | |
3085 | 3085 | //$path = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/weather/' . $picto; |
3086 | - $path = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/weather/' . $picto; |
|
3086 | + $path = DOL_BASE_URI.'/theme/'.$conf->theme.'/img/weather/'.$picto; |
|
3087 | 3087 | |
3088 | 3088 | return img_picto($titlealt, $path, $moreatt, 1); |
3089 | 3089 | } |
@@ -3109,10 +3109,10 @@ discard block |
||
3109 | 3109 | $path = $picto; |
3110 | 3110 | else { |
3111 | 3111 | //$path = DOL_URL_ROOT . '/theme/common/' . $picto; |
3112 | - $path = DOL_BASE_URI . '/theme/common/' . $picto; |
|
3112 | + $path = DOL_BASE_URI.'/theme/common/'.$picto; |
|
3113 | 3113 | |
3114 | 3114 | if (!empty($conf->global->MAIN_MODULE_CAN_OVERWRITE_COMMONICONS)) { |
3115 | - $themepath = DOL_BASE_PATH . 'theme/' . $conf->theme . '/img/' . $picto; |
|
3115 | + $themepath = DOL_BASE_PATH.'theme/'.$conf->theme.'/img/'.$picto; |
|
3116 | 3116 | |
3117 | 3117 | if (file_exists($themepath)) |
3118 | 3118 | $path = $themepath; |
@@ -3150,14 +3150,14 @@ discard block |
||
3150 | 3150 | $numaction = 3; |
3151 | 3151 | $titlealt = $langs->transnoentitiesnoconv('ChangeContactDone'); |
3152 | 3152 | } else { |
3153 | - $titlealt = $langs->transnoentitiesnoconv('ChangeStatus ' . $numaction); |
|
3153 | + $titlealt = $langs->transnoentitiesnoconv('ChangeStatus '.$numaction); |
|
3154 | 3154 | $numaction = 0; |
3155 | 3155 | } |
3156 | 3156 | } |
3157 | 3157 | if (!is_numeric($numaction)) |
3158 | 3158 | $numaction = 0; |
3159 | 3159 | |
3160 | - return img_picto($titlealt, 'stcomm' . $numaction . '.png'); |
|
3160 | + return img_picto($titlealt, 'stcomm'.$numaction.'.png'); |
|
3161 | 3161 | } |
3162 | 3162 | |
3163 | 3163 | /** |
@@ -3174,7 +3174,7 @@ discard block |
||
3174 | 3174 | if ($titlealt == 'default') |
3175 | 3175 | $titlealt = $langs->trans('Show'); |
3176 | 3176 | |
3177 | - return img_picto($titlealt, 'pdf' . $size . '.png'); |
|
3177 | + return img_picto($titlealt, 'pdf'.$size.'.png'); |
|
3178 | 3178 | } |
3179 | 3179 | |
3180 | 3180 | /** |
@@ -3226,7 +3226,7 @@ discard block |
||
3226 | 3226 | if ($titlealt == 'default') |
3227 | 3227 | $titlealt = $langs->trans('Modify'); |
3228 | 3228 | |
3229 | - return img_picto($titlealt, 'edit.png', ($float ? 'style="float: ' . ($langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right') . '"' : "") . ($other ? ' ' . $other : '')); |
|
3229 | + return img_picto($titlealt, 'edit.png', ($float ? 'style="float: '.($langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right').'"' : "").($other ? ' '.$other : '')); |
|
3230 | 3230 | } |
3231 | 3231 | |
3232 | 3232 | /** |
@@ -3244,7 +3244,7 @@ discard block |
||
3244 | 3244 | if ($titlealt == 'default') |
3245 | 3245 | $titlealt = $langs->trans('View'); |
3246 | 3246 | |
3247 | - $moreatt = ($float ? 'style="float: right" ' : '') . $other; |
|
3247 | + $moreatt = ($float ? 'style="float: right" ' : '').$other; |
|
3248 | 3248 | |
3249 | 3249 | return img_picto($titlealt, 'view.png', $moreatt); |
3250 | 3250 | } |
@@ -3317,7 +3317,7 @@ discard block |
||
3317 | 3317 | $usealttitle = $langs->trans('Info'); |
3318 | 3318 | } |
3319 | 3319 | |
3320 | - return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;' . ($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')) . '"'); |
|
3320 | + return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;'.($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')).'"'); |
|
3321 | 3321 | } |
3322 | 3322 | |
3323 | 3323 | /** |
@@ -3351,7 +3351,7 @@ discard block |
||
3351 | 3351 | $titlealt = $langs->trans('Warning'); |
3352 | 3352 | |
3353 | 3353 | //return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>'; |
3354 | - return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"' . ($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' ' . $moreatt) : '')); |
|
3354 | + return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt) : '')); |
|
3355 | 3355 | } |
3356 | 3356 | |
3357 | 3357 | /** |
@@ -3385,7 +3385,7 @@ discard block |
||
3385 | 3385 | $titlealt = $langs->trans('Next'); |
3386 | 3386 | |
3387 | 3387 | //return img_picto($titlealt, 'next.png', $moreatt); |
3388 | - return '<span class="fa fa-chevron-right paddingright paddingleft" title="' . dol_escape_htmltag($titlealt) . '"></span>'; |
|
3388 | + return '<span class="fa fa-chevron-right paddingright paddingleft" title="'.dol_escape_htmltag($titlealt).'"></span>'; |
|
3389 | 3389 | } |
3390 | 3390 | |
3391 | 3391 | /** |
@@ -3403,7 +3403,7 @@ discard block |
||
3403 | 3403 | $titlealt = $langs->trans('Previous'); |
3404 | 3404 | |
3405 | 3405 | //return img_picto($titlealt, 'previous.png', $moreatt); |
3406 | - return '<span class="fa fa-chevron-left paddingright paddingleft" title="' . dol_escape_htmltag($titlealt) . '"></span>'; |
|
3406 | + return '<span class="fa fa-chevron-left paddingright paddingleft" title="'.dol_escape_htmltag($titlealt).'"></span>'; |
|
3407 | 3407 | } |
3408 | 3408 | |
3409 | 3409 | /** |
@@ -3421,7 +3421,7 @@ discard block |
||
3421 | 3421 | if ($titlealt == 'default') |
3422 | 3422 | $titlealt = $langs->trans('Down'); |
3423 | 3423 | |
3424 | - return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown' . ($moreclass ? " " . $moreclass : "") . '"'); |
|
3424 | + return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown'.($moreclass ? " ".$moreclass : "").'"'); |
|
3425 | 3425 | } |
3426 | 3426 | |
3427 | 3427 | /** |
@@ -3439,7 +3439,7 @@ discard block |
||
3439 | 3439 | if ($titlealt == 'default') |
3440 | 3440 | $titlealt = $langs->trans('Up'); |
3441 | 3441 | |
3442 | - return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup' . ($moreclass ? " " . $moreclass : "") . '"'); |
|
3442 | + return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup'.($moreclass ? " ".$moreclass : "").'"'); |
|
3443 | 3443 | } |
3444 | 3444 | |
3445 | 3445 | /** |
@@ -3522,7 +3522,7 @@ discard block |
||
3522 | 3522 | $brand = 'credit-card'; |
3523 | 3523 | } |
3524 | 3524 | |
3525 | - return '<span class="fa fa-' . $brand . ' fa-2x fa-fw"></span>'; |
|
3525 | + return '<span class="fa fa-'.$brand.' fa-2x fa-fw"></span>'; |
|
3526 | 3526 | } |
3527 | 3527 | |
3528 | 3528 | /** |
@@ -3535,17 +3535,17 @@ discard block |
||
3535 | 3535 | */ |
3536 | 3536 | function img_mime($file, $titlealt = '', $morecss = '') |
3537 | 3537 | { |
3538 | - require_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
3538 | + require_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
3539 | 3539 | |
3540 | 3540 | $mimetype = dol_mimetype($file, '', 1); |
3541 | 3541 | $mimeimg = dol_mimetype($file, '', 2); |
3542 | 3542 | $mimefa = dol_mimetype($file, '', 4); |
3543 | 3543 | |
3544 | 3544 | if (empty($titlealt)) |
3545 | - $titlealt = 'Mime type: ' . $mimetype; |
|
3545 | + $titlealt = 'Mime type: '.$mimetype; |
|
3546 | 3546 | |
3547 | 3547 | //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); |
3548 | - return '<i class="fa fa-' . $mimefa . ' paddingright"></i>'; |
|
3548 | + return '<i class="fa fa-'.$mimefa.' paddingright"></i>'; |
|
3549 | 3549 | } |
3550 | 3550 | |
3551 | 3551 | /** |
@@ -3560,7 +3560,7 @@ discard block |
||
3560 | 3560 | */ |
3561 | 3561 | function img_phone($titlealt = 'default', $option = 0) |
3562 | 3562 | { |
3563 | - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
3563 | + dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
3564 | 3564 | |
3565 | 3565 | global $conf, $langs; |
3566 | 3566 | |
@@ -3591,8 +3591,8 @@ discard block |
||
3591 | 3591 | |
3592 | 3592 | $img = img_picto($titlealt, 'search.png', $other, false, 1); |
3593 | 3593 | |
3594 | - $input = '<input type="image" class="liste_titre" name="button_search" src="' . $img . '" '; |
|
3595 | - $input .= 'value="' . dol_escape_htmltag($titlealt) . '" title="' . dol_escape_htmltag($titlealt) . '" >'; |
|
3594 | + $input = '<input type="image" class="liste_titre" name="button_search" src="'.$img.'" '; |
|
3595 | + $input .= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >'; |
|
3596 | 3596 | |
3597 | 3597 | return $input; |
3598 | 3598 | } |
@@ -3613,8 +3613,8 @@ discard block |
||
3613 | 3613 | |
3614 | 3614 | $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); |
3615 | 3615 | |
3616 | - $input = '<input type="image" class="liste_titre" name="button_removefilter" src="' . $img . '" '; |
|
3617 | - $input .= 'value="' . dol_escape_htmltag($titlealt) . '" title="' . dol_escape_htmltag($titlealt) . '" >'; |
|
3616 | + $input = '<input type="image" class="liste_titre" name="button_removefilter" src="'.$img.'" '; |
|
3617 | + $input .= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >'; |
|
3618 | 3618 | |
3619 | 3619 | return $input; |
3620 | 3620 | } |
@@ -3634,10 +3634,10 @@ discard block |
||
3634 | 3634 | global $conf, $langs; |
3635 | 3635 | |
3636 | 3636 | if ($infoonimgalt) { |
3637 | - return img_picto($text, 'info', 'class="hideonsmartphone' . ($morecss ? ' ' . $morecss : '') . '"'); |
|
3637 | + return img_picto($text, 'info', 'class="hideonsmartphone'.($morecss ? ' '.$morecss : '').'"'); |
|
3638 | 3638 | } |
3639 | 3639 | |
3640 | - return ($nodiv ? '' : '<div class="' . (empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)) . ' hideonsmartphone' . ($morecss ? ' ' . $morecss : '') . '">') . '<span class="fa fa-info-circle" title="' . dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')) . '"></span> ' . $text . ($nodiv ? '' : '</div>'); |
|
3640 | + return ($nodiv ? '' : '<div class="'.(empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)).' hideonsmartphone'.($morecss ? ' '.$morecss : '').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>'); |
|
3641 | 3641 | } |
3642 | 3642 | |
3643 | 3643 | /** |
@@ -3662,7 +3662,7 @@ discard block |
||
3662 | 3662 | |
3663 | 3663 | // Si erreur intervenue avant chargement langue |
3664 | 3664 | if (!$langs) { |
3665 | - require_once DOL_BASE_PATH . '/core/class/translate.class.php'; |
|
3665 | + require_once DOL_BASE_PATH.'/core/class/translate.class.php'; |
|
3666 | 3666 | $langs = new Translate('', $conf); |
3667 | 3667 | $langs->load("main"); |
3668 | 3668 | } |
@@ -3670,51 +3670,51 @@ discard block |
||
3670 | 3670 | $langs->loadLangs(array('main', 'errors')); |
3671 | 3671 | |
3672 | 3672 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web |
3673 | - $out .= $langs->trans("DolibarrHasDetectedError") . ".<br>\n"; |
|
3673 | + $out .= $langs->trans("DolibarrHasDetectedError").".<br>\n"; |
|
3674 | 3674 | if (!empty($conf->global->MAIN_FEATURES_LEVEL)) |
3675 | 3675 | $out .= "You use an experimental or develop level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n"; |
3676 | - $out .= $langs->trans("InformationToHelpDiagnose") . ":<br>\n"; |
|
3676 | + $out .= $langs->trans("InformationToHelpDiagnose").":<br>\n"; |
|
3677 | 3677 | |
3678 | - $out .= "<b>" . $langs->trans("Date") . ":</b> " . dol_print_date(time(), 'dayhourlog') . "<br>\n"; |
|
3679 | - $out .= "<b>" . $langs->trans("Dolibarr") . ":</b> " . DOL_VERSION . "<br>\n"; |
|
3678 | + $out .= "<b>".$langs->trans("Date").":</b> ".dol_print_date(time(), 'dayhourlog')."<br>\n"; |
|
3679 | + $out .= "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n"; |
|
3680 | 3680 | if (isset($conf->global->MAIN_FEATURES_LEVEL)) |
3681 | - $out .= "<b>" . $langs->trans("LevelOfFeature") . ":</b> " . $conf->global->MAIN_FEATURES_LEVEL . "<br>\n"; |
|
3681 | + $out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n"; |
|
3682 | 3682 | if (function_exists("phpversion")) { |
3683 | - $out .= "<b>" . $langs->trans("PHP") . ":</b> " . phpversion() . "<br>\n"; |
|
3683 | + $out .= "<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n"; |
|
3684 | 3684 | } |
3685 | - $out .= "<b>" . $langs->trans("Server") . ":</b> " . $_SERVER["SERVER_SOFTWARE"] . "<br>\n"; |
|
3685 | + $out .= "<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n"; |
|
3686 | 3686 | if (function_exists("php_uname")) { |
3687 | - $out .= "<b>" . $langs->trans("OS") . ":</b> " . php_uname() . "<br>\n"; |
|
3687 | + $out .= "<b>".$langs->trans("OS").":</b> ".php_uname()."<br>\n"; |
|
3688 | 3688 | } |
3689 | - $out .= "<b>" . $langs->trans("UserAgent") . ":</b> " . $_SERVER["HTTP_USER_AGENT"] . "<br>\n"; |
|
3689 | + $out .= "<b>".$langs->trans("UserAgent").":</b> ".$_SERVER["HTTP_USER_AGENT"]."<br>\n"; |
|
3690 | 3690 | $out .= "<br>\n"; |
3691 | - $out .= "<b>" . $langs->trans("RequestedUrl") . ":</b> " . dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8') . "<br>\n"; |
|
3692 | - $out .= "<b>" . $langs->trans("Referer") . ":</b> " . (isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '') . "<br>\n"; |
|
3693 | - $out .= "<b>" . $langs->trans("MenuManager") . ":</b> " . (isset($conf->standard_menu) ? $conf->standard_menu : '') . "<br>\n"; |
|
3691 | + $out .= "<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8')."<br>\n"; |
|
3692 | + $out .= "<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '')."<br>\n"; |
|
3693 | + $out .= "<b>".$langs->trans("MenuManager").":</b> ".(isset($conf->standard_menu) ? $conf->standard_menu : '')."<br>\n"; |
|
3694 | 3694 | $out .= "<br>\n"; |
3695 | - $syslog .= "url=" . dol_escape_htmltag($_SERVER["REQUEST_URI"]); |
|
3696 | - $syslog .= ", query_string=" . dol_escape_htmltag($_SERVER["QUERY_STRING"]); |
|
3695 | + $syslog .= "url=".dol_escape_htmltag($_SERVER["REQUEST_URI"]); |
|
3696 | + $syslog .= ", query_string=".dol_escape_htmltag($_SERVER["QUERY_STRING"]); |
|
3697 | 3697 | } else { // Mode CLI |
3698 | - $out .= '> ' . $langs->transnoentities("ErrorInternalErrorDetected") . ":\n" . $argv[0] . "\n"; |
|
3699 | - $syslog .= "pid=" . dol_getmypid(); |
|
3698 | + $out .= '> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n"; |
|
3699 | + $syslog .= "pid=".dol_getmypid(); |
|
3700 | 3700 | } |
3701 | 3701 | |
3702 | 3702 | if (is_object($db)) { |
3703 | 3703 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web |
3704 | - $out .= "<b>" . $langs->trans("DatabaseTypeManager") . ":</b> " . $db->type . "<br>\n"; |
|
3705 | - $out .= "<b>" . $langs->trans("RequestLastAccessInError") . ":</b> " . ($db->lastqueryerror() ? dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n"; |
|
3706 | - $out .= "<b>" . $langs->trans("ReturnCodeLastAccessInError") . ":</b> " . ($db->lasterrno() ? dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n"; |
|
3707 | - $out .= "<b>" . $langs->trans("InformationLastAccessInError") . ":</b> " . ($db->lasterror() ? dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n"; |
|
3704 | + $out .= "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n"; |
|
3705 | + $out .= "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror() ? dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError"))."<br>\n"; |
|
3706 | + $out .= "<b>".$langs->trans("ReturnCodeLastAccessInError").":</b> ".($db->lasterrno() ? dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError"))."<br>\n"; |
|
3707 | + $out .= "<b>".$langs->trans("InformationLastAccessInError").":</b> ".($db->lasterror() ? dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError"))."<br>\n"; |
|
3708 | 3708 | $out .= "<br>\n"; |
3709 | 3709 | } else { // Mode CLI |
3710 | 3710 | // No dol_escape_htmltag for output, we are in CLI mode |
3711 | - $out .= '> ' . $langs->transnoentities("DatabaseTypeManager") . ":\n" . $db->type . "\n"; |
|
3712 | - $out .= '> ' . $langs->transnoentities("RequestLastAccessInError") . ":\n" . ($db->lastqueryerror() ? $db->lastqueryerror() : $langs->transnoentities("ErrorNoRequestInError")) . "\n"; |
|
3713 | - $out .= '> ' . $langs->transnoentities("ReturnCodeLastAccessInError") . ":\n" . ($db->lasterrno() ? $db->lasterrno() : $langs->transnoentities("ErrorNoRequestInError")) . "\n"; |
|
3714 | - $out .= '> ' . $langs->transnoentities("InformationLastAccessInError") . ":\n" . ($db->lasterror() ? $db->lasterror() : $langs->transnoentities("ErrorNoRequestInError")) . "\n"; |
|
3711 | + $out .= '> '.$langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n"; |
|
3712 | + $out .= '> '.$langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror() ? $db->lastqueryerror() : $langs->transnoentities("ErrorNoRequestInError"))."\n"; |
|
3713 | + $out .= '> '.$langs->transnoentities("ReturnCodeLastAccessInError").":\n".($db->lasterrno() ? $db->lasterrno() : $langs->transnoentities("ErrorNoRequestInError"))."\n"; |
|
3714 | + $out .= '> '.$langs->transnoentities("InformationLastAccessInError").":\n".($db->lasterror() ? $db->lasterror() : $langs->transnoentities("ErrorNoRequestInError"))."\n"; |
|
3715 | 3715 | } |
3716 | - $syslog .= ", sql=" . $db->lastquery(); |
|
3717 | - $syslog .= ", db_error=" . $db->lasterror(); |
|
3716 | + $syslog .= ", sql=".$db->lastquery(); |
|
3717 | + $syslog .= ", db_error=".$db->lasterror(); |
|
3718 | 3718 | } |
3719 | 3719 | |
3720 | 3720 | if ($error || $errors) { |
@@ -3734,31 +3734,31 @@ discard block |
||
3734 | 3734 | if (empty($msg)) |
3735 | 3735 | continue; |
3736 | 3736 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web |
3737 | - $out .= "<b>" . $langs->trans("Message") . ":</b> " . dol_escape_htmltag($msg) . "<br>\n"; |
|
3737 | + $out .= "<b>".$langs->trans("Message").":</b> ".dol_escape_htmltag($msg)."<br>\n"; |
|
3738 | 3738 | } else { // Mode CLI |
3739 | - $out .= '> ' . $langs->transnoentities("Message") . ":\n" . $msg . "\n"; |
|
3739 | + $out .= '> '.$langs->transnoentities("Message").":\n".$msg."\n"; |
|
3740 | 3740 | } |
3741 | - $syslog .= ", msg=" . $msg; |
|
3741 | + $syslog .= ", msg=".$msg; |
|
3742 | 3742 | } |
3743 | 3743 | } |
3744 | 3744 | if (empty($dolibarr_main_prod) && $_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_print_function_stack') && function_exists('xdebug_call_file')) { |
3745 | 3745 | xdebug_print_function_stack(); |
3746 | - $out .= '<b>XDebug informations:</b>' . "<br>\n"; |
|
3747 | - $out .= 'File: ' . xdebug_call_file() . "<br>\n"; |
|
3748 | - $out .= 'Line: ' . xdebug_call_line() . "<br>\n"; |
|
3749 | - $out .= 'Function: ' . xdebug_call_function() . "<br>\n"; |
|
3746 | + $out .= '<b>XDebug informations:</b>'."<br>\n"; |
|
3747 | + $out .= 'File: '.xdebug_call_file()."<br>\n"; |
|
3748 | + $out .= 'Line: '.xdebug_call_line()."<br>\n"; |
|
3749 | + $out .= 'Function: '.xdebug_call_function()."<br>\n"; |
|
3750 | 3750 | $out .= "<br>\n"; |
3751 | 3751 | } |
3752 | 3752 | |
3753 | 3753 | if (empty($dolibarr_main_prod)) |
3754 | 3754 | print $out; |
3755 | 3755 | else { |
3756 | - print $langs->trans("DolibarrHasDetectedError") . '. '; |
|
3756 | + print $langs->trans("DolibarrHasDetectedError").'. '; |
|
3757 | 3757 | print $langs->trans("YouCanSetOptionDolibarrMainProdToZero"); |
3758 | 3758 | define("MAIN_CORE_ERROR", 1); |
3759 | 3759 | } |
3760 | 3760 | //else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported to your browser. Please read the log file for error message.'; |
3761 | - dol_syslog("Error " . $syslog, LOG_ERR); |
|
3761 | + dol_syslog("Error ".$syslog, LOG_ERR); |
|
3762 | 3762 | } |
3763 | 3763 | |
3764 | 3764 | /** |
@@ -3781,13 +3781,13 @@ discard block |
||
3781 | 3781 | $langs->load("errors"); |
3782 | 3782 | $now = dol_now(); |
3783 | 3783 | |
3784 | - print '<br><div class="center login_main_message"><div class="' . $morecss . '">'; |
|
3785 | - print $langs->trans("ErrorContactEMail", $email, $prefixcode . dol_print_date($now, '%Y%m%d')); |
|
3784 | + print '<br><div class="center login_main_message"><div class="'.$morecss.'">'; |
|
3785 | + print $langs->trans("ErrorContactEMail", $email, $prefixcode.dol_print_date($now, '%Y%m%d')); |
|
3786 | 3786 | if ($errormessage) |
3787 | - print '<br><br>' . $errormessage; |
|
3787 | + print '<br><br>'.$errormessage; |
|
3788 | 3788 | if (is_array($errormessages) && count($errormessages)) { |
3789 | 3789 | foreach ($errormessages as $mesgtoshow) { |
3790 | - print '<br><br>' . $mesgtoshow; |
|
3790 | + print '<br><br>'.$mesgtoshow; |
|
3791 | 3791 | } |
3792 | 3792 | } |
3793 | 3793 | print '</div></div>'; |
@@ -3845,16 +3845,16 @@ discard block |
||
3845 | 3845 | } |
3846 | 3846 | |
3847 | 3847 | $tmpsortfield = explode(',', $sortfield); |
3848 | - $sortfield1 = trim($tmpsortfield[0]); // If $sortfield is 'd.datep,d.id', it becomes 'd.datep' |
|
3848 | + $sortfield1 = trim($tmpsortfield[0]); // If $sortfield is 'd.datep,d.id', it becomes 'd.datep' |
|
3849 | 3849 | $tmpfield = explode(',', $field); |
3850 | - $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' |
|
3850 | + $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' |
|
3851 | 3851 | //var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1); |
3852 | 3852 | // If field is used as sort criteria we use a specific css class liste_titre_sel |
3853 | 3853 | // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") |
3854 | 3854 | if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./", "", $field1))) { |
3855 | - $out .= '<' . $tag . ' class="' . $prefix . 'liste_titre_sel" ' . $moreattrib . '>'; |
|
3855 | + $out .= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '.$moreattrib.'>'; |
|
3856 | 3856 | } else { |
3857 | - $out .= '<' . $tag . ' class="' . $prefix . 'liste_titre" ' . $moreattrib . '>'; |
|
3857 | + $out .= '<'.$tag.' class="'.$prefix.'liste_titre" '.$moreattrib.'>'; |
|
3858 | 3858 | } |
3859 | 3859 | |
3860 | 3860 | if (empty($thead) && $field && empty($disablesortlink)) { // If this is a sort field |
@@ -3862,7 +3862,7 @@ discard block |
||
3862 | 3862 | $options = preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i', '', $options); |
3863 | 3863 | $options = preg_replace('/&+/i', '&', $options); |
3864 | 3864 | if (!preg_match('/^&/', $options)) { |
3865 | - $options = '&' . $options; |
|
3865 | + $options = '&'.$options; |
|
3866 | 3866 | } |
3867 | 3867 | |
3868 | 3868 | $sortordertouseinlink = ''; |
@@ -3880,7 +3880,7 @@ discard block |
||
3880 | 3880 | } |
3881 | 3881 | } |
3882 | 3882 | $sortordertouseinlink = preg_replace('/,$/', '', $sortordertouseinlink); |
3883 | - $out .= '<a class="reposition" href="' . $file . '?sortfield=' . $field . '&sortorder=' . $sortordertouseinlink . '&begin=' . $begin . $options . '">'; |
|
3883 | + $out .= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder='.$sortordertouseinlink.'&begin='.$begin.$options.'">'; |
|
3884 | 3884 | } |
3885 | 3885 | |
3886 | 3886 | if ($tooltip) { |
@@ -3898,7 +3898,7 @@ discard block |
||
3898 | 3898 | $options = preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i', '', $options); |
3899 | 3899 | $options = preg_replace('/&+/i', '&', $options); |
3900 | 3900 | if (!preg_match('/^&/', $options)) { |
3901 | - $options = '&' . $options; |
|
3901 | + $options = '&'.$options; |
|
3902 | 3902 | } |
3903 | 3903 | |
3904 | 3904 | if (!$sortorder || $field1 != $sortfield1) { |
@@ -3908,19 +3908,19 @@ discard block |
||
3908 | 3908 | if (preg_match('/^DESC/', $sortorder)) { |
3909 | 3909 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>'; |
3910 | 3910 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",1).'</a>'; |
3911 | - $sortimg .= '<span class="nowrap">' . img_up("Z-A", 0) . '</span>'; |
|
3911 | + $sortimg .= '<span class="nowrap">'.img_up("Z-A", 0).'</span>'; |
|
3912 | 3912 | } |
3913 | 3913 | if (preg_match('/^ASC/', $sortorder)) { |
3914 | 3914 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",1).'</a>'; |
3915 | 3915 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",0).'</a>'; |
3916 | - $sortimg .= '<span class="nowrap">' . img_down("A-Z", 0) . '</span>'; |
|
3916 | + $sortimg .= '<span class="nowrap">'.img_down("A-Z", 0).'</span>'; |
|
3917 | 3917 | } |
3918 | 3918 | } |
3919 | 3919 | } |
3920 | 3920 | |
3921 | 3921 | $out .= $sortimg; |
3922 | 3922 | |
3923 | - $out .= '</' . $tag . '>'; |
|
3923 | + $out .= '</'.$tag.'>'; |
|
3924 | 3924 | |
3925 | 3925 | return $out; |
3926 | 3926 | } |
@@ -3935,9 +3935,9 @@ discard block |
||
3935 | 3935 | */ |
3936 | 3936 | function print_titre($title) |
3937 | 3937 | { |
3938 | - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
3938 | + dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
3939 | 3939 | |
3940 | - print '<div class="titre">' . $title . '</div>'; |
|
3940 | + print '<div class="titre">'.$title.'</div>'; |
|
3941 | 3941 | } |
3942 | 3942 | |
3943 | 3943 | /** |
@@ -3980,20 +3980,20 @@ discard block |
||
3980 | 3980 | } |
3981 | 3981 | |
3982 | 3982 | $return .= "\n"; |
3983 | - $return .= '<table ' . ($id ? 'id="' . $id . '" ' : '') . 'summary="" class="centpercent notopnoleftnoright' . ($morecssontable ? ' ' . $morecssontable : '') . '" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into print_barre_list |
|
3983 | + $return .= '<table '.($id ? 'id="'.$id.'" ' : '').'summary="" class="centpercent notopnoleftnoright'.($morecssontable ? ' '.$morecssontable : '').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into print_barre_list |
|
3984 | 3984 | if ($picto) { |
3985 | - $return .= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">' . img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath) . '</td>'; |
|
3985 | + $return .= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>'; |
|
3986 | 3986 | } |
3987 | 3987 | $return .= '<td class="nobordernopadding valignmiddle">'; |
3988 | - $return .= '<div class="titre inline-block">' . $titre . '</div>'; |
|
3988 | + $return .= '<div class="titre inline-block">'.$titre.'</div>'; |
|
3989 | 3989 | $return .= '</td>'; |
3990 | 3990 | if (dol_strlen($morehtmlcenter)) { |
3991 | - $return .= '<td class="nobordernopadding" align="center" valign="middle">' . $morehtmlcenter . '</td>'; |
|
3991 | + $return .= '<td class="nobordernopadding" align="center" valign="middle">'.$morehtmlcenter.'</td>'; |
|
3992 | 3992 | } |
3993 | 3993 | if (dol_strlen($morehtmlright)) { |
3994 | - $return .= '<td class="nobordernopadding titre_right wordbreak" align="right" valign="middle">' . $morehtmlright . '</td>'; |
|
3994 | + $return .= '<td class="nobordernopadding titre_right wordbreak" align="right" valign="middle">'.$morehtmlright.'</td>'; |
|
3995 | 3995 | } |
3996 | - $return .= '</tr></table>' . "\n"; |
|
3996 | + $return .= '</tr></table>'."\n"; |
|
3997 | 3997 | |
3998 | 3998 | return $return; |
3999 | 3999 | } |
@@ -4041,29 +4041,29 @@ discard block |
||
4041 | 4041 | //print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage; |
4042 | 4042 | |
4043 | 4043 | print "\n"; |
4044 | - print "<!-- Begin title '" . $titre . "' -->\n"; |
|
4045 | - print '<table border="0" class="centpercent notopnoleftnoright' . ($morecss ? ' ' . $morecss : '') . '" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire |
|
4044 | + print "<!-- Begin title '".$titre."' -->\n"; |
|
4045 | + print '<table border="0" class="centpercent notopnoleftnoright'.($morecss ? ' '.$morecss : '').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire |
|
4046 | 4046 | // Left |
4047 | 4047 | //if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>'; |
4048 | 4048 | print '<td class="nobordernopadding valignmiddle">'; |
4049 | 4049 | if ($picto && $titre) |
4050 | 4050 | print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath); |
4051 | - print '<div class="titre inline-block">' . $titre; |
|
4051 | + print '<div class="titre inline-block">'.$titre; |
|
4052 | 4052 | if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') |
4053 | - print ' (' . $totalnboflines . ')'; |
|
4053 | + print ' ('.$totalnboflines.')'; |
|
4054 | 4054 | print '</div></td>'; |
4055 | 4055 | |
4056 | 4056 | // Center |
4057 | 4057 | if ($morehtmlcenter) { |
4058 | - print '<td class="nobordernopadding center valignmiddle">' . $morehtmlcenter . '</td>'; |
|
4058 | + print '<td class="nobordernopadding center valignmiddle">'.$morehtmlcenter.'</td>'; |
|
4059 | 4059 | } |
4060 | 4060 | |
4061 | 4061 | // Right |
4062 | 4062 | print '<td class="nobordernopadding valignmiddle" align="right">'; |
4063 | 4063 | if ($sortfield) |
4064 | - $options .= "&sortfield=" . urlencode($sortfield); |
|
4064 | + $options .= "&sortfield=".urlencode($sortfield); |
|
4065 | 4065 | if ($sortorder) |
4066 | - $options .= "&sortorder=" . urlencode($sortorder); |
|
4066 | + $options .= "&sortorder=".urlencode($sortorder); |
|
4067 | 4067 | // Show navigation bar |
4068 | 4068 | $pagelist = ''; |
4069 | 4069 | if ($savlimit != 0 && ($page > 0 || $num > $limit)) { |
@@ -4081,40 +4081,40 @@ discard block |
||
4081 | 4081 | } |
4082 | 4082 | |
4083 | 4083 | if ($cpt >= 1) { |
4084 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=0' . $options . '">1</a></li>'; |
|
4084 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page=0'.$options.'">1</a></li>'; |
|
4085 | 4085 | if ($cpt > 2) |
4086 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
4086 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.(($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '').'>...</span></li>'; |
|
4087 | 4087 | else if ($cpt == 2) |
4088 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=1' . $options . '">2</a></li>'; |
|
4088 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page=1'.$options.'">2</a></li>'; |
|
4089 | 4089 | } |
4090 | 4090 | |
4091 | 4091 | do { |
4092 | 4092 | if ($cpt == $page) { |
4093 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . '</span></li>'; |
|
4093 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.(($conf->dol_use_jmobile != 4) ? 'class="active"' : '').'>'.($page + 1).'</span></li>'; |
|
4094 | 4094 | } else { |
4095 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . $cpt . $options . '">' . ($cpt + 1) . '</a></li>'; |
|
4095 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.$cpt.$options.'">'.($cpt + 1).'</a></li>'; |
|
4096 | 4096 | } |
4097 | 4097 | $cpt++; |
4098 | 4098 | } while ($cpt < $nbpages && $cpt <= $page + $maxnbofpage); |
4099 | 4099 | |
4100 | 4100 | if ($cpt < $nbpages) { |
4101 | 4101 | if ($cpt < $nbpages - 2) |
4102 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
4102 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.(($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '').'>...</span></li>'; |
|
4103 | 4103 | else if ($cpt == $nbpages - 2) |
4104 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 2) . $options . '">' . ($nbpages - 1) . '</a></li>'; |
|
4105 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 1) . $options . '">' . $nbpages . '</a></li>'; |
|
4104 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.($nbpages - 2).$options.'">'.($nbpages - 1).'</a></li>'; |
|
4105 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.($nbpages - 1).$options.'">'.$nbpages.'</a></li>'; |
|
4106 | 4106 | } |
4107 | 4107 | } |
4108 | 4108 | else { |
4109 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . "</li>"; |
|
4109 | + $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.(($conf->dol_use_jmobile != 4) ? 'class="active"' : '').'>'.($page + 1)."</li>"; |
|
4110 | 4110 | } |
4111 | 4111 | } |
4112 | 4112 | |
4113 | - print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist |
|
4113 | + print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist |
|
4114 | 4114 | |
4115 | 4115 | print '</td>'; |
4116 | 4116 | |
4117 | - print '</tr></table>' . "\n"; |
|
4117 | + print '</tr></table>'."\n"; |
|
4118 | 4118 | print "<!-- End title -->\n\n"; |
4119 | 4119 | } |
4120 | 4120 | |
@@ -4145,12 +4145,12 @@ discard block |
||
4145 | 4145 | $pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES; |
4146 | 4146 | |
4147 | 4147 | print '<li class="pagination">'; |
4148 | - print '<select class="flat selectlimit" name="limit" title="' . dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")) . '">'; |
|
4148 | + print '<select class="flat selectlimit" name="limit" title="'.dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")).'">'; |
|
4149 | 4149 | $tmpchoice = explode(',', $pagesizechoices); |
4150 | - $tmpkey = $limit . ':' . $limit; |
|
4150 | + $tmpkey = $limit.':'.$limit; |
|
4151 | 4151 | if (!in_array($tmpkey, $tmpchoice)) |
4152 | 4152 | $tmpchoice[] = $tmpkey; |
4153 | - $tmpkey = $conf->liste_limit . ':' . $conf->liste_limit; |
|
4153 | + $tmpkey = $conf->liste_limit.':'.$conf->liste_limit; |
|
4154 | 4154 | if (!in_array($tmpkey, $tmpchoice)) |
4155 | 4155 | $tmpchoice[] = $tmpkey; |
4156 | 4156 | asort($tmpchoice, SORT_NUMERIC); |
@@ -4165,7 +4165,7 @@ discard block |
||
4165 | 4165 | $selected = ' selected="selected"'; |
4166 | 4166 | $found = true; |
4167 | 4167 | } |
4168 | - print '<option name="' . $key . '"' . $selected . '>' . dol_escape_htmltag($val) . '</option>' . "\n"; |
|
4168 | + print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n"; |
|
4169 | 4169 | } |
4170 | 4170 | } |
4171 | 4171 | print '</select>'; |
@@ -4184,20 +4184,20 @@ discard block |
||
4184 | 4184 | print '</li>'; |
4185 | 4185 | } |
4186 | 4186 | if ($page > 0) { |
4187 | - print '<li class="pagination"><a class="paginationprevious" href="' . $file . '?page=' . ($page - 1) . $options . '"><i class="fa fa-chevron-left" title="' . dol_escape_htmltag($langs->trans("Previous")) . '"></i></a></li>'; |
|
4187 | + print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page - 1).$options.'"><i class="fa fa-chevron-left" title="'.dol_escape_htmltag($langs->trans("Previous")).'"></i></a></li>'; |
|
4188 | 4188 | } |
4189 | 4189 | if ($betweenarrows) { |
4190 | 4190 | print $betweenarrows; |
4191 | 4191 | } |
4192 | 4192 | if ($nextpage > 0) { |
4193 | - print '<li class="pagination"><a class="paginationnext" href="' . $file . '?page=' . ($page + 1) . $options . '"><i class="fa fa-chevron-right" title="' . dol_escape_htmltag($langs->trans("Next")) . '"></i></a></li>'; |
|
4193 | + print '<li class="pagination"><a class="paginationnext" href="'.$file.'?page='.($page + 1).$options.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>'; |
|
4194 | 4194 | } |
4195 | 4195 | if ($afterarrows) { |
4196 | 4196 | print '<li class="paginationafterarrows">'; |
4197 | 4197 | print $afterarrows; |
4198 | 4198 | print '</li>'; |
4199 | 4199 | } |
4200 | - print '</ul></div>' . "\n"; |
|
4200 | + print '</ul></div>'."\n"; |
|
4201 | 4201 | } |
4202 | 4202 | |
4203 | 4203 | /** |
@@ -4219,8 +4219,8 @@ discard block |
||
4219 | 4219 | $addpercent = true; |
4220 | 4220 | } |
4221 | 4221 | if (preg_match('/\((.*)\)/', $rate, $reg)) { |
4222 | - $morelabel = ' (' . $reg[1] . ')'; |
|
4223 | - $rate = preg_replace('/\s*' . preg_quote($morelabel, '/') . '/', '', $rate); |
|
4222 | + $morelabel = ' ('.$reg[1].')'; |
|
4223 | + $rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate); |
|
4224 | 4224 | } |
4225 | 4225 | if (preg_match('/\*/', $rate)) { |
4226 | 4226 | $rate = str_replace('*', '', $rate); |
@@ -4229,10 +4229,10 @@ discard block |
||
4229 | 4229 | |
4230 | 4230 | // If rate is '9/9/9' we don't change it. If rate is '9.000' we apply price() |
4231 | 4231 | if (!preg_match('/\//', $rate)) |
4232 | - $ret = price($rate, 0, '', 0, 0) . ($addpercent ? '%' : ''); |
|
4232 | + $ret = price($rate, 0, '', 0, 0).($addpercent ? '%' : ''); |
|
4233 | 4233 | else { |
4234 | 4234 | // TODO Split on / and output with a price2num to have clean numbers without ton of 000. |
4235 | - $ret = $rate . ($addpercent ? '%' : ''); |
|
4235 | + $ret = $rate.($addpercent ? '%' : ''); |
|
4236 | 4236 | } |
4237 | 4237 | if (($info_bits & 1) && $usestarfornpr >= 0) |
4238 | 4238 | $ret .= ' *'; |
@@ -4326,10 +4326,10 @@ discard block |
||
4326 | 4326 | $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code); |
4327 | 4327 | else { |
4328 | 4328 | $tmpcur = $outlangs->getCurrencySymbol($currency_code); |
4329 | - $cursymbolafter .= ($tmpcur == $currency_code ? ' ' . $tmpcur : $tmpcur); |
|
4329 | + $cursymbolafter .= ($tmpcur == $currency_code ? ' '.$tmpcur : $tmpcur); |
|
4330 | 4330 | } |
4331 | 4331 | } |
4332 | - $output = $cursymbolbefore . $output . $end . ($cursymbolafter ? ' ' : '') . $cursymbolafter; |
|
4332 | + $output = $cursymbolbefore.$output.$end.($cursymbolafter ? ' ' : '').$cursymbolafter; |
|
4333 | 4333 | |
4334 | 4334 | return $output; |
4335 | 4335 | } |
@@ -4383,7 +4383,7 @@ discard block |
||
4383 | 4383 | // Now make replace (the main goal of function) |
4384 | 4384 | if ($thousand != ',' && $thousand != '.') |
4385 | 4385 | $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users |
4386 | - $amount = str_replace(' ', '', $amount); // To avoid spaces |
|
4386 | + $amount = str_replace(' ', '', $amount); // To avoid spaces |
|
4387 | 4387 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
4388 | 4388 | $amount = str_replace($dec, '.', $amount); |
4389 | 4389 | } |
@@ -4412,14 +4412,14 @@ discard block |
||
4412 | 4412 | $temps = sprintf("%0.10F", $amount - intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000 |
4413 | 4413 | $temps = preg_replace('/([\.1-9])0+$/', '\\1', $temps); // temps=0. or 0.00002 or 9999.1 |
4414 | 4414 | $nbofdec = max(0, dol_strlen($temps) - 2); // -2 to remove "0." |
4415 | - $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand); // Convert amount to format with dolibarr dec and thousand |
|
4415 | + $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand); // Convert amount to format with dolibarr dec and thousand |
|
4416 | 4416 | } |
4417 | 4417 | //print "TT".$amount.'<br>'; |
4418 | 4418 | // Always make replace because each math function (like round) replace |
4419 | 4419 | // with local values and we want a number that has a SQL string format x.y |
4420 | 4420 | if ($thousand != ',' && $thousand != '.') |
4421 | 4421 | $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users |
4422 | - $amount = str_replace(' ', '', $amount); // To avoid spaces |
|
4422 | + $amount = str_replace(' ', '', $amount); // To avoid spaces |
|
4423 | 4423 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
4424 | 4424 | $amount = str_replace($dec, '.', $amount); |
4425 | 4425 | } |
@@ -4440,7 +4440,7 @@ discard block |
||
4440 | 4440 | */ |
4441 | 4441 | function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round = -1, $forceunitoutput = 'no') |
4442 | 4442 | { |
4443 | - require_once DOL_BASE_PATH . '/core/lib/product.lib.php'; |
|
4443 | + require_once DOL_BASE_PATH.'/core/lib/product.lib.php'; |
|
4444 | 4444 | |
4445 | 4445 | if (($forceunitoutput == 'no' && $dimension < 1 / 10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6)) { |
4446 | 4446 | $dimension = $dimension * 1000000; |
@@ -4456,7 +4456,7 @@ discard block |
||
4456 | 4456 | $unit = $unit + 3; |
4457 | 4457 | } |
4458 | 4458 | |
4459 | - $ret = price($dimension, 0, $outputlangs, 0, 0, $round) . ' ' . measuring_units_string($unit, $type); |
|
4459 | + $ret = price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type); |
|
4460 | 4460 | |
4461 | 4461 | return $ret; |
4462 | 4462 | } |
@@ -4480,7 +4480,7 @@ discard block |
||
4480 | 4480 | if (empty($thirdparty_seller) || !is_object($thirdparty_seller)) |
4481 | 4481 | $thirdparty_seller = $mysoc; |
4482 | 4482 | |
4483 | - dol_syslog("get_localtax tva=" . $vatrate . " local=" . $local . " thirdparty_buyer id=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '') . "/country_code=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '') . " thirdparty_seller id=" . $thirdparty_seller->id . "/country_code=" . $thirdparty_seller->country_code . " thirdparty_seller localtax1_assuj=" . $thirdparty_seller->localtax1_assuj . " thirdparty_seller localtax2_assuj=" . $thirdparty_seller->localtax2_assuj); |
|
4483 | + dol_syslog("get_localtax tva=".$vatrate." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '')."/country_code=".(is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj); |
|
4484 | 4484 | |
4485 | 4485 | $vatratecleaned = $vatrate; |
4486 | 4486 | if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "xx (yy)" |
@@ -4511,7 +4511,7 @@ discard block |
||
4511 | 4511 | if ($local == 2) { |
4512 | 4512 | //if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0; |
4513 | 4513 | if (!$mysoc->localtax2_assuj) |
4514 | - return 0; // If main vat is 0, IRPF may be different than 0. |
|
4514 | + return 0; // If main vat is 0, IRPF may be different than 0. |
|
4515 | 4515 | if ($thirdparty_seller->id == $mysoc->id) { |
4516 | 4516 | if (!$thirdparty_buyer->localtax2_assuj) |
4517 | 4517 | return 0; |
@@ -4565,13 +4565,13 @@ discard block |
||
4565 | 4565 | |
4566 | 4566 | // By default, search value of local tax on line of common tax |
4567 | 4567 | $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; |
4568 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
4569 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $thirdparty_seller->country_code . "'"; |
|
4570 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
4568 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
4569 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'"; |
|
4570 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
4571 | 4571 | if ($vatratecode) |
4572 | - $sql .= " AND t.code ='" . $vatratecode . "'"; // If we have the code, we use it in priority |
|
4572 | + $sql .= " AND t.code ='".$vatratecode."'"; // If we have the code, we use it in priority |
|
4573 | 4573 | else |
4574 | - $sql .= " AND t.recuperableonly ='" . $vatnpr . "'"; |
|
4574 | + $sql .= " AND t.recuperableonly ='".$vatnpr."'"; |
|
4575 | 4575 | dol_syslog("get_localtax", LOG_DEBUG); |
4576 | 4576 | $resql = $db->query($sql); |
4577 | 4577 | |
@@ -4617,10 +4617,10 @@ discard block |
||
4617 | 4617 | { |
4618 | 4618 | global $db, $mysoc; |
4619 | 4619 | $sql = "SELECT t.localtax1, t.localtax2 "; |
4620 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t inner join " . MAIN_DB_PREFIX . "c_country as c ON c.rowid=t.fk_pays"; |
|
4621 | - $sql .= " WHERE c.code = '" . $mysoc->country_code . "' AND t.active = 1 AND t.taux=("; |
|
4622 | - $sql .= " SELECT max(tt.taux) FROM " . MAIN_DB_PREFIX . "c_tva as tt inner join " . MAIN_DB_PREFIX . "c_country as c ON c.rowid=tt.fk_pays"; |
|
4623 | - $sql .= " WHERE c.code = '" . $mysoc->country_code . "' AND tt.active = 1"; |
|
4620 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays"; |
|
4621 | + $sql .= " WHERE c.code = '".$mysoc->country_code."' AND t.active = 1 AND t.taux=("; |
|
4622 | + $sql .= " SELECT max(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=tt.fk_pays"; |
|
4623 | + $sql .= " WHERE c.code = '".$mysoc->country_code."' AND tt.active = 1"; |
|
4624 | 4624 | $sql .= " )"; |
4625 | 4625 | |
4626 | 4626 | $resql = $db->query($sql); |
@@ -4650,13 +4650,13 @@ discard block |
||
4650 | 4650 | { |
4651 | 4651 | global $db, $mysoc; |
4652 | 4652 | |
4653 | - dol_syslog("getTaxesFromId vat id or rate = " . $vatrate); |
|
4653 | + dol_syslog("getTaxesFromId vat id or rate = ".$vatrate); |
|
4654 | 4654 | |
4655 | 4655 | // Search local taxes |
4656 | 4656 | $sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr, t.accountancy_code_sell, t.accountancy_code_buy"; |
4657 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
|
4657 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; |
|
4658 | 4658 | if ($firstparamisid) |
4659 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
4659 | + $sql .= " WHERE t.rowid = ".(int) $vatrate; |
|
4660 | 4660 | else { |
4661 | 4661 | $vatratecleaned = $vatrate; |
4662 | 4662 | $vatratecode = ''; |
@@ -4665,13 +4665,13 @@ discard block |
||
4665 | 4665 | $vatratecode = $reg[2]; |
4666 | 4666 | } |
4667 | 4667 | |
4668 | - $sql .= ", " . MAIN_DB_PREFIX . "c_country as c"; |
|
4668 | + $sql .= ", ".MAIN_DB_PREFIX."c_country as c"; |
|
4669 | 4669 | /* if ($mysoc->country_code == 'ES') $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // vat in spain use the buyer country ?? |
4670 | 4670 | else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; */ |
4671 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
4672 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
4671 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; |
|
4672 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
4673 | 4673 | if ($vatratecode) |
4674 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
4674 | + $sql .= " AND t.code = '".$vatratecode."'"; |
|
4675 | 4675 | } |
4676 | 4676 | |
4677 | 4677 | $resql = $db->query($sql); |
@@ -4707,13 +4707,13 @@ discard block |
||
4707 | 4707 | { |
4708 | 4708 | global $db, $mysoc; |
4709 | 4709 | |
4710 | - dol_syslog("getLocalTaxesFromRate vatrate=" . $vatrate . " local=" . $local); |
|
4710 | + dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local); |
|
4711 | 4711 | |
4712 | 4712 | // Search local taxes |
4713 | 4713 | $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; |
4714 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
|
4714 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; |
|
4715 | 4715 | if ($firstparamisid) |
4716 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
4716 | + $sql .= " WHERE t.rowid = ".(int) $vatrate; |
|
4717 | 4717 | else { |
4718 | 4718 | $vatratecleaned = $vatrate; |
4719 | 4719 | $vatratecode = ''; |
@@ -4722,14 +4722,14 @@ discard block |
||
4722 | 4722 | $vatratecode = $reg[2]; |
4723 | 4723 | } |
4724 | 4724 | |
4725 | - $sql .= ", " . MAIN_DB_PREFIX . "c_country as c"; |
|
4725 | + $sql .= ", ".MAIN_DB_PREFIX."c_country as c"; |
|
4726 | 4726 | if ($mysoc->country_code == 'ES') |
4727 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $buyer->country_code . "'"; // local tax in spain use the buyer country ?? |
|
4727 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ?? |
|
4728 | 4728 | else |
4729 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
4730 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
4729 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; |
|
4730 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
4731 | 4731 | if ($vatratecode) |
4732 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
4732 | + $sql .= " AND t.code = '".$vatratecode."'"; |
|
4733 | 4733 | } |
4734 | 4734 | |
4735 | 4735 | $resql = $db->query($sql); |
@@ -4761,7 +4761,7 @@ discard block |
||
4761 | 4761 | { |
4762 | 4762 | global $db, $conf, $mysoc; |
4763 | 4763 | |
4764 | - require_once DOL_BASE_PATH . '/product/class/product.class.php'; |
|
4764 | + require_once DOL_BASE_PATH.'/product/class/product.class.php'; |
|
4765 | 4765 | |
4766 | 4766 | $ret = 0; |
4767 | 4767 | $found = 0; |
@@ -4776,12 +4776,12 @@ discard block |
||
4776 | 4776 | $product->get_buyprice($idprodfournprice, 0, 0, 0); |
4777 | 4777 | $ret = $product->vatrate_supplier; |
4778 | 4778 | if ($product->default_vat_code) |
4779 | - $ret .= ' (' . $product->default_vat_code . ')'; |
|
4779 | + $ret .= ' ('.$product->default_vat_code.')'; |
|
4780 | 4780 | } |
4781 | 4781 | else { |
4782 | - $ret = $product->tva_tx; // Default vat of product we defined |
|
4782 | + $ret = $product->tva_tx; // Default vat of product we defined |
|
4783 | 4783 | if ($product->default_vat_code) |
4784 | - $ret .= ' (' . $product->default_vat_code . ')'; |
|
4784 | + $ret .= ' ('.$product->default_vat_code.')'; |
|
4785 | 4785 | } |
4786 | 4786 | $found = 1; |
4787 | 4787 | } |
@@ -4795,8 +4795,8 @@ discard block |
||
4795 | 4795 | if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) { |
4796 | 4796 | // If vat of product for the country not found or not defined, we return the first higher vat of country. |
4797 | 4797 | $sql = "SELECT t.taux as vat_rate, t.code as default_vat_code"; |
4798 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
4799 | - $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='" . $thirdparty_seller->country_code . "'"; |
|
4798 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
4799 | + $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; |
|
4800 | 4800 | $sql .= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC"; |
4801 | 4801 | $sql .= $db->plimit(1); |
4802 | 4802 | |
@@ -4806,16 +4806,16 @@ discard block |
||
4806 | 4806 | if ($obj) { |
4807 | 4807 | $ret = $obj->vat_rate; |
4808 | 4808 | if ($obj->default_vat_code) |
4809 | - $ret .= ' (' . $obj->default_vat_code . ')'; |
|
4809 | + $ret .= ' ('.$obj->default_vat_code.')'; |
|
4810 | 4810 | } |
4811 | 4811 | $db->free($sql); |
4812 | 4812 | } else |
4813 | 4813 | dol_print_error($db); |
4814 | 4814 | } else |
4815 | - $ret = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails |
|
4815 | + $ret = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails |
|
4816 | 4816 | } |
4817 | 4817 | |
4818 | - dol_syslog("get_product_vat_for_country: ret=" . $ret); |
|
4818 | + dol_syslog("get_product_vat_for_country: ret=".$ret); |
|
4819 | 4819 | return $ret; |
4820 | 4820 | } |
4821 | 4821 | |
@@ -4833,7 +4833,7 @@ discard block |
||
4833 | 4833 | global $db, $mysoc; |
4834 | 4834 | |
4835 | 4835 | if (!class_exists('Product')) { |
4836 | - require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
4836 | + require_once DOL_BASE_PATH.'product/class/product.class.php'; |
|
4837 | 4837 | } |
4838 | 4838 | |
4839 | 4839 | $ret = 0; |
@@ -4858,8 +4858,8 @@ discard block |
||
4858 | 4858 | if (!$found) { |
4859 | 4859 | // If vat of product for the country not found or not defined, we return higher vat of country. |
4860 | 4860 | $sql = "SELECT taux as vat_rate, localtax1, localtax2"; |
4861 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
4862 | - $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='" . $thirdparty_seller->country_code . "'"; |
|
4861 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
4862 | + $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; |
|
4863 | 4863 | $sql .= " ORDER BY t.taux DESC, t.recuperableonly ASC"; |
4864 | 4864 | $sql .= $db->plimit(1); |
4865 | 4865 | |
@@ -4876,7 +4876,7 @@ discard block |
||
4876 | 4876 | dol_print_error($db); |
4877 | 4877 | } |
4878 | 4878 | |
4879 | - dol_syslog("get_product_localtax_for_country: ret=" . $ret); |
|
4879 | + dol_syslog("get_product_localtax_for_country: ret=".$ret); |
|
4880 | 4880 | return $ret; |
4881 | 4881 | } |
4882 | 4882 | |
@@ -4900,7 +4900,7 @@ discard block |
||
4900 | 4900 | { |
4901 | 4901 | global $conf; |
4902 | 4902 | |
4903 | - require_once DOL_BASE_PATH . '/core/lib/company.lib.php'; |
|
4903 | + require_once DOL_BASE_PATH.'/core/lib/company.lib.php'; |
|
4904 | 4904 | |
4905 | 4905 | // Note: possible values for tva_assuj are 0/1 or franchise/reel |
4906 | 4906 | $seller_use_vat = ((is_numeric($thirdparty_seller->tva_assuj) && !$thirdparty_seller->tva_assuj) || (!is_numeric($thirdparty_seller->tva_assuj) && $thirdparty_seller->tva_assuj == 'franchise')) ? 0 : 1; |
@@ -4911,7 +4911,7 @@ discard block |
||
4911 | 4911 | $buyer_country_code = $thirdparty_buyer->country_code; |
4912 | 4912 | $buyer_in_cee = isInEEC($thirdparty_buyer); |
4913 | 4913 | |
4914 | - dol_syslog("get_default_tva: seller use vat=" . $seller_use_vat . ", seller country=" . $seller_country_code . ", seller in cee=" . $seller_in_cee . ", buyer vat number=" . $thirdparty_buyer->tva_intra . " buyer country=" . $buyer_country_code . ", buyer in cee=" . $buyer_in_cee . ", idprod=" . $idprod . ", idprodfournprice=" . $idprodfournprice . ", SERVICE_ARE_ECOMMERCE_200238EC=" . (!empty($conf->global->SERVICES_ARE_ECOMMERCE_200238EC) ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); |
|
4914 | + dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".$seller_in_cee.", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".$buyer_in_cee.", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(!empty($conf->global->SERVICES_ARE_ECOMMERCE_200238EC) ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); |
|
4915 | 4915 | |
4916 | 4916 | // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) |
4917 | 4917 | // we use the buyer VAT. |
@@ -4977,14 +4977,14 @@ discard block |
||
4977 | 4977 | |
4978 | 4978 | if ($idprodfournprice > 0) { |
4979 | 4979 | if (!class_exists('ProductFournisseur')) |
4980 | - require_once DOL_BASE_PATH . '/fourn/class/fournisseur.product.class.php'; |
|
4980 | + require_once DOL_BASE_PATH.'/fourn/class/fournisseur.product.class.php'; |
|
4981 | 4981 | $prodprice = new ProductFournisseur($db); |
4982 | 4982 | $prodprice->fetch_product_fournisseur_price($idprodfournprice); |
4983 | 4983 | return $prodprice->fourn_tva_npr; |
4984 | 4984 | } |
4985 | 4985 | elseif ($idprod > 0) { |
4986 | 4986 | if (!class_exists('Product')) |
4987 | - require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
4987 | + require_once DOL_BASE_PATH.'product/class/product.class.php'; |
|
4988 | 4988 | $prod = new Product($db); |
4989 | 4989 | $prod->fetch($idprod); |
4990 | 4990 | return $prod->tva_npr; |
@@ -5063,7 +5063,7 @@ discard block |
||
5063 | 5063 | if ($case == 2) |
5064 | 5064 | $result = '<input type="checkbox" value="1" checked disabled>'; |
5065 | 5065 | if ($case == 3) |
5066 | - $result = '<input type="checkbox" value="1" checked disabled> ' . $result; |
|
5066 | + $result = '<input type="checkbox" value="1" checked disabled> '.$result; |
|
5067 | 5067 | |
5068 | 5068 | $classname = 'ok'; |
5069 | 5069 | } |
@@ -5074,7 +5074,7 @@ discard block |
||
5074 | 5074 | if ($case == 2) |
5075 | 5075 | $result = '<input type="checkbox" value="0" disabled>'; |
5076 | 5076 | if ($case == 3) |
5077 | - $result = '<input type="checkbox" value="0" disabled> ' . $result; |
|
5077 | + $result = '<input type="checkbox" value="0" disabled> '.$result; |
|
5078 | 5078 | |
5079 | 5079 | if ($color == 2) |
5080 | 5080 | $classname = 'ok'; |
@@ -5082,7 +5082,7 @@ discard block |
||
5082 | 5082 | $classname = 'error'; |
5083 | 5083 | } |
5084 | 5084 | if ($color) |
5085 | - return '<font class="' . $classname . '">' . $result . '</font>'; |
|
5085 | + return '<font class="'.$classname.'">'.$result.'</font>'; |
|
5086 | 5086 | return $result; |
5087 | 5087 | } |
5088 | 5088 | |
@@ -5116,13 +5116,13 @@ discard block |
||
5116 | 5116 | $num = preg_replace('/([^0-9])/i', '', $num); |
5117 | 5117 | else |
5118 | 5118 | $num = preg_replace('/^.*\-/i', '', $num); |
5119 | - $num = substr("000" . $num, -$level); |
|
5119 | + $num = substr("000".$num, -$level); |
|
5120 | 5120 | if ($level == 1) |
5121 | 5121 | $path = substr($num, 0, 1); |
5122 | 5122 | if ($level == 2) |
5123 | - $path = substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
5123 | + $path = substr($num, 1, 1).'/'.substr($num, 0, 1); |
|
5124 | 5124 | if ($level == 3) |
5125 | - $path = substr($num, 2, 1) . '/' . substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
5125 | + $path = substr($num, 2, 1).'/'.substr($num, 1, 1).'/'.substr($num, 0, 1); |
|
5126 | 5126 | } |
5127 | 5127 | else { |
5128 | 5128 | // TODO |
@@ -5153,7 +5153,7 @@ discard block |
||
5153 | 5153 | { |
5154 | 5154 | global $conf; |
5155 | 5155 | |
5156 | - dol_syslog("functions.lib::dol_mkdir: dir=" . $dir, LOG_INFO); |
|
5156 | + dol_syslog("functions.lib::dol_mkdir: dir=".$dir, LOG_INFO); |
|
5157 | 5157 | |
5158 | 5158 | $dir_osencoded = dol_osencode($dir); |
5159 | 5159 | if (@is_dir($dir_osencoded)) |
@@ -5165,15 +5165,15 @@ discard block |
||
5165 | 5165 | $ccdir = ''; |
5166 | 5166 | if (!empty($dataroot)) { |
5167 | 5167 | // Remove data root from loop |
5168 | - $dir = str_replace($dataroot . '/', '', $dir); |
|
5169 | - $ccdir = $dataroot . '/'; |
|
5168 | + $dir = str_replace($dataroot.'/', '', $dir); |
|
5169 | + $ccdir = $dataroot.'/'; |
|
5170 | 5170 | } |
5171 | 5171 | |
5172 | 5172 | $cdir = explode("/", $dir); |
5173 | 5173 | $num = count($cdir); |
5174 | 5174 | for ($i = 0; $i < $num; $i++) { |
5175 | 5175 | if ($i > 0) |
5176 | - $ccdir .= '/' . $cdir[$i]; |
|
5176 | + $ccdir .= '/'.$cdir[$i]; |
|
5177 | 5177 | else |
5178 | 5178 | $ccdir .= $cdir[$i]; |
5179 | 5179 | if (preg_match("/^.:$/", $ccdir, $regs)) |
@@ -5204,20 +5204,20 @@ discard block |
||
5204 | 5204 | if ($ccdir) { |
5205 | 5205 | $ccdir_osencoded = dol_osencode($ccdir); |
5206 | 5206 | if (!@is_dir($ccdir_osencoded)) { |
5207 | - dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG); |
|
5207 | + dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG); |
|
5208 | 5208 | |
5209 | 5209 | umask(0); |
5210 | 5210 | $dirmaskdec = octdec($newmask); |
5211 | 5211 | if (empty($newmask)) { |
5212 | 5212 | $dirmaskdec = empty($conf->global->MAIN_UMASK) ? octdec('0755') : octdec($conf->global->MAIN_UMASK); |
5213 | 5213 | } |
5214 | - $dirmaskdec |= octdec('0111'); // Set x bit required for directories |
|
5214 | + $dirmaskdec |= octdec('0111'); // Set x bit required for directories |
|
5215 | 5215 | if (!@mkdir($ccdir_osencoded, $dirmaskdec)) { |
5216 | 5216 | // Si le is_dir a renvoye une fausse info, alors on passe ici. |
5217 | - dol_syslog("functions.lib::dol_mkdir: Fails to create directory '" . $ccdir . "' or directory already exists.", LOG_WARNING); |
|
5217 | + dol_syslog("functions.lib::dol_mkdir: Fails to create directory '".$ccdir."' or directory already exists.", LOG_WARNING); |
|
5218 | 5218 | $nberr++; |
5219 | 5219 | } else { |
5220 | - dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' created", LOG_DEBUG); |
|
5220 | + dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' created", LOG_DEBUG); |
|
5221 | 5221 | $nberr = 0; // On remet a zero car si on arrive ici, cela veut dire que les echecs precedents peuvent etre ignore |
5222 | 5222 | $nbcreated++; |
5223 | 5223 | } |
@@ -5265,9 +5265,9 @@ discard block |
||
5265 | 5265 | } else { |
5266 | 5266 | $pattern = "/<[^<>]+>/"; |
5267 | 5267 | // Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a> |
5268 | - $temp = preg_replace($pattern, "", $temp); // pass 1 |
|
5268 | + $temp = preg_replace($pattern, "", $temp); // pass 1 |
|
5269 | 5269 | // $temp after pass 1: <a href="/myurl" title="A title">0000-021 |
5270 | - $temp = preg_replace($pattern, "", $temp); // pass 2 |
|
5270 | + $temp = preg_replace($pattern, "", $temp); // pass 2 |
|
5271 | 5271 | // $temp after pass 2: 0000-021 |
5272 | 5272 | } |
5273 | 5273 | |
@@ -5323,8 +5323,8 @@ discard block |
||
5323 | 5323 | { |
5324 | 5324 | $temp = $stringtoclean; |
5325 | 5325 | foreach ($disallowed_tags as $tagtoremove) { |
5326 | - $temp = preg_replace('/<\/?' . $tagtoremove . '>/', '', $temp); |
|
5327 | - $temp = preg_replace('/<\/?' . $tagtoremove . '\s+[^>]*>/', '', $temp); |
|
5326 | + $temp = preg_replace('/<\/?'.$tagtoremove.'>/', '', $temp); |
|
5327 | + $temp = preg_replace('/<\/?'.$tagtoremove.'\s+[^>]*>/', '', $temp); |
|
5328 | 5328 | } |
5329 | 5329 | return $temp; |
5330 | 5330 | } |
@@ -5341,12 +5341,12 @@ discard block |
||
5341 | 5341 | { |
5342 | 5342 | if ($nboflines == 1) { |
5343 | 5343 | if (dol_textishtml($text)) { |
5344 | - $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters |
|
5344 | + $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters |
|
5345 | 5345 | $firstline = preg_replace('/<div[^>]*>.*$/s', '', $firstline); // The s pattern modifier means the . can match newline characters |
5346 | 5346 | } else { |
5347 | 5347 | $firstline = preg_replace('/[\n\r].*/', '', $text); |
5348 | 5348 | } |
5349 | - return $firstline . ((strlen($firstline) != strlen($text)) ? '...' : ''); |
|
5349 | + return $firstline.((strlen($firstline) != strlen($text)) ? '...' : ''); |
|
5350 | 5350 | } else { |
5351 | 5351 | $ishtml = 0; |
5352 | 5352 | if (dol_textishtml($text)) { |
@@ -5362,7 +5362,7 @@ discard block |
||
5362 | 5362 | $pattern = '/(<br[^>]*>)/Uu'; |
5363 | 5363 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
5364 | 5364 | else |
5365 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5365 | + $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5366 | 5366 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
5367 | 5367 | |
5368 | 5368 | $firstline = ''; |
@@ -5376,7 +5376,7 @@ discard block |
||
5376 | 5376 | $i++; |
5377 | 5377 | } |
5378 | 5378 | unset($a); |
5379 | - return $firstline . (($i < $nba) ? '...' : ''); |
|
5379 | + return $firstline.(($i < $nba) ? '...' : ''); |
|
5380 | 5380 | } |
5381 | 5381 | } |
5382 | 5382 | |
@@ -5447,9 +5447,9 @@ discard block |
||
5447 | 5447 | function dol_htmlentitiesbr_decode($stringtodecode, $pagecodeto = 'UTF-8') |
5448 | 5448 | { |
5449 | 5449 | $ret = dol_html_entity_decode($stringtodecode, ENT_COMPAT, $pagecodeto); |
5450 | - $ret = preg_replace('/' . "\r\n" . '<br(\s[\sa-zA-Z_="]*)?\/?>/i', "<br>", $ret); |
|
5451 | - $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>' . "\r\n" . '/i', "\r\n", $ret); |
|
5452 | - $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>' . "\n" . '/i', "\n", $ret); |
|
5450 | + $ret = preg_replace('/'."\r\n".'<br(\s[\sa-zA-Z_="]*)?\/?>/i', "<br>", $ret); |
|
5451 | + $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>'."\r\n".'/i', "\r\n", $ret); |
|
5452 | + $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>'."\n".'/i', "\n", $ret); |
|
5453 | 5453 | $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', "\n", $ret); |
5454 | 5454 | return $ret; |
5455 | 5455 | } |
@@ -5462,7 +5462,7 @@ discard block |
||
5462 | 5462 | */ |
5463 | 5463 | function dol_htmlcleanlastbr($stringtodecode) |
5464 | 5464 | { |
5465 | - $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|' . "\n" . '|' . "\r" . ')+$/i', "", $stringtodecode); |
|
5465 | + $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|'."\n".'|'."\r".')+$/i', "", $stringtodecode); |
|
5466 | 5466 | return $ret; |
5467 | 5467 | } |
5468 | 5468 | |
@@ -5559,7 +5559,7 @@ discard block |
||
5559 | 5559 | $pattern = '/(<br[^>]*>)/Uu'; |
5560 | 5560 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
5561 | 5561 | else |
5562 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5562 | + $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5563 | 5563 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
5564 | 5564 | |
5565 | 5565 | $nblines = (int) floor((count($a) + 1) / 2); |
@@ -5590,7 +5590,7 @@ discard block |
||
5590 | 5590 | */ |
5591 | 5591 | function dol_microtime_float() |
5592 | 5592 | { |
5593 | - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
5593 | + dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
5594 | 5594 | |
5595 | 5595 | return microtime(true); |
5596 | 5596 | } |
@@ -5636,9 +5636,9 @@ discard block |
||
5636 | 5636 | elseif (preg_match('/<h[0-9]>/i', $msg)) |
5637 | 5637 | return true; |
5638 | 5638 | elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg)) |
5639 | - return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
5639 | + return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
5640 | 5640 | elseif (preg_match('/&#[0-9]{2,3};/i', $msg)) |
5641 | - return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
5641 | + return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
5642 | 5642 | |
5643 | 5643 | return false; |
5644 | 5644 | } |
@@ -5863,7 +5863,7 @@ discard block |
||
5863 | 5863 | if ($object->fetch_optionals() > 0) { |
5864 | 5864 | if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { |
5865 | 5865 | foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { |
5866 | - $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key]; |
|
5866 | + $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; |
|
5867 | 5867 | } |
5868 | 5868 | } |
5869 | 5869 | } |
@@ -5875,7 +5875,7 @@ discard block |
||
5875 | 5875 | $paymenturl = ''; |
5876 | 5876 | } else { |
5877 | 5877 | // Set the online payment url link into __ONLINE_PAYMENT_URL__ key |
5878 | - require_once DOL_BASE_PATH . '/core/lib/payments.lib.php'; |
|
5878 | + require_once DOL_BASE_PATH.'/core/lib/payments.lib.php'; |
|
5879 | 5879 | $outputlangs->loadLangs(array('paypal', 'other')); |
5880 | 5880 | $typeforonlinepayment = 'free'; |
5881 | 5881 | if (is_object($object) && $object->element == 'commande') |
@@ -5936,7 +5936,7 @@ discard block |
||
5936 | 5936 | |
5937 | 5937 | //var_dump($substitutionarray['__AMOUNT_FORMATED__']); |
5938 | 5938 | if (empty($exclude) || !in_array('date', $exclude)) { |
5939 | - include_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
|
5939 | + include_once DOL_BASE_PATH.'/core/lib/date.lib.php'; |
|
5940 | 5940 | |
5941 | 5941 | $tmp = dol_getdate(dol_now(), true); |
5942 | 5942 | $tmp2 = dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); |
@@ -5946,13 +5946,13 @@ discard block |
||
5946 | 5946 | |
5947 | 5947 | $substitutionarray = array_merge($substitutionarray, array( |
5948 | 5948 | '__DAY__' => (string) $tmp['mday'], |
5949 | - '__DAY_TEXT__' => $outputlangs->trans('Day' . $tmp['wday']), // Monday |
|
5950 | - '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'] . 'Min'), // Mon |
|
5951 | - '__DAY_TEXT_MIN__' => $outputlangs->trans('Short' . $tmp['weekday']), // M |
|
5949 | + '__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), // Monday |
|
5950 | + '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'].'Min'), // Mon |
|
5951 | + '__DAY_TEXT_MIN__' => $outputlangs->trans('Short'.$tmp['weekday']), // M |
|
5952 | 5952 | '__MONTH__' => (string) $tmp['mon'], |
5953 | - '__MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp['mon'])), |
|
5954 | - '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp['mon'])), |
|
5955 | - '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp['mon'])), |
|
5953 | + '__MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp['mon'])), |
|
5954 | + '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])), |
|
5955 | + '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort'.sprintf("%02d", $tmp['mon'])), |
|
5956 | 5956 | '__YEAR__' => (string) $tmp['year'], |
5957 | 5957 | '__PREVIOUS_DAY__' => (string) $tmp2['day'], |
5958 | 5958 | '__PREVIOUS_MONTH__' => (string) $tmp3['month'], |
@@ -6011,7 +6011,7 @@ discard block |
||
6011 | 6011 | if (!empty($tmp[1])) |
6012 | 6012 | $outputlangs->load($tmp[1]); |
6013 | 6013 | |
6014 | - $text = preg_replace('/__\(' . preg_quote($reg[1], '/') . '\)__/', $msgishtml ? dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text); |
|
6014 | + $text = preg_replace('/__\('.preg_quote($reg[1], '/').'\)__/', $msgishtml ? dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text); |
|
6015 | 6015 | } |
6016 | 6016 | } |
6017 | 6017 | |
@@ -6027,13 +6027,13 @@ discard block |
||
6027 | 6027 | $newval = '*****forbidden*****'; |
6028 | 6028 | else |
6029 | 6029 | $newval = empty($conf->global->$keyfound) ? '' : $conf->global->$keyfound; |
6030 | - $text = preg_replace('/__\[' . preg_quote($keyfound, '/') . '\]__/', $msgishtml ? dol_htmlentitiesbr($newval) : $newval, $text); |
|
6030 | + $text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml ? dol_htmlentitiesbr($newval) : $newval, $text); |
|
6031 | 6031 | } |
6032 | 6032 | |
6033 | 6033 | // Make substitition for array $substitutionarray |
6034 | 6034 | foreach ($substitutionarray as $key => $value) { |
6035 | 6035 | if ($key == '__SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
6036 | - $value = ''; // Protection |
|
6036 | + $value = ''; // Protection |
|
6037 | 6037 | if ($key == '__USER_SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
6038 | 6038 | $value = ''; // Protection |
6039 | 6039 | |
@@ -6059,7 +6059,7 @@ discard block |
||
6059 | 6059 | { |
6060 | 6060 | global $conf, $user; |
6061 | 6061 | |
6062 | - require_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
6062 | + require_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
6063 | 6063 | |
6064 | 6064 | // Add a substitution key for each extrafields, using key __EXTRA_XXX__ |
6065 | 6065 | // TODO Remove this. Already available into the getCommonSubstitutionArray used to build the substitution array. |
@@ -6089,11 +6089,11 @@ discard block |
||
6089 | 6089 | if (preg_match('/functions_(.*)\.lib\.php/i', $substitfile['name'], $reg)) { |
6090 | 6090 | $module = $reg[1]; |
6091 | 6091 | |
6092 | - dol_syslog("Library " . $substitfile['name'] . " found into " . $dir); |
|
6092 | + dol_syslog("Library ".$substitfile['name']." found into ".$dir); |
|
6093 | 6093 | // Include the user's functions file |
6094 | - require_once $dir . $substitfile['name']; |
|
6094 | + require_once $dir.$substitfile['name']; |
|
6095 | 6095 | // Call the user's function, and only if it is defined |
6096 | - $function_name = $module . "_" . $callfunc; |
|
6096 | + $function_name = $module."_".$callfunc; |
|
6097 | 6097 | if (function_exists($function_name)) |
6098 | 6098 | $function_name($substitutionarray, $outputlangs, $object, $parameters); |
6099 | 6099 | } |
@@ -6135,13 +6135,13 @@ discard block |
||
6135 | 6135 | $outputlangs = $langs; |
6136 | 6136 | |
6137 | 6137 | if ($date_start && $date_end) { |
6138 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($date_start, $format, false, $outputlangs), dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : ''); |
|
6138 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($date_start, $format, false, $outputlangs), dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis ? ')' : ''); |
|
6139 | 6139 | } |
6140 | 6140 | if ($date_start && !$date_end) { |
6141 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($date_start, $format, false, $outputlangs)) . ($withparenthesis ? ')' : ''); |
|
6141 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($date_start, $format, false, $outputlangs)).($withparenthesis ? ')' : ''); |
|
6142 | 6142 | } |
6143 | 6143 | if (!$date_start && $date_end) { |
6144 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : ''); |
|
6144 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis ? ')' : ''); |
|
6145 | 6145 | } |
6146 | 6146 | |
6147 | 6147 | return $out; |
@@ -6221,7 +6221,7 @@ discard block |
||
6221 | 6221 | dol_syslog("Try to add a message in stack with empty message", LOG_WARNING); |
6222 | 6222 | } else { |
6223 | 6223 | if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) |
6224 | - dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages'); |
|
6224 | + dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages'); |
|
6225 | 6225 | if (empty($mesgs)) |
6226 | 6226 | setEventMessage($mesg, $style); |
6227 | 6227 | else { |
@@ -6290,7 +6290,7 @@ discard block |
||
6290 | 6290 | |
6291 | 6291 | // If inline message with no format, we add it. |
6292 | 6292 | if ((empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && !preg_match('/<div class=".*">/i', $out)) { |
6293 | - $divstart = '<div class="' . $style . ' clearboth">'; |
|
6293 | + $divstart = '<div class="'.$style.' clearboth">'; |
|
6294 | 6294 | $divend = '</div>'; |
6295 | 6295 | } |
6296 | 6296 | |
@@ -6317,14 +6317,14 @@ discard block |
||
6317 | 6317 | if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) { |
6318 | 6318 | $return = '<script type="text/javascript"> |
6319 | 6319 | $(document).ready(function() { |
6320 | - var block = ' . (!empty($conf->global->MAIN_USE_JQUERY_BLOCKUI) ? "true" : "false") . ' |
|
6320 | + var block = ' . (!empty($conf->global->MAIN_USE_JQUERY_BLOCKUI) ? "true" : "false").' |
|
6321 | 6321 | if (block) { |
6322 | - $.dolEventValid("","' . dol_escape_js($out) . '"); |
|
6322 | + $.dolEventValid("","' . dol_escape_js($out).'"); |
|
6323 | 6323 | } else { |
6324 | 6324 | /* jnotify(message, preset of message type, keepmessage) */ |
6325 | - $.jnotify("' . dol_escape_js($out) . '", |
|
6326 | - "' . ($style == "ok" ? 3000 : $style) . '", |
|
6327 | - ' . ($style == "ok" ? "false" : "true") . ', |
|
6325 | + $.jnotify("' . dol_escape_js($out).'", |
|
6326 | + "' . ($style == "ok" ? 3000 : $style).'", |
|
6327 | + ' . ($style == "ok" ? "false" : "true").', |
|
6328 | 6328 | { remove: function (){} } ); |
6329 | 6329 | } |
6330 | 6330 | }); |
@@ -6519,11 +6519,11 @@ discard block |
||
6519 | 6519 | { |
6520 | 6520 | global $conf; |
6521 | 6521 | |
6522 | - $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 |
|
6522 | + $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 |
|
6523 | 6523 | if (empty($tmp) && !empty($_SERVER["WINDIR"])) |
6524 | 6524 | $tmp = 'iso-8859-1'; // By default for windows |
6525 | 6525 | if (empty($tmp)) |
6526 | - $tmp = 'utf-8'; // By default for other |
|
6526 | + $tmp = 'utf-8'; // By default for other |
|
6527 | 6527 | if (!empty($conf->global->MAIN_FILESYSTEM_ENCODING)) |
6528 | 6528 | $tmp = $conf->global->MAIN_FILESYSTEM_ENCODING; |
6529 | 6529 | |
@@ -6555,16 +6555,16 @@ discard block |
||
6555 | 6555 | |
6556 | 6556 | // Check in cache |
6557 | 6557 | if (isset($cache_codes[$tablename][$key][$fieldid])) { // Can be defined to 0 or '' |
6558 | - return $cache_codes[$tablename][$key][$fieldid]; // Found in cache |
|
6558 | + return $cache_codes[$tablename][$key][$fieldid]; // Found in cache |
|
6559 | 6559 | } |
6560 | 6560 | |
6561 | 6561 | dol_syslog('dol_getIdFromCode (value not found into cache)', LOG_DEBUG); |
6562 | 6562 | |
6563 | - $sql = "SELECT " . $fieldid . " as valuetoget"; |
|
6564 | - $sql .= " FROM " . MAIN_DB_PREFIX . $tablename; |
|
6565 | - $sql .= " WHERE " . $fieldkey . " = '" . $db->escape($key) . "'"; |
|
6563 | + $sql = "SELECT ".$fieldid." as valuetoget"; |
|
6564 | + $sql .= " FROM ".MAIN_DB_PREFIX.$tablename; |
|
6565 | + $sql .= " WHERE ".$fieldkey." = '".$db->escape($key)."'"; |
|
6566 | 6566 | if (!empty($entityfilter)) |
6567 | - $sql .= " AND entity IN (" . getEntity($tablename) . ")"; |
|
6567 | + $sql .= " AND entity IN (".getEntity($tablename).")"; |
|
6568 | 6568 | |
6569 | 6569 | $resql = $db->query($sql); |
6570 | 6570 | if ($resql) { |
@@ -6591,12 +6591,12 @@ discard block |
||
6591 | 6591 | { |
6592 | 6592 | global $user, $conf, $langs; |
6593 | 6593 | global $leftmenu; |
6594 | - global $rights; // To export to dol_eval function |
|
6594 | + global $rights; // To export to dol_eval function |
|
6595 | 6595 | //print $strRights."<br>\n"; |
6596 | 6596 | $rights = true; |
6597 | 6597 | if ($strRights != '') { |
6598 | - $str = 'if(!(' . $strRights . ')) { $rights = false; }'; |
|
6599 | - dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition |
|
6598 | + $str = 'if(!('.$strRights.')) { $rights = false; }'; |
|
6599 | + dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition |
|
6600 | 6600 | } |
6601 | 6601 | return $rights; |
6602 | 6602 | } |
@@ -6619,14 +6619,14 @@ discard block |
||
6619 | 6619 | global $object; |
6620 | 6620 | global $mysoc; |
6621 | 6621 | |
6622 | - global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object |
|
6623 | - global $soc; // For backward compatibility |
|
6622 | + global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object |
|
6623 | + global $soc; // For backward compatibility |
|
6624 | 6624 | //print $s."<br>\n"; |
6625 | 6625 | if ($returnvalue) { |
6626 | 6626 | if ($hideerrors) |
6627 | - return @eval('return ' . $s . ';'); |
|
6627 | + return @eval('return '.$s.';'); |
|
6628 | 6628 | else |
6629 | - return eval('return ' . $s . ';'); |
|
6629 | + return eval('return '.$s.';'); |
|
6630 | 6630 | } |
6631 | 6631 | else { |
6632 | 6632 | if ($hideerrors) |
@@ -6680,7 +6680,7 @@ discard block |
||
6680 | 6680 | $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1]; |
6681 | 6681 | } |
6682 | 6682 | |
6683 | - return img_picto_common($codelang, 'flags/' . strtolower($flagImage) . '.png', $moreatt); |
|
6683 | + return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt); |
|
6684 | 6684 | } |
6685 | 6685 | |
6686 | 6686 | /** |
@@ -6878,16 +6878,16 @@ discard block |
||
6878 | 6878 | 'zu-ZA', |
6879 | 6879 | ); |
6880 | 6880 | |
6881 | - $buildprimarykeytotest = strtolower($countrycode) . '-' . strtoupper($countrycode); |
|
6881 | + $buildprimarykeytotest = strtolower($countrycode).'-'.strtoupper($countrycode); |
|
6882 | 6882 | if (in_array($buildprimarykeytotest, $locales)) |
6883 | - return strtolower($countrycode) . '_' . strtoupper($countrycode); |
|
6883 | + return strtolower($countrycode).'_'.strtoupper($countrycode); |
|
6884 | 6884 | |
6885 | 6885 | foreach ($locales as $locale) { |
6886 | 6886 | $locale_language = locale_get_primary_language($locale); |
6887 | 6887 | $locale_region = locale_get_region($locale); |
6888 | 6888 | if (strtoupper($countrycode) == $locale_region) { |
6889 | 6889 | //var_dump($locale.'-'.$locale_language.'-'.$locale_region); |
6890 | - return strtolower($locale_language) . '_' . strtoupper($locale_region); |
|
6890 | + return strtolower($locale_language).'_'.strtoupper($locale_region); |
|
6891 | 6891 | } |
6892 | 6892 | } |
6893 | 6893 | |
@@ -6948,7 +6948,7 @@ discard block |
||
6948 | 6948 | $label = $langs->trans($values[2]); |
6949 | 6949 | |
6950 | 6950 | //$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1); |
6951 | - $head[$h][0] = BASE_URI . preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]); |
|
6951 | + $head[$h][0] = BASE_URI.preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]); |
|
6952 | 6952 | $head[$h][1] = $label; |
6953 | 6953 | $head[$h][2] = str_replace('+', '', $values[1]); |
6954 | 6954 | $h++; |
@@ -7019,43 +7019,43 @@ discard block |
||
7019 | 7019 | global $micro_start_time; |
7020 | 7020 | |
7021 | 7021 | if ($zone == 'private') |
7022 | - print "\n" . '<!-- Common footer for private page -->' . "\n"; |
|
7022 | + print "\n".'<!-- Common footer for private page -->'."\n"; |
|
7023 | 7023 | else |
7024 | - print "\n" . '<!-- Common footer for public page -->' . "\n"; |
|
7024 | + print "\n".'<!-- Common footer for public page -->'."\n"; |
|
7025 | 7025 | |
7026 | 7026 | // A div to store page_y POST parameter so we can read it using javascript |
7027 | 7027 | print "\n<!-- A div to store page_y POST paramater -->\n"; |
7028 | - print '<div id="page_y" style="display: none;">' . $_POST['page_y'] . '</div>' . "\n"; |
|
7028 | + print '<div id="page_y" style="display: none;">'.$_POST['page_y'].'</div>'."\n"; |
|
7029 | 7029 | |
7030 | 7030 | $parameters = array(); |
7031 | - $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks |
|
7031 | + $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks |
|
7032 | 7032 | if (empty($reshook)) { |
7033 | 7033 | if (!empty($conf->global->MAIN_HTML_FOOTER)) |
7034 | - print $conf->global->MAIN_HTML_FOOTER . "\n"; |
|
7034 | + print $conf->global->MAIN_HTML_FOOTER."\n"; |
|
7035 | 7035 | |
7036 | 7036 | print "\n"; |
7037 | 7037 | if (!empty($conf->use_javascript_ajax)) { |
7038 | - print '<script type="text/javascript" language="javascript">' . "\n"; |
|
7039 | - print 'jQuery(document).ready(function() {' . "\n"; |
|
7038 | + print '<script type="text/javascript" language="javascript">'."\n"; |
|
7039 | + print 'jQuery(document).ready(function() {'."\n"; |
|
7040 | 7040 | |
7041 | 7041 | if ($zone == 'private' && empty($conf->dol_use_jmobile)) { |
7042 | 7042 | print "\n"; |
7043 | - print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */' . "\n"; |
|
7043 | + print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */'."\n"; |
|
7044 | 7044 | print 'jQuery(".menuhider").click(function() {'; |
7045 | - print ' console.log("We click on .menuhider");' . "\n"; |
|
7045 | + print ' console.log("We click on .menuhider");'."\n"; |
|
7046 | 7046 | //print " $('.side-nav').animate({width:'toggle'},200);\n"; // OK with eldy theme but not with md |
7047 | 7047 | print " $('.side-nav').toggle()\n"; |
7048 | 7048 | print " $('.login_block').toggle()\n"; |
7049 | - print '});' . "\n"; |
|
7049 | + print '});'."\n"; |
|
7050 | 7050 | } |
7051 | 7051 | |
7052 | 7052 | // Management of focus and mandatory for fields |
7053 | 7053 | if ($action == 'create' || $action == 'edit' || (empty($action) && (preg_match('/new\.php/', $_SERVER["PHP_SELF"])))) { |
7054 | - print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */' . "\n"; |
|
7054 | + print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */'."\n"; |
|
7055 | 7055 | $relativepathstring = $_SERVER["PHP_SELF"]; |
7056 | 7056 | // Clean $relativepathstring |
7057 | 7057 | if (constant('DOL_URL_ROOT')) |
7058 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
7058 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring); |
|
7059 | 7059 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
7060 | 7060 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
7061 | 7061 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
@@ -7078,9 +7078,9 @@ discard block |
||
7078 | 7078 | if ($qualified) { |
7079 | 7079 | foreach ($defval as $paramkey => $paramval) { |
7080 | 7080 | // Set focus on field |
7081 | - print 'jQuery("input[name=\'' . $paramkey . '\']").focus();' . "\n"; |
|
7082 | - print 'jQuery("textarea[name=\'' . $paramkey . '\']").focus();' . "\n"; |
|
7083 | - print 'jQuery("select[name=\'' . $paramkey . '\']").focus();' . "\n"; // Not really usefull, but we keep it in case of. |
|
7081 | + print 'jQuery("input[name=\''.$paramkey.'\']").focus();'."\n"; |
|
7082 | + print 'jQuery("textarea[name=\''.$paramkey.'\']").focus();'."\n"; |
|
7083 | + print 'jQuery("select[name=\''.$paramkey.'\']").focus();'."\n"; // Not really usefull, but we keep it in case of. |
|
7084 | 7084 | } |
7085 | 7085 | } |
7086 | 7086 | } |
@@ -7104,16 +7104,16 @@ discard block |
||
7104 | 7104 | if ($qualified) { |
7105 | 7105 | foreach ($defval as $paramkey => $paramval) { |
7106 | 7106 | // Add property 'required' on input |
7107 | - print 'jQuery("input[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n"; |
|
7108 | - print 'jQuery("textarea[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n"; |
|
7109 | - print 'jQuery("select[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n"; // required on a select works only if key is "", this does not happen in Dolibarr |
|
7107 | + print 'jQuery("input[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; |
|
7108 | + print 'jQuery("textarea[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; |
|
7109 | + print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; // required on a select works only if key is "", this does not happen in Dolibarr |
|
7110 | 7110 | } |
7111 | 7111 | } |
7112 | 7112 | } |
7113 | 7113 | } |
7114 | 7114 | } |
7115 | 7115 | |
7116 | - print '});' . "\n"; |
|
7116 | + print '});'."\n"; |
|
7117 | 7117 | |
7118 | 7118 | // Google Analytics |
7119 | 7119 | // TODO Add a hook here |
@@ -7121,15 +7121,15 @@ discard block |
||
7121 | 7121 | if (($conf->dol_use_jmobile != 4)) { |
7122 | 7122 | print "\n"; |
7123 | 7123 | print "/* JS CODE TO ENABLE for google analtics tag */\n"; |
7124 | - print ' var _gaq = _gaq || [];' . "\n"; |
|
7125 | - print ' _gaq.push([\'_setAccount\', \'' . $conf->global->MAIN_GOOGLE_AN_ID . '\']);' . "\n"; |
|
7126 | - print ' _gaq.push([\'_trackPageview\']);' . "\n"; |
|
7127 | - print '' . "\n"; |
|
7128 | - print ' (function() {' . "\n"; |
|
7129 | - print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . "\n"; |
|
7130 | - print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . "\n"; |
|
7131 | - print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . "\n"; |
|
7132 | - print ' })();' . "\n"; |
|
7124 | + print ' var _gaq = _gaq || [];'."\n"; |
|
7125 | + print ' _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n"; |
|
7126 | + print ' _gaq.push([\'_trackPageview\']);'."\n"; |
|
7127 | + print ''."\n"; |
|
7128 | + print ' (function() {'."\n"; |
|
7129 | + print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n"; |
|
7130 | + print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n"; |
|
7131 | + print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n"; |
|
7132 | + print ' })();'."\n"; |
|
7133 | 7133 | } |
7134 | 7134 | } |
7135 | 7135 | |
@@ -7139,27 +7139,27 @@ discard block |
||
7139 | 7139 | print "/* JS CODE TO ENABLE to add memory info */\n"; |
7140 | 7140 | print 'window.console && console.log("'; |
7141 | 7141 | if (!empty($conf->global->MEMCACHED_SERVER)) |
7142 | - print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - '; |
|
7143 | - print 'MAIN_OPTIMIZE_SPEED=' . (isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off'); |
|
7142 | + print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - '; |
|
7143 | + print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off'); |
|
7144 | 7144 | if (!empty($micro_start_time)) { // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in global variable. |
7145 | 7145 | $micro_end_time = microtime(true); |
7146 | - print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms'; |
|
7146 | + print ' - Build time: '.ceil(1000 * ($micro_end_time - $micro_start_time)).' ms'; |
|
7147 | 7147 | } |
7148 | 7148 | if (function_exists("memory_get_usage")) { |
7149 | - print ' - Mem: ' . memory_get_usage(); |
|
7149 | + print ' - Mem: '.memory_get_usage(); |
|
7150 | 7150 | } |
7151 | 7151 | if (function_exists("xdebug_memory_usage")) { |
7152 | - print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms'; |
|
7153 | - print ' - XDebug mem: ' . xdebug_memory_usage(); |
|
7154 | - print ' - XDebug mem peak: ' . xdebug_peak_memory_usage(); |
|
7152 | + print ' - XDebug time: '.ceil(1000 * xdebug_time_index()).' ms'; |
|
7153 | + print ' - XDebug mem: '.xdebug_memory_usage(); |
|
7154 | + print ' - XDebug mem peak: '.xdebug_peak_memory_usage(); |
|
7155 | 7155 | } |
7156 | 7156 | if (function_exists("zend_loader_file_encoded")) { |
7157 | - print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no'); |
|
7157 | + print ' - Zend encoded file: '.(zend_loader_file_encoded() ? 'yes' : 'no'); |
|
7158 | 7158 | } |
7159 | - print '");' . "\n"; |
|
7159 | + print '");'."\n"; |
|
7160 | 7160 | } |
7161 | 7161 | |
7162 | - print "\n" . '</script>' . "\n"; |
|
7162 | + print "\n".'</script>'."\n"; |
|
7163 | 7163 | } |
7164 | 7164 | |
7165 | 7165 | // Add Xdebug coverage of code |
@@ -7173,7 +7173,7 @@ discard block |
||
7173 | 7173 | print "<!-- Start of log output\n"; |
7174 | 7174 | //print '<div class="hidden">'."\n"; |
7175 | 7175 | foreach ($conf->logbuffer as $logline) { |
7176 | - print $logline . "<br>\n"; |
|
7176 | + print $logline."<br>\n"; |
|
7177 | 7177 | } |
7178 | 7178 | //print '</div>'."\n"; |
7179 | 7179 | print "End of log output -->\n"; |
@@ -7216,8 +7216,8 @@ discard block |
||
7216 | 7216 | */ |
7217 | 7217 | function dol_set_focus($selector) |
7218 | 7218 | { |
7219 | - print "\n" . '<!-- Set focus onto a specific field -->' . "\n"; |
|
7220 | - print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("' . dol_escape_js($selector) . '").focus(); });</script>' . "\n"; |
|
7219 | + print "\n".'<!-- Set focus onto a specific field -->'."\n"; |
|
7220 | + print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.dol_escape_js($selector).'").focus(); });</script>'."\n"; |
|
7221 | 7221 | } |
7222 | 7222 | |
7223 | 7223 | /** |
@@ -7262,7 +7262,7 @@ discard block |
||
7262 | 7262 | $value = preg_replace('/\*/', '%', $value); // Replace * with % |
7263 | 7263 | } |
7264 | 7264 | if ($mode == 1) { |
7265 | - $value = preg_replace('/([<>=]+)\s+([0-9' . preg_quote($langs->trans("DecimalSeparator"), '/') . '\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do |
|
7265 | + $value = preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do |
|
7266 | 7266 | } |
7267 | 7267 | |
7268 | 7268 | $value = preg_replace('/\s*\|\s*/', '|', $value); |
@@ -7291,14 +7291,14 @@ discard block |
||
7291 | 7291 | if ($newcrit != '') { |
7292 | 7292 | $numnewcrit = price2num($newcrit); |
7293 | 7293 | if (is_numeric($numnewcrit)) { |
7294 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . ' ' . $operator . ' ' . $numnewcrit; |
|
7294 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$numnewcrit; |
|
7295 | 7295 | } else { |
7296 | - $newres .= ($i2 > 0 ? ' OR ' : '') . '1 = 2'; // force false |
|
7296 | + $newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false |
|
7297 | 7297 | } |
7298 | 7298 | $i2++; // a criteria was added to string |
7299 | 7299 | } |
7300 | 7300 | } else if ($mode == 2) { |
7301 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $db->escape(trim($crit)) . ")"; |
|
7301 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field." IN (".$db->escape(trim($crit)).")"; |
|
7302 | 7302 | $i2++; // a criteria was added to string |
7303 | 7303 | } else if ($mode == 3) { |
7304 | 7304 | $tmparray = explode(',', trim($crit)); |
@@ -7307,10 +7307,10 @@ discard block |
||
7307 | 7307 | foreach ($tmparray as $val) { |
7308 | 7308 | if ($val) { |
7309 | 7309 | $listofcodes .= ($listofcodes ? ',' : ''); |
7310 | - $listofcodes .= "'" . $db->escape(trim($val)) . "'"; |
|
7310 | + $listofcodes .= "'".$db->escape(trim($val))."'"; |
|
7311 | 7311 | } |
7312 | 7312 | } |
7313 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $listofcodes . ")"; |
|
7313 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field." IN (".$listofcodes.")"; |
|
7314 | 7314 | $i2++; // a criteria was added to string |
7315 | 7315 | } |
7316 | 7316 | } else if ($mode == 4) { |
@@ -7319,10 +7319,10 @@ discard block |
||
7319 | 7319 | $listofcodes = ''; |
7320 | 7320 | foreach ($tmparray as $val) { |
7321 | 7321 | if ($val) { |
7322 | - $newres .= ($i2 > 0 ? ' OR (' : '(') . $field . ' LIKE \'' . $db->escape(trim($val)) . ',%\''; |
|
7323 | - $newres .= ' OR ' . $field . ' = \'' . $db->escape(trim($val)) . '\''; |
|
7324 | - $newres .= ' OR ' . $field . ' LIKE \'%,' . $db->escape(trim($val)) . '\''; |
|
7325 | - $newres .= ' OR ' . $field . ' LIKE \'%,' . $db->escape(trim($val)) . ',%\''; |
|
7322 | + $newres .= ($i2 > 0 ? ' OR (' : '(').$field.' LIKE \''.$db->escape(trim($val)).',%\''; |
|
7323 | + $newres .= ' OR '.$field.' = \''.$db->escape(trim($val)).'\''; |
|
7324 | + $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).'\''; |
|
7325 | + $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).',%\''; |
|
7326 | 7326 | $newres .= ')'; |
7327 | 7327 | $i2++; |
7328 | 7328 | } |
@@ -7339,9 +7339,9 @@ discard block |
||
7339 | 7339 | $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); |
7340 | 7340 | |
7341 | 7341 | if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field |
7342 | - $newres .= $field . " = " . (is_numeric(trim($tmpcrit)) ? trim($tmpcrit) : '0'); |
|
7342 | + $newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? trim($tmpcrit) : '0'); |
|
7343 | 7343 | } else { |
7344 | - $newres .= $field . " LIKE '"; |
|
7344 | + $newres .= $field." LIKE '"; |
|
7345 | 7345 | |
7346 | 7346 | $tmpcrit = trim($tmpcrit); |
7347 | 7347 | $tmpcrit2 = $tmpcrit; |
@@ -7360,7 +7360,7 @@ discard block |
||
7360 | 7360 | $newres .= $tmpafter; |
7361 | 7361 | $newres .= "'"; |
7362 | 7362 | if ($tmpcrit2 == '') { |
7363 | - $newres .= ' OR ' . $field . " IS NULL"; |
|
7363 | + $newres .= ' OR '.$field." IS NULL"; |
|
7364 | 7364 | } |
7365 | 7365 | } |
7366 | 7366 | |
@@ -7371,10 +7371,10 @@ discard block |
||
7371 | 7371 | $i++; |
7372 | 7372 | } |
7373 | 7373 | if ($newres) |
7374 | - $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') . $newres . ($i2 > 1 ? ')' : ''); |
|
7374 | + $res = $res.($res ? ' AND ' : '').($i2 > 1 ? '(' : '').$newres.($i2 > 1 ? ')' : ''); |
|
7375 | 7375 | $j++; |
7376 | 7376 | } |
7377 | - $res = ($nofirstand ? "" : " AND ") . "(" . $res . ")"; |
|
7377 | + $res = ($nofirstand ? "" : " AND ")."(".$res.")"; |
|
7378 | 7378 | //print 'xx'.$res.'yy'; |
7379 | 7379 | return $res; |
7380 | 7380 | } |
@@ -7393,8 +7393,8 @@ discard block |
||
7393 | 7393 | $url = $object->getLastMainDocLink($object->element); |
7394 | 7394 | |
7395 | 7395 | if ($url) { |
7396 | - $out .= img_picto('', 'object_globe.png') . ' ' . $langs->trans("DirectDownloadLink") . '<br>'; |
|
7397 | - $out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="' . $url . '">'; |
|
7396 | + $out .= img_picto('', 'object_globe.png').' '.$langs->trans("DirectDownloadLink").'<br>'; |
|
7397 | + $out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="'.$url.'">'; |
|
7398 | 7398 | $out .= ajax_autoselect("directdownloadlink", 0); |
7399 | 7399 | } |
7400 | 7400 | return $out; |
@@ -7435,7 +7435,7 @@ discard block |
||
7435 | 7435 | if ($extName) |
7436 | 7436 | $subdir = 'thumbs/'; |
7437 | 7437 | |
7438 | - return ($dirName ? $dirName . '/' : '') . $subdir . $fileName . $extName . $extImgTarget; // New filename for thumb |
|
7438 | + return ($dirName ? $dirName.'/' : '').$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb |
|
7439 | 7439 | } |
7440 | 7440 | |
7441 | 7441 | /** |
@@ -7461,14 +7461,14 @@ discard block |
||
7461 | 7461 | |
7462 | 7462 | if ($alldata == 1) { |
7463 | 7463 | if ($num_mime !== false) |
7464 | - return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : ''), 'mime' => dol_mimetype($relativepath),); |
|
7464 | + return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : ''), 'mime' => dol_mimetype($relativepath),); |
|
7465 | 7465 | else |
7466 | 7466 | return array(); |
7467 | 7467 | } |
7468 | 7468 | |
7469 | 7469 | // old behavior |
7470 | 7470 | if ($num_mime !== false) |
7471 | - return 'javascript:document_preview(\'' . dol_escape_js(DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : '')) . '\', \'' . dol_mimetype($relativepath) . '\', \'' . dol_escape_js($langs->trans('Preview')) . '\')'; |
|
7471 | + return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : '')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')'; |
|
7472 | 7472 | else |
7473 | 7473 | return ''; |
7474 | 7474 | } |
@@ -7485,11 +7485,11 @@ discard block |
||
7485 | 7485 | global $langs; |
7486 | 7486 | $out = '<script type="text/javascript"> |
7487 | 7487 | jQuery(document).ready(function () { |
7488 | - jQuery("#' . $htmlname . '").click(function() { jQuery(this).select(); } ); |
|
7488 | + jQuery("#' . $htmlname.'").click(function() { jQuery(this).select(); } ); |
|
7489 | 7489 | }); |
7490 | 7490 | </script>'; |
7491 | 7491 | if ($addlink) |
7492 | - $out .= ' <a href="' . $addlink . '" target="_blank">' . $langs->trans("Link") . '</a>'; |
|
7492 | + $out .= ' <a href="'.$addlink.'" target="_blank">'.$langs->trans("Link").'</a>'; |
|
7493 | 7493 | return $out; |
7494 | 7494 | } |
7495 | 7495 | |
@@ -7870,9 +7870,9 @@ discard block |
||
7870 | 7870 | |
7871 | 7871 | if (!isset($dictvalues[$tablename])) { |
7872 | 7872 | $dictvalues[$tablename] = array(); |
7873 | - $sql = 'SELECT * FROM ' . $tablename . ' WHERE 1'; |
|
7873 | + $sql = 'SELECT * FROM '.$tablename.' WHERE 1'; |
|
7874 | 7874 | if ($checkentity) |
7875 | - $sql .= ' AND entity IN (0,' . getEntity($tablename) . ')'; |
|
7875 | + $sql .= ' AND entity IN (0,'.getEntity($tablename).')'; |
|
7876 | 7876 | |
7877 | 7877 | $resql = $db->query($sql); |
7878 | 7878 | if ($resql) { |
@@ -7910,14 +7910,14 @@ discard block |
||
7910 | 7910 | $g = $tmp[1]; |
7911 | 7911 | $b = $tmp[2]; |
7912 | 7912 | } else { |
7913 | - $hexr = $stringcolor[0] . $stringcolor[1]; |
|
7914 | - $hexg = $stringcolor[2] . $stringcolor[3]; |
|
7915 | - $hexb = $stringcolor[4] . $stringcolor[5]; |
|
7913 | + $hexr = $stringcolor[0].$stringcolor[1]; |
|
7914 | + $hexg = $stringcolor[2].$stringcolor[3]; |
|
7915 | + $hexb = $stringcolor[4].$stringcolor[5]; |
|
7916 | 7916 | $r = hexdec($hexr); |
7917 | 7917 | $g = hexdec($hexg); |
7918 | 7918 | $b = hexdec($hexb); |
7919 | 7919 | } |
7920 | - $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm |
|
7920 | + $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm |
|
7921 | 7921 | if ($bright > 0.6) |
7922 | 7922 | $res = 1; |
7923 | 7923 | } |
@@ -7953,11 +7953,11 @@ discard block |
||
7953 | 7953 | return 0; // Entry is for menus all excluded to external users |
7954 | 7954 | } |
7955 | 7955 | if (!$menuentry['perms'] && $type_user) |
7956 | - return 0; // No permissions and user is external |
|
7956 | + return 0; // No permissions and user is external |
|
7957 | 7957 | if (!$menuentry['perms'] && !empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) |
7958 | 7958 | return 0; // No permissions and option to hide when not allowed, even for internal user, is on |
7959 | 7959 | if (!$menuentry['perms']) |
7960 | - return 2; // No permissions and user is external |
|
7960 | + return 2; // No permissions and user is external |
|
7961 | 7961 | return 1; |
7962 | 7962 | } |
7963 | 7963 |
@@ -75,8 +75,9 @@ discard block |
||
75 | 75 | if ($found) return $result; |
76 | 76 | } */ |
77 | 77 | |
78 | - if (isset($class::$member)) |
|
79 | - return $class::$member; |
|
78 | + if (isset($class::$member)) { |
|
79 | + return $class::$member; |
|
80 | + } |
|
80 | 81 | dol_print_error('', 'Try to get a static member "' . $member . '" in class "' . $class . '" that does not exists or is not static.'); |
81 | 82 | return null; |
82 | 83 | } |
@@ -127,8 +128,9 @@ discard block |
||
127 | 128 | } else { |
128 | 129 | $out = ''; |
129 | 130 | $addzero = array('user', 'usergroup', 'c_email_templates', 'email_template', 'default_values'); |
130 | - if (in_array($element, $addzero)) |
|
131 | - $out .= '0,'; |
|
131 | + if (in_array($element, $addzero)) { |
|
132 | + $out .= '0,'; |
|
133 | + } |
|
132 | 134 | $out .= $conf->entity; |
133 | 135 | return $out; |
134 | 136 | } |
@@ -307,32 +309,35 @@ discard block |
||
307 | 309 | { |
308 | 310 | global $mysoc, $user, $conf; |
309 | 311 | |
310 | - if (empty($paramname)) |
|
311 | - return 'BadFirstParameterForGETPOST'; |
|
312 | + if (empty($paramname)) { |
|
313 | + return 'BadFirstParameterForGETPOST'; |
|
314 | + } |
|
312 | 315 | if (empty($check)) { |
313 | 316 | dol_syslog("Deprecated use of GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING); |
314 | 317 | // Enable this line to know who call the GETPOST with '' $check parameter. |
315 | 318 | //var_dump(debug_backtrace()[0]); |
316 | 319 | } |
317 | 320 | |
318 | - if (empty($method)) |
|
319 | - $out = isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_POST[$paramname]) ? $_POST[$paramname] : ''); |
|
320 | - elseif ($method == 1) |
|
321 | - $out = isset($_GET[$paramname]) ? $_GET[$paramname] : ''; |
|
322 | - elseif ($method == 2) |
|
323 | - $out = isset($_POST[$paramname]) ? $_POST[$paramname] : ''; |
|
324 | - elseif ($method == 3) |
|
325 | - $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : ''); |
|
326 | - elseif ($method == 4) |
|
327 | - $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_COOKIE[$paramname]) ? $_COOKIE[$paramname] : '')); |
|
328 | - else |
|
329 | - return 'BadThirdParameterForGETPOST'; |
|
321 | + if (empty($method)) { |
|
322 | + $out = isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_POST[$paramname]) ? $_POST[$paramname] : ''); |
|
323 | + } elseif ($method == 1) { |
|
324 | + $out = isset($_GET[$paramname]) ? $_GET[$paramname] : ''; |
|
325 | + } elseif ($method == 2) { |
|
326 | + $out = isset($_POST[$paramname]) ? $_POST[$paramname] : ''; |
|
327 | + } elseif ($method == 3) { |
|
328 | + $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : ''); |
|
329 | + } elseif ($method == 4) { |
|
330 | + $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_COOKIE[$paramname]) ? $_COOKIE[$paramname] : '')); |
|
331 | + } else { |
|
332 | + return 'BadThirdParameterForGETPOST'; |
|
333 | + } |
|
330 | 334 | |
331 | 335 | if (empty($method) || $method == 3 || $method == 4) { |
332 | 336 | $relativepathstring = $_SERVER["PHP_SELF"]; |
333 | 337 | // Clean $relativepathstring |
334 | - if (constant('DOL_URL_ROOT')) |
|
335 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
338 | + if (constant('DOL_URL_ROOT')) { |
|
339 | + $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
340 | + } |
|
336 | 341 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
337 | 342 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
338 | 343 | //var_dump($relativepathstring); |
@@ -381,14 +386,17 @@ discard block |
||
381 | 386 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
382 | 387 | $foundintru = 0; |
383 | 388 | foreach ($tmpqueryarraytohave as $tmpquerytohave) { |
384 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
385 | - $foundintru = 1; |
|
389 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
390 | + $foundintru = 1; |
|
391 | + } |
|
386 | 392 | } |
387 | - if (!$foundintru) |
|
388 | - $qualified = 1; |
|
393 | + if (!$foundintru) { |
|
394 | + $qualified = 1; |
|
395 | + } |
|
389 | 396 | //var_dump($defkey.'-'.$qualified); |
390 | - } else |
|
391 | - $qualified = 1; |
|
397 | + } else { |
|
398 | + $qualified = 1; |
|
399 | + } |
|
392 | 400 | |
393 | 401 | if ($qualified) { |
394 | 402 | //var_dump($user->default_values[$relativepathstring][$defkey]['createform']); |
@@ -415,20 +423,24 @@ discard block |
||
415 | 423 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
416 | 424 | $foundintru = 0; |
417 | 425 | foreach ($tmpqueryarraytohave as $tmpquerytohave) { |
418 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
419 | - $foundintru = 1; |
|
426 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
427 | + $foundintru = 1; |
|
428 | + } |
|
420 | 429 | } |
421 | - if (!$foundintru) |
|
422 | - $qualified = 1; |
|
430 | + if (!$foundintru) { |
|
431 | + $qualified = 1; |
|
432 | + } |
|
423 | 433 | //var_dump($defkey.'-'.$qualified); |
424 | - } else |
|
425 | - $qualified = 1; |
|
434 | + } else { |
|
435 | + $qualified = 1; |
|
436 | + } |
|
426 | 437 | |
427 | 438 | if ($qualified) { |
428 | 439 | $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
429 | 440 | foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) { |
430 | - if ($out) |
|
431 | - $out .= ', '; |
|
441 | + if ($out) { |
|
442 | + $out .= ', '; |
|
443 | + } |
|
432 | 444 | if ($paramname == 'sortfield') { |
433 | 445 | $out .= dol_string_nospecial($key, '', $forbidden_chars_to_replace); |
434 | 446 | } |
@@ -448,14 +460,17 @@ discard block |
||
448 | 460 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
449 | 461 | $foundintru = 0; |
450 | 462 | foreach ($tmpqueryarraytohave as $tmpquerytohave) { |
451 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
452 | - $foundintru = 1; |
|
463 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
464 | + $foundintru = 1; |
|
465 | + } |
|
453 | 466 | } |
454 | - if (!$foundintru) |
|
455 | - $qualified = 1; |
|
467 | + if (!$foundintru) { |
|
468 | + $qualified = 1; |
|
469 | + } |
|
456 | 470 | //var_dump($defkey.'-'.$qualified); |
457 | - } else |
|
458 | - $qualified = 1; |
|
471 | + } else { |
|
472 | + $qualified = 1; |
|
473 | + } |
|
459 | 474 | |
460 | 475 | if ($qualified) { |
461 | 476 | if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) { |
@@ -527,8 +542,10 @@ discard block |
||
527 | 542 | $newout = $user->fk_user; |
528 | 543 | } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') { |
529 | 544 | $newout = $conf->entity; |
530 | - } else |
|
531 | - $newout = ''; // Key not found, we replace with empty string |
|
545 | + } else { |
|
546 | + $newout = ''; |
|
547 | + } |
|
548 | + // Key not found, we replace with empty string |
|
532 | 549 | |
533 | 550 | |
534 | 551 | |
@@ -564,18 +581,20 @@ discard block |
||
564 | 581 | } |
565 | 582 | break; |
566 | 583 | case 'intcomma': |
567 | - if (preg_match('/[^0-9,-]+/i', $out)) |
|
568 | - $out = ''; |
|
584 | + if (preg_match('/[^0-9,-]+/i', $out)) { |
|
585 | + $out = ''; |
|
586 | + } |
|
569 | 587 | break; |
570 | 588 | case 'alpha': |
571 | 589 | if (!is_array($out)) { |
572 | 590 | $out = trim($out); |
573 | 591 | // '"' is dangerous because param in url can close the href= or src= and add javascript functions. |
574 | 592 | // '../' is dangerous because it allows dir transversals |
575 | - if (preg_match('/"/', $out)) |
|
576 | - $out = ''; |
|
577 | - else if (preg_match('/\.\.\//', $out)) |
|
578 | - $out = ''; |
|
593 | + if (preg_match('/"/', $out)) { |
|
594 | + $out = ''; |
|
595 | + } else if (preg_match('/\.\.\//', $out)) { |
|
596 | + $out = ''; |
|
597 | + } |
|
579 | 598 | } |
580 | 599 | break; |
581 | 600 | case 'san_alpha': |
@@ -584,27 +603,31 @@ discard block |
||
584 | 603 | case 'aZ': |
585 | 604 | if (!is_array($out)) { |
586 | 605 | $out = trim($out); |
587 | - if (preg_match('/[^a-z]+/i', $out)) |
|
588 | - $out = ''; |
|
606 | + if (preg_match('/[^a-z]+/i', $out)) { |
|
607 | + $out = ''; |
|
608 | + } |
|
589 | 609 | } |
590 | 610 | break; |
591 | 611 | case 'aZ09': |
592 | 612 | if (!is_array($out)) { |
593 | 613 | $out = trim($out); |
594 | - if (preg_match('/[^a-z0-9_\-\.]+/i', $out)) |
|
595 | - $out = ''; |
|
614 | + if (preg_match('/[^a-z0-9_\-\.]+/i', $out)) { |
|
615 | + $out = ''; |
|
616 | + } |
|
596 | 617 | } |
597 | 618 | break; |
598 | 619 | case 'aZ09comma': // great to sanitize sortfield or sortorder params that can be t.abc,t.def_gh |
599 | 620 | if (!is_array($out)) { |
600 | 621 | $out = trim($out); |
601 | - if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) |
|
602 | - $out = ''; |
|
622 | + if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) { |
|
623 | + $out = ''; |
|
624 | + } |
|
603 | 625 | } |
604 | 626 | break; |
605 | 627 | case 'array': |
606 | - if (!is_array($out) || empty($out)) |
|
607 | - $out = array(); |
|
628 | + if (!is_array($out) || empty($out)) { |
|
629 | + $out = array(); |
|
630 | + } |
|
608 | 631 | break; |
609 | 632 | case 'nohtml': // Recommended for most scalar parameters |
610 | 633 | $out = dol_string_nohtmltag($out, 0); |
@@ -614,16 +637,18 @@ discard block |
||
614 | 637 | $out = trim($out); |
615 | 638 | // '"' is dangerous because param in url can close the href= or src= and add javascript functions. |
616 | 639 | // '../' is dangerous because it allows dir transversals |
617 | - if (preg_match('/"/', $out)) |
|
618 | - $out = ''; |
|
619 | - else if (preg_match('/\.\.\//', $out)) |
|
620 | - $out = ''; |
|
640 | + if (preg_match('/"/', $out)) { |
|
641 | + $out = ''; |
|
642 | + } else if (preg_match('/\.\.\//', $out)) { |
|
643 | + $out = ''; |
|
644 | + } |
|
621 | 645 | $out = dol_string_nohtmltag($out); |
622 | 646 | } |
623 | 647 | break; |
624 | 648 | case 'custom': |
625 | - if (empty($filter)) |
|
626 | - return 'BadFourthParameterForGETPOST'; |
|
649 | + if (empty($filter)) { |
|
650 | + return 'BadFourthParameterForGETPOST'; |
|
651 | + } |
|
627 | 652 | $out = filter_var($out, $filter, $options); |
628 | 653 | break; |
629 | 654 | } |
@@ -663,10 +688,11 @@ discard block |
||
663 | 688 | // If prefix is for email |
664 | 689 | if ($mode == 'email') { |
665 | 690 | if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended) |
666 | - if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') |
|
667 | - return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; |
|
668 | - else if (isset($_SERVER["SERVER_NAME"])) |
|
669 | - return $_SERVER["SERVER_NAME"]; |
|
691 | + if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') { |
|
692 | + return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; |
|
693 | + } else if (isset($_SERVER["SERVER_NAME"])) { |
|
694 | + return $_SERVER["SERVER_NAME"]; |
|
695 | + } |
|
670 | 696 | } |
671 | 697 | return dol_hash(DOL_DOCUMENT_ROOT . DOL_URL_ROOT); |
672 | 698 | } |
@@ -739,22 +765,27 @@ discard block |
||
739 | 765 | } |
740 | 766 | } |
741 | 767 | if ($returnemptyifnotfound) { // Not found into alternate dir |
742 | - if ($returnemptyifnotfound == 1 || !file_exists($res)) |
|
743 | - return ''; |
|
768 | + if ($returnemptyifnotfound == 1 || !file_exists($res)) { |
|
769 | + return ''; |
|
770 | + } |
|
744 | 771 | } |
745 | - } |
|
746 | - else { // For an url path |
|
772 | + } else { // For an url path |
|
747 | 773 | // We try to get local path of file on filesystem from url |
748 | 774 | // Note that trying to know if a file on disk exist by forging path on disk from url |
749 | 775 | // works only for some web server and some setup. This is bugged when |
750 | 776 | // using proxy, rewriting, virtual path, etc... |
751 | 777 | $res = ''; |
752 | - if ($type == 1) |
|
753 | - $res = /* DOL_URL_ROOT */ DOL_BASE_URI . '/' . $path; // Standard value |
|
754 | - if ($type == 2) |
|
755 | - $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH . '/' . $path; // Standard value |
|
756 | - if ($type == 3) |
|
757 | - $res = DOL_URL_ROOT . '/' . $path; |
|
778 | + if ($type == 1) { |
|
779 | + $res = /* DOL_URL_ROOT */ DOL_BASE_URI . '/' . $path; |
|
780 | + } |
|
781 | + // Standard value |
|
782 | + if ($type == 2) { |
|
783 | + $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH . '/' . $path; |
|
784 | + } |
|
785 | + // Standard value |
|
786 | + if ($type == 3) { |
|
787 | + $res = DOL_URL_ROOT . '/' . $path; |
|
788 | + } |
|
758 | 789 | |
759 | 790 | foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) |
760 | 791 | if ($key == 'main') { |
@@ -834,13 +865,15 @@ discard block |
||
834 | 865 | function dol_size($size, $type = '') |
835 | 866 | { |
836 | 867 | global $conf; |
837 | - if (empty($conf->dol_optimize_smallscreen)) |
|
838 | - return $size; |
|
839 | - if ($type == 'width' && $size > 250) |
|
840 | - return 250; |
|
841 | - else |
|
842 | - return 10; |
|
843 | -} |
|
868 | + if (empty($conf->dol_optimize_smallscreen)) { |
|
869 | + return $size; |
|
870 | + } |
|
871 | + if ($type == 'width' && $size > 250) { |
|
872 | + return 250; |
|
873 | + } else { |
|
874 | + return 10; |
|
875 | + } |
|
876 | + } |
|
844 | 877 | |
845 | 878 | /** |
846 | 879 | * Clean a string to use it as a file name |
@@ -939,8 +972,9 @@ discard block |
||
939 | 972 | { |
940 | 973 | $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName |
941 | 974 | $forbidden_chars_to_remove = array(); |
942 | - if (is_array($badcharstoreplace)) |
|
943 | - $forbidden_chars_to_replace = $badcharstoreplace; |
|
975 | + if (is_array($badcharstoreplace)) { |
|
976 | + $forbidden_chars_to_replace = $badcharstoreplace; |
|
977 | + } |
|
944 | 978 | //$forbidden_chars_to_remove=array("(",")"); |
945 | 979 | |
946 | 980 | return str_replace($forbidden_chars_to_replace, $newstr, str_replace($forbidden_chars_to_remove, "", $str)); |
@@ -977,9 +1011,9 @@ discard block |
||
977 | 1011 | if (empty($mode)) { |
978 | 1012 | $substitjs["'"] = "\\'"; |
979 | 1013 | $substitjs['"'] = "\\'"; |
980 | - } else if ($mode == 1) |
|
981 | - $substitjs["'"] = "\\'"; |
|
982 | - else if ($mode == 2) { |
|
1014 | + } else if ($mode == 1) { |
|
1015 | + $substitjs["'"] = "\\'"; |
|
1016 | + } else if ($mode == 2) { |
|
983 | 1017 | $substitjs['"'] = '\\"'; |
984 | 1018 | } else if ($mode == 3) { |
985 | 1019 | $substitjs["'"] = "\\'"; |
@@ -1001,10 +1035,12 @@ discard block |
||
1001 | 1035 | { |
1002 | 1036 | // escape quotes and backslashes, newlines, etc. |
1003 | 1037 | $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags |
1004 | - if (!$keepb) |
|
1005 | - $tmp = strtr($tmp, array("<b>" => '', '</b>' => '')); |
|
1006 | - if (!$keepn) |
|
1007 | - $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n')); |
|
1038 | + if (!$keepb) { |
|
1039 | + $tmp = strtr($tmp, array("<b>" => '', '</b>' => '')); |
|
1040 | + } |
|
1041 | + if (!$keepn) { |
|
1042 | + $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n')); |
|
1043 | + } |
|
1008 | 1044 | return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags |
1009 | 1045 | } |
1010 | 1046 | |
@@ -1055,8 +1091,9 @@ discard block |
||
1055 | 1091 | global $conf, $user; |
1056 | 1092 | |
1057 | 1093 | // If syslog module enabled |
1058 | - if (empty($conf->syslog->enabled)) |
|
1059 | - return; |
|
1094 | + if (empty($conf->syslog->enabled)) { |
|
1095 | + return; |
|
1096 | + } |
|
1060 | 1097 | |
1061 | 1098 | if ($ident < 0) { |
1062 | 1099 | foreach ($conf->loghandlers as $loghandlerinstance) { |
@@ -1070,8 +1107,9 @@ discard block |
||
1070 | 1107 | if (!in_array($level, $logLevels, true)) { |
1071 | 1108 | throw new Exception('Incorrect log level'); |
1072 | 1109 | } |
1073 | - if ($level > $conf->global->SYSLOG_LEVEL) |
|
1074 | - return; |
|
1110 | + if ($level > $conf->global->SYSLOG_LEVEL) { |
|
1111 | + return; |
|
1112 | + } |
|
1075 | 1113 | |
1076 | 1114 | $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log |
1077 | 1115 | // If adding log inside HTML page is required |
@@ -1096,24 +1134,30 @@ discard block |
||
1096 | 1134 | ); |
1097 | 1135 | |
1098 | 1136 | // This is when server run behind a reverse proxy |
1099 | - if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) |
|
1100 | - $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']); |
|
1137 | + if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
1138 | + $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']); |
|
1139 | + } |
|
1101 | 1140 | // This is when server run normally on a server |
1102 | - else if (!empty($_SERVER["REMOTE_ADDR"])) |
|
1103 | - $data['ip'] = $_SERVER['REMOTE_ADDR']; |
|
1141 | + else if (!empty($_SERVER["REMOTE_ADDR"])) { |
|
1142 | + $data['ip'] = $_SERVER['REMOTE_ADDR']; |
|
1143 | + } |
|
1104 | 1144 | // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) |
1105 | - else if (!empty($_SERVER['SERVER_ADDR'])) |
|
1106 | - $data['ip'] = $_SERVER['SERVER_ADDR']; |
|
1145 | + else if (!empty($_SERVER['SERVER_ADDR'])) { |
|
1146 | + $data['ip'] = $_SERVER['SERVER_ADDR']; |
|
1147 | + } |
|
1107 | 1148 | // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). |
1108 | - else if (!empty($_SERVER['COMPUTERNAME'])) |
|
1109 | - $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']); |
|
1149 | + else if (!empty($_SERVER['COMPUTERNAME'])) { |
|
1150 | + $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']); |
|
1151 | + } |
|
1110 | 1152 | // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). |
1111 | - else if (!empty($_SERVER['LOGNAME'])) |
|
1112 | - $data['ip'] = '???@' . $_SERVER['LOGNAME']; |
|
1153 | + else if (!empty($_SERVER['LOGNAME'])) { |
|
1154 | + $data['ip'] = '???@' . $_SERVER['LOGNAME']; |
|
1155 | + } |
|
1113 | 1156 | // Loop on each log handler and send output |
1114 | 1157 | foreach ($conf->loghandlers as $loghandlerinstance) { |
1115 | - if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) |
|
1116 | - continue; |
|
1158 | + if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) { |
|
1159 | + continue; |
|
1160 | + } |
|
1117 | 1161 | $loghandlerinstance->export($data, $suffixinfilename); |
1118 | 1162 | } |
1119 | 1163 | unset($data); |
@@ -1169,13 +1213,15 @@ discard block |
||
1169 | 1213 | |
1170 | 1214 | // Show title |
1171 | 1215 | $showtitle = 1; |
1172 | - if (!empty($conf->dol_optimize_smallscreen)) |
|
1173 | - $showtitle = 0; |
|
1216 | + if (!empty($conf->dol_optimize_smallscreen)) { |
|
1217 | + $showtitle = 0; |
|
1218 | + } |
|
1174 | 1219 | if (!empty($title) && $showtitle) { |
1175 | 1220 | $limittitle = 30; |
1176 | 1221 | $out .= '<a class="tabTitle">'; |
1177 | - if ($picto) |
|
1178 | - $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' '; |
|
1222 | + if ($picto) { |
|
1223 | + $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' '; |
|
1224 | + } |
|
1179 | 1225 | $out .= '<span class="tabTitleText">' . dol_trunc($title, $limittitle) . '</span>'; |
1180 | 1226 | $out .= '</a>'; |
1181 | 1227 | } |
@@ -1184,12 +1230,14 @@ discard block |
||
1184 | 1230 | $maxkey = -1; |
1185 | 1231 | if (is_array($links) && !empty($links)) { |
1186 | 1232 | $keys = array_keys($links); |
1187 | - if (count($keys)) |
|
1188 | - $maxkey = max($keys); |
|
1233 | + if (count($keys)) { |
|
1234 | + $maxkey = max($keys); |
|
1235 | + } |
|
1189 | 1236 | } |
1190 | 1237 | |
1191 | - if (!empty($conf->dol_optimize_smallscreen)) |
|
1192 | - $conf->global->MAIN_MAXTABS_IN_CARD = 2; |
|
1238 | + if (!empty($conf->dol_optimize_smallscreen)) { |
|
1239 | + $conf->global->MAIN_MAXTABS_IN_CARD = 2; |
|
1240 | + } |
|
1193 | 1241 | |
1194 | 1242 | // Show tabs |
1195 | 1243 | $bactive = false; |
@@ -1202,8 +1250,9 @@ discard block |
||
1202 | 1250 | for ($i = 0; $i <= $maxkey; $i++) { |
1203 | 1251 | if ((is_numeric($active) && $i == $active) || (!empty($links[$i][2]) && !is_numeric($active) && $active == $links[$i][2])) { |
1204 | 1252 | // If active tab is already present |
1205 | - if ($i >= $limittoshow) |
|
1206 | - $limittoshow--; |
|
1253 | + if ($i >= $limittoshow) { |
|
1254 | + $limittoshow--; |
|
1255 | + } |
|
1207 | 1256 | } |
1208 | 1257 | } |
1209 | 1258 | |
@@ -1244,12 +1293,12 @@ discard block |
||
1244 | 1293 | } |
1245 | 1294 | $outmore .= '<div class="popuptab wordwrap" style="display:inherit;">'; |
1246 | 1295 | if (isset($links[$i][2]) && $links[$i][2] == 'image') { |
1247 | - if (!empty($links[$i][0])) |
|
1248 | - $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
1249 | - else |
|
1250 | - $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
1251 | - } |
|
1252 | - else if (!empty($links[$i][1])) { |
|
1296 | + if (!empty($links[$i][0])) { |
|
1297 | + $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
1298 | + } else { |
|
1299 | + $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
1300 | + } |
|
1301 | + } else if (!empty($links[$i][1])) { |
|
1253 | 1302 | $outmore .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="wordwrap inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
1254 | 1303 | $outmore .= preg_replace('/([a-z])\/([a-z])/i', '\\1 / \\2', $links[$i][1]); // Replace x/y with x / y to allow wrap on long composed texts. |
1255 | 1304 | $outmore .= '</a>' . "\n"; |
@@ -1260,8 +1309,9 @@ discard block |
||
1260 | 1309 | } |
1261 | 1310 | $displaytab = $i; |
1262 | 1311 | } |
1263 | - if ($popuptab) |
|
1264 | - $outmore .= '</div>'; |
|
1312 | + if ($popuptab) { |
|
1313 | + $outmore .= '</div>'; |
|
1314 | + } |
|
1265 | 1315 | |
1266 | 1316 | if ($displaytab > $limittoshow) { |
1267 | 1317 | $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); |
@@ -1284,8 +1334,9 @@ discard block |
||
1284 | 1334 | |
1285 | 1335 | $out .= "</div>\n"; |
1286 | 1336 | |
1287 | - if (!$notab || $notab == -1) |
|
1288 | - $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n"; |
|
1337 | + if (!$notab || $notab == -1) { |
|
1338 | + $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n"; |
|
1339 | + } |
|
1289 | 1340 | |
1290 | 1341 | $parameters = array('tabname' => $active, 'out' => $out); |
1291 | 1342 | $reshook = $hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead" |
@@ -1315,11 +1366,12 @@ discard block |
||
1315 | 1366 | */ |
1316 | 1367 | function dol_get_fiche_end($notab = 0) |
1317 | 1368 | { |
1318 | - if (!$notab || $notab == -1) |
|
1319 | - return "\n</div>\n"; |
|
1320 | - else |
|
1321 | - return ''; |
|
1322 | -} |
|
1369 | + if (!$notab || $notab == -1) { |
|
1370 | + return "\n</div>\n"; |
|
1371 | + } else { |
|
1372 | + return ''; |
|
1373 | + } |
|
1374 | + } |
|
1323 | 1375 | |
1324 | 1376 | /** |
1325 | 1377 | * Show tab footer of a card. |
@@ -1350,40 +1402,55 @@ discard block |
||
1350 | 1402 | $showimage = 1; |
1351 | 1403 | $entity = (empty($object->entity) ? $conf->entity : $object->entity); |
1352 | 1404 | $showbarcode = empty($conf->barcode->enabled) ? 0 : ($object->barcode ? 1 : 0); |
1353 | - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) |
|
1354 | - $showbarcode = 0; |
|
1405 | + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) { |
|
1406 | + $showbarcode = 0; |
|
1407 | + } |
|
1355 | 1408 | $modulepart = 'unknown'; |
1356 | 1409 | |
1357 | - if ($object->element == 'societe') |
|
1358 | - $modulepart = 'societe'; |
|
1359 | - if ($object->element == 'contact') |
|
1360 | - $modulepart = 'contact'; |
|
1361 | - if ($object->element == 'member') |
|
1362 | - $modulepart = 'memberphoto'; |
|
1363 | - if ($object->element == 'user') |
|
1364 | - $modulepart = 'userphoto'; |
|
1365 | - if ($object->element == 'product') |
|
1366 | - $modulepart = 'product'; |
|
1410 | + if ($object->element == 'societe') { |
|
1411 | + $modulepart = 'societe'; |
|
1412 | + } |
|
1413 | + if ($object->element == 'contact') { |
|
1414 | + $modulepart = 'contact'; |
|
1415 | + } |
|
1416 | + if ($object->element == 'member') { |
|
1417 | + $modulepart = 'memberphoto'; |
|
1418 | + } |
|
1419 | + if ($object->element == 'user') { |
|
1420 | + $modulepart = 'userphoto'; |
|
1421 | + } |
|
1422 | + if ($object->element == 'product') { |
|
1423 | + $modulepart = 'product'; |
|
1424 | + } |
|
1367 | 1425 | |
1368 | 1426 | if (class_exists("Imagick")) { |
1369 | - if ($object->element == 'propal') |
|
1370 | - $modulepart = 'propal'; |
|
1371 | - if ($object->element == 'commande') |
|
1372 | - $modulepart = 'commande'; |
|
1373 | - if ($object->element == 'facture') |
|
1374 | - $modulepart = 'facture'; |
|
1375 | - if ($object->element == 'fichinter') |
|
1376 | - $modulepart = 'ficheinter'; |
|
1377 | - if ($object->element == 'contrat') |
|
1378 | - $modulepart = 'contract'; |
|
1379 | - if ($object->element == 'supplier_proposal') |
|
1380 | - $modulepart = 'supplier_proposal'; |
|
1381 | - if ($object->element == 'order_supplier') |
|
1382 | - $modulepart = 'supplier_order'; |
|
1383 | - if ($object->element == 'invoice_supplier') |
|
1384 | - $modulepart = 'supplier_invoice'; |
|
1385 | - if ($object->element == 'expensereport') |
|
1386 | - $modulepart = 'expensereport'; |
|
1427 | + if ($object->element == 'propal') { |
|
1428 | + $modulepart = 'propal'; |
|
1429 | + } |
|
1430 | + if ($object->element == 'commande') { |
|
1431 | + $modulepart = 'commande'; |
|
1432 | + } |
|
1433 | + if ($object->element == 'facture') { |
|
1434 | + $modulepart = 'facture'; |
|
1435 | + } |
|
1436 | + if ($object->element == 'fichinter') { |
|
1437 | + $modulepart = 'ficheinter'; |
|
1438 | + } |
|
1439 | + if ($object->element == 'contrat') { |
|
1440 | + $modulepart = 'contract'; |
|
1441 | + } |
|
1442 | + if ($object->element == 'supplier_proposal') { |
|
1443 | + $modulepart = 'supplier_proposal'; |
|
1444 | + } |
|
1445 | + if ($object->element == 'order_supplier') { |
|
1446 | + $modulepart = 'supplier_order'; |
|
1447 | + } |
|
1448 | + if ($object->element == 'invoice_supplier') { |
|
1449 | + $modulepart = 'supplier_invoice'; |
|
1450 | + } |
|
1451 | + if ($object->element == 'expensereport') { |
|
1452 | + $modulepart = 'expensereport'; |
|
1453 | + } |
|
1387 | 1454 | } |
1388 | 1455 | |
1389 | 1456 | if ($object->element == 'product') { |
@@ -1391,11 +1458,12 @@ discard block |
||
1391 | 1458 | $cssclass = 'photoref'; |
1392 | 1459 | $showimage = $object->is_photo_available($conf->product->multidir_output[$entity]); |
1393 | 1460 | $maxvisiblephotos = (isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO) ? $conf->global->PRODUCT_MAX_VISIBLE_PHOTO : 5); |
1394 | - if ($conf->browser->layout == 'phone') |
|
1395 | - $maxvisiblephotos = 1; |
|
1396 | - if ($showimage) |
|
1397 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>'; |
|
1398 | - else { |
|
1461 | + if ($conf->browser->layout == 'phone') { |
|
1462 | + $maxvisiblephotos = 1; |
|
1463 | + } |
|
1464 | + if ($showimage) { |
|
1465 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>'; |
|
1466 | + } else { |
|
1399 | 1467 | if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { |
1400 | 1468 | $nophoto = ''; |
1401 | 1469 | $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"></div>'; |
@@ -1411,11 +1479,12 @@ discard block |
||
1411 | 1479 | $cssclass = 'photoref'; |
1412 | 1480 | $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity] . '/' . $object->track_id); |
1413 | 1481 | $maxvisiblephotos = (isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO) ? $conf->global->TICKETSUP_MAX_VISIBLE_PHOTO : 2); |
1414 | - if ($conf->browser->layout == 'phone') |
|
1415 | - $maxvisiblephotos = 1; |
|
1416 | - if ($showimage) |
|
1417 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('ticket', $conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>'; |
|
1418 | - else { |
|
1482 | + if ($conf->browser->layout == 'phone') { |
|
1483 | + $maxvisiblephotos = 1; |
|
1484 | + } |
|
1485 | + if ($showimage) { |
|
1486 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('ticket', $conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>'; |
|
1487 | + } else { |
|
1419 | 1488 | if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) { |
1420 | 1489 | $nophoto = ''; |
1421 | 1490 | $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"></div>'; |
@@ -1440,8 +1509,10 @@ discard block |
||
1440 | 1509 | } else { |
1441 | 1510 | $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart); |
1442 | 1511 | } |
1443 | - if (empty($subdir)) |
|
1444 | - $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path |
|
1512 | + if (empty($subdir)) { |
|
1513 | + $subdir = 'errorgettingsubdirofobject'; |
|
1514 | + } |
|
1515 | + // Protection to avoid to return empty path |
|
1445 | 1516 | |
1446 | 1517 | $filepath = $dir_output . $subdir . "/"; |
1447 | 1518 | |
@@ -1462,14 +1533,16 @@ discard block |
||
1462 | 1533 | if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) { // If you experienc trouble with pdf thumb generation and imagick, you can disable here. |
1463 | 1534 | include_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
1464 | 1535 | $ret = dol_convert_file($file, 'png', $fileimage); |
1465 | - if ($ret < 0) |
|
1466 | - $error++; |
|
1536 | + if ($ret < 0) { |
|
1537 | + $error++; |
|
1538 | + } |
|
1467 | 1539 | } |
1468 | 1540 | } |
1469 | 1541 | |
1470 | 1542 | $heightforphotref = 70; |
1471 | - if (!empty($conf->dol_optimize_smallscreen)) |
|
1472 | - $heightforphotref = 60; |
|
1543 | + if (!empty($conf->dol_optimize_smallscreen)) { |
|
1544 | + $heightforphotref = 60; |
|
1545 | + } |
|
1473 | 1546 | // Si fichier png PDF d'1 page trouve |
1474 | 1547 | if (file_exists($fileimage)) { |
1475 | 1548 | $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; |
@@ -1505,8 +1578,10 @@ discard block |
||
1505 | 1578 | $width = 14; |
1506 | 1579 | $cssclass = 'photorefcenter'; |
1507 | 1580 | $picto = $object->picto; |
1508 | - if ($object->element == 'project' && !$object->public) |
|
1509 | - $picto = 'project'; // instead of projectpub |
|
1581 | + if ($object->element == 'project' && !$object->public) { |
|
1582 | + $picto = 'project'; |
|
1583 | + } |
|
1584 | + // instead of projectpub |
|
1510 | 1585 | $nophoto = img_picto('', 'object_' . $picto, '', false, 1); |
1511 | 1586 | } |
1512 | 1587 | $morehtmlleft .= '<!-- No photo to show -->'; |
@@ -1517,8 +1592,9 @@ discard block |
||
1517 | 1592 | } |
1518 | 1593 | } |
1519 | 1594 | |
1520 | - if ($showbarcode) |
|
1521 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>'; |
|
1595 | + if ($showbarcode) { |
|
1596 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>'; |
|
1597 | + } |
|
1522 | 1598 | |
1523 | 1599 | if ($object->element == 'societe') { |
1524 | 1600 | if (!empty($conf->use_javascript_ajax) && $user->rights->societe->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { |
@@ -1542,35 +1618,37 @@ discard block |
||
1542 | 1618 | } |
1543 | 1619 | } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) { |
1544 | 1620 | $tmptxt = $object->getLibStatut(6, $object->totalpaye); |
1545 | - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout == 'phone') |
|
1546 | - $tmptxt = $object->getLibStatut(5, $object->totalpaye); |
|
1621 | + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout == 'phone') { |
|
1622 | + $tmptxt = $object->getLibStatut(5, $object->totalpaye); |
|
1623 | + } |
|
1547 | 1624 | $morehtmlstatus .= $tmptxt; |
1548 | - } |
|
1549 | - elseif ($object->element == 'contrat' || $object->element == 'contract') { |
|
1550 | - if ($object->statut == 0) |
|
1551 | - $morehtmlstatus .= $object->getLibStatut(5); |
|
1552 | - else |
|
1553 | - $morehtmlstatus .= $object->getLibStatut(4); |
|
1554 | - } |
|
1555 | - elseif ($object->element == 'facturerec') { |
|
1556 | - if ($object->frequency == 0) |
|
1557 | - $morehtmlstatus .= $object->getLibStatut(2); |
|
1558 | - else |
|
1559 | - $morehtmlstatus .= $object->getLibStatut(5); |
|
1560 | - } |
|
1561 | - elseif ($object->element == 'project_task') { |
|
1625 | + } elseif ($object->element == 'contrat' || $object->element == 'contract') { |
|
1626 | + if ($object->statut == 0) { |
|
1627 | + $morehtmlstatus .= $object->getLibStatut(5); |
|
1628 | + } else { |
|
1629 | + $morehtmlstatus .= $object->getLibStatut(4); |
|
1630 | + } |
|
1631 | + } elseif ($object->element == 'facturerec') { |
|
1632 | + if ($object->frequency == 0) { |
|
1633 | + $morehtmlstatus .= $object->getLibStatut(2); |
|
1634 | + } else { |
|
1635 | + $morehtmlstatus .= $object->getLibStatut(5); |
|
1636 | + } |
|
1637 | + } elseif ($object->element == 'project_task') { |
|
1562 | 1638 | $object->fk_statut = 1; |
1563 | - if ($object->progress > 0) |
|
1564 | - $object->fk_statut = 2; |
|
1565 | - if ($object->progress >= 100) |
|
1566 | - $object->fk_statut = 3; |
|
1639 | + if ($object->progress > 0) { |
|
1640 | + $object->fk_statut = 2; |
|
1641 | + } |
|
1642 | + if ($object->progress >= 100) { |
|
1643 | + $object->fk_statut = 3; |
|
1644 | + } |
|
1567 | 1645 | $tmptxt = $object->getLibStatut(5); |
1568 | 1646 | $morehtmlstatus .= $tmptxt; // No status on task |
1569 | - } |
|
1570 | - else { // Generic case |
|
1647 | + } else { // Generic case |
|
1571 | 1648 | $tmptxt = $object->getLibStatut(6); |
1572 | - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout == 'phone') |
|
1573 | - $tmptxt = $object->getLibStatut(5); |
|
1649 | + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout == 'phone') { |
|
1650 | + $tmptxt = $object->getLibStatut(5); |
|
1651 | + } |
|
1574 | 1652 | $morehtmlstatus .= $tmptxt; |
1575 | 1653 | } |
1576 | 1654 | |
@@ -1584,13 +1662,15 @@ discard block |
||
1584 | 1662 | } |
1585 | 1663 | |
1586 | 1664 | // Add alias for thirdparty |
1587 | - if (!empty($object->name_alias)) |
|
1588 | - $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>'; |
|
1665 | + if (!empty($object->name_alias)) { |
|
1666 | + $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>'; |
|
1667 | + } |
|
1589 | 1668 | |
1590 | 1669 | // Add label |
1591 | 1670 | if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task') { |
1592 | - if (!empty($object->label)) |
|
1593 | - $morehtmlref .= '<div class="refidno">' . $object->label . '</div>'; |
|
1671 | + if (!empty($object->label)) { |
|
1672 | + $morehtmlref .= '<div class="refidno">' . $object->label . '</div>'; |
|
1673 | + } |
|
1594 | 1674 | } |
1595 | 1675 | |
1596 | 1676 | if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') { |
@@ -1623,15 +1703,19 @@ discard block |
||
1623 | 1703 | { |
1624 | 1704 | global $conf, $langs; |
1625 | 1705 | $ret = ''; |
1626 | - if ($fieldrequired) |
|
1627 | - $ret .= '<span class="fieldrequired">'; |
|
1628 | - if (($conf->dol_use_jmobile != 4)) |
|
1629 | - $ret .= '<label for="' . $fieldkey . '">'; |
|
1706 | + if ($fieldrequired) { |
|
1707 | + $ret .= '<span class="fieldrequired">'; |
|
1708 | + } |
|
1709 | + if (($conf->dol_use_jmobile != 4)) { |
|
1710 | + $ret .= '<label for="' . $fieldkey . '">'; |
|
1711 | + } |
|
1630 | 1712 | $ret .= $langs->trans($langkey); |
1631 | - if (($conf->dol_use_jmobile != 4)) |
|
1632 | - $ret .= '</label>'; |
|
1633 | - if ($fieldrequired) |
|
1634 | - $ret .= '</span>'; |
|
1713 | + if (($conf->dol_use_jmobile != 4)) { |
|
1714 | + $ret .= '</label>'; |
|
1715 | + } |
|
1716 | + if ($fieldrequired) { |
|
1717 | + $ret .= '</span>'; |
|
1718 | + } |
|
1635 | 1719 | return $ret; |
1636 | 1720 | } |
1637 | 1721 | |
@@ -1646,8 +1730,9 @@ discard block |
||
1646 | 1730 | { |
1647 | 1731 | global $bc; |
1648 | 1732 | $ret = ' ' . $bc[$var]; |
1649 | - if ($moreclass) |
|
1650 | - $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret); |
|
1733 | + if ($moreclass) { |
|
1734 | + $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret); |
|
1735 | + } |
|
1651 | 1736 | return $ret; |
1652 | 1737 | } |
1653 | 1738 | |
@@ -1678,18 +1763,18 @@ discard block |
||
1678 | 1763 | if ($object->state) { |
1679 | 1764 | $ret .= ($ret ? ", " : '') . $object->state; |
1680 | 1765 | } |
1681 | - if ($object->zip) |
|
1682 | - $ret .= ($ret ? ", " : '') . $object->zip; |
|
1683 | - } |
|
1684 | - else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country |
|
1766 | + if ($object->zip) { |
|
1767 | + $ret .= ($ret ? ", " : '') . $object->zip; |
|
1768 | + } |
|
1769 | + } else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country |
|
1685 | 1770 | $ret .= ($ret ? $sep : '' ) . $object->town; |
1686 | 1771 | if ($object->state) { |
1687 | 1772 | $ret .= ($ret ? ", " : '') . $object->state; |
1688 | 1773 | } |
1689 | - if ($object->zip) |
|
1690 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
1691 | - } |
|
1692 | - else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country |
|
1774 | + if ($object->zip) { |
|
1775 | + $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
1776 | + } |
|
1777 | + } else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country |
|
1693 | 1778 | $ret .= ($ret ? $sep : '' ) . $object->zip; |
1694 | 1779 | $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : ''); |
1695 | 1780 | if ($object->state) { |
@@ -1706,8 +1791,9 @@ discard block |
||
1706 | 1791 | $ret .= ($ret ? ", " : '') . $object->state; |
1707 | 1792 | } |
1708 | 1793 | } |
1709 | - if (!is_object($outputlangs)) |
|
1710 | - $outputlangs = $langs; |
|
1794 | + if (!is_object($outputlangs)) { |
|
1795 | + $outputlangs = $langs; |
|
1796 | + } |
|
1711 | 1797 | if ($withcountry) { |
1712 | 1798 | $langs->load("dict"); |
1713 | 1799 | $ret .= ($object->country_code ? ($ret ? $sep : '') . $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country" . $object->country_code)) : ''); |
@@ -1728,9 +1814,10 @@ discard block |
||
1728 | 1814 | { |
1729 | 1815 | if ((abs($ts) <= 0x7FFFFFFF)) { // check if number in 32-bit signed range |
1730 | 1816 | return ($is_gmt) ? @gmstrftime($fmt, $ts) : @strftime($fmt, $ts); |
1731 | - } else |
|
1732 | - return 'Error date into a not supported range'; |
|
1733 | -} |
|
1817 | + } else { |
|
1818 | + return 'Error date into a not supported range'; |
|
1819 | + } |
|
1820 | + } |
|
1734 | 1821 | |
1735 | 1822 | /** |
1736 | 1823 | * Output date in a string format according to outputlangs (or langs if not defined). |
@@ -1776,10 +1863,12 @@ discard block |
||
1776 | 1863 | } |
1777 | 1864 | } |
1778 | 1865 | } |
1779 | - if (!is_object($outputlangs)) |
|
1780 | - $outputlangs = $langs; |
|
1781 | - if (!$format) |
|
1782 | - $format = 'daytextshort'; |
|
1866 | + if (!is_object($outputlangs)) { |
|
1867 | + $outputlangs = $langs; |
|
1868 | + } |
|
1869 | + if (!$format) { |
|
1870 | + $format = 'daytextshort'; |
|
1871 | + } |
|
1783 | 1872 | $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0; |
1784 | 1873 | $formatwithoutreduce = preg_replace('/reduceformat/', '', $format); |
1785 | 1874 | if ($formatwithoutreduce != $format) { |
@@ -1788,40 +1877,46 @@ discard block |
||
1788 | 1877 | } // so format 'dayreduceformat' is processed like day |
1789 | 1878 | // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. |
1790 | 1879 | // TODO Add format daysmallyear and dayhoursmallyear |
1791 | - if ($format == 'day') |
|
1792 | - $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short); |
|
1793 | - else if ($format == 'hour') |
|
1794 | - $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short); |
|
1795 | - else if ($format == 'hourduration') |
|
1796 | - $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration); |
|
1797 | - else if ($format == 'daytext') |
|
1798 | - $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text); |
|
1799 | - else if ($format == 'daytextshort') |
|
1800 | - // Notice: Undefined property: stdClass::$format_date_text_short in \alixar\dolibarr\htdocs\core\lib\functions.lib.php on line 1781 |
|
1801 | - $format = ($outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : $conf->format_date_text_short); |
|
1802 | - else if ($format == 'dayhour') |
|
1803 | - $format = ($outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : $conf->format_date_hour_short); |
|
1804 | - else if ($format == 'dayhoursec') |
|
1805 | - $format = ($outputlangs->trans("FormatDateHourSecShort") != "FormatDateHourSecShort" ? $outputlangs->trans("FormatDateHourSecShort") : $conf->format_date_hour_sec_short); |
|
1806 | - else if ($format == 'dayhourtext') |
|
1807 | - $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text); |
|
1808 | - else if ($format == 'dayhourtextshort') |
|
1809 | - $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short); |
|
1880 | + if ($format == 'day') { |
|
1881 | + $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short); |
|
1882 | + } else if ($format == 'hour') { |
|
1883 | + $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short); |
|
1884 | + } else if ($format == 'hourduration') { |
|
1885 | + $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration); |
|
1886 | + } else if ($format == 'daytext') { |
|
1887 | + $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text); |
|
1888 | + } else if ($format == 'daytextshort') { |
|
1889 | + // Notice: Undefined property: stdClass::$format_date_text_short in \alixar\dolibarr\htdocs\core\lib\functions.lib.php on line 1781 |
|
1890 | + $format = ($outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : $conf->format_date_text_short); |
|
1891 | + } else if ($format == 'dayhour') { |
|
1892 | + $format = ($outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : $conf->format_date_hour_short); |
|
1893 | + } else if ($format == 'dayhoursec') { |
|
1894 | + $format = ($outputlangs->trans("FormatDateHourSecShort") != "FormatDateHourSecShort" ? $outputlangs->trans("FormatDateHourSecShort") : $conf->format_date_hour_sec_short); |
|
1895 | + } else if ($format == 'dayhourtext') { |
|
1896 | + $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text); |
|
1897 | + } else if ($format == 'dayhourtextshort') { |
|
1898 | + $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short); |
|
1899 | + } |
|
1810 | 1900 | // Format not sensitive to language |
1811 | - else if ($format == 'dayhourlog') |
|
1812 | - $format = '%Y%m%d%H%M%S'; |
|
1813 | - else if ($format == 'dayhourldap') |
|
1814 | - $format = '%Y%m%d%H%M%SZ'; |
|
1815 | - else if ($format == 'dayhourxcard') |
|
1816 | - $format = '%Y%m%dT%H%M%SZ'; |
|
1817 | - else if ($format == 'dayxcard') |
|
1818 | - $format = '%Y%m%d'; |
|
1819 | - else if ($format == 'dayrfc') |
|
1820 | - $format = '%Y-%m-%d'; // DATE_RFC3339 |
|
1821 | - else if ($format == 'dayhourrfc') |
|
1822 | - $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 |
|
1823 | - else if ($format == 'standard') |
|
1824 | - $format = '%Y-%m-%d %H:%M:%S'; |
|
1901 | + else if ($format == 'dayhourlog') { |
|
1902 | + $format = '%Y%m%d%H%M%S'; |
|
1903 | + } else if ($format == 'dayhourldap') { |
|
1904 | + $format = '%Y%m%d%H%M%SZ'; |
|
1905 | + } else if ($format == 'dayhourxcard') { |
|
1906 | + $format = '%Y%m%dT%H%M%SZ'; |
|
1907 | + } else if ($format == 'dayxcard') { |
|
1908 | + $format = '%Y%m%d'; |
|
1909 | + } else if ($format == 'dayrfc') { |
|
1910 | + $format = '%Y-%m-%d'; |
|
1911 | + } |
|
1912 | + // DATE_RFC3339 |
|
1913 | + else if ($format == 'dayhourrfc') { |
|
1914 | + $format = '%Y-%m-%dT%H:%M:%SZ'; |
|
1915 | + } |
|
1916 | + // DATETIME RFC3339 |
|
1917 | + else if ($format == 'standard') { |
|
1918 | + $format = '%Y-%m-%d %H:%M:%S'; |
|
1919 | + } |
|
1825 | 1920 | |
1826 | 1921 | if ($reduceformat) { |
1827 | 1922 | $format = str_replace('%Y', '%y', $format); |
@@ -1829,8 +1924,10 @@ discard block |
||
1829 | 1924 | } |
1830 | 1925 | |
1831 | 1926 | // If date undefined or "", we return "" |
1832 | - if (dol_strlen($time) == 0) |
|
1833 | - return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
1927 | + if (dol_strlen($time) == 0) { |
|
1928 | + return ''; |
|
1929 | + } |
|
1930 | + // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
1834 | 1931 | |
1835 | 1932 | |
1836 | 1933 | |
@@ -1885,8 +1982,9 @@ discard block |
||
1885 | 1982 | $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
1886 | 1983 | |
1887 | 1984 | $ret = adodb_strftime($format, $timetouse, $to_gmt); |
1888 | - } else |
|
1889 | - $ret = 'Bad value ' . $time . ' for date'; |
|
1985 | + } else { |
|
1986 | + $ret = 'Bad value ' . $time . ' for date'; |
|
1987 | + } |
|
1890 | 1988 | } |
1891 | 1989 | |
1892 | 1990 | if (preg_match('/__b__/i', $format)) { |
@@ -1957,10 +2055,14 @@ discard block |
||
1957 | 2055 | global $conf; |
1958 | 2056 | |
1959 | 2057 | $usealternatemethod = false; |
1960 | - if ($timestamp <= 0) |
|
1961 | - $usealternatemethod = true; // <= 1970 |
|
1962 | - if ($timestamp >= 2145913200) |
|
1963 | - $usealternatemethod = true; // >= 2038 |
|
2058 | + if ($timestamp <= 0) { |
|
2059 | + $usealternatemethod = true; |
|
2060 | + } |
|
2061 | + // <= 1970 |
|
2062 | + if ($timestamp >= 2145913200) { |
|
2063 | + $usealternatemethod = true; |
|
2064 | + } |
|
2065 | + // >= 2038 |
|
1964 | 2066 | |
1965 | 2067 | if ($usealternatemethod) { |
1966 | 2068 | $arrayinfo = adodb_getdate($timestamp, $fast); |
@@ -1995,27 +2097,36 @@ discard block |
||
1995 | 2097 | global $conf; |
1996 | 2098 | //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; |
1997 | 2099 | // Clean parameters |
1998 | - if ($hour == -1 || empty($hour)) |
|
1999 | - $hour = 0; |
|
2000 | - if ($minute == -1 || empty($minute)) |
|
2001 | - $minute = 0; |
|
2002 | - if ($second == -1 || empty($second)) |
|
2003 | - $second = 0; |
|
2100 | + if ($hour == -1 || empty($hour)) { |
|
2101 | + $hour = 0; |
|
2102 | + } |
|
2103 | + if ($minute == -1 || empty($minute)) { |
|
2104 | + $minute = 0; |
|
2105 | + } |
|
2106 | + if ($second == -1 || empty($second)) { |
|
2107 | + $second = 0; |
|
2108 | + } |
|
2004 | 2109 | |
2005 | 2110 | // Check parameters |
2006 | 2111 | if ($check) { |
2007 | - if (!$month || !$day) |
|
2008 | - return ''; |
|
2009 | - if ($day > 31) |
|
2010 | - return ''; |
|
2011 | - if ($month > 12) |
|
2012 | - return ''; |
|
2013 | - if ($hour < 0 || $hour > 24) |
|
2014 | - return ''; |
|
2015 | - if ($minute < 0 || $minute > 60) |
|
2016 | - return ''; |
|
2017 | - if ($second < 0 || $second > 60) |
|
2018 | - return ''; |
|
2112 | + if (!$month || !$day) { |
|
2113 | + return ''; |
|
2114 | + } |
|
2115 | + if ($day > 31) { |
|
2116 | + return ''; |
|
2117 | + } |
|
2118 | + if ($month > 12) { |
|
2119 | + return ''; |
|
2120 | + } |
|
2121 | + if ($hour < 0 || $hour > 24) { |
|
2122 | + return ''; |
|
2123 | + } |
|
2124 | + if ($minute < 0 || $minute > 60) { |
|
2125 | + return ''; |
|
2126 | + } |
|
2127 | + if ($second < 0 || $second > 60) { |
|
2128 | + return ''; |
|
2129 | + } |
|
2019 | 2130 | } |
2020 | 2131 | |
2021 | 2132 | if (method_exists('DateTime', 'getTimestamp')) { |
@@ -2072,8 +2183,10 @@ discard block |
||
2072 | 2183 | |
2073 | 2184 | // Note that gmmktime and mktime return same value (GMT) when used without parameters |
2074 | 2185 | //if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead |
2075 | - if ($mode == 'gmt') |
|
2076 | - $ret = time(); // Time for now at greenwich. |
|
2186 | + if ($mode == 'gmt') { |
|
2187 | + $ret = time(); |
|
2188 | + } |
|
2189 | + // Time for now at greenwich. |
|
2077 | 2190 | else if ($mode == 'tzserver') { // Time for now with PHP server timezone added |
2078 | 2191 | require_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
2079 | 2192 | $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time |
@@ -2107,8 +2220,9 @@ discard block |
||
2107 | 2220 | global $conf, $langs; |
2108 | 2221 | $level = 1024; |
2109 | 2222 | |
2110 | - if (!empty($conf->dol_optimize_smallscreen)) |
|
2111 | - $shortunit = 1; |
|
2223 | + if (!empty($conf->dol_optimize_smallscreen)) { |
|
2224 | + $shortunit = 1; |
|
2225 | + } |
|
2112 | 2226 | |
2113 | 2227 | // Set value text |
2114 | 2228 | if (empty($shortvalue) || $size < ($level * 10)) { |
@@ -2143,19 +2257,23 @@ discard block |
||
2143 | 2257 | { |
2144 | 2258 | global $langs; |
2145 | 2259 | |
2146 | - if (empty($url)) |
|
2147 | - return ''; |
|
2260 | + if (empty($url)) { |
|
2261 | + return ''; |
|
2262 | + } |
|
2148 | 2263 | |
2149 | 2264 | $link = '<a href="'; |
2150 | - if (!preg_match('/^http/i', $url)) |
|
2151 | - $link .= 'http://'; |
|
2265 | + if (!preg_match('/^http/i', $url)) { |
|
2266 | + $link .= 'http://'; |
|
2267 | + } |
|
2152 | 2268 | $link .= $url; |
2153 | 2269 | $link .= '"'; |
2154 | - if ($target) |
|
2155 | - $link .= ' target="' . $target . '"'; |
|
2270 | + if ($target) { |
|
2271 | + $link .= ' target="' . $target . '"'; |
|
2272 | + } |
|
2156 | 2273 | $link .= '>'; |
2157 | - if (!preg_match('/^http/i', $url)) |
|
2158 | - $link .= 'http://'; |
|
2274 | + if (!preg_match('/^http/i', $url)) { |
|
2275 | + $link .= 'http://'; |
|
2276 | + } |
|
2159 | 2277 | $link .= dol_trunc($url, $max); |
2160 | 2278 | $link .= '</a>'; |
2161 | 2279 | return '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto($langs->trans("Url"), 'object_globe.png') . ' ' : '') . $link . '</div>'; |
@@ -2179,13 +2297,15 @@ discard block |
||
2179 | 2297 | |
2180 | 2298 | $newemail = $email; |
2181 | 2299 | |
2182 | - if (empty($email)) |
|
2183 | - return ' '; |
|
2300 | + if (empty($email)) { |
|
2301 | + return ' '; |
|
2302 | + } |
|
2184 | 2303 | |
2185 | 2304 | if (!empty($addlink)) { |
2186 | 2305 | $newemail = '<a style="text-overflow: ellipsis;" href="'; |
2187 | - if (!preg_match('/^mailto:/i', $email)) |
|
2188 | - $newemail .= 'mailto:'; |
|
2306 | + if (!preg_match('/^mailto:/i', $email)) { |
|
2307 | + $newemail .= 'mailto:'; |
|
2308 | + } |
|
2189 | 2309 | $newemail .= $email; |
2190 | 2310 | $newemail .= '">'; |
2191 | 2311 | $newemail .= dol_trunc($email, $max); |
@@ -2198,13 +2318,14 @@ discard block |
||
2198 | 2318 | if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { |
2199 | 2319 | $type = 'AC_EMAIL'; |
2200 | 2320 | $link = ''; |
2201 | - if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) |
|
2202 | - $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2203 | - if ($link) |
|
2204 | - $newemail = '<div>' . $newemail . ' ' . $link . '</div>'; |
|
2321 | + if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) { |
|
2322 | + $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2323 | + } |
|
2324 | + if ($link) { |
|
2325 | + $newemail = '<div>' . $newemail . ' ' . $link . '</div>'; |
|
2326 | + } |
|
2205 | 2327 | } |
2206 | - } |
|
2207 | - else { |
|
2328 | + } else { |
|
2208 | 2329 | if ($showinvalid && !isValidEmail($email)) { |
2209 | 2330 | $langs->load("errors"); |
2210 | 2331 | $newemail .= img_warning($langs->trans("ErrorBadEMail", $email)); |
@@ -2236,8 +2357,9 @@ discard block |
||
2236 | 2357 | |
2237 | 2358 | $newskype = $value; |
2238 | 2359 | |
2239 | - if (empty($value)) |
|
2240 | - return ' '; |
|
2360 | + if (empty($value)) { |
|
2361 | + return ' '; |
|
2362 | + } |
|
2241 | 2363 | |
2242 | 2364 | if (!empty($type)) { |
2243 | 2365 | $newskype = '<div class="divsocialnetwork inline-block valignmiddle">'; |
@@ -2258,13 +2380,13 @@ discard block |
||
2258 | 2380 | if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type == 'skype') { |
2259 | 2381 | $addlink = 'AC_SKYPE'; |
2260 | 2382 | $link = ''; |
2261 | - if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) |
|
2262 | - $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $addlink . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2383 | + if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE)) { |
|
2384 | + $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $addlink . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2385 | + } |
|
2263 | 2386 | $newskype .= ($link ? ' ' . $link : ''); |
2264 | 2387 | } |
2265 | 2388 | $newskype .= '</div>'; |
2266 | - } |
|
2267 | - else { |
|
2389 | + } else { |
|
2268 | 2390 | $langs->load("errors"); |
2269 | 2391 | $newskype .= img_warning($langs->trans("ErrorBadSocialNetworkValue", $value)); |
2270 | 2392 | } |
@@ -2294,12 +2416,14 @@ discard block |
||
2294 | 2416 | if (empty($phone)) { |
2295 | 2417 | return ''; |
2296 | 2418 | } |
2297 | - if (empty($countrycode)) |
|
2298 | - $countrycode = $mysoc->country_code; |
|
2419 | + if (empty($countrycode)) { |
|
2420 | + $countrycode = $mysoc->country_code; |
|
2421 | + } |
|
2299 | 2422 | |
2300 | 2423 | // Short format for small screens |
2301 | - if ($conf->dol_optimize_smallscreen) |
|
2302 | - $separ = ''; |
|
2424 | + if ($conf->dol_optimize_smallscreen) { |
|
2425 | + $separ = ''; |
|
2426 | + } |
|
2303 | 2427 | |
2304 | 2428 | $newphone = $phone; |
2305 | 2429 | if (strtoupper($countrycode) == "FR") { |
@@ -2465,15 +2589,18 @@ discard block |
||
2465 | 2589 | $newphone = '<a href="tel:' . $phone . '"'; |
2466 | 2590 | $newphone .= '>' . $phone . '</a>'; |
2467 | 2591 | } else if (!empty($conf->clicktodial->enabled) && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url |
2468 | - if (empty($user->clicktodial_loaded)) |
|
2469 | - $user->fetch_clicktodial(); |
|
2592 | + if (empty($user->clicktodial_loaded)) { |
|
2593 | + $user->fetch_clicktodial(); |
|
2594 | + } |
|
2470 | 2595 | |
2471 | 2596 | // Define urlmask |
2472 | 2597 | $urlmask = 'ErrorClickToDialModuleNotConfigured'; |
2473 | - if (!empty($conf->global->CLICKTODIAL_URL)) |
|
2474 | - $urlmask = $conf->global->CLICKTODIAL_URL; |
|
2475 | - if (!empty($user->clicktodial_url)) |
|
2476 | - $urlmask = $user->clicktodial_url; |
|
2598 | + if (!empty($conf->global->CLICKTODIAL_URL)) { |
|
2599 | + $urlmask = $conf->global->CLICKTODIAL_URL; |
|
2600 | + } |
|
2601 | + if (!empty($user->clicktodial_url)) { |
|
2602 | + $urlmask = $user->clicktodial_url; |
|
2603 | + } |
|
2477 | 2604 | |
2478 | 2605 | $clicktodial_poste = (!empty($user->clicktodial_poste) ? urlencode($user->clicktodial_poste) : ''); |
2479 | 2606 | $clicktodial_login = (!empty($user->clicktodial_login) ? urlencode($user->clicktodial_login) : ''); |
@@ -2488,8 +2615,9 @@ discard block |
||
2488 | 2615 | $url = make_substitutions($url, $substitarray); |
2489 | 2616 | $newphonesav = $newphone; |
2490 | 2617 | $newphone = '<a href="' . $url . '"'; |
2491 | - if (!empty($conf->global->CLICKTODIAL_FORCENEWTARGET)) |
|
2492 | - $newphone .= ' target="_blank"'; |
|
2618 | + if (!empty($conf->global->CLICKTODIAL_FORCENEWTARGET)) { |
|
2619 | + $newphone .= ' target="_blank"'; |
|
2620 | + } |
|
2493 | 2621 | $newphone .= '>' . $newphonesav . '</a>'; |
2494 | 2622 | } |
2495 | 2623 | |
@@ -2497,12 +2625,15 @@ discard block |
||
2497 | 2625 | if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { |
2498 | 2626 | $type = 'AC_TEL'; |
2499 | 2627 | $link = ''; |
2500 | - if ($addlink == 'AC_FAX') |
|
2501 | - $type = 'AC_FAX'; |
|
2502 | - if (!empty($conf->global->AGENDA_ADDACTIONFORPHONE)) |
|
2503 | - $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . ($cid ? '&contactid=' . $cid : '') . ($socid ? '&socid=' . $socid : '') . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2504 | - if ($link) |
|
2505 | - $newphone = '<div>' . $newphone . ' ' . $link . '</div>'; |
|
2628 | + if ($addlink == 'AC_FAX') { |
|
2629 | + $type = 'AC_FAX'; |
|
2630 | + } |
|
2631 | + if (!empty($conf->global->AGENDA_ADDACTIONFORPHONE)) { |
|
2632 | + $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . ($cid ? '&contactid=' . $cid : '') . ($socid ? '&socid=' . $socid : '') . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2633 | + } |
|
2634 | + if ($link) { |
|
2635 | + $newphone = '<div>' . $newphone . ' ' . $link . '</div>'; |
|
2636 | + } |
|
2506 | 2637 | } |
2507 | 2638 | } |
2508 | 2639 | |
@@ -2529,15 +2660,17 @@ discard block |
||
2529 | 2660 | $picto = ''; |
2530 | 2661 | } |
2531 | 2662 | } |
2532 | - if ($adddivfloat) |
|
2533 | - $rep .= '<div class="nospan float" style="margin-right: 10px">'; |
|
2534 | - else |
|
2535 | - $rep .= '<span style="margin-right: 10px;">'; |
|
2663 | + if ($adddivfloat) { |
|
2664 | + $rep .= '<div class="nospan float" style="margin-right: 10px">'; |
|
2665 | + } else { |
|
2666 | + $rep .= '<span style="margin-right: 10px;">'; |
|
2667 | + } |
|
2536 | 2668 | $rep .= ($withpicto ? img_picto($titlealt, 'object_' . $picto . '.png') . ' ' : '') . $newphone; |
2537 | - if ($adddivfloat) |
|
2538 | - $rep .= '</div>'; |
|
2539 | - else |
|
2540 | - $rep .= '</span>'; |
|
2669 | + if ($adddivfloat) { |
|
2670 | + $rep .= '</div>'; |
|
2671 | + } else { |
|
2672 | + $rep .= '</span>'; |
|
2673 | + } |
|
2541 | 2674 | } |
2542 | 2675 | |
2543 | 2676 | return $rep; |
@@ -2568,8 +2701,9 @@ discard block |
||
2568 | 2701 | if ($countrycode) { // If success, countrycode is us, fr, ... |
2569 | 2702 | if (file_exists(DOL_BASE_PATH . '/theme/common/flags/' . $countrycode . '.png')) { |
2570 | 2703 | $ret .= ' ' . img_picto($countrycode . ' ' . $langs->trans("AccordingToGeoIPDatabase"), DOL_BASE_URI . '/theme/common/flags/' . $countrycode . '.png', '', 1); |
2571 | - } else |
|
2572 | - $ret .= ' (' . $countrycode . ')'; |
|
2704 | + } else { |
|
2705 | + $ret .= ' (' . $countrycode . ')'; |
|
2706 | + } |
|
2573 | 2707 | } |
2574 | 2708 | } |
2575 | 2709 | |
@@ -2667,26 +2801,33 @@ discard block |
||
2667 | 2801 | $out .= $hookmanager->resPrint; |
2668 | 2802 | } |
2669 | 2803 | if (empty($reshook)) { |
2670 | - if (empty($charfornl)) |
|
2671 | - $out .= nl2br($address); |
|
2672 | - else |
|
2673 | - $out .= preg_replace('/[\r\n]+/', $charfornl, $address); |
|
2804 | + if (empty($charfornl)) { |
|
2805 | + $out .= nl2br($address); |
|
2806 | + } else { |
|
2807 | + $out .= preg_replace('/[\r\n]+/', $charfornl, $address); |
|
2808 | + } |
|
2674 | 2809 | |
2675 | 2810 | $showgmap = $showomap = 0; |
2676 | 2811 | |
2677 | 2812 | // TODO Add a hook here |
2678 | - if (($mode == 'thirdparty' || $mode == 'societe') && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS)) |
|
2679 | - $showgmap = 1; |
|
2680 | - if ($mode == 'contact' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) |
|
2681 | - $showgmap = 1; |
|
2682 | - if ($mode == 'member' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) |
|
2683 | - $showgmap = 1; |
|
2684 | - if (($mode == 'thirdparty' || $mode == 'societe') && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) |
|
2685 | - $showomap = 1; |
|
2686 | - if ($mode == 'contact' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) |
|
2687 | - $showomap = 1; |
|
2688 | - if ($mode == 'member' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) |
|
2689 | - $showomap = 1; |
|
2813 | + if (($mode == 'thirdparty' || $mode == 'societe') && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS)) { |
|
2814 | + $showgmap = 1; |
|
2815 | + } |
|
2816 | + if ($mode == 'contact' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) { |
|
2817 | + $showgmap = 1; |
|
2818 | + } |
|
2819 | + if ($mode == 'member' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) { |
|
2820 | + $showgmap = 1; |
|
2821 | + } |
|
2822 | + if (($mode == 'thirdparty' || $mode == 'societe') && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) { |
|
2823 | + $showomap = 1; |
|
2824 | + } |
|
2825 | + if ($mode == 'contact' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) { |
|
2826 | + $showomap = 1; |
|
2827 | + } |
|
2828 | + if ($mode == 'member' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) { |
|
2829 | + $showomap = 1; |
|
2830 | + } |
|
2690 | 2831 | |
2691 | 2832 | if ($showgmap) { |
2692 | 2833 | $url = dol_buildpath('/google/gmaps.php?mode=' . $mode . '&id=' . $id, 1); |
@@ -2698,11 +2839,12 @@ discard block |
||
2698 | 2839 | } |
2699 | 2840 | } |
2700 | 2841 | } |
2701 | - if ($noprint) |
|
2702 | - return $out; |
|
2703 | - else |
|
2704 | - print $out; |
|
2705 | -} |
|
2842 | + if ($noprint) { |
|
2843 | + return $out; |
|
2844 | + } else { |
|
2845 | + print $out; |
|
2846 | + } |
|
2847 | + } |
|
2706 | 2848 | |
2707 | 2849 | /** |
2708 | 2850 | * Return true if email syntax is ok |
@@ -2713,10 +2855,12 @@ discard block |
||
2713 | 2855 | */ |
2714 | 2856 | function isValidEmail($address, $acceptsupervisorkey = 0) |
2715 | 2857 | { |
2716 | - if ($acceptsupervisorkey && $address == '__SUPERVISOREMAIL__') |
|
2717 | - return true; |
|
2718 | - if (filter_var($address, FILTER_VALIDATE_EMAIL)) |
|
2719 | - return true; |
|
2858 | + if ($acceptsupervisorkey && $address == '__SUPERVISOREMAIL__') { |
|
2859 | + return true; |
|
2860 | + } |
|
2861 | + if (filter_var($address, FILTER_VALIDATE_EMAIL)) { |
|
2862 | + return true; |
|
2863 | + } |
|
2720 | 2864 | |
2721 | 2865 | return false; |
2722 | 2866 | } |
@@ -2738,10 +2882,12 @@ discard block |
||
2738 | 2882 | $mxhosts = array(); |
2739 | 2883 | $weight = array(); |
2740 | 2884 | getmxrr(idn_to_ascii($domain), $mxhosts, $weight); |
2741 | - if (count($mxhosts) > 1) |
|
2742 | - return 1; |
|
2743 | - if (count($mxhosts) == 1 && !empty($mxhosts[0])) |
|
2744 | - return 1; |
|
2885 | + if (count($mxhosts) > 1) { |
|
2886 | + return 1; |
|
2887 | + } |
|
2888 | + if (count($mxhosts) == 1 && !empty($mxhosts[0])) { |
|
2889 | + return 1; |
|
2890 | + } |
|
2745 | 2891 | |
2746 | 2892 | return 0; |
2747 | 2893 | } |
@@ -2770,11 +2916,12 @@ discard block |
||
2770 | 2916 | */ |
2771 | 2917 | function dol_strlen($string, $stringencoding = 'UTF-8') |
2772 | 2918 | { |
2773 | - if (function_exists('mb_strlen')) |
|
2774 | - return mb_strlen($string, $stringencoding); |
|
2775 | - else |
|
2776 | - return strlen($string); |
|
2777 | -} |
|
2919 | + if (function_exists('mb_strlen')) { |
|
2920 | + return mb_strlen($string, $stringencoding); |
|
2921 | + } else { |
|
2922 | + return strlen($string); |
|
2923 | + } |
|
2924 | + } |
|
2778 | 2925 | |
2779 | 2926 | /** |
2780 | 2927 | * Make a substring. Works even if mbstring module is not enabled for better compatibility. |
@@ -2790,8 +2937,9 @@ discard block |
||
2790 | 2937 | { |
2791 | 2938 | global $langs; |
2792 | 2939 | |
2793 | - if (empty($stringencoding)) |
|
2794 | - $stringencoding = $langs->charset_output; |
|
2940 | + if (empty($stringencoding)) { |
|
2941 | + $stringencoding = $langs->charset_output; |
|
2942 | + } |
|
2795 | 2943 | |
2796 | 2944 | $ret = ''; |
2797 | 2945 | if (empty($trunconbytes)) { |
@@ -2827,49 +2975,56 @@ discard block |
||
2827 | 2975 | { |
2828 | 2976 | global $conf; |
2829 | 2977 | |
2830 | - if ($size == 0 || !empty($conf->global->MAIN_DISABLE_TRUNC)) |
|
2831 | - return $string; |
|
2978 | + if ($size == 0 || !empty($conf->global->MAIN_DISABLE_TRUNC)) { |
|
2979 | + return $string; |
|
2980 | + } |
|
2832 | 2981 | |
2833 | - if (empty($stringencoding)) |
|
2834 | - $stringencoding = 'UTF-8'; |
|
2982 | + if (empty($stringencoding)) { |
|
2983 | + $stringencoding = 'UTF-8'; |
|
2984 | + } |
|
2835 | 2985 | // reduce for small screen |
2836 | - if ($conf->dol_optimize_smallscreen == 1 && $display == 1) |
|
2837 | - $size = round($size / 3); |
|
2986 | + if ($conf->dol_optimize_smallscreen == 1 && $display == 1) { |
|
2987 | + $size = round($size / 3); |
|
2988 | + } |
|
2838 | 2989 | |
2839 | 2990 | // We go always here |
2840 | 2991 | if ($trunc == 'right') { |
2841 | 2992 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2842 | - if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
|
2843 | - return dol_substr($newstring, 0, $size, $stringencoding) . ($nodot ? '' : '...'); |
|
2844 | - else |
|
2845 | - //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string; |
|
2846 | - return $string; |
|
2847 | - } |
|
2848 | - elseif ($trunc == 'middle') { |
|
2993 | + if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) { |
|
2994 | + // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
|
2995 | + return dol_substr($newstring, 0, $size, $stringencoding) . ($nodot ? '' : '...'); |
|
2996 | + } else { |
|
2997 | + //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string; |
|
2998 | + return $string; |
|
2999 | + } |
|
3000 | + } elseif ($trunc == 'middle') { |
|
2849 | 3001 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2850 | 3002 | if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1)) { |
2851 | 3003 | $size1 = round($size / 2); |
2852 | 3004 | $size2 = round($size / 2); |
2853 | 3005 | return dol_substr($newstring, 0, $size1, $stringencoding) . '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); |
2854 | - } else |
|
2855 | - return $string; |
|
2856 | - } |
|
2857 | - elseif ($trunc == 'left') { |
|
3006 | + } else { |
|
3007 | + return $string; |
|
3008 | + } |
|
3009 | + } elseif ($trunc == 'left') { |
|
2858 | 3010 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2859 | - if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
|
2860 | - return '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
2861 | - else |
|
2862 | - return $string; |
|
2863 | - } |
|
2864 | - elseif ($trunc == 'wrap') { |
|
3011 | + if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) { |
|
3012 | + // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
|
3013 | + return '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
3014 | + } else { |
|
3015 | + return $string; |
|
3016 | + } |
|
3017 | + } elseif ($trunc == 'wrap') { |
|
2865 | 3018 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2866 | - if (dol_strlen($newstring, $stringencoding) > ($size + 1)) |
|
2867 | - return dol_substr($newstring, 0, $size, $stringencoding) . "\n" . dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
2868 | - else |
|
2869 | - return $string; |
|
2870 | - } else |
|
2871 | - return 'BadParam3CallingDolTrunc'; |
|
2872 | -} |
|
3019 | + if (dol_strlen($newstring, $stringencoding) > ($size + 1)) { |
|
3020 | + return dol_substr($newstring, 0, $size, $stringencoding) . "\n" . dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
3021 | + } else { |
|
3022 | + return $string; |
|
3023 | + } |
|
3024 | + } else { |
|
3025 | + return 'BadParam3CallingDolTrunc'; |
|
3026 | + } |
|
3027 | + } |
|
2873 | 3028 | |
2874 | 3029 | /** |
2875 | 3030 | * Show picto whatever it's its name (generic function) |
@@ -3079,8 +3234,9 @@ discard block |
||
3079 | 3234 | { |
3080 | 3235 | global $conf; |
3081 | 3236 | |
3082 | - if (!preg_match('/(\.png|\.gif)$/i', $picto)) |
|
3083 | - $picto .= '.png'; |
|
3237 | + if (!preg_match('/(\.png|\.gif)$/i', $picto)) { |
|
3238 | + $picto .= '.png'; |
|
3239 | + } |
|
3084 | 3240 | |
3085 | 3241 | //$path = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/weather/' . $picto; |
3086 | 3242 | $path = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/weather/' . $picto; |
@@ -3102,20 +3258,22 @@ discard block |
||
3102 | 3258 | { |
3103 | 3259 | global $conf; |
3104 | 3260 | |
3105 | - if (!preg_match('/(\.png|\.gif)$/i', $picto)) |
|
3106 | - $picto .= '.png'; |
|
3261 | + if (!preg_match('/(\.png|\.gif)$/i', $picto)) { |
|
3262 | + $picto .= '.png'; |
|
3263 | + } |
|
3107 | 3264 | |
3108 | - if ($pictoisfullpath) |
|
3109 | - $path = $picto; |
|
3110 | - else { |
|
3265 | + if ($pictoisfullpath) { |
|
3266 | + $path = $picto; |
|
3267 | + } else { |
|
3111 | 3268 | //$path = DOL_URL_ROOT . '/theme/common/' . $picto; |
3112 | 3269 | $path = DOL_BASE_URI . '/theme/common/' . $picto; |
3113 | 3270 | |
3114 | 3271 | if (!empty($conf->global->MAIN_MODULE_CAN_OVERWRITE_COMMONICONS)) { |
3115 | 3272 | $themepath = DOL_BASE_PATH . 'theme/' . $conf->theme . '/img/' . $picto; |
3116 | 3273 | |
3117 | - if (file_exists($themepath)) |
|
3118 | - $path = $themepath; |
|
3274 | + if (file_exists($themepath)) { |
|
3275 | + $path = $themepath; |
|
3276 | + } |
|
3119 | 3277 | } |
3120 | 3278 | } |
3121 | 3279 | |
@@ -3154,8 +3312,9 @@ discard block |
||
3154 | 3312 | $numaction = 0; |
3155 | 3313 | } |
3156 | 3314 | } |
3157 | - if (!is_numeric($numaction)) |
|
3158 | - $numaction = 0; |
|
3315 | + if (!is_numeric($numaction)) { |
|
3316 | + $numaction = 0; |
|
3317 | + } |
|
3159 | 3318 | |
3160 | 3319 | return img_picto($titlealt, 'stcomm' . $numaction . '.png'); |
3161 | 3320 | } |
@@ -3171,8 +3330,9 @@ discard block |
||
3171 | 3330 | { |
3172 | 3331 | global $conf, $langs; |
3173 | 3332 | |
3174 | - if ($titlealt == 'default') |
|
3175 | - $titlealt = $langs->trans('Show'); |
|
3333 | + if ($titlealt == 'default') { |
|
3334 | + $titlealt = $langs->trans('Show'); |
|
3335 | + } |
|
3176 | 3336 | |
3177 | 3337 | return img_picto($titlealt, 'pdf' . $size . '.png'); |
3178 | 3338 | } |
@@ -3188,8 +3348,9 @@ discard block |
||
3188 | 3348 | { |
3189 | 3349 | global $conf, $langs; |
3190 | 3350 | |
3191 | - if ($titlealt == 'default') |
|
3192 | - $titlealt = $langs->trans('Add'); |
|
3351 | + if ($titlealt == 'default') { |
|
3352 | + $titlealt = $langs->trans('Add'); |
|
3353 | + } |
|
3193 | 3354 | |
3194 | 3355 | return img_picto($titlealt, 'edit_add.png', $other); |
3195 | 3356 | } |
@@ -3205,8 +3366,9 @@ discard block |
||
3205 | 3366 | { |
3206 | 3367 | global $conf, $langs; |
3207 | 3368 | |
3208 | - if ($titlealt == 'default') |
|
3209 | - $titlealt = $langs->trans('Remove'); |
|
3369 | + if ($titlealt == 'default') { |
|
3370 | + $titlealt = $langs->trans('Remove'); |
|
3371 | + } |
|
3210 | 3372 | |
3211 | 3373 | return img_picto($titlealt, 'edit_remove.png', $other); |
3212 | 3374 | } |
@@ -3223,8 +3385,9 @@ discard block |
||
3223 | 3385 | { |
3224 | 3386 | global $conf, $langs; |
3225 | 3387 | |
3226 | - if ($titlealt == 'default') |
|
3227 | - $titlealt = $langs->trans('Modify'); |
|
3388 | + if ($titlealt == 'default') { |
|
3389 | + $titlealt = $langs->trans('Modify'); |
|
3390 | + } |
|
3228 | 3391 | |
3229 | 3392 | return img_picto($titlealt, 'edit.png', ($float ? 'style="float: ' . ($langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right') . '"' : "") . ($other ? ' ' . $other : '')); |
3230 | 3393 | } |
@@ -3241,8 +3404,9 @@ discard block |
||
3241 | 3404 | { |
3242 | 3405 | global $conf, $langs; |
3243 | 3406 | |
3244 | - if ($titlealt == 'default') |
|
3245 | - $titlealt = $langs->trans('View'); |
|
3407 | + if ($titlealt == 'default') { |
|
3408 | + $titlealt = $langs->trans('View'); |
|
3409 | + } |
|
3246 | 3410 | |
3247 | 3411 | $moreatt = ($float ? 'style="float: right" ' : '') . $other; |
3248 | 3412 | |
@@ -3260,8 +3424,9 @@ discard block |
||
3260 | 3424 | { |
3261 | 3425 | global $conf, $langs; |
3262 | 3426 | |
3263 | - if ($titlealt == 'default') |
|
3264 | - $titlealt = $langs->trans('Delete'); |
|
3427 | + if ($titlealt == 'default') { |
|
3428 | + $titlealt = $langs->trans('Delete'); |
|
3429 | + } |
|
3265 | 3430 | |
3266 | 3431 | return img_picto($titlealt, 'delete.png', $other); |
3267 | 3432 | //return '<span class="fa fa-trash fa-2x fa-fw" style="font-size: 1.7em;" title="'.$titlealt.'"></span>'; |
@@ -3277,8 +3442,9 @@ discard block |
||
3277 | 3442 | function img_printer($titlealt = "default", $other = '') |
3278 | 3443 | { |
3279 | 3444 | global $conf, $langs; |
3280 | - if ($titlealt == "default") |
|
3281 | - $titlealt = $langs->trans("Print"); |
|
3445 | + if ($titlealt == "default") { |
|
3446 | + $titlealt = $langs->trans("Print"); |
|
3447 | + } |
|
3282 | 3448 | return img_picto($titlealt, 'printer.png', $other); |
3283 | 3449 | } |
3284 | 3450 | |
@@ -3293,8 +3459,9 @@ discard block |
||
3293 | 3459 | { |
3294 | 3460 | global $conf, $langs; |
3295 | 3461 | |
3296 | - if ($titlealt == 'default') |
|
3297 | - $titlealt = $langs->trans('Split'); |
|
3462 | + if ($titlealt == 'default') { |
|
3463 | + $titlealt = $langs->trans('Split'); |
|
3464 | + } |
|
3298 | 3465 | |
3299 | 3466 | return img_picto($titlealt, 'split.png', $other); |
3300 | 3467 | } |
@@ -3311,10 +3478,11 @@ discard block |
||
3311 | 3478 | global $conf, $langs; |
3312 | 3479 | |
3313 | 3480 | if ($usealttitle) { |
3314 | - if (is_string($usealttitle)) |
|
3315 | - $usealttitle = dol_escape_htmltag($usealttitle); |
|
3316 | - else |
|
3317 | - $usealttitle = $langs->trans('Info'); |
|
3481 | + if (is_string($usealttitle)) { |
|
3482 | + $usealttitle = dol_escape_htmltag($usealttitle); |
|
3483 | + } else { |
|
3484 | + $usealttitle = $langs->trans('Info'); |
|
3485 | + } |
|
3318 | 3486 | } |
3319 | 3487 | |
3320 | 3488 | return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;' . ($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')) . '"'); |
@@ -3330,8 +3498,9 @@ discard block |
||
3330 | 3498 | { |
3331 | 3499 | global $conf, $langs; |
3332 | 3500 | |
3333 | - if ($titlealt == 'default') |
|
3334 | - $titlealt = $langs->trans('Informations'); |
|
3501 | + if ($titlealt == 'default') { |
|
3502 | + $titlealt = $langs->trans('Informations'); |
|
3503 | + } |
|
3335 | 3504 | |
3336 | 3505 | return img_picto($titlealt, 'info.png', 'style="vertical-align: middle;"'); |
3337 | 3506 | } |
@@ -3347,8 +3516,9 @@ discard block |
||
3347 | 3516 | { |
3348 | 3517 | global $conf, $langs; |
3349 | 3518 | |
3350 | - if ($titlealt == 'default') |
|
3351 | - $titlealt = $langs->trans('Warning'); |
|
3519 | + if ($titlealt == 'default') { |
|
3520 | + $titlealt = $langs->trans('Warning'); |
|
3521 | + } |
|
3352 | 3522 | |
3353 | 3523 | //return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>'; |
3354 | 3524 | return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"' . ($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' ' . $moreatt) : '')); |
@@ -3364,8 +3534,9 @@ discard block |
||
3364 | 3534 | { |
3365 | 3535 | global $conf, $langs; |
3366 | 3536 | |
3367 | - if ($titlealt == 'default') |
|
3368 | - $titlealt = $langs->trans('Error'); |
|
3537 | + if ($titlealt == 'default') { |
|
3538 | + $titlealt = $langs->trans('Error'); |
|
3539 | + } |
|
3369 | 3540 | |
3370 | 3541 | return img_picto($titlealt, 'error.png', 'class="valigntextbottom"'); |
3371 | 3542 | } |
@@ -3381,8 +3552,9 @@ discard block |
||
3381 | 3552 | { |
3382 | 3553 | global $conf, $langs; |
3383 | 3554 | |
3384 | - if ($titlealt == 'default') |
|
3385 | - $titlealt = $langs->trans('Next'); |
|
3555 | + if ($titlealt == 'default') { |
|
3556 | + $titlealt = $langs->trans('Next'); |
|
3557 | + } |
|
3386 | 3558 | |
3387 | 3559 | //return img_picto($titlealt, 'next.png', $moreatt); |
3388 | 3560 | return '<span class="fa fa-chevron-right paddingright paddingleft" title="' . dol_escape_htmltag($titlealt) . '"></span>'; |
@@ -3399,8 +3571,9 @@ discard block |
||
3399 | 3571 | { |
3400 | 3572 | global $conf, $langs; |
3401 | 3573 | |
3402 | - if ($titlealt == 'default') |
|
3403 | - $titlealt = $langs->trans('Previous'); |
|
3574 | + if ($titlealt == 'default') { |
|
3575 | + $titlealt = $langs->trans('Previous'); |
|
3576 | + } |
|
3404 | 3577 | |
3405 | 3578 | //return img_picto($titlealt, 'previous.png', $moreatt); |
3406 | 3579 | return '<span class="fa fa-chevron-left paddingright paddingleft" title="' . dol_escape_htmltag($titlealt) . '"></span>'; |
@@ -3418,8 +3591,9 @@ discard block |
||
3418 | 3591 | { |
3419 | 3592 | global $conf, $langs; |
3420 | 3593 | |
3421 | - if ($titlealt == 'default') |
|
3422 | - $titlealt = $langs->trans('Down'); |
|
3594 | + if ($titlealt == 'default') { |
|
3595 | + $titlealt = $langs->trans('Down'); |
|
3596 | + } |
|
3423 | 3597 | |
3424 | 3598 | return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown' . ($moreclass ? " " . $moreclass : "") . '"'); |
3425 | 3599 | } |
@@ -3436,8 +3610,9 @@ discard block |
||
3436 | 3610 | { |
3437 | 3611 | global $conf, $langs; |
3438 | 3612 | |
3439 | - if ($titlealt == 'default') |
|
3440 | - $titlealt = $langs->trans('Up'); |
|
3613 | + if ($titlealt == 'default') { |
|
3614 | + $titlealt = $langs->trans('Up'); |
|
3615 | + } |
|
3441 | 3616 | |
3442 | 3617 | return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup' . ($moreclass ? " " . $moreclass : "") . '"'); |
3443 | 3618 | } |
@@ -3454,8 +3629,9 @@ discard block |
||
3454 | 3629 | { |
3455 | 3630 | global $conf, $langs; |
3456 | 3631 | |
3457 | - if ($titlealt == 'default') |
|
3458 | - $titlealt = $langs->trans('Left'); |
|
3632 | + if ($titlealt == 'default') { |
|
3633 | + $titlealt = $langs->trans('Left'); |
|
3634 | + } |
|
3459 | 3635 | |
3460 | 3636 | return img_picto($titlealt, ($selected ? '1leftarrow_selected.png' : '1leftarrow.png'), $moreatt); |
3461 | 3637 | } |
@@ -3472,8 +3648,9 @@ discard block |
||
3472 | 3648 | { |
3473 | 3649 | global $conf, $langs; |
3474 | 3650 | |
3475 | - if ($titlealt == 'default') |
|
3476 | - $titlealt = $langs->trans('Right'); |
|
3651 | + if ($titlealt == 'default') { |
|
3652 | + $titlealt = $langs->trans('Right'); |
|
3653 | + } |
|
3477 | 3654 | |
3478 | 3655 | return img_picto($titlealt, ($selected ? '1rightarrow_selected.png' : '1rightarrow.png'), $moreatt); |
3479 | 3656 | } |
@@ -3489,11 +3666,13 @@ discard block |
||
3489 | 3666 | { |
3490 | 3667 | global $conf, $langs; |
3491 | 3668 | |
3492 | - if ($titlealt == 'default') |
|
3493 | - $titlealt = $langs->trans('Active'); |
|
3669 | + if ($titlealt == 'default') { |
|
3670 | + $titlealt = $langs->trans('Active'); |
|
3671 | + } |
|
3494 | 3672 | |
3495 | - if ($allow == 1) |
|
3496 | - return img_picto($titlealt, 'tick.png'); |
|
3673 | + if ($allow == 1) { |
|
3674 | + return img_picto($titlealt, 'tick.png'); |
|
3675 | + } |
|
3497 | 3676 | |
3498 | 3677 | return '-'; |
3499 | 3678 | } |
@@ -3541,8 +3720,9 @@ discard block |
||
3541 | 3720 | $mimeimg = dol_mimetype($file, '', 2); |
3542 | 3721 | $mimefa = dol_mimetype($file, '', 4); |
3543 | 3722 | |
3544 | - if (empty($titlealt)) |
|
3545 | - $titlealt = 'Mime type: ' . $mimetype; |
|
3723 | + if (empty($titlealt)) { |
|
3724 | + $titlealt = 'Mime type: ' . $mimetype; |
|
3725 | + } |
|
3546 | 3726 | |
3547 | 3727 | //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); |
3548 | 3728 | return '<i class="fa fa-' . $mimefa . ' paddingright"></i>'; |
@@ -3564,13 +3744,15 @@ discard block |
||
3564 | 3744 | |
3565 | 3745 | global $conf, $langs; |
3566 | 3746 | |
3567 | - if ($titlealt == 'default') |
|
3568 | - $titlealt = $langs->trans('Call'); |
|
3747 | + if ($titlealt == 'default') { |
|
3748 | + $titlealt = $langs->trans('Call'); |
|
3749 | + } |
|
3569 | 3750 | |
3570 | - if ($option == 1) |
|
3571 | - $img = 'call'; |
|
3572 | - else |
|
3573 | - $img = 'call_out'; |
|
3751 | + if ($option == 1) { |
|
3752 | + $img = 'call'; |
|
3753 | + } else { |
|
3754 | + $img = 'call_out'; |
|
3755 | + } |
|
3574 | 3756 | |
3575 | 3757 | return img_picto($titlealt, $img); |
3576 | 3758 | } |
@@ -3586,8 +3768,9 @@ discard block |
||
3586 | 3768 | { |
3587 | 3769 | global $conf, $langs; |
3588 | 3770 | |
3589 | - if ($titlealt == 'default') |
|
3590 | - $titlealt = $langs->trans('Search'); |
|
3771 | + if ($titlealt == 'default') { |
|
3772 | + $titlealt = $langs->trans('Search'); |
|
3773 | + } |
|
3591 | 3774 | |
3592 | 3775 | $img = img_picto($titlealt, 'search.png', $other, false, 1); |
3593 | 3776 | |
@@ -3608,8 +3791,9 @@ discard block |
||
3608 | 3791 | { |
3609 | 3792 | global $conf, $langs; |
3610 | 3793 | |
3611 | - if ($titlealt == 'default') |
|
3612 | - $titlealt = $langs->trans('Search'); |
|
3794 | + if ($titlealt == 'default') { |
|
3795 | + $titlealt = $langs->trans('Search'); |
|
3796 | + } |
|
3613 | 3797 | |
3614 | 3798 | $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); |
3615 | 3799 | |
@@ -3671,14 +3855,16 @@ discard block |
||
3671 | 3855 | |
3672 | 3856 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web |
3673 | 3857 | $out .= $langs->trans("DolibarrHasDetectedError") . ".<br>\n"; |
3674 | - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) |
|
3675 | - $out .= "You use an experimental or develop level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n"; |
|
3858 | + if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { |
|
3859 | + $out .= "You use an experimental or develop level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n"; |
|
3860 | + } |
|
3676 | 3861 | $out .= $langs->trans("InformationToHelpDiagnose") . ":<br>\n"; |
3677 | 3862 | |
3678 | 3863 | $out .= "<b>" . $langs->trans("Date") . ":</b> " . dol_print_date(time(), 'dayhourlog') . "<br>\n"; |
3679 | 3864 | $out .= "<b>" . $langs->trans("Dolibarr") . ":</b> " . DOL_VERSION . "<br>\n"; |
3680 | - if (isset($conf->global->MAIN_FEATURES_LEVEL)) |
|
3681 | - $out .= "<b>" . $langs->trans("LevelOfFeature") . ":</b> " . $conf->global->MAIN_FEATURES_LEVEL . "<br>\n"; |
|
3865 | + if (isset($conf->global->MAIN_FEATURES_LEVEL)) { |
|
3866 | + $out .= "<b>" . $langs->trans("LevelOfFeature") . ":</b> " . $conf->global->MAIN_FEATURES_LEVEL . "<br>\n"; |
|
3867 | + } |
|
3682 | 3868 | if (function_exists("phpversion")) { |
3683 | 3869 | $out .= "<b>" . $langs->trans("PHP") . ":</b> " . phpversion() . "<br>\n"; |
3684 | 3870 | } |
@@ -3721,18 +3907,20 @@ discard block |
||
3721 | 3907 | $langs->load("errors"); |
3722 | 3908 | |
3723 | 3909 | // Merge all into $errors array |
3724 | - if (is_array($error) && is_array($errors)) |
|
3725 | - $errors = array_merge($error, $errors); |
|
3726 | - elseif (is_array($error)) |
|
3727 | - $errors = $error; |
|
3728 | - elseif (is_array($errors)) |
|
3729 | - $errors = array_merge(array($error), $errors); |
|
3730 | - else |
|
3731 | - $errors = array_merge(array($error)); |
|
3910 | + if (is_array($error) && is_array($errors)) { |
|
3911 | + $errors = array_merge($error, $errors); |
|
3912 | + } elseif (is_array($error)) { |
|
3913 | + $errors = $error; |
|
3914 | + } elseif (is_array($errors)) { |
|
3915 | + $errors = array_merge(array($error), $errors); |
|
3916 | + } else { |
|
3917 | + $errors = array_merge(array($error)); |
|
3918 | + } |
|
3732 | 3919 | |
3733 | 3920 | foreach ($errors as $msg) { |
3734 | - if (empty($msg)) |
|
3735 | - continue; |
|
3921 | + if (empty($msg)) { |
|
3922 | + continue; |
|
3923 | + } |
|
3736 | 3924 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web |
3737 | 3925 | $out .= "<b>" . $langs->trans("Message") . ":</b> " . dol_escape_htmltag($msg) . "<br>\n"; |
3738 | 3926 | } else { // Mode CLI |
@@ -3750,9 +3938,9 @@ discard block |
||
3750 | 3938 | $out .= "<br>\n"; |
3751 | 3939 | } |
3752 | 3940 | |
3753 | - if (empty($dolibarr_main_prod)) |
|
3754 | - print $out; |
|
3755 | - else { |
|
3941 | + if (empty($dolibarr_main_prod)) { |
|
3942 | + print $out; |
|
3943 | + } else { |
|
3756 | 3944 | print $langs->trans("DolibarrHasDetectedError") . '. '; |
3757 | 3945 | print $langs->trans("YouCanSetOptionDolibarrMainProdToZero"); |
3758 | 3946 | define("MAIN_CORE_ERROR", 1); |
@@ -3775,16 +3963,18 @@ discard block |
||
3775 | 3963 | { |
3776 | 3964 | global $langs, $conf; |
3777 | 3965 | |
3778 | - if (empty($email)) |
|
3779 | - $email = $conf->global->MAIN_INFO_SOCIETE_MAIL; |
|
3966 | + if (empty($email)) { |
|
3967 | + $email = $conf->global->MAIN_INFO_SOCIETE_MAIL; |
|
3968 | + } |
|
3780 | 3969 | |
3781 | 3970 | $langs->load("errors"); |
3782 | 3971 | $now = dol_now(); |
3783 | 3972 | |
3784 | 3973 | print '<br><div class="center login_main_message"><div class="' . $morecss . '">'; |
3785 | 3974 | print $langs->trans("ErrorContactEMail", $email, $prefixcode . dol_print_date($now, '%Y%m%d')); |
3786 | - if ($errormessage) |
|
3787 | - print '<br><br>' . $errormessage; |
|
3975 | + if ($errormessage) { |
|
3976 | + print '<br><br>' . $errormessage; |
|
3977 | + } |
|
3788 | 3978 | if (is_array($errormessages) && count($errormessages)) { |
3789 | 3979 | foreach ($errormessages as $mesgtoshow) { |
3790 | 3980 | print '<br><br>' . $mesgtoshow; |
@@ -4027,12 +4217,15 @@ discard block |
||
4027 | 4217 | $savtotalnboflines = $totalnboflines; |
4028 | 4218 | $totalnboflines = abs($totalnboflines); |
4029 | 4219 | |
4030 | - if ($picto == 'setup') |
|
4031 | - $picto = 'title_setup.png'; |
|
4032 | - if (($conf->browser->name == 'ie') && $picto == 'title_generic.png') |
|
4033 | - $picto = 'title.gif'; |
|
4034 | - if ($limit < 0) |
|
4035 | - $limit = $conf->liste_limit; |
|
4220 | + if ($picto == 'setup') { |
|
4221 | + $picto = 'title_setup.png'; |
|
4222 | + } |
|
4223 | + if (($conf->browser->name == 'ie') && $picto == 'title_generic.png') { |
|
4224 | + $picto = 'title.gif'; |
|
4225 | + } |
|
4226 | + if ($limit < 0) { |
|
4227 | + $limit = $conf->liste_limit; |
|
4228 | + } |
|
4036 | 4229 | if ($savlimit != 0 && (($num > $limit) || ($num == -1) || ($limit == 0))) { |
4037 | 4230 | $nextpage = 1; |
4038 | 4231 | } else { |
@@ -4046,11 +4239,13 @@ discard block |
||
4046 | 4239 | // Left |
4047 | 4240 | //if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>'; |
4048 | 4241 | print '<td class="nobordernopadding valignmiddle">'; |
4049 | - if ($picto && $titre) |
|
4050 | - print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath); |
|
4242 | + if ($picto && $titre) { |
|
4243 | + print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath); |
|
4244 | + } |
|
4051 | 4245 | print '<div class="titre inline-block">' . $titre; |
4052 | - if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') |
|
4053 | - print ' (' . $totalnboflines . ')'; |
|
4246 | + if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') { |
|
4247 | + print ' (' . $totalnboflines . ')'; |
|
4248 | + } |
|
4054 | 4249 | print '</div></td>'; |
4055 | 4250 | |
4056 | 4251 | // Center |
@@ -4060,10 +4255,12 @@ discard block |
||
4060 | 4255 | |
4061 | 4256 | // Right |
4062 | 4257 | print '<td class="nobordernopadding valignmiddle" align="right">'; |
4063 | - if ($sortfield) |
|
4064 | - $options .= "&sortfield=" . urlencode($sortfield); |
|
4065 | - if ($sortorder) |
|
4066 | - $options .= "&sortorder=" . urlencode($sortorder); |
|
4258 | + if ($sortfield) { |
|
4259 | + $options .= "&sortfield=" . urlencode($sortfield); |
|
4260 | + } |
|
4261 | + if ($sortorder) { |
|
4262 | + $options .= "&sortorder=" . urlencode($sortorder); |
|
4263 | + } |
|
4067 | 4264 | // Show navigation bar |
4068 | 4265 | $pagelist = ''; |
4069 | 4266 | if ($savlimit != 0 && ($page > 0 || $num > $limit)) { |
@@ -4071,10 +4268,11 @@ discard block |
||
4071 | 4268 | // Define nb of extra page links before and after selected page + ... + first or last |
4072 | 4269 | $maxnbofpage = (empty($conf->dol_optimize_smallscreen) ? 4 : 1); |
4073 | 4270 | |
4074 | - if ($limit > 0) |
|
4075 | - $nbpages = ceil($totalnboflines / $limit); |
|
4076 | - else |
|
4077 | - $nbpages = 1; |
|
4271 | + if ($limit > 0) { |
|
4272 | + $nbpages = ceil($totalnboflines / $limit); |
|
4273 | + } else { |
|
4274 | + $nbpages = 1; |
|
4275 | + } |
|
4078 | 4276 | $cpt = ($page - $maxnbofpage); |
4079 | 4277 | if ($cpt < 0) { |
4080 | 4278 | $cpt = 0; |
@@ -4082,10 +4280,11 @@ discard block |
||
4082 | 4280 | |
4083 | 4281 | if ($cpt >= 1) { |
4084 | 4282 | $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=0' . $options . '">1</a></li>'; |
4085 | - if ($cpt > 2) |
|
4086 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
4087 | - else if ($cpt == 2) |
|
4088 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=1' . $options . '">2</a></li>'; |
|
4283 | + if ($cpt > 2) { |
|
4284 | + $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
4285 | + } else if ($cpt == 2) { |
|
4286 | + $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=1' . $options . '">2</a></li>'; |
|
4287 | + } |
|
4089 | 4288 | } |
4090 | 4289 | |
4091 | 4290 | do { |
@@ -4098,14 +4297,14 @@ discard block |
||
4098 | 4297 | } while ($cpt < $nbpages && $cpt <= $page + $maxnbofpage); |
4099 | 4298 | |
4100 | 4299 | if ($cpt < $nbpages) { |
4101 | - if ($cpt < $nbpages - 2) |
|
4102 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
4103 | - else if ($cpt == $nbpages - 2) |
|
4104 | - $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 2) . $options . '">' . ($nbpages - 1) . '</a></li>'; |
|
4300 | + if ($cpt < $nbpages - 2) { |
|
4301 | + $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
4302 | + } else if ($cpt == $nbpages - 2) { |
|
4303 | + $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 2) . $options . '">' . ($nbpages - 1) . '</a></li>'; |
|
4304 | + } |
|
4105 | 4305 | $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 1) . $options . '">' . $nbpages . '</a></li>'; |
4106 | 4306 | } |
4107 | - } |
|
4108 | - else { |
|
4307 | + } else { |
|
4109 | 4308 | $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . "</li>"; |
4110 | 4309 | } |
4111 | 4310 | } |
@@ -4141,18 +4340,21 @@ discard block |
||
4141 | 4340 | $pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000'; |
4142 | 4341 | //$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported |
4143 | 4342 | //$pagesizechoices.=',2:2'; |
4144 | - if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) |
|
4145 | - $pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES; |
|
4343 | + if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) { |
|
4344 | + $pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES; |
|
4345 | + } |
|
4146 | 4346 | |
4147 | 4347 | print '<li class="pagination">'; |
4148 | 4348 | print '<select class="flat selectlimit" name="limit" title="' . dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")) . '">'; |
4149 | 4349 | $tmpchoice = explode(',', $pagesizechoices); |
4150 | 4350 | $tmpkey = $limit . ':' . $limit; |
4151 | - if (!in_array($tmpkey, $tmpchoice)) |
|
4152 | - $tmpchoice[] = $tmpkey; |
|
4351 | + if (!in_array($tmpkey, $tmpchoice)) { |
|
4352 | + $tmpchoice[] = $tmpkey; |
|
4353 | + } |
|
4153 | 4354 | $tmpkey = $conf->liste_limit . ':' . $conf->liste_limit; |
4154 | - if (!in_array($tmpkey, $tmpchoice)) |
|
4155 | - $tmpchoice[] = $tmpkey; |
|
4355 | + if (!in_array($tmpkey, $tmpchoice)) { |
|
4356 | + $tmpchoice[] = $tmpkey; |
|
4357 | + } |
|
4156 | 4358 | asort($tmpchoice, SORT_NUMERIC); |
4157 | 4359 | $found = false; |
4158 | 4360 | foreach ($tmpchoice as $val) { |
@@ -4228,14 +4430,15 @@ discard block |
||
4228 | 4430 | } |
4229 | 4431 | |
4230 | 4432 | // If rate is '9/9/9' we don't change it. If rate is '9.000' we apply price() |
4231 | - if (!preg_match('/\//', $rate)) |
|
4232 | - $ret = price($rate, 0, '', 0, 0) . ($addpercent ? '%' : ''); |
|
4233 | - else { |
|
4433 | + if (!preg_match('/\//', $rate)) { |
|
4434 | + $ret = price($rate, 0, '', 0, 0) . ($addpercent ? '%' : ''); |
|
4435 | + } else { |
|
4234 | 4436 | // TODO Split on / and output with a price2num to have clean numbers without ton of 000. |
4235 | 4437 | $ret = $rate . ($addpercent ? '%' : ''); |
4236 | 4438 | } |
4237 | - if (($info_bits & 1) && $usestarfornpr >= 0) |
|
4238 | - $ret .= ' *'; |
|
4439 | + if (($info_bits & 1) && $usestarfornpr >= 0) { |
|
4440 | + $ret .= ' *'; |
|
4441 | + } |
|
4239 | 4442 | $ret .= $morelabel; |
4240 | 4443 | return $ret; |
4241 | 4444 | } |
@@ -4260,11 +4463,14 @@ discard block |
||
4260 | 4463 | global $langs, $conf; |
4261 | 4464 | |
4262 | 4465 | // Clean parameters |
4263 | - if (empty($amount)) |
|
4264 | - $amount = 0; // To have a numeric value if amount not defined or = '' |
|
4466 | + if (empty($amount)) { |
|
4467 | + $amount = 0; |
|
4468 | + } |
|
4469 | + // To have a numeric value if amount not defined or = '' |
|
4265 | 4470 | $amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number) |
4266 | - if ($rounding < 0) |
|
4267 | - $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); |
|
4471 | + if ($rounding < 0) { |
|
4472 | + $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); |
|
4473 | + } |
|
4268 | 4474 | $nbdecimal = $rounding; |
4269 | 4475 | |
4270 | 4476 | // Output separators by default (french) |
@@ -4272,17 +4478,21 @@ discard block |
||
4272 | 4478 | $thousand = ' '; |
4273 | 4479 | |
4274 | 4480 | // If $outlangs not forced, we use use language |
4275 | - if (!is_object($outlangs)) |
|
4276 | - $outlangs = $langs; |
|
4277 | - |
|
4278 | - if ($outlangs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") |
|
4279 | - $dec = $outlangs->transnoentitiesnoconv("SeparatorDecimal"); |
|
4280 | - if ($outlangs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") |
|
4281 | - $thousand = $outlangs->transnoentitiesnoconv("SeparatorThousand"); |
|
4282 | - if ($thousand == 'None') |
|
4283 | - $thousand = ''; |
|
4284 | - else if ($thousand == 'Space') |
|
4285 | - $thousand = ' '; |
|
4481 | + if (!is_object($outlangs)) { |
|
4482 | + $outlangs = $langs; |
|
4483 | + } |
|
4484 | + |
|
4485 | + if ($outlangs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { |
|
4486 | + $dec = $outlangs->transnoentitiesnoconv("SeparatorDecimal"); |
|
4487 | + } |
|
4488 | + if ($outlangs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { |
|
4489 | + $thousand = $outlangs->transnoentitiesnoconv("SeparatorThousand"); |
|
4490 | + } |
|
4491 | + if ($thousand == 'None') { |
|
4492 | + $thousand = ''; |
|
4493 | + } else if ($thousand == 'Space') { |
|
4494 | + $thousand = ' '; |
|
4495 | + } |
|
4286 | 4496 | //print "outlangs=".$outlangs->defaultlang." amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>"; |
4287 | 4497 | //print "amount=".$amount."-"; |
4288 | 4498 | $amount = str_replace(',', '.', $amount); // should be useless |
@@ -4294,8 +4504,9 @@ discard block |
||
4294 | 4504 | $end = ''; |
4295 | 4505 | |
4296 | 4506 | // We increase nbdecimal if there is more decimal than asked (to not loose information) |
4297 | - if (dol_strlen($decpart) > $nbdecimal) |
|
4298 | - $nbdecimal = dol_strlen($decpart); |
|
4507 | + if (dol_strlen($decpart) > $nbdecimal) { |
|
4508 | + $nbdecimal = dol_strlen($decpart); |
|
4509 | + } |
|
4299 | 4510 | // Si on depasse max |
4300 | 4511 | if ($trunc && $nbdecimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN) { |
4301 | 4512 | $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_SHOWN; |
@@ -4306,8 +4517,9 @@ discard block |
||
4306 | 4517 | } |
4307 | 4518 | |
4308 | 4519 | // If force rounding |
4309 | - if ($forcerounding >= 0) |
|
4310 | - $nbdecimal = $forcerounding; |
|
4520 | + if ($forcerounding >= 0) { |
|
4521 | + $nbdecimal = $forcerounding; |
|
4522 | + } |
|
4311 | 4523 | |
4312 | 4524 | // Format number |
4313 | 4525 | $output = number_format($amount, $nbdecimal, $dec, $thousand); |
@@ -4318,13 +4530,14 @@ discard block |
||
4318 | 4530 | // Add symbol of currency if requested |
4319 | 4531 | $cursymbolbefore = $cursymbolafter = ''; |
4320 | 4532 | if ($currency_code) { |
4321 | - if ($currency_code == 'auto') |
|
4322 | - $currency_code = $conf->currency; |
|
4533 | + if ($currency_code == 'auto') { |
|
4534 | + $currency_code = $conf->currency; |
|
4535 | + } |
|
4323 | 4536 | |
4324 | 4537 | $listofcurrenciesbefore = array('USD', 'GBP', 'AUD', 'MXN', 'PEN', 'CNY'); |
4325 | - if (in_array($currency_code, $listofcurrenciesbefore)) |
|
4326 | - $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code); |
|
4327 | - else { |
|
4538 | + if (in_array($currency_code, $listofcurrenciesbefore)) { |
|
4539 | + $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code); |
|
4540 | + } else { |
|
4328 | 4541 | $tmpcur = $outlangs->getCurrencySymbol($currency_code); |
4329 | 4542 | $cursymbolafter .= ($tmpcur == $currency_code ? ' ' . $tmpcur : $tmpcur); |
4330 | 4543 | } |
@@ -4358,14 +4571,17 @@ discard block |
||
4358 | 4571 | // Decimal delimiter for PHP and database SQL requests must be '.' |
4359 | 4572 | $dec = ','; |
4360 | 4573 | $thousand = ' '; |
4361 | - if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") |
|
4362 | - $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); |
|
4363 | - if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") |
|
4364 | - $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); |
|
4365 | - if ($thousand == 'None') |
|
4366 | - $thousand = ''; |
|
4367 | - elseif ($thousand == 'Space') |
|
4368 | - $thousand = ' '; |
|
4574 | + if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { |
|
4575 | + $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); |
|
4576 | + } |
|
4577 | + if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { |
|
4578 | + $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); |
|
4579 | + } |
|
4580 | + if ($thousand == 'None') { |
|
4581 | + $thousand = ''; |
|
4582 | + } elseif ($thousand == 'Space') { |
|
4583 | + $thousand = ' '; |
|
4584 | + } |
|
4369 | 4585 | //print "amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>"; |
4370 | 4586 | // Convert value to universal number format (no thousand separator, '.' as decimal separator) |
4371 | 4587 | if ($alreadysqlnb != 1) { // If not a PHP number or unknown, we change format |
@@ -4381,8 +4597,10 @@ discard block |
||
4381 | 4597 | } |
4382 | 4598 | //print "QQ".$amount.'<br>'; |
4383 | 4599 | // Now make replace (the main goal of function) |
4384 | - if ($thousand != ',' && $thousand != '.') |
|
4385 | - $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users |
|
4600 | + if ($thousand != ',' && $thousand != '.') { |
|
4601 | + $amount = str_replace(',', '.', $amount); |
|
4602 | + } |
|
4603 | + // To accept 2 notations for french users |
|
4386 | 4604 | $amount = str_replace(' ', '', $amount); // To avoid spaces |
4387 | 4605 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
4388 | 4606 | $amount = str_replace($dec, '.', $amount); |
@@ -4391,19 +4609,23 @@ discard block |
||
4391 | 4609 | // Now, make a rounding if required |
4392 | 4610 | if ($rounding) { |
4393 | 4611 | $nbofdectoround = ''; |
4394 | - if ($rounding == 'MU') |
|
4395 | - $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT; |
|
4396 | - elseif ($rounding == 'MT') |
|
4397 | - $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT; |
|
4398 | - elseif ($rounding == 'MS') |
|
4399 | - $nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK; |
|
4400 | - elseif (is_numeric($rounding)) |
|
4401 | - $nbofdectoround = $rounding; |
|
4612 | + if ($rounding == 'MU') { |
|
4613 | + $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT; |
|
4614 | + } elseif ($rounding == 'MT') { |
|
4615 | + $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT; |
|
4616 | + } elseif ($rounding == 'MS') { |
|
4617 | + $nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK; |
|
4618 | + } elseif (is_numeric($rounding)) { |
|
4619 | + $nbofdectoround = $rounding; |
|
4620 | + } |
|
4402 | 4621 | //print "RR".$amount.' - '.$nbofdectoround.'<br>'; |
4403 | - if (dol_strlen($nbofdectoround)) |
|
4404 | - $amount = round($amount, $nbofdectoround); // $nbofdectoround can be 0. |
|
4405 | - else |
|
4406 | - return 'ErrorBadParameterProvidedToFunction'; |
|
4622 | + if (dol_strlen($nbofdectoround)) { |
|
4623 | + $amount = round($amount, $nbofdectoround); |
|
4624 | + } |
|
4625 | + // $nbofdectoround can be 0. |
|
4626 | + else { |
|
4627 | + return 'ErrorBadParameterProvidedToFunction'; |
|
4628 | + } |
|
4407 | 4629 | //print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>'; |
4408 | 4630 | // Convert amount to format with dolibarr dec and thousand (this is because PHP convert a number |
4409 | 4631 | // to format defined by LC_NUMERIC after a calculation and we want source format to be defined by Dolibarr setup. |
@@ -4417,8 +4639,10 @@ discard block |
||
4417 | 4639 | //print "TT".$amount.'<br>'; |
4418 | 4640 | // Always make replace because each math function (like round) replace |
4419 | 4641 | // with local values and we want a number that has a SQL string format x.y |
4420 | - if ($thousand != ',' && $thousand != '.') |
|
4421 | - $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users |
|
4642 | + if ($thousand != ',' && $thousand != '.') { |
|
4643 | + $amount = str_replace(',', '.', $amount); |
|
4644 | + } |
|
4645 | + // To accept 2 notations for french users |
|
4422 | 4646 | $amount = str_replace(' ', '', $amount); // To avoid spaces |
4423 | 4647 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
4424 | 4648 | $amount = str_replace($dec, '.', $amount); |
@@ -4477,8 +4701,9 @@ discard block |
||
4477 | 4701 | { |
4478 | 4702 | global $db, $conf, $mysoc; |
4479 | 4703 | |
4480 | - if (empty($thirdparty_seller) || !is_object($thirdparty_seller)) |
|
4481 | - $thirdparty_seller = $mysoc; |
|
4704 | + if (empty($thirdparty_seller) || !is_object($thirdparty_seller)) { |
|
4705 | + $thirdparty_seller = $mysoc; |
|
4706 | + } |
|
4482 | 4707 | |
4483 | 4708 | dol_syslog("get_localtax tva=" . $vatrate . " local=" . $local . " thirdparty_buyer id=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '') . "/country_code=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '') . " thirdparty_seller id=" . $thirdparty_seller->id . "/country_code=" . $thirdparty_seller->country_code . " thirdparty_seller localtax1_assuj=" . $thirdparty_seller->localtax1_assuj . " thirdparty_seller localtax2_assuj=" . $thirdparty_seller->localtax2_assuj); |
4484 | 4709 | |
@@ -4496,37 +4721,43 @@ discard block |
||
4496 | 4721 | // Some test to guess with no need to make database access |
4497 | 4722 | if ($mysoc->country_code == 'ES') { // For spain localtaxes 1 and 2, tax is qualified if buyer use local tax |
4498 | 4723 | if ($local == 1) { |
4499 | - if (!$mysoc->localtax1_assuj || (string) $vatratecleaned == "0") |
|
4500 | - return 0; |
|
4724 | + if (!$mysoc->localtax1_assuj || (string) $vatratecleaned == "0") { |
|
4725 | + return 0; |
|
4726 | + } |
|
4501 | 4727 | if ($thirdparty_seller->id == $mysoc->id) { |
4502 | - if (!$thirdparty_buyer->localtax1_assuj) |
|
4503 | - return 0; |
|
4504 | - } |
|
4505 | - else { |
|
4506 | - if (!$thirdparty_seller->localtax1_assuj) |
|
4507 | - return 0; |
|
4728 | + if (!$thirdparty_buyer->localtax1_assuj) { |
|
4729 | + return 0; |
|
4730 | + } |
|
4731 | + } else { |
|
4732 | + if (!$thirdparty_seller->localtax1_assuj) { |
|
4733 | + return 0; |
|
4734 | + } |
|
4508 | 4735 | } |
4509 | 4736 | } |
4510 | 4737 | |
4511 | 4738 | if ($local == 2) { |
4512 | 4739 | //if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0; |
4513 | - if (!$mysoc->localtax2_assuj) |
|
4514 | - return 0; // If main vat is 0, IRPF may be different than 0. |
|
4740 | + if (!$mysoc->localtax2_assuj) { |
|
4741 | + return 0; |
|
4742 | + } |
|
4743 | + // If main vat is 0, IRPF may be different than 0. |
|
4515 | 4744 | if ($thirdparty_seller->id == $mysoc->id) { |
4516 | - if (!$thirdparty_buyer->localtax2_assuj) |
|
4517 | - return 0; |
|
4518 | - } |
|
4519 | - else { |
|
4520 | - if (!$thirdparty_seller->localtax2_assuj) |
|
4521 | - return 0; |
|
4745 | + if (!$thirdparty_buyer->localtax2_assuj) { |
|
4746 | + return 0; |
|
4747 | + } |
|
4748 | + } else { |
|
4749 | + if (!$thirdparty_seller->localtax2_assuj) { |
|
4750 | + return 0; |
|
4751 | + } |
|
4522 | 4752 | } |
4523 | 4753 | } |
4524 | - } |
|
4525 | - else { |
|
4526 | - if ($local == 1 && !$thirdparty_seller->localtax1_assuj) |
|
4527 | - return 0; |
|
4528 | - if ($local == 2 && !$thirdparty_seller->localtax2_assuj) |
|
4529 | - return 0; |
|
4754 | + } else { |
|
4755 | + if ($local == 1 && !$thirdparty_seller->localtax1_assuj) { |
|
4756 | + return 0; |
|
4757 | + } |
|
4758 | + if ($local == 2 && !$thirdparty_seller->localtax2_assuj) { |
|
4759 | + return 0; |
|
4760 | + } |
|
4530 | 4761 | } |
4531 | 4762 | |
4532 | 4763 | // For some country MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY is forced to on. |
@@ -4568,19 +4799,23 @@ discard block |
||
4568 | 4799 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
4569 | 4800 | $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $thirdparty_seller->country_code . "'"; |
4570 | 4801 | $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
4571 | - if ($vatratecode) |
|
4572 | - $sql .= " AND t.code ='" . $vatratecode . "'"; // If we have the code, we use it in priority |
|
4573 | - else |
|
4574 | - $sql .= " AND t.recuperableonly ='" . $vatnpr . "'"; |
|
4802 | + if ($vatratecode) { |
|
4803 | + $sql .= " AND t.code ='" . $vatratecode . "'"; |
|
4804 | + } |
|
4805 | + // If we have the code, we use it in priority |
|
4806 | + else { |
|
4807 | + $sql .= " AND t.recuperableonly ='" . $vatnpr . "'"; |
|
4808 | + } |
|
4575 | 4809 | dol_syslog("get_localtax", LOG_DEBUG); |
4576 | 4810 | $resql = $db->query($sql); |
4577 | 4811 | |
4578 | 4812 | if ($resql) { |
4579 | 4813 | $obj = $db->fetch_object($resql); |
4580 | - if ($local == 1) |
|
4581 | - return $obj->localtax1; |
|
4582 | - elseif ($local == 2) |
|
4583 | - return $obj->localtax2; |
|
4814 | + if ($local == 1) { |
|
4815 | + return $obj->localtax1; |
|
4816 | + } elseif ($local == 2) { |
|
4817 | + return $obj->localtax2; |
|
4818 | + } |
|
4584 | 4819 | } |
4585 | 4820 | |
4586 | 4821 | return 0; |
@@ -4626,10 +4861,11 @@ discard block |
||
4626 | 4861 | $resql = $db->query($sql); |
4627 | 4862 | if ($resql) { |
4628 | 4863 | $obj = $db->fetch_object($resql); |
4629 | - if ($local == 1) |
|
4630 | - return $obj->localtax1; |
|
4631 | - elseif ($local == 2) |
|
4632 | - return $obj->localtax2; |
|
4864 | + if ($local == 1) { |
|
4865 | + return $obj->localtax1; |
|
4866 | + } elseif ($local == 2) { |
|
4867 | + return $obj->localtax2; |
|
4868 | + } |
|
4633 | 4869 | } |
4634 | 4870 | |
4635 | 4871 | return 0; |
@@ -4655,9 +4891,9 @@ discard block |
||
4655 | 4891 | // Search local taxes |
4656 | 4892 | $sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr, t.accountancy_code_sell, t.accountancy_code_buy"; |
4657 | 4893 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
4658 | - if ($firstparamisid) |
|
4659 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
4660 | - else { |
|
4894 | + if ($firstparamisid) { |
|
4895 | + $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
4896 | + } else { |
|
4661 | 4897 | $vatratecleaned = $vatrate; |
4662 | 4898 | $vatratecode = ''; |
4663 | 4899 | if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "xx (yy)" |
@@ -4670,19 +4906,22 @@ discard block |
||
4670 | 4906 | else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; */ |
4671 | 4907 | $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
4672 | 4908 | $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
4673 | - if ($vatratecode) |
|
4674 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
4909 | + if ($vatratecode) { |
|
4910 | + $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
4911 | + } |
|
4675 | 4912 | } |
4676 | 4913 | |
4677 | 4914 | $resql = $db->query($sql); |
4678 | 4915 | if ($resql) { |
4679 | 4916 | $obj = $db->fetch_object($resql); |
4680 | - if ($obj) |
|
4681 | - return array('rowid' => $obj->rowid, 'code' => $obj->code, 'rate' => $obj->rate, 'npr' => $obj->npr, 'accountancy_code_sell' => $obj->accountancy_code_sell, 'accountancy_code_buy' => $obj->accountancy_code_buy); |
|
4682 | - else |
|
4683 | - return array(); |
|
4684 | - } else |
|
4685 | - dol_print_error($db); |
|
4917 | + if ($obj) { |
|
4918 | + return array('rowid' => $obj->rowid, 'code' => $obj->code, 'rate' => $obj->rate, 'npr' => $obj->npr, 'accountancy_code_sell' => $obj->accountancy_code_sell, 'accountancy_code_buy' => $obj->accountancy_code_buy); |
|
4919 | + } else { |
|
4920 | + return array(); |
|
4921 | + } |
|
4922 | + } else { |
|
4923 | + dol_print_error($db); |
|
4924 | + } |
|
4686 | 4925 | |
4687 | 4926 | return array(); |
4688 | 4927 | } |
@@ -4712,9 +4951,9 @@ discard block |
||
4712 | 4951 | // Search local taxes |
4713 | 4952 | $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; |
4714 | 4953 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
4715 | - if ($firstparamisid) |
|
4716 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
4717 | - else { |
|
4954 | + if ($firstparamisid) { |
|
4955 | + $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
4956 | + } else { |
|
4718 | 4957 | $vatratecleaned = $vatrate; |
4719 | 4958 | $vatratecode = ''; |
4720 | 4959 | if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "x.x (yy)" |
@@ -4723,13 +4962,17 @@ discard block |
||
4723 | 4962 | } |
4724 | 4963 | |
4725 | 4964 | $sql .= ", " . MAIN_DB_PREFIX . "c_country as c"; |
4726 | - if ($mysoc->country_code == 'ES') |
|
4727 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $buyer->country_code . "'"; // local tax in spain use the buyer country ?? |
|
4728 | - else |
|
4729 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
4965 | + if ($mysoc->country_code == 'ES') { |
|
4966 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $buyer->country_code . "'"; |
|
4967 | + } |
|
4968 | + // local tax in spain use the buyer country ?? |
|
4969 | + else { |
|
4970 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
4971 | + } |
|
4730 | 4972 | $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
4731 | - if ($vatratecode) |
|
4732 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
4973 | + if ($vatratecode) { |
|
4974 | + $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
4975 | + } |
|
4733 | 4976 | } |
4734 | 4977 | |
4735 | 4978 | $resql = $db->query($sql); |
@@ -4775,17 +5018,17 @@ discard block |
||
4775 | 5018 | if ($idprodfournprice > 0) { // We want vat for product for a "supplier" object |
4776 | 5019 | $product->get_buyprice($idprodfournprice, 0, 0, 0); |
4777 | 5020 | $ret = $product->vatrate_supplier; |
4778 | - if ($product->default_vat_code) |
|
4779 | - $ret .= ' (' . $product->default_vat_code . ')'; |
|
4780 | - } |
|
4781 | - else { |
|
5021 | + if ($product->default_vat_code) { |
|
5022 | + $ret .= ' (' . $product->default_vat_code . ')'; |
|
5023 | + } |
|
5024 | + } else { |
|
4782 | 5025 | $ret = $product->tva_tx; // Default vat of product we defined |
4783 | - if ($product->default_vat_code) |
|
4784 | - $ret .= ' (' . $product->default_vat_code . ')'; |
|
5026 | + if ($product->default_vat_code) { |
|
5027 | + $ret .= ' (' . $product->default_vat_code . ')'; |
|
5028 | + } |
|
4785 | 5029 | } |
4786 | 5030 | $found = 1; |
4787 | - } |
|
4788 | - else { |
|
5031 | + } else { |
|
4789 | 5032 | // TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet. |
4790 | 5033 | // May be usefull/required if hidden option SERVICE_ARE_ECOMMERCE_200238EC is on |
4791 | 5034 | } |
@@ -4805,14 +5048,18 @@ discard block |
||
4805 | 5048 | $obj = $db->fetch_object($resql); |
4806 | 5049 | if ($obj) { |
4807 | 5050 | $ret = $obj->vat_rate; |
4808 | - if ($obj->default_vat_code) |
|
4809 | - $ret .= ' (' . $obj->default_vat_code . ')'; |
|
5051 | + if ($obj->default_vat_code) { |
|
5052 | + $ret .= ' (' . $obj->default_vat_code . ')'; |
|
5053 | + } |
|
4810 | 5054 | } |
4811 | 5055 | $db->free($sql); |
4812 | - } else |
|
4813 | - dol_print_error($db); |
|
4814 | - } else |
|
4815 | - $ret = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails |
|
5056 | + } else { |
|
5057 | + dol_print_error($db); |
|
5058 | + } |
|
5059 | + } else { |
|
5060 | + $ret = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; |
|
5061 | + } |
|
5062 | + // Forced value if autodetect fails |
|
4816 | 5063 | } |
4817 | 5064 | |
4818 | 5065 | dol_syslog("get_product_vat_for_country: ret=" . $ret); |
@@ -4867,13 +5114,15 @@ discard block |
||
4867 | 5114 | if ($resql) { |
4868 | 5115 | $obj = $db->fetch_object($resql); |
4869 | 5116 | if ($obj) { |
4870 | - if ($local == 1) |
|
4871 | - $ret = $obj->localtax1; |
|
4872 | - elseif ($local == 2) |
|
4873 | - $ret = $obj->localtax2; |
|
5117 | + if ($local == 1) { |
|
5118 | + $ret = $obj->localtax1; |
|
5119 | + } elseif ($local == 2) { |
|
5120 | + $ret = $obj->localtax2; |
|
5121 | + } |
|
4874 | 5122 | } |
4875 | - } else |
|
4876 | - dol_print_error($db); |
|
5123 | + } else { |
|
5124 | + dol_print_error($db); |
|
5125 | + } |
|
4877 | 5126 | } |
4878 | 5127 | |
4879 | 5128 | dol_syslog("get_product_localtax_for_country: ret=" . $ret); |
@@ -4976,15 +5225,16 @@ discard block |
||
4976 | 5225 | global $db; |
4977 | 5226 | |
4978 | 5227 | if ($idprodfournprice > 0) { |
4979 | - if (!class_exists('ProductFournisseur')) |
|
4980 | - require_once DOL_BASE_PATH . '/fourn/class/fournisseur.product.class.php'; |
|
5228 | + if (!class_exists('ProductFournisseur')) { |
|
5229 | + require_once DOL_BASE_PATH . '/fourn/class/fournisseur.product.class.php'; |
|
5230 | + } |
|
4981 | 5231 | $prodprice = new ProductFournisseur($db); |
4982 | 5232 | $prodprice->fetch_product_fournisseur_price($idprodfournprice); |
4983 | 5233 | return $prodprice->fourn_tva_npr; |
4984 | - } |
|
4985 | - elseif ($idprod > 0) { |
|
4986 | - if (!class_exists('Product')) |
|
4987 | - require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
5234 | + } elseif ($idprod > 0) { |
|
5235 | + if (!class_exists('Product')) { |
|
5236 | + require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
5237 | + } |
|
4988 | 5238 | $prod = new Product($db); |
4989 | 5239 | $prod->fetch($idprod); |
4990 | 5240 | return $prod->tva_npr; |
@@ -5010,30 +5260,35 @@ discard block |
||
5010 | 5260 | { |
5011 | 5261 | global $mysoc; |
5012 | 5262 | |
5013 | - if (!is_object($thirdparty_seller)) |
|
5014 | - return -1; |
|
5015 | - if (!is_object($thirdparty_buyer)) |
|
5016 | - return -1; |
|
5263 | + if (!is_object($thirdparty_seller)) { |
|
5264 | + return -1; |
|
5265 | + } |
|
5266 | + if (!is_object($thirdparty_buyer)) { |
|
5267 | + return -1; |
|
5268 | + } |
|
5017 | 5269 | |
5018 | 5270 | if ($local == 1) { // Localtax 1 |
5019 | 5271 | if ($mysoc->country_code == 'ES') { |
5020 | - if (is_numeric($thirdparty_buyer->localtax1_assuj) && !$thirdparty_buyer->localtax1_assuj) |
|
5021 | - return 0; |
|
5022 | - } |
|
5023 | - else { |
|
5272 | + if (is_numeric($thirdparty_buyer->localtax1_assuj) && !$thirdparty_buyer->localtax1_assuj) { |
|
5273 | + return 0; |
|
5274 | + } |
|
5275 | + } else { |
|
5024 | 5276 | // Si vendeur non assujeti a Localtax1, localtax1 par default=0 |
5025 | - if (is_numeric($thirdparty_seller->localtax1_assuj) && !$thirdparty_seller->localtax1_assuj) |
|
5026 | - return 0; |
|
5027 | - if (!is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj == 'localtax1off') |
|
5028 | - return 0; |
|
5029 | - } |
|
5030 | - } |
|
5031 | - elseif ($local == 2) { //I Localtax 2 |
|
5277 | + if (is_numeric($thirdparty_seller->localtax1_assuj) && !$thirdparty_seller->localtax1_assuj) { |
|
5278 | + return 0; |
|
5279 | + } |
|
5280 | + if (!is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj == 'localtax1off') { |
|
5281 | + return 0; |
|
5282 | + } |
|
5283 | + } |
|
5284 | + } elseif ($local == 2) { //I Localtax 2 |
|
5032 | 5285 | // Si vendeur non assujeti a Localtax2, localtax2 par default=0 |
5033 | - if (is_numeric($thirdparty_seller->localtax2_assuj) && !$thirdparty_seller->localtax2_assuj) |
|
5034 | - return 0; |
|
5035 | - if (!is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj == 'localtax2off') |
|
5036 | - return 0; |
|
5286 | + if (is_numeric($thirdparty_seller->localtax2_assuj) && !$thirdparty_seller->localtax2_assuj) { |
|
5287 | + return 0; |
|
5288 | + } |
|
5289 | + if (!is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj == 'localtax2off') { |
|
5290 | + return 0; |
|
5291 | + } |
|
5037 | 5292 | } |
5038 | 5293 | |
5039 | 5294 | if ($thirdparty_seller->country_code == $thirdparty_buyer->country_code) { |
@@ -5058,31 +5313,38 @@ discard block |
||
5058 | 5313 | $classname = ''; |
5059 | 5314 | if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0 |
5060 | 5315 | $result = $langs->trans('yes'); |
5061 | - if ($case == 1 || $case == 3) |
|
5062 | - $result = $langs->trans("Yes"); |
|
5063 | - if ($case == 2) |
|
5064 | - $result = '<input type="checkbox" value="1" checked disabled>'; |
|
5065 | - if ($case == 3) |
|
5066 | - $result = '<input type="checkbox" value="1" checked disabled> ' . $result; |
|
5316 | + if ($case == 1 || $case == 3) { |
|
5317 | + $result = $langs->trans("Yes"); |
|
5318 | + } |
|
5319 | + if ($case == 2) { |
|
5320 | + $result = '<input type="checkbox" value="1" checked disabled>'; |
|
5321 | + } |
|
5322 | + if ($case == 3) { |
|
5323 | + $result = '<input type="checkbox" value="1" checked disabled> ' . $result; |
|
5324 | + } |
|
5067 | 5325 | |
5068 | 5326 | $classname = 'ok'; |
5069 | - } |
|
5070 | - elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') { |
|
5327 | + } elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') { |
|
5071 | 5328 | $result = $langs->trans("no"); |
5072 | - if ($case == 1 || $case == 3) |
|
5073 | - $result = $langs->trans("No"); |
|
5074 | - if ($case == 2) |
|
5075 | - $result = '<input type="checkbox" value="0" disabled>'; |
|
5076 | - if ($case == 3) |
|
5077 | - $result = '<input type="checkbox" value="0" disabled> ' . $result; |
|
5078 | - |
|
5079 | - if ($color == 2) |
|
5080 | - $classname = 'ok'; |
|
5081 | - else |
|
5082 | - $classname = 'error'; |
|
5083 | - } |
|
5084 | - if ($color) |
|
5085 | - return '<font class="' . $classname . '">' . $result . '</font>'; |
|
5329 | + if ($case == 1 || $case == 3) { |
|
5330 | + $result = $langs->trans("No"); |
|
5331 | + } |
|
5332 | + if ($case == 2) { |
|
5333 | + $result = '<input type="checkbox" value="0" disabled>'; |
|
5334 | + } |
|
5335 | + if ($case == 3) { |
|
5336 | + $result = '<input type="checkbox" value="0" disabled> ' . $result; |
|
5337 | + } |
|
5338 | + |
|
5339 | + if ($color == 2) { |
|
5340 | + $classname = 'ok'; |
|
5341 | + } else { |
|
5342 | + $classname = 'error'; |
|
5343 | + } |
|
5344 | + } |
|
5345 | + if ($color) { |
|
5346 | + return '<font class="' . $classname . '">' . $result . '</font>'; |
|
5347 | + } |
|
5086 | 5348 | return $result; |
5087 | 5349 | } |
5088 | 5350 | |
@@ -5108,23 +5370,27 @@ discard block |
||
5108 | 5370 | $path = ''; |
5109 | 5371 | |
5110 | 5372 | $arrayforoldpath = array('cheque', 'user', 'category', 'holiday', 'supplier_invoice', 'invoice_supplier', 'mailing', 'supplier_payment'); |
5111 | - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) |
|
5112 | - $arrayforoldpath[] = 'product'; |
|
5373 | + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { |
|
5374 | + $arrayforoldpath[] = 'product'; |
|
5375 | + } |
|
5113 | 5376 | if (!empty($level) && in_array($modulepart, $arrayforoldpath)) { |
5114 | 5377 | // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided. |
5115 | - if (empty($alpha)) |
|
5116 | - $num = preg_replace('/([^0-9])/i', '', $num); |
|
5117 | - else |
|
5118 | - $num = preg_replace('/^.*\-/i', '', $num); |
|
5378 | + if (empty($alpha)) { |
|
5379 | + $num = preg_replace('/([^0-9])/i', '', $num); |
|
5380 | + } else { |
|
5381 | + $num = preg_replace('/^.*\-/i', '', $num); |
|
5382 | + } |
|
5119 | 5383 | $num = substr("000" . $num, -$level); |
5120 | - if ($level == 1) |
|
5121 | - $path = substr($num, 0, 1); |
|
5122 | - if ($level == 2) |
|
5123 | - $path = substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
5124 | - if ($level == 3) |
|
5125 | - $path = substr($num, 2, 1) . '/' . substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
5126 | - } |
|
5127 | - else { |
|
5384 | + if ($level == 1) { |
|
5385 | + $path = substr($num, 0, 1); |
|
5386 | + } |
|
5387 | + if ($level == 2) { |
|
5388 | + $path = substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
5389 | + } |
|
5390 | + if ($level == 3) { |
|
5391 | + $path = substr($num, 2, 1) . '/' . substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
5392 | + } |
|
5393 | + } else { |
|
5128 | 5394 | // TODO |
5129 | 5395 | // We will enhance here a common way of forging path for document storage |
5130 | 5396 | // Here, object->id, object->ref and modulepart are required. |
@@ -5135,8 +5401,9 @@ discard block |
||
5135 | 5401 | } |
5136 | 5402 | } |
5137 | 5403 | |
5138 | - if (empty($withoutslash) && !empty($path)) |
|
5139 | - $path .= '/'; |
|
5404 | + if (empty($withoutslash) && !empty($path)) { |
|
5405 | + $path .= '/'; |
|
5406 | + } |
|
5140 | 5407 | |
5141 | 5408 | return $path; |
5142 | 5409 | } |
@@ -5156,8 +5423,9 @@ discard block |
||
5156 | 5423 | dol_syslog("functions.lib::dol_mkdir: dir=" . $dir, LOG_INFO); |
5157 | 5424 | |
5158 | 5425 | $dir_osencoded = dol_osencode($dir); |
5159 | - if (@is_dir($dir_osencoded)) |
|
5160 | - return 0; |
|
5426 | + if (@is_dir($dir_osencoded)) { |
|
5427 | + return 0; |
|
5428 | + } |
|
5161 | 5429 | |
5162 | 5430 | $nberr = 0; |
5163 | 5431 | $nbcreated = 0; |
@@ -5172,12 +5440,15 @@ discard block |
||
5172 | 5440 | $cdir = explode("/", $dir); |
5173 | 5441 | $num = count($cdir); |
5174 | 5442 | for ($i = 0; $i < $num; $i++) { |
5175 | - if ($i > 0) |
|
5176 | - $ccdir .= '/' . $cdir[$i]; |
|
5177 | - else |
|
5178 | - $ccdir .= $cdir[$i]; |
|
5179 | - if (preg_match("/^.:$/", $ccdir, $regs)) |
|
5180 | - continue; // Si chemin Windows incomplet, on poursuit par rep suivant |
|
5443 | + if ($i > 0) { |
|
5444 | + $ccdir .= '/' . $cdir[$i]; |
|
5445 | + } else { |
|
5446 | + $ccdir .= $cdir[$i]; |
|
5447 | + } |
|
5448 | + if (preg_match("/^.:$/", $ccdir, $regs)) { |
|
5449 | + continue; |
|
5450 | + } |
|
5451 | + // Si chemin Windows incomplet, on poursuit par rep suivant |
|
5181 | 5452 | |
5182 | 5453 | |
5183 | 5454 | |
@@ -5256,8 +5527,9 @@ discard block |
||
5256 | 5527 | */ |
5257 | 5528 | function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0) |
5258 | 5529 | { |
5259 | - if ($removelinefeed == 2) |
|
5260 | - $stringtoclean = preg_replace('/<br[^>]*>\n+/ims', '<br>', $stringtoclean); |
|
5530 | + if ($removelinefeed == 2) { |
|
5531 | + $stringtoclean = preg_replace('/<br[^>]*>\n+/ims', '<br>', $stringtoclean); |
|
5532 | + } |
|
5261 | 5533 | $temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean); |
5262 | 5534 | |
5263 | 5535 | if ($strip_tags) { |
@@ -5274,8 +5546,9 @@ discard block |
||
5274 | 5546 | $temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto); |
5275 | 5547 | |
5276 | 5548 | // Supprime aussi les retours |
5277 | - if ($removelinefeed == 1) |
|
5278 | - $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp); |
|
5549 | + if ($removelinefeed == 1) { |
|
5550 | + $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp); |
|
5551 | + } |
|
5279 | 5552 | |
5280 | 5553 | // et les espaces doubles |
5281 | 5554 | while (strpos($temp, " ")) { |
@@ -5361,18 +5634,21 @@ discard block |
||
5361 | 5634 | if ($charset == 'UTF-8') { |
5362 | 5635 | $pattern = '/(<br[^>]*>)/Uu'; |
5363 | 5636 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
5364 | - else |
|
5365 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5637 | + else { |
|
5638 | + $pattern = '/(<br[^>]*>)/U'; |
|
5639 | + } |
|
5640 | + // /U is to have UNGREEDY regex to limit to one html tag. |
|
5366 | 5641 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
5367 | 5642 | |
5368 | 5643 | $firstline = ''; |
5369 | 5644 | $i = 0; |
5370 | 5645 | $nba = count($a); // 2x nb of lines in $a because $a contains also a line for each new line separator |
5371 | 5646 | while (($i < $nba) && ($i < ($nboflines * 2))) { |
5372 | - if ($i % 2 == 0) |
|
5373 | - $firstline .= $a[$i]; |
|
5374 | - elseif (($i < (($nboflines * 2) - 1)) && ($i < ($nba - 1))) |
|
5375 | - $firstline .= ($ishtml ? "<br>\n" : "\n"); |
|
5647 | + if ($i % 2 == 0) { |
|
5648 | + $firstline .= $a[$i]; |
|
5649 | + } elseif (($i < (($nboflines * 2) - 1)) && ($i < ($nba - 1))) { |
|
5650 | + $firstline .= ($ishtml ? "<br>\n" : "\n"); |
|
5651 | + } |
|
5376 | 5652 | $i++; |
5377 | 5653 | } |
5378 | 5654 | unset($a); |
@@ -5421,15 +5697,18 @@ discard block |
||
5421 | 5697 | $newstring = $stringtoencode; |
5422 | 5698 | if (dol_textishtml($stringtoencode)) { // Check if text is already HTML or not |
5423 | 5699 | $newstring = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF. |
5424 | - if ($removelasteolbr) |
|
5425 | - $newstring = preg_replace('/<br>$/i', '', $newstring); // Remove last <br> (remove only last one) |
|
5700 | + if ($removelasteolbr) { |
|
5701 | + $newstring = preg_replace('/<br>$/i', '', $newstring); |
|
5702 | + } |
|
5703 | + // Remove last <br> (remove only last one) |
|
5426 | 5704 | $newstring = strtr($newstring, array('&' => '__and__', '<' => '__lt__', '>' => '__gt__', '"' => '__dquot__')); |
5427 | 5705 | $newstring = dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom); // Make entity encoding |
5428 | 5706 | $newstring = strtr($newstring, array('__and__' => '&', '__lt__' => '<', '__gt__' => '>', '__dquot__' => '"')); |
5429 | - } |
|
5430 | - else { |
|
5431 | - if ($removelasteolbr) |
|
5432 | - $newstring = preg_replace('/(\r\n|\r|\n)$/i', '', $newstring); // Remove last \n (may remove several) |
|
5707 | + } else { |
|
5708 | + if ($removelasteolbr) { |
|
5709 | + $newstring = preg_replace('/(\r\n|\r|\n)$/i', '', $newstring); |
|
5710 | + } |
|
5711 | + // Remove last \n (may remove several) |
|
5433 | 5712 | $newstring = dol_nl2br(dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom), $nl2brmode); |
5434 | 5713 | } |
5435 | 5714 | // Other substitutions that htmlentities does not do |
@@ -5531,8 +5810,9 @@ discard block |
||
5531 | 5810 | */ |
5532 | 5811 | function dol_nboflines($s, $maxchar = 0) |
5533 | 5812 | { |
5534 | - if ($s == '') |
|
5535 | - return 0; |
|
5813 | + if ($s == '') { |
|
5814 | + return 0; |
|
5815 | + } |
|
5536 | 5816 | $arraystring = explode("\n", $s); |
5537 | 5817 | $nb = count($arraystring); |
5538 | 5818 | |
@@ -5551,15 +5831,18 @@ discard block |
||
5551 | 5831 | function dol_nboflines_bis($text, $maxlinesize = 0, $charset = 'UTF-8') |
5552 | 5832 | { |
5553 | 5833 | $repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " "); |
5554 | - if (dol_textishtml($text)) |
|
5555 | - $repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " "); |
|
5834 | + if (dol_textishtml($text)) { |
|
5835 | + $repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " "); |
|
5836 | + } |
|
5556 | 5837 | |
5557 | 5838 | $text = strtr($text, $repTable); |
5558 | 5839 | if ($charset == 'UTF-8') { |
5559 | 5840 | $pattern = '/(<br[^>]*>)/Uu'; |
5560 | 5841 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
5561 | - else |
|
5562 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5842 | + else { |
|
5843 | + $pattern = '/(<br[^>]*>)/U'; |
|
5844 | + } |
|
5845 | + // /U is to have UNGREEDY regex to limit to one html tag. |
|
5563 | 5846 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
5564 | 5847 | |
5565 | 5848 | $nblines = (int) floor((count($a) + 1) / 2); |
@@ -5606,39 +5889,47 @@ discard block |
||
5606 | 5889 | function dol_textishtml($msg, $option = 0) |
5607 | 5890 | { |
5608 | 5891 | if ($option == 1) { |
5609 | - if (preg_match('/<html/i', $msg)) |
|
5610 | - return true; |
|
5611 | - elseif (preg_match('/<body/i', $msg)) |
|
5612 | - return true; |
|
5613 | - elseif (preg_match('/<br/i', $msg)) |
|
5614 | - return true; |
|
5892 | + if (preg_match('/<html/i', $msg)) { |
|
5893 | + return true; |
|
5894 | + } elseif (preg_match('/<body/i', $msg)) { |
|
5895 | + return true; |
|
5896 | + } elseif (preg_match('/<br/i', $msg)) { |
|
5897 | + return true; |
|
5898 | + } |
|
5615 | 5899 | return false; |
5616 | - } |
|
5617 | - else { |
|
5618 | - if (preg_match('/<html/i', $msg)) |
|
5619 | - return true; |
|
5620 | - elseif (preg_match('/<body/i', $msg)) |
|
5621 | - return true; |
|
5622 | - elseif (preg_match('/<(b|em|i|u)>/i', $msg)) |
|
5623 | - return true; |
|
5624 | - elseif (preg_match('/<br\/>/i', $msg)) |
|
5625 | - return true; |
|
5626 | - elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i', $msg)) |
|
5627 | - return true; |
|
5628 | - elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i', $msg)) |
|
5629 | - return true; |
|
5630 | - elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i', $msg)) |
|
5631 | - return true; |
|
5632 | - elseif (preg_match('/<img\s+[^<>]*src[^<>]*>/i', $msg)) |
|
5633 | - return true; // must accept <img src="http://example.com/aaa.png" /> |
|
5634 | - elseif (preg_match('/<a\s+[^<>]*href[^<>]*>/i', $msg)) |
|
5635 | - return true; // must accept <a href="http://example.com/aaa.png" /> |
|
5636 | - elseif (preg_match('/<h[0-9]>/i', $msg)) |
|
5637 | - return true; |
|
5638 | - elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg)) |
|
5639 | - return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
5640 | - elseif (preg_match('/&#[0-9]{2,3};/i', $msg)) |
|
5641 | - return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
5900 | + } else { |
|
5901 | + if (preg_match('/<html/i', $msg)) { |
|
5902 | + return true; |
|
5903 | + } elseif (preg_match('/<body/i', $msg)) { |
|
5904 | + return true; |
|
5905 | + } elseif (preg_match('/<(b|em|i|u)>/i', $msg)) { |
|
5906 | + return true; |
|
5907 | + } elseif (preg_match('/<br\/>/i', $msg)) { |
|
5908 | + return true; |
|
5909 | + } elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i', $msg)) { |
|
5910 | + return true; |
|
5911 | + } elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i', $msg)) { |
|
5912 | + return true; |
|
5913 | + } elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i', $msg)) { |
|
5914 | + return true; |
|
5915 | + } elseif (preg_match('/<img\s+[^<>]*src[^<>]*>/i', $msg)) { |
|
5916 | + return true; |
|
5917 | + } |
|
5918 | + // must accept <img src="http://example.com/aaa.png" /> |
|
5919 | + elseif (preg_match('/<a\s+[^<>]*href[^<>]*>/i', $msg)) { |
|
5920 | + return true; |
|
5921 | + } |
|
5922 | + // must accept <a href="http://example.com/aaa.png" /> |
|
5923 | + elseif (preg_match('/<h[0-9]>/i', $msg)) { |
|
5924 | + return true; |
|
5925 | + } elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg)) { |
|
5926 | + return true; |
|
5927 | + } |
|
5928 | + // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
5929 | + elseif (preg_match('/&#[0-9]{2,3};/i', $msg)) { |
|
5930 | + return true; |
|
5931 | + } |
|
5932 | + // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
5642 | 5933 | |
5643 | 5934 | return false; |
5644 | 5935 | } |
@@ -5790,12 +6081,14 @@ discard block |
||
5790 | 6081 | $birthday = dol_print_date($object->birth, 'day'); |
5791 | 6082 | |
5792 | 6083 | $substitutionarray['__MEMBER_ID__'] = $object->id; |
5793 | - if (method_exists($object, 'getCivilityLabel')) |
|
5794 | - $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel(); |
|
6084 | + if (method_exists($object, 'getCivilityLabel')) { |
|
6085 | + $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel(); |
|
6086 | + } |
|
5795 | 6087 | $substitutionarray['__MEMBER_FIRSTNAME__'] = $msgishtml ? dol_htmlentitiesbr($object->firstname) : $object->firstname; |
5796 | 6088 | $substitutionarray['__MEMBER_LASTNAME__'] = $msgishtml ? dol_htmlentitiesbr($object->lastname) : $object->lastname; |
5797 | - if (method_exists($object, 'getFullName')) |
|
5798 | - $substitutionarray['__MEMBER_FULLNAME__'] = $msgishtml ? dol_htmlentitiesbr($object->getFullName($outputlangs)) : $object->getFullName($outputlangs); |
|
6089 | + if (method_exists($object, 'getFullName')) { |
|
6090 | + $substitutionarray['__MEMBER_FULLNAME__'] = $msgishtml ? dol_htmlentitiesbr($object->getFullName($outputlangs)) : $object->getFullName($outputlangs); |
|
6091 | + } |
|
5799 | 6092 | $substitutionarray['__MEMBER_COMPANY__'] = $msgishtml ? dol_htmlentitiesbr($object->societe) : $object->societe; |
5800 | 6093 | $substitutionarray['__MEMBER_ADDRESS__'] = $msgishtml ? dol_htmlentitiesbr($object->address) : $object->address; |
5801 | 6094 | $substitutionarray['__MEMBER_ZIP__'] = $msgishtml ? dol_htmlentitiesbr($object->zip) : $object->zip; |
@@ -5843,10 +6136,12 @@ discard block |
||
5843 | 6136 | $dateplannedstart = ''; |
5844 | 6137 | $datenextexpiration = ''; |
5845 | 6138 | foreach ($object->lines as $line) { |
5846 | - if ($line->date_ouverture_prevue > $dateplannedstart) |
|
5847 | - $dateplannedstart = $line->date_ouverture_prevue; |
|
5848 | - if ($line->statut == 4 && $line->date_fin_prevue && (!$datenextexpiration || $line->date_fin_prevue < $datenextexpiration)) |
|
5849 | - $datenextexpiration = $line->date_fin_prevue; |
|
6139 | + if ($line->date_ouverture_prevue > $dateplannedstart) { |
|
6140 | + $dateplannedstart = $line->date_ouverture_prevue; |
|
6141 | + } |
|
6142 | + if ($line->statut == 4 && $line->date_fin_prevue && (!$datenextexpiration || $line->date_fin_prevue < $datenextexpiration)) { |
|
6143 | + $datenextexpiration = $line->date_fin_prevue; |
|
6144 | + } |
|
5850 | 6145 | } |
5851 | 6146 | $substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATE__'] = dol_print_date($dateplannedstart, 'dayrfc'); |
5852 | 6147 | $substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATETIME__'] = dol_print_date($dateplannedstart, 'standard'); |
@@ -5856,8 +6151,9 @@ discard block |
||
5856 | 6151 | |
5857 | 6152 | // Create dynamic tags for __EXTRAFIELD_FIELD__ |
5858 | 6153 | if ($object->table_element && $object->id > 0) { |
5859 | - if (!is_object($extrafields)) |
|
5860 | - $extrafields = new ExtraFields($db); |
|
6154 | + if (!is_object($extrafields)) { |
|
6155 | + $extrafields = new ExtraFields($db); |
|
6156 | + } |
|
5861 | 6157 | $extrafields->fetch_name_optionals_label($object->table_element, true); |
5862 | 6158 | |
5863 | 6159 | if ($object->fetch_optionals() > 0) { |
@@ -5878,12 +6174,15 @@ discard block |
||
5878 | 6174 | require_once DOL_BASE_PATH . '/core/lib/payments.lib.php'; |
5879 | 6175 | $outputlangs->loadLangs(array('paypal', 'other')); |
5880 | 6176 | $typeforonlinepayment = 'free'; |
5881 | - if (is_object($object) && $object->element == 'commande') |
|
5882 | - $typeforonlinepayment = 'order'; |
|
5883 | - if (is_object($object) && $object->element == 'facture') |
|
5884 | - $typeforonlinepayment = 'invoice'; |
|
5885 | - if (is_object($object) && $object->element == 'member') |
|
5886 | - $typeforonlinepayment = 'member'; |
|
6177 | + if (is_object($object) && $object->element == 'commande') { |
|
6178 | + $typeforonlinepayment = 'order'; |
|
6179 | + } |
|
6180 | + if (is_object($object) && $object->element == 'facture') { |
|
6181 | + $typeforonlinepayment = 'invoice'; |
|
6182 | + } |
|
6183 | + if (is_object($object) && $object->element == 'member') { |
|
6184 | + $typeforonlinepayment = 'member'; |
|
6185 | + } |
|
5887 | 6186 | $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__']); |
5888 | 6187 | $paymenturl = $url; |
5889 | 6188 | } |
@@ -5893,16 +6192,19 @@ discard block |
||
5893 | 6192 | |
5894 | 6193 | if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') { |
5895 | 6194 | $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element); |
5896 | - } else |
|
5897 | - $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = ''; |
|
6195 | + } else { |
|
6196 | + $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = ''; |
|
6197 | + } |
|
5898 | 6198 | if (!empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'commande') { |
5899 | 6199 | $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = $object->getLastMainDocLink($object->element); |
5900 | - } else |
|
5901 | - $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = ''; |
|
6200 | + } else { |
|
6201 | + $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = ''; |
|
6202 | + } |
|
5902 | 6203 | if (!empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'facture') { |
5903 | 6204 | $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element); |
5904 | - } else |
|
5905 | - $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = ''; |
|
6205 | + } else { |
|
6206 | + $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = ''; |
|
6207 | + } |
|
5906 | 6208 | } |
5907 | 6209 | } |
5908 | 6210 | if (empty($exclude) || !in_array('objectamount', $exclude)) { |
@@ -5912,18 +6214,22 @@ discard block |
||
5912 | 6214 | $substitutionarray['__AMOUNT__'] = is_object($object) ? $object->total_ttc : ''; |
5913 | 6215 | $substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object) ? $object->total_ht : ''; |
5914 | 6216 | $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? ($object->total_vat ? $object->total_vat : $object->total_tva) : ''; |
5915 | - if ($onlykey != 2 || $mysoc->useLocalTax(1)) |
|
5916 | - $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : ''; |
|
5917 | - if ($onlykey != 2 || $mysoc->useLocalTax(2)) |
|
5918 | - $substitutionarray['__AMOUNT_TAX3__'] = is_object($object) ? $object->total_localtax2 : ''; |
|
6217 | + if ($onlykey != 2 || $mysoc->useLocalTax(1)) { |
|
6218 | + $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : ''; |
|
6219 | + } |
|
6220 | + if ($onlykey != 2 || $mysoc->useLocalTax(2)) { |
|
6221 | + $substitutionarray['__AMOUNT_TAX3__'] = is_object($object) ? $object->total_localtax2 : ''; |
|
6222 | + } |
|
5919 | 6223 | |
5920 | 6224 | $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object) ? price($object->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency) : ''; |
5921 | 6225 | $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object) ? price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency) : ''; |
5922 | 6226 | $substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object) ? ($object->total_vat ? price($object->total_vat, 0, $outputlangs, 0, 0, -1, $conf->currency) : price($object->total_tva, 0, $outputlangs, 0, 0, -1, $conf->currency)) : ''; |
5923 | - if ($onlykey != 2 || $mysoc->useLocalTax(1)) |
|
5924 | - $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, $conf->currency) : ''; |
|
5925 | - if ($onlykey != 2 || $mysoc->useLocalTax(2)) |
|
5926 | - $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, $conf->currency) : ''; |
|
6227 | + if ($onlykey != 2 || $mysoc->useLocalTax(1)) { |
|
6228 | + $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, $conf->currency) : ''; |
|
6229 | + } |
|
6230 | + if ($onlykey != 2 || $mysoc->useLocalTax(2)) { |
|
6231 | + $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, $conf->currency) : ''; |
|
6232 | + } |
|
5927 | 6233 | |
5928 | 6234 | // TODO Add keys for foreign multicurrency |
5929 | 6235 | // For backward compatibility |
@@ -5993,23 +6299,27 @@ discard block |
||
5993 | 6299 | { |
5994 | 6300 | global $conf, $langs; |
5995 | 6301 | |
5996 | - if (!is_array($substitutionarray)) |
|
5997 | - return 'ErrorBadParameterSubstitutionArrayWhenCalling_make_substitutions'; |
|
6302 | + if (!is_array($substitutionarray)) { |
|
6303 | + return 'ErrorBadParameterSubstitutionArrayWhenCalling_make_substitutions'; |
|
6304 | + } |
|
5998 | 6305 | |
5999 | - if (empty($outputlangs)) |
|
6000 | - $outputlangs = $langs; |
|
6306 | + if (empty($outputlangs)) { |
|
6307 | + $outputlangs = $langs; |
|
6308 | + } |
|
6001 | 6309 | |
6002 | 6310 | // Make substitution for language keys |
6003 | 6311 | if (is_object($outputlangs)) { |
6004 | 6312 | while (preg_match('/__\(([^\)]+)\)__/', $text, $reg)) { |
6005 | 6313 | $msgishtml = 0; |
6006 | - if (dol_textishtml($text, 1)) |
|
6007 | - $msgishtml = 1; |
|
6314 | + if (dol_textishtml($text, 1)) { |
|
6315 | + $msgishtml = 1; |
|
6316 | + } |
|
6008 | 6317 | |
6009 | 6318 | // If key is __(TranslationKey|langfile)__, then force load of langfile.lang |
6010 | 6319 | $tmp = explode('|', $reg[1]); |
6011 | - if (!empty($tmp[1])) |
|
6012 | - $outputlangs->load($tmp[1]); |
|
6320 | + if (!empty($tmp[1])) { |
|
6321 | + $outputlangs->load($tmp[1]); |
|
6322 | + } |
|
6013 | 6323 | |
6014 | 6324 | $text = preg_replace('/__\(' . preg_quote($reg[1], '/') . '\)__/', $msgishtml ? dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text); |
6015 | 6325 | } |
@@ -6019,23 +6329,29 @@ discard block |
||
6019 | 6329 | // it is also converted. |
6020 | 6330 | while (preg_match('/__\[([^\]]+)\]__/', $text, $reg)) { |
6021 | 6331 | $msgishtml = 0; |
6022 | - if (dol_textishtml($text, 1)) |
|
6023 | - $msgishtml = 1; |
|
6332 | + if (dol_textishtml($text, 1)) { |
|
6333 | + $msgishtml = 1; |
|
6334 | + } |
|
6024 | 6335 | |
6025 | 6336 | $keyfound = $reg[1]; |
6026 | - if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) |
|
6027 | - $newval = '*****forbidden*****'; |
|
6028 | - else |
|
6029 | - $newval = empty($conf->global->$keyfound) ? '' : $conf->global->$keyfound; |
|
6337 | + if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) { |
|
6338 | + $newval = '*****forbidden*****'; |
|
6339 | + } else { |
|
6340 | + $newval = empty($conf->global->$keyfound) ? '' : $conf->global->$keyfound; |
|
6341 | + } |
|
6030 | 6342 | $text = preg_replace('/__\[' . preg_quote($keyfound, '/') . '\]__/', $msgishtml ? dol_htmlentitiesbr($newval) : $newval, $text); |
6031 | 6343 | } |
6032 | 6344 | |
6033 | 6345 | // Make substitition for array $substitutionarray |
6034 | 6346 | foreach ($substitutionarray as $key => $value) { |
6035 | - if ($key == '__SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
|
6036 | - $value = ''; // Protection |
|
6037 | - if ($key == '__USER_SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
|
6038 | - $value = ''; // Protection |
|
6347 | + if ($key == '__SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) { |
|
6348 | + $value = ''; |
|
6349 | + } |
|
6350 | + // Protection |
|
6351 | + if ($key == '__USER_SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) { |
|
6352 | + $value = ''; |
|
6353 | + } |
|
6354 | + // Protection |
|
6039 | 6355 | |
6040 | 6356 | $text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example |
6041 | 6357 | } |
@@ -6081,8 +6397,9 @@ discard block |
||
6081 | 6397 | $dir = dol_buildpath($reldir, 0); |
6082 | 6398 | |
6083 | 6399 | // Check if directory exists |
6084 | - if (!dol_is_dir($dir)) |
|
6085 | - continue; |
|
6400 | + if (!dol_is_dir($dir)) { |
|
6401 | + continue; |
|
6402 | + } |
|
6086 | 6403 | |
6087 | 6404 | $substitfiles = dol_dir_list($dir, 'files', 0, 'functions_'); |
6088 | 6405 | foreach ($substitfiles as $substitfile) { |
@@ -6094,8 +6411,9 @@ discard block |
||
6094 | 6411 | require_once $dir . $substitfile['name']; |
6095 | 6412 | // Call the user's function, and only if it is defined |
6096 | 6413 | $function_name = $module . "_" . $callfunc; |
6097 | - if (function_exists($function_name)) |
|
6098 | - $function_name($substitutionarray, $outputlangs, $object, $parameters); |
|
6414 | + if (function_exists($function_name)) { |
|
6415 | + $function_name($substitutionarray, $outputlangs, $object, $parameters); |
|
6416 | + } |
|
6099 | 6417 | } |
6100 | 6418 | } |
6101 | 6419 | } |
@@ -6131,8 +6449,9 @@ discard block |
||
6131 | 6449 | |
6132 | 6450 | $out = ''; |
6133 | 6451 | |
6134 | - if (!is_object($outputlangs)) |
|
6135 | - $outputlangs = $langs; |
|
6452 | + if (!is_object($outputlangs)) { |
|
6453 | + $outputlangs = $langs; |
|
6454 | + } |
|
6136 | 6455 | |
6137 | 6456 | if ($date_start && $date_end) { |
6138 | 6457 | $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($date_start, $format, false, $outputlangs), dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : ''); |
@@ -6161,20 +6480,22 @@ discard block |
||
6161 | 6480 | |
6162 | 6481 | $ret = ''; |
6163 | 6482 | // If order not defined, we use the setup |
6164 | - if ($nameorder < 0) |
|
6165 | - $nameorder = (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? 1 : 0); |
|
6483 | + if ($nameorder < 0) { |
|
6484 | + $nameorder = (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? 1 : 0); |
|
6485 | + } |
|
6166 | 6486 | if ($nameorder && ((string) $nameorder != '2')) { |
6167 | 6487 | $ret .= $firstname; |
6168 | - if ($firstname && $lastname) |
|
6169 | - $ret .= ' '; |
|
6488 | + if ($firstname && $lastname) { |
|
6489 | + $ret .= ' '; |
|
6490 | + } |
|
6170 | 6491 | $ret .= $lastname; |
6171 | - } |
|
6172 | - else if ($nameorder == 2) { |
|
6492 | + } else if ($nameorder == 2) { |
|
6173 | 6493 | $ret .= $firstname; |
6174 | 6494 | } else { |
6175 | 6495 | $ret .= $lastname; |
6176 | - if ($firstname && $lastname) |
|
6177 | - $ret .= ' '; |
|
6496 | + if ($firstname && $lastname) { |
|
6497 | + $ret .= ' '; |
|
6498 | + } |
|
6178 | 6499 | $ret .= $firstname; |
6179 | 6500 | } |
6180 | 6501 | return $ret; |
@@ -6194,13 +6515,14 @@ discard block |
||
6194 | 6515 | { |
6195 | 6516 | //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function |
6196 | 6517 | if (!is_array($mesgs)) { // If mesgs is a string |
6197 | - if ($mesgs) |
|
6198 | - $_SESSION['dol_events'][$style][] = $mesgs; |
|
6199 | - } |
|
6200 | - else { // If mesgs is an array |
|
6518 | + if ($mesgs) { |
|
6519 | + $_SESSION['dol_events'][$style][] = $mesgs; |
|
6520 | + } |
|
6521 | + } else { // If mesgs is an array |
|
6201 | 6522 | foreach ($mesgs as $mesg) { |
6202 | - if ($mesg) |
|
6203 | - $_SESSION['dol_events'][$style][] = $mesg; |
|
6523 | + if ($mesg) { |
|
6524 | + $_SESSION['dol_events'][$style][] = $mesg; |
|
6525 | + } |
|
6204 | 6526 | } |
6205 | 6527 | } |
6206 | 6528 | } |
@@ -6220,13 +6542,16 @@ discard block |
||
6220 | 6542 | if (empty($mesg) && empty($mesgs)) { |
6221 | 6543 | dol_syslog("Try to add a message in stack with empty message", LOG_WARNING); |
6222 | 6544 | } else { |
6223 | - if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) |
|
6224 | - dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages'); |
|
6225 | - if (empty($mesgs)) |
|
6226 | - setEventMessage($mesg, $style); |
|
6227 | - else { |
|
6228 | - if (!empty($mesg) && !in_array($mesg, $mesgs)) |
|
6229 | - setEventMessage($mesg, $style); // Add message string if not already into array |
|
6545 | + if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) { |
|
6546 | + dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages'); |
|
6547 | + } |
|
6548 | + if (empty($mesgs)) { |
|
6549 | + setEventMessage($mesg, $style); |
|
6550 | + } else { |
|
6551 | + if (!empty($mesg) && !in_array($mesg, $mesgs)) { |
|
6552 | + setEventMessage($mesg, $style); |
|
6553 | + } |
|
6554 | + // Add message string if not already into array |
|
6230 | 6555 | setEventMessage($mesgs, $style); |
6231 | 6556 | } |
6232 | 6557 | } |
@@ -6245,22 +6570,25 @@ discard block |
||
6245 | 6570 | { |
6246 | 6571 | // Show mesgs |
6247 | 6572 | if (isset($_SESSION['dol_events']['mesgs'])) { |
6248 | - if (empty($disabledoutputofmessages)) |
|
6249 | - dol_htmloutput_mesg('', $_SESSION['dol_events']['mesgs']); |
|
6573 | + if (empty($disabledoutputofmessages)) { |
|
6574 | + dol_htmloutput_mesg('', $_SESSION['dol_events']['mesgs']); |
|
6575 | + } |
|
6250 | 6576 | unset($_SESSION['dol_events']['mesgs']); |
6251 | 6577 | } |
6252 | 6578 | |
6253 | 6579 | // Show errors |
6254 | 6580 | if (isset($_SESSION['dol_events']['errors'])) { |
6255 | - if (empty($disabledoutputofmessages)) |
|
6256 | - dol_htmloutput_mesg('', $_SESSION['dol_events']['errors'], 'error'); |
|
6581 | + if (empty($disabledoutputofmessages)) { |
|
6582 | + dol_htmloutput_mesg('', $_SESSION['dol_events']['errors'], 'error'); |
|
6583 | + } |
|
6257 | 6584 | unset($_SESSION['dol_events']['errors']); |
6258 | 6585 | } |
6259 | 6586 | |
6260 | 6587 | // Show warnings |
6261 | 6588 | if (isset($_SESSION['dol_events']['warnings'])) { |
6262 | - if (empty($disabledoutputofmessages)) |
|
6263 | - dol_htmloutput_mesg('', $_SESSION['dol_events']['warnings'], 'warning'); |
|
6589 | + if (empty($disabledoutputofmessages)) { |
|
6590 | + dol_htmloutput_mesg('', $_SESSION['dol_events']['warnings'], 'warning'); |
|
6591 | + } |
|
6264 | 6592 | unset($_SESSION['dol_events']['warnings']); |
6265 | 6593 | } |
6266 | 6594 | } |
@@ -6301,8 +6629,9 @@ discard block |
||
6301 | 6629 | foreach ($mesgarray as $message) { |
6302 | 6630 | $ret++; |
6303 | 6631 | $out .= $langs->trans($message); |
6304 | - if ($ret < count($mesgarray)) |
|
6305 | - $out .= "<br>\n"; |
|
6632 | + if ($ret < count($mesgarray)) { |
|
6633 | + $out .= "<br>\n"; |
|
6634 | + } |
|
6306 | 6635 | } |
6307 | 6636 | } |
6308 | 6637 | if ($mesgstring) { |
@@ -6368,8 +6697,9 @@ discard block |
||
6368 | 6697 | */ |
6369 | 6698 | function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'ok', $keepembedded = 0) |
6370 | 6699 | { |
6371 | - if (empty($mesgstring) && (!is_array($mesgarray) || count($mesgarray) == 0)) |
|
6372 | - return; |
|
6700 | + if (empty($mesgstring) && (!is_array($mesgarray) || count($mesgarray) == 0)) { |
|
6701 | + return; |
|
6702 | + } |
|
6373 | 6703 | |
6374 | 6704 | $iserror = 0; |
6375 | 6705 | $iswarning = 0; |
@@ -6384,14 +6714,17 @@ discard block |
||
6384 | 6714 | break; |
6385 | 6715 | } |
6386 | 6716 | } |
6387 | - } else if ($mesgstring && preg_match('/class="error"/i', $mesgstring)) |
|
6388 | - $iserror++; |
|
6389 | - else if ($mesgstring && preg_match('/class="warning"/i', $mesgstring)) |
|
6390 | - $iswarning++; |
|
6391 | - if ($style == 'error') |
|
6392 | - $iserror++; |
|
6393 | - if ($style == 'warning') |
|
6394 | - $iswarning++; |
|
6717 | + } else if ($mesgstring && preg_match('/class="error"/i', $mesgstring)) { |
|
6718 | + $iserror++; |
|
6719 | + } else if ($mesgstring && preg_match('/class="warning"/i', $mesgstring)) { |
|
6720 | + $iswarning++; |
|
6721 | + } |
|
6722 | + if ($style == 'error') { |
|
6723 | + $iserror++; |
|
6724 | + } |
|
6725 | + if ($style == 'warning') { |
|
6726 | + $iswarning++; |
|
6727 | + } |
|
6395 | 6728 | |
6396 | 6729 | if ($iserror || $iswarning) { |
6397 | 6730 | // Remove div from texts |
@@ -6410,9 +6743,10 @@ discard block |
||
6410 | 6743 | $mesgarray = $newmesgarray; |
6411 | 6744 | } |
6412 | 6745 | print get_htmloutput_mesg($mesgstring, $mesgarray, ($iserror ? 'error' : 'warning'), $keepembedded); |
6413 | - } else |
|
6414 | - print get_htmloutput_mesg($mesgstring, $mesgarray, 'ok', $keepembedded); |
|
6415 | -} |
|
6746 | + } else { |
|
6747 | + print get_htmloutput_mesg($mesgstring, $mesgarray, 'ok', $keepembedded); |
|
6748 | + } |
|
6749 | + } |
|
6416 | 6750 | |
6417 | 6751 | /** |
6418 | 6752 | * Print formated error messages to output (Used to show messages on html output). |
@@ -6452,15 +6786,17 @@ discard block |
||
6452 | 6786 | $sizearray = count($array); |
6453 | 6787 | if ($sizearray > 0) { |
6454 | 6788 | $temp = array(); |
6455 | - foreach (array_keys($array) as $key) |
|
6456 | - $temp[$key] = $array[$key][$index]; |
|
6789 | + foreach (array_keys($array) as $key) { |
|
6790 | + $temp[$key] = $array[$key][$index]; |
|
6791 | + } |
|
6457 | 6792 | |
6458 | - if (!$natsort) |
|
6459 | - ($order == 'asc') ? asort($temp) : arsort($temp); |
|
6460 | - else { |
|
6793 | + if (!$natsort) { |
|
6794 | + ($order == 'asc') ? asort($temp) : arsort($temp); |
|
6795 | + } else { |
|
6461 | 6796 | ($case_sensitive) ? natsort($temp) : natcasesort($temp); |
6462 | - if ($order != 'asc') |
|
6463 | - $temp = array_reverse($temp, true); |
|
6797 | + if ($order != 'asc') { |
|
6798 | + $temp = array_reverse($temp, true); |
|
6799 | + } |
|
6464 | 6800 | } |
6465 | 6801 | |
6466 | 6802 | $sorted = array(); |
@@ -6486,23 +6822,38 @@ discard block |
||
6486 | 6822 | // We must use here a binary strlen function (so not dol_strlen) |
6487 | 6823 | $strLength = dol_strlen($str); |
6488 | 6824 | for ($i = 0; $i < $strLength; $i++) { |
6489 | - if (ord($str[$i]) < 0x80) |
|
6490 | - continue; // 0bbbbbbb |
|
6491 | - elseif ((ord($str[$i]) & 0xE0) == 0xC0) |
|
6492 | - $n = 1; // 110bbbbb |
|
6493 | - elseif ((ord($str[$i]) & 0xF0) == 0xE0) |
|
6494 | - $n = 2; // 1110bbbb |
|
6495 | - elseif ((ord($str[$i]) & 0xF8) == 0xF0) |
|
6496 | - $n = 3; // 11110bbb |
|
6497 | - elseif ((ord($str[$i]) & 0xFC) == 0xF8) |
|
6498 | - $n = 4; // 111110bb |
|
6499 | - elseif ((ord($str[$i]) & 0xFE) == 0xFC) |
|
6500 | - $n = 5; // 1111110b |
|
6501 | - else |
|
6502 | - return false; // Does not match any model |
|
6825 | + if (ord($str[$i]) < 0x80) { |
|
6826 | + continue; |
|
6827 | + } |
|
6828 | + // 0bbbbbbb |
|
6829 | + elseif ((ord($str[$i]) & 0xE0) == 0xC0) { |
|
6830 | + $n = 1; |
|
6831 | + } |
|
6832 | + // 110bbbbb |
|
6833 | + elseif ((ord($str[$i]) & 0xF0) == 0xE0) { |
|
6834 | + $n = 2; |
|
6835 | + } |
|
6836 | + // 1110bbbb |
|
6837 | + elseif ((ord($str[$i]) & 0xF8) == 0xF0) { |
|
6838 | + $n = 3; |
|
6839 | + } |
|
6840 | + // 11110bbb |
|
6841 | + elseif ((ord($str[$i]) & 0xFC) == 0xF8) { |
|
6842 | + $n = 4; |
|
6843 | + } |
|
6844 | + // 111110bb |
|
6845 | + elseif ((ord($str[$i]) & 0xFE) == 0xFC) { |
|
6846 | + $n = 5; |
|
6847 | + } |
|
6848 | + // 1111110b |
|
6849 | + else { |
|
6850 | + return false; |
|
6851 | + } |
|
6852 | + // Does not match any model |
|
6503 | 6853 | for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ? |
6504 | - if (( ++$i == strlen($str)) || ((ord($str[$i]) & 0xC0) != 0x80)) |
|
6505 | - return false; |
|
6854 | + if (( ++$i == strlen($str)) || ((ord($str[$i]) & 0xC0) != 0x80)) { |
|
6855 | + return false; |
|
6856 | + } |
|
6506 | 6857 | } |
6507 | 6858 | } |
6508 | 6859 | return true; |
@@ -6520,15 +6871,21 @@ discard block |
||
6520 | 6871 | global $conf; |
6521 | 6872 | |
6522 | 6873 | $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 |
6523 | - if (empty($tmp) && !empty($_SERVER["WINDIR"])) |
|
6524 | - $tmp = 'iso-8859-1'; // By default for windows |
|
6525 | - if (empty($tmp)) |
|
6526 | - $tmp = 'utf-8'; // By default for other |
|
6527 | - if (!empty($conf->global->MAIN_FILESYSTEM_ENCODING)) |
|
6528 | - $tmp = $conf->global->MAIN_FILESYSTEM_ENCODING; |
|
6529 | - |
|
6530 | - if ($tmp == 'iso-8859-1') |
|
6531 | - return utf8_decode($str); |
|
6874 | + if (empty($tmp) && !empty($_SERVER["WINDIR"])) { |
|
6875 | + $tmp = 'iso-8859-1'; |
|
6876 | + } |
|
6877 | + // By default for windows |
|
6878 | + if (empty($tmp)) { |
|
6879 | + $tmp = 'utf-8'; |
|
6880 | + } |
|
6881 | + // By default for other |
|
6882 | + if (!empty($conf->global->MAIN_FILESYSTEM_ENCODING)) { |
|
6883 | + $tmp = $conf->global->MAIN_FILESYSTEM_ENCODING; |
|
6884 | + } |
|
6885 | + |
|
6886 | + if ($tmp == 'iso-8859-1') { |
|
6887 | + return utf8_decode($str); |
|
6888 | + } |
|
6532 | 6889 | return $str; |
6533 | 6890 | } |
6534 | 6891 | |
@@ -6550,8 +6907,9 @@ discard block |
||
6550 | 6907 | global $cache_codes; |
6551 | 6908 | |
6552 | 6909 | // If key empty |
6553 | - if ($key == '') |
|
6554 | - return ''; |
|
6910 | + if ($key == '') { |
|
6911 | + return ''; |
|
6912 | + } |
|
6555 | 6913 | |
6556 | 6914 | // Check in cache |
6557 | 6915 | if (isset($cache_codes[$tablename][$key][$fieldid])) { // Can be defined to 0 or '' |
@@ -6563,20 +6921,21 @@ discard block |
||
6563 | 6921 | $sql = "SELECT " . $fieldid . " as valuetoget"; |
6564 | 6922 | $sql .= " FROM " . MAIN_DB_PREFIX . $tablename; |
6565 | 6923 | $sql .= " WHERE " . $fieldkey . " = '" . $db->escape($key) . "'"; |
6566 | - if (!empty($entityfilter)) |
|
6567 | - $sql .= " AND entity IN (" . getEntity($tablename) . ")"; |
|
6924 | + if (!empty($entityfilter)) { |
|
6925 | + $sql .= " AND entity IN (" . getEntity($tablename) . ")"; |
|
6926 | + } |
|
6568 | 6927 | |
6569 | 6928 | $resql = $db->query($sql); |
6570 | 6929 | if ($resql) { |
6571 | 6930 | $obj = $db->fetch_object($resql); |
6572 | - if ($obj) |
|
6573 | - $cache_codes[$tablename][$key][$fieldid] = $obj->valuetoget; |
|
6574 | - else |
|
6575 | - $cache_codes[$tablename][$key][$fieldid] = ''; |
|
6931 | + if ($obj) { |
|
6932 | + $cache_codes[$tablename][$key][$fieldid] = $obj->valuetoget; |
|
6933 | + } else { |
|
6934 | + $cache_codes[$tablename][$key][$fieldid] = ''; |
|
6935 | + } |
|
6576 | 6936 | $db->free($resql); |
6577 | 6937 | return $cache_codes[$tablename][$key][$fieldid]; |
6578 | - } |
|
6579 | - else { |
|
6938 | + } else { |
|
6580 | 6939 | return -1; |
6581 | 6940 | } |
6582 | 6941 | } |
@@ -6623,16 +6982,17 @@ discard block |
||
6623 | 6982 | global $soc; // For backward compatibility |
6624 | 6983 | //print $s."<br>\n"; |
6625 | 6984 | if ($returnvalue) { |
6626 | - if ($hideerrors) |
|
6627 | - return @eval('return ' . $s . ';'); |
|
6628 | - else |
|
6629 | - return eval('return ' . $s . ';'); |
|
6630 | - } |
|
6631 | - else { |
|
6632 | - if ($hideerrors) |
|
6633 | - @eval($s); |
|
6634 | - else |
|
6635 | - eval($s); |
|
6985 | + if ($hideerrors) { |
|
6986 | + return @eval('return ' . $s . ';'); |
|
6987 | + } else { |
|
6988 | + return eval('return ' . $s . ';'); |
|
6989 | + } |
|
6990 | + } else { |
|
6991 | + if ($hideerrors) { |
|
6992 | + @eval($s); |
|
6993 | + } else { |
|
6994 | + eval($s); |
|
6995 | + } |
|
6636 | 6996 | } |
6637 | 6997 | } |
6638 | 6998 | |
@@ -6658,8 +7018,9 @@ discard block |
||
6658 | 7018 | { |
6659 | 7019 | global $langs; |
6660 | 7020 | |
6661 | - if (empty($codelang)) |
|
6662 | - return ''; |
|
7021 | + if (empty($codelang)) { |
|
7022 | + return ''; |
|
7023 | + } |
|
6663 | 7024 | |
6664 | 7025 | if ($codelang == 'auto') { |
6665 | 7026 | return '<span class="fa fa-globe"></span>'; |
@@ -6673,9 +7034,9 @@ discard block |
||
6673 | 7034 | 'sv_SV' => 'se' |
6674 | 7035 | ); |
6675 | 7036 | |
6676 | - if (isset($langtocountryflag[$codelang])) |
|
6677 | - $flagImage = $langtocountryflag[$codelang]; |
|
6678 | - else { |
|
7037 | + if (isset($langtocountryflag[$codelang])) { |
|
7038 | + $flagImage = $langtocountryflag[$codelang]; |
|
7039 | + } else { |
|
6679 | 7040 | $tmparray = explode('_', $codelang); |
6680 | 7041 | $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1]; |
6681 | 7042 | } |
@@ -6693,15 +7054,20 @@ discard block |
||
6693 | 7054 | { |
6694 | 7055 | global $mysoc; |
6695 | 7056 | |
6696 | - if (strtoupper($countrycode) == 'MQ') |
|
6697 | - return 'fr_CA'; |
|
6698 | - if (strtoupper($countrycode) == 'SE') |
|
6699 | - return 'sv_SE'; // se_SE is Sami/Sweden, and we want in priority sv_SE for SE country |
|
7057 | + if (strtoupper($countrycode) == 'MQ') { |
|
7058 | + return 'fr_CA'; |
|
7059 | + } |
|
7060 | + if (strtoupper($countrycode) == 'SE') { |
|
7061 | + return 'sv_SE'; |
|
7062 | + } |
|
7063 | + // se_SE is Sami/Sweden, and we want in priority sv_SE for SE country |
|
6700 | 7064 | if (strtoupper($countrycode) == 'CH') { |
6701 | - if ($mysoc->country_code == 'FR') |
|
6702 | - return 'fr_CH'; |
|
6703 | - if ($mysoc->country_code == 'DE') |
|
6704 | - return 'de_CH'; |
|
7065 | + if ($mysoc->country_code == 'FR') { |
|
7066 | + return 'fr_CH'; |
|
7067 | + } |
|
7068 | + if ($mysoc->country_code == 'DE') { |
|
7069 | + return 'de_CH'; |
|
7070 | + } |
|
6705 | 7071 | } |
6706 | 7072 | |
6707 | 7073 | // Locale list taken from: |
@@ -6879,8 +7245,9 @@ discard block |
||
6879 | 7245 | ); |
6880 | 7246 | |
6881 | 7247 | $buildprimarykeytotest = strtolower($countrycode) . '-' . strtoupper($countrycode); |
6882 | - if (in_array($buildprimarykeytotest, $locales)) |
|
6883 | - return strtolower($countrycode) . '_' . strtoupper($countrycode); |
|
7248 | + if (in_array($buildprimarykeytotest, $locales)) { |
|
7249 | + return strtolower($countrycode) . '_' . strtoupper($countrycode); |
|
7250 | + } |
|
6884 | 7251 | |
6885 | 7252 | foreach ($locales as $locale) { |
6886 | 7253 | $locale_language = locale_get_primary_language($locale); |
@@ -6934,18 +7301,21 @@ discard block |
||
6934 | 7301 | |
6935 | 7302 | if ($mode == 'add' && !preg_match('/^\-/', $values[1])) { |
6936 | 7303 | if (count($values) == 6) { // new declaration with permissions: $value='objecttype:+tabname1:Title1:langfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__' |
6937 | - if ($values[0] != $type) |
|
6938 | - continue; |
|
7304 | + if ($values[0] != $type) { |
|
7305 | + continue; |
|
7306 | + } |
|
6939 | 7307 | |
6940 | 7308 | if (verifCond($values[4])) { |
6941 | - if ($values[3]) |
|
6942 | - $langs->load($values[3]); |
|
7309 | + if ($values[3]) { |
|
7310 | + $langs->load($values[3]); |
|
7311 | + } |
|
6943 | 7312 | if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) { |
6944 | 7313 | $substitutionarray = array(); |
6945 | 7314 | complete_substitutions_array($substitutionarray, $langs, $object, array('needforkey' => $values[2])); |
6946 | 7315 | $label = make_substitutions($reg[1], $substitutionarray); |
6947 | - } else |
|
6948 | - $label = $langs->trans($values[2]); |
|
7316 | + } else { |
|
7317 | + $label = $langs->trans($values[2]); |
|
7318 | + } |
|
6949 | 7319 | |
6950 | 7320 | //$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1); |
6951 | 7321 | $head[$h][0] = BASE_URI . preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]); |
@@ -6953,30 +7323,32 @@ discard block |
||
6953 | 7323 | $head[$h][2] = str_replace('+', '', $values[1]); |
6954 | 7324 | $h++; |
6955 | 7325 | } |
6956 | - } |
|
6957 | - else if (count($values) == 5) { // deprecated |
|
7326 | + } else if (count($values) == 5) { // deprecated |
|
6958 | 7327 | dol_syslog('Passing 5 values in tabs module_parts is deprecated. Please update to 6 with permissions.', LOG_WARNING); |
6959 | 7328 | |
6960 | - if ($values[0] != $type) |
|
6961 | - continue; |
|
6962 | - if ($values[3]) |
|
6963 | - $langs->load($values[3]); |
|
7329 | + if ($values[0] != $type) { |
|
7330 | + continue; |
|
7331 | + } |
|
7332 | + if ($values[3]) { |
|
7333 | + $langs->load($values[3]); |
|
7334 | + } |
|
6964 | 7335 | if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) { |
6965 | 7336 | $substitutionarray = array(); |
6966 | 7337 | complete_substitutions_array($substitutionarray, $langs, $object, array('needforkey' => $values[2])); |
6967 | 7338 | $label = make_substitutions($reg[1], $substitutionarray); |
6968 | - } else |
|
6969 | - $label = $langs->trans($values[2]); |
|
7339 | + } else { |
|
7340 | + $label = $langs->trans($values[2]); |
|
7341 | + } |
|
6970 | 7342 | |
6971 | 7343 | $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[4]), 1); |
6972 | 7344 | $head[$h][1] = $label; |
6973 | 7345 | $head[$h][2] = str_replace('+', '', $values[1]); |
6974 | 7346 | $h++; |
6975 | 7347 | } |
6976 | - } |
|
6977 | - else if ($mode == 'remove' && preg_match('/^\-/', $values[1])) { |
|
6978 | - if ($values[0] != $type) |
|
6979 | - continue; |
|
7348 | + } else if ($mode == 'remove' && preg_match('/^\-/', $values[1])) { |
|
7349 | + if ($values[0] != $type) { |
|
7350 | + continue; |
|
7351 | + } |
|
6980 | 7352 | $tabname = str_replace('-', '', $values[1]); |
6981 | 7353 | foreach ($head as $key => $val) { |
6982 | 7354 | $condition = (!empty($values[3]) ? verifCond($values[3]) : 1); |
@@ -7018,10 +7390,11 @@ discard block |
||
7018 | 7390 | global $action; |
7019 | 7391 | global $micro_start_time; |
7020 | 7392 | |
7021 | - if ($zone == 'private') |
|
7022 | - print "\n" . '<!-- Common footer for private page -->' . "\n"; |
|
7023 | - else |
|
7024 | - print "\n" . '<!-- Common footer for public page -->' . "\n"; |
|
7393 | + if ($zone == 'private') { |
|
7394 | + print "\n" . '<!-- Common footer for private page -->' . "\n"; |
|
7395 | + } else { |
|
7396 | + print "\n" . '<!-- Common footer for public page -->' . "\n"; |
|
7397 | + } |
|
7025 | 7398 | |
7026 | 7399 | // A div to store page_y POST parameter so we can read it using javascript |
7027 | 7400 | print "\n<!-- A div to store page_y POST paramater -->\n"; |
@@ -7030,8 +7403,9 @@ discard block |
||
7030 | 7403 | $parameters = array(); |
7031 | 7404 | $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks |
7032 | 7405 | if (empty($reshook)) { |
7033 | - if (!empty($conf->global->MAIN_HTML_FOOTER)) |
|
7034 | - print $conf->global->MAIN_HTML_FOOTER . "\n"; |
|
7406 | + if (!empty($conf->global->MAIN_HTML_FOOTER)) { |
|
7407 | + print $conf->global->MAIN_HTML_FOOTER . "\n"; |
|
7408 | + } |
|
7035 | 7409 | |
7036 | 7410 | print "\n"; |
7037 | 7411 | if (!empty($conf->use_javascript_ajax)) { |
@@ -7054,8 +7428,9 @@ discard block |
||
7054 | 7428 | print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */' . "\n"; |
7055 | 7429 | $relativepathstring = $_SERVER["PHP_SELF"]; |
7056 | 7430 | // Clean $relativepathstring |
7057 | - if (constant('DOL_URL_ROOT')) |
|
7058 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
7431 | + if (constant('DOL_URL_ROOT')) { |
|
7432 | + $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring); |
|
7433 | + } |
|
7059 | 7434 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
7060 | 7435 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
7061 | 7436 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
@@ -7066,14 +7441,17 @@ discard block |
||
7066 | 7441 | $tmpqueryarraytohave = explode('&', $defkey); |
7067 | 7442 | $foundintru = 0; |
7068 | 7443 | foreach ($tmpqueryarraytohave as $tmpquerytohave) { |
7069 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
7070 | - $foundintru = 1; |
|
7444 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
7445 | + $foundintru = 1; |
|
7446 | + } |
|
7071 | 7447 | } |
7072 | - if (!$foundintru) |
|
7073 | - $qualified = 1; |
|
7448 | + if (!$foundintru) { |
|
7449 | + $qualified = 1; |
|
7450 | + } |
|
7074 | 7451 | //var_dump($defkey.'-'.$qualified); |
7075 | - } else |
|
7076 | - $qualified = 1; |
|
7452 | + } else { |
|
7453 | + $qualified = 1; |
|
7454 | + } |
|
7077 | 7455 | |
7078 | 7456 | if ($qualified) { |
7079 | 7457 | foreach ($defval as $paramkey => $paramval) { |
@@ -7092,14 +7470,17 @@ discard block |
||
7092 | 7470 | $tmpqueryarraytohave = explode('&', $defkey); |
7093 | 7471 | $foundintru = 0; |
7094 | 7472 | foreach ($tmpqueryarraytohave as $tmpquerytohave) { |
7095 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
7096 | - $foundintru = 1; |
|
7473 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
7474 | + $foundintru = 1; |
|
7475 | + } |
|
7097 | 7476 | } |
7098 | - if (!$foundintru) |
|
7099 | - $qualified = 1; |
|
7477 | + if (!$foundintru) { |
|
7478 | + $qualified = 1; |
|
7479 | + } |
|
7100 | 7480 | //var_dump($defkey.'-'.$qualified); |
7101 | - } else |
|
7102 | - $qualified = 1; |
|
7481 | + } else { |
|
7482 | + $qualified = 1; |
|
7483 | + } |
|
7103 | 7484 | |
7104 | 7485 | if ($qualified) { |
7105 | 7486 | foreach ($defval as $paramkey => $paramval) { |
@@ -7138,8 +7519,9 @@ discard block |
||
7138 | 7519 | print "\n"; |
7139 | 7520 | print "/* JS CODE TO ENABLE to add memory info */\n"; |
7140 | 7521 | print 'window.console && console.log("'; |
7141 | - if (!empty($conf->global->MEMCACHED_SERVER)) |
|
7142 | - print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - '; |
|
7522 | + if (!empty($conf->global->MEMCACHED_SERVER)) { |
|
7523 | + print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - '; |
|
7524 | + } |
|
7143 | 7525 | print 'MAIN_OPTIMIZE_SPEED=' . (isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off'); |
7144 | 7526 | if (!empty($micro_start_time)) { // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in global variable. |
7145 | 7527 | $micro_end_time = microtime(true); |
@@ -7269,8 +7651,9 @@ discard block |
||
7269 | 7651 | |
7270 | 7652 | $crits = explode(' ', $value); |
7271 | 7653 | $res = ''; |
7272 | - if (!is_array($fields)) |
|
7273 | - $fields = array($fields); |
|
7654 | + if (!is_array($fields)) { |
|
7655 | + $fields = array($fields); |
|
7656 | + } |
|
7274 | 7657 | |
7275 | 7658 | $nboffields = count($fields); |
7276 | 7659 | $end2 = count($crits); |
@@ -7333,8 +7716,9 @@ discard block |
||
7333 | 7716 | $tmpcrits = explode('|', $crit); |
7334 | 7717 | $i3 = 0; |
7335 | 7718 | foreach ($tmpcrits as $tmpcrit) { |
7336 | - if (empty($tmpcrit)) |
|
7337 | - continue; |
|
7719 | + if (empty($tmpcrit)) { |
|
7720 | + continue; |
|
7721 | + } |
|
7338 | 7722 | |
7339 | 7723 | $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); |
7340 | 7724 | |
@@ -7370,8 +7754,9 @@ discard block |
||
7370 | 7754 | } |
7371 | 7755 | $i++; |
7372 | 7756 | } |
7373 | - if ($newres) |
|
7374 | - $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') . $newres . ($i2 > 1 ? ')' : ''); |
|
7757 | + if ($newres) { |
|
7758 | + $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') . $newres . ($i2 > 1 ? ')' : ''); |
|
7759 | + } |
|
7375 | 7760 | $j++; |
7376 | 7761 | } |
7377 | 7762 | $res = ($nofirstand ? "" : " AND ") . "(" . $res . ")"; |
@@ -7411,29 +7796,37 @@ discard block |
||
7411 | 7796 | function getImageFileNameForSize($file, $extName, $extImgTarget = '') |
7412 | 7797 | { |
7413 | 7798 | $dirName = dirname($file); |
7414 | - if ($dirName == '.') |
|
7415 | - $dirName = ''; |
|
7799 | + if ($dirName == '.') { |
|
7800 | + $dirName = ''; |
|
7801 | + } |
|
7416 | 7802 | |
7417 | 7803 | $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // We remove extension, whatever is its case |
7418 | 7804 | $fileName = basename($fileName); |
7419 | 7805 | |
7420 | - if (empty($extImgTarget)) |
|
7421 | - $extImgTarget = (preg_match('/\.jpg$/i', $file) ? '.jpg' : ''); |
|
7422 | - if (empty($extImgTarget)) |
|
7423 | - $extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : ''); |
|
7424 | - if (empty($extImgTarget)) |
|
7425 | - $extImgTarget = (preg_match('/\.gif$/i', $file) ? '.gif' : ''); |
|
7426 | - if (empty($extImgTarget)) |
|
7427 | - $extImgTarget = (preg_match('/\.png$/i', $file) ? '.png' : ''); |
|
7428 | - if (empty($extImgTarget)) |
|
7429 | - $extImgTarget = (preg_match('/\.bmp$/i', $file) ? '.bmp' : ''); |
|
7430 | - |
|
7431 | - if (!$extImgTarget) |
|
7432 | - return $file; |
|
7806 | + if (empty($extImgTarget)) { |
|
7807 | + $extImgTarget = (preg_match('/\.jpg$/i', $file) ? '.jpg' : ''); |
|
7808 | + } |
|
7809 | + if (empty($extImgTarget)) { |
|
7810 | + $extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : ''); |
|
7811 | + } |
|
7812 | + if (empty($extImgTarget)) { |
|
7813 | + $extImgTarget = (preg_match('/\.gif$/i', $file) ? '.gif' : ''); |
|
7814 | + } |
|
7815 | + if (empty($extImgTarget)) { |
|
7816 | + $extImgTarget = (preg_match('/\.png$/i', $file) ? '.png' : ''); |
|
7817 | + } |
|
7818 | + if (empty($extImgTarget)) { |
|
7819 | + $extImgTarget = (preg_match('/\.bmp$/i', $file) ? '.bmp' : ''); |
|
7820 | + } |
|
7821 | + |
|
7822 | + if (!$extImgTarget) { |
|
7823 | + return $file; |
|
7824 | + } |
|
7433 | 7825 | |
7434 | 7826 | $subdir = ''; |
7435 | - if ($extName) |
|
7436 | - $subdir = 'thumbs/'; |
|
7827 | + if ($extName) { |
|
7828 | + $subdir = 'thumbs/'; |
|
7829 | + } |
|
7437 | 7830 | |
7438 | 7831 | return ($dirName ? $dirName . '/' : '') . $subdir . $fileName . $extName . $extImgTarget; // New filename for thumb |
7439 | 7832 | } |
@@ -7451,8 +7844,9 @@ discard block |
||
7451 | 7844 | { |
7452 | 7845 | global $conf, $langs; |
7453 | 7846 | |
7454 | - if (empty($conf->use_javascript_ajax)) |
|
7455 | - return ''; |
|
7847 | + if (empty($conf->use_javascript_ajax)) { |
|
7848 | + return ''; |
|
7849 | + } |
|
7456 | 7850 | |
7457 | 7851 | $mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'svg+xml'); |
7458 | 7852 | //$mime_preview[]='vnd.oasis.opendocument.presentation'; |
@@ -7460,18 +7854,20 @@ discard block |
||
7460 | 7854 | $num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview); |
7461 | 7855 | |
7462 | 7856 | if ($alldata == 1) { |
7463 | - if ($num_mime !== false) |
|
7464 | - return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : ''), 'mime' => dol_mimetype($relativepath),); |
|
7465 | - else |
|
7466 | - return array(); |
|
7857 | + if ($num_mime !== false) { |
|
7858 | + return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : ''), 'mime' => dol_mimetype($relativepath),); |
|
7859 | + } else { |
|
7860 | + return array(); |
|
7861 | + } |
|
7467 | 7862 | } |
7468 | 7863 | |
7469 | 7864 | // old behavior |
7470 | - if ($num_mime !== false) |
|
7471 | - return 'javascript:document_preview(\'' . dol_escape_js(DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : '')) . '\', \'' . dol_mimetype($relativepath) . '\', \'' . dol_escape_js($langs->trans('Preview')) . '\')'; |
|
7472 | - else |
|
7473 | - return ''; |
|
7474 | -} |
|
7865 | + if ($num_mime !== false) { |
|
7866 | + return 'javascript:document_preview(\'' . dol_escape_js(DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : '')) . '\', \'' . dol_mimetype($relativepath) . '\', \'' . dol_escape_js($langs->trans('Preview')) . '\')'; |
|
7867 | + } else { |
|
7868 | + return ''; |
|
7869 | + } |
|
7870 | + } |
|
7475 | 7871 | |
7476 | 7872 | /** |
7477 | 7873 | * Make content of an input box selected when we click into input field. |
@@ -7488,8 +7884,9 @@ discard block |
||
7488 | 7884 | jQuery("#' . $htmlname . '").click(function() { jQuery(this).select(); } ); |
7489 | 7885 | }); |
7490 | 7886 | </script>'; |
7491 | - if ($addlink) |
|
7492 | - $out .= ' <a href="' . $addlink . '" target="_blank">' . $langs->trans("Link") . '</a>'; |
|
7887 | + if ($addlink) { |
|
7888 | + $out .= ' <a href="' . $addlink . '" target="_blank">' . $langs->trans("Link") . '</a>'; |
|
7889 | + } |
|
7493 | 7890 | return $out; |
7494 | 7891 | } |
7495 | 7892 | |
@@ -7871,8 +8268,9 @@ discard block |
||
7871 | 8268 | if (!isset($dictvalues[$tablename])) { |
7872 | 8269 | $dictvalues[$tablename] = array(); |
7873 | 8270 | $sql = 'SELECT * FROM ' . $tablename . ' WHERE 1'; |
7874 | - if ($checkentity) |
|
7875 | - $sql .= ' AND entity IN (0,' . getEntity($tablename) . ')'; |
|
8271 | + if ($checkentity) { |
|
8272 | + $sql .= ' AND entity IN (0,' . getEntity($tablename) . ')'; |
|
8273 | + } |
|
7876 | 8274 | |
7877 | 8275 | $resql = $db->query($sql); |
7878 | 8276 | if ($resql) { |
@@ -7884,11 +8282,14 @@ discard block |
||
7884 | 8282 | } |
7885 | 8283 | } |
7886 | 8284 | |
7887 | - if (!empty($dictvalues[$tablename][$id])) |
|
7888 | - return $dictvalues[$tablename][$id]->{$field}; // Found |
|
8285 | + if (!empty($dictvalues[$tablename][$id])) { |
|
8286 | + return $dictvalues[$tablename][$id]->{$field}; |
|
8287 | + } |
|
8288 | + // Found |
|
7889 | 8289 | else { // Not found |
7890 | - if ($id > 0) |
|
7891 | - return $id; |
|
8290 | + if ($id > 0) { |
|
8291 | + return $id; |
|
8292 | + } |
|
7892 | 8293 | return ''; |
7893 | 8294 | } |
7894 | 8295 | } |
@@ -7918,8 +8319,9 @@ discard block |
||
7918 | 8319 | $b = hexdec($hexb); |
7919 | 8320 | } |
7920 | 8321 | $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm |
7921 | - if ($bright > 0.6) |
|
7922 | - $res = 1; |
|
8322 | + if ($bright > 0.6) { |
|
8323 | + $res = 1; |
|
8324 | + } |
|
7923 | 8325 | } |
7924 | 8326 | return $res; |
7925 | 8327 | } |
@@ -7938,8 +8340,10 @@ discard block |
||
7938 | 8340 | |
7939 | 8341 | //print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms']; |
7940 | 8342 | //print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal); |
7941 | - if (empty($menuentry['enabled'])) |
|
7942 | - return 0; // Entry disabled by condition |
|
8343 | + if (empty($menuentry['enabled'])) { |
|
8344 | + return 0; |
|
8345 | + } |
|
8346 | + // Entry disabled by condition |
|
7943 | 8347 | if ($type_user && $menuentry['module']) { |
7944 | 8348 | $tmploops = explode('|', $menuentry['module']); |
7945 | 8349 | $found = 0; |
@@ -7949,15 +8353,23 @@ discard block |
||
7949 | 8353 | break; |
7950 | 8354 | } |
7951 | 8355 | } |
7952 | - if (!$found) |
|
7953 | - return 0; // Entry is for menus all excluded to external users |
|
7954 | - } |
|
7955 | - if (!$menuentry['perms'] && $type_user) |
|
7956 | - return 0; // No permissions and user is external |
|
7957 | - if (!$menuentry['perms'] && !empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) |
|
7958 | - return 0; // No permissions and option to hide when not allowed, even for internal user, is on |
|
7959 | - if (!$menuentry['perms']) |
|
7960 | - return 2; // No permissions and user is external |
|
8356 | + if (!$found) { |
|
8357 | + return 0; |
|
8358 | + } |
|
8359 | + // Entry is for menus all excluded to external users |
|
8360 | + } |
|
8361 | + if (!$menuentry['perms'] && $type_user) { |
|
8362 | + return 0; |
|
8363 | + } |
|
8364 | + // No permissions and user is external |
|
8365 | + if (!$menuentry['perms'] && !empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) { |
|
8366 | + return 0; |
|
8367 | + } |
|
8368 | + // No permissions and option to hide when not allowed, even for internal user, is on |
|
8369 | + if (!$menuentry['perms']) { |
|
8370 | + return 2; |
|
8371 | + } |
|
8372 | + // No permissions and user is external |
|
7961 | 8373 | return 1; |
7962 | 8374 | } |
7963 | 8375 |
@@ -32,90 +32,90 @@ discard block |
||
32 | 32 | { |
33 | 33 | |
34 | 34 | /** |
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | 38 | */ |
39 | 39 | function __construct($db) |
40 | 40 | { |
41 | - global $langs,$conf; |
|
41 | + global $langs,$conf; |
|
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | $this->numero = 10000; |
45 | 45 | |
46 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | - // It is used to group modules in module setup page |
|
46 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
47 | + // It is used to group modules in module setup page |
|
48 | 48 | $this->family = "portal"; |
49 | 49 | $this->module_position = '50'; |
50 | 50 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
51 | 51 | $this->name = preg_replace('/^mod/i','',get_class($this)); |
52 | 52 | $this->description = "Enable to build and serve public web sites with CMS features"; |
53 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
53 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
54 | 54 | $this->version = 'dolibarr'; |
55 | 55 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
57 | 57 | // Name of image file used for this module. |
58 | 58 | $this->picto='globe'; |
59 | 59 | |
60 | - // Data directories to create when module is enabled |
|
61 | - $this->dirs = array("/website/temp"); |
|
60 | + // Data directories to create when module is enabled |
|
61 | + $this->dirs = array("/website/temp"); |
|
62 | 62 | |
63 | 63 | // Config pages |
64 | 64 | $this->config_page_url = array('website.php'); |
65 | 65 | |
66 | 66 | // Dependencies |
67 | - $this->hidden = ! empty($conf->global->MODULE_WEBSITE_DISABLED); // A condition to disable module |
|
68 | - $this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled |
|
67 | + $this->hidden = ! empty($conf->global->MODULE_WEBSITE_DISABLED); // A condition to disable module |
|
68 | + $this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled |
|
69 | 69 | $this->requiredby = array(); // List of modules id to disable if this one is disabled |
70 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
71 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
70 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
71 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
72 | 72 | $this->langfiles = array("website"); |
73 | 73 | |
74 | 74 | // Constants |
75 | - $this->const = array(); |
|
75 | + $this->const = array(); |
|
76 | 76 | |
77 | 77 | // New pages on tabs |
78 | - //$this->tabs[] = array(); // To add a new tab identified by code tabname1 |
|
78 | + //$this->tabs[] = array(); // To add a new tab identified by code tabname1 |
|
79 | 79 | |
80 | 80 | // Boxes |
81 | 81 | $this->boxes = array(); |
82 | 82 | |
83 | - // Permissions |
|
84 | - $this->rights = array(); // Permission array used by this module |
|
85 | - $this->rights_class = 'website'; |
|
86 | - $r=0; |
|
87 | - |
|
88 | - $this->rights[$r][0] = 10001; |
|
89 | - $this->rights[$r][1] = 'Read website content'; |
|
90 | - $this->rights[$r][3] = 0; |
|
91 | - $this->rights[$r][4] = 'read'; |
|
92 | - $r++; |
|
93 | - |
|
94 | - $this->rights[$r][0] = 10002; |
|
95 | - $this->rights[$r][1] = 'Create/modify website content'; |
|
96 | - $this->rights[$r][3] = 0; |
|
97 | - $this->rights[$r][4] = 'write'; |
|
98 | - $r++; |
|
99 | - |
|
100 | - $this->rights[$r][0] = 10003; |
|
101 | - $this->rights[$r][1] = 'Delete website content'; |
|
102 | - $this->rights[$r][3] = 0; |
|
103 | - $this->rights[$r][4] = 'delete'; |
|
104 | - $r++; |
|
83 | + // Permissions |
|
84 | + $this->rights = array(); // Permission array used by this module |
|
85 | + $this->rights_class = 'website'; |
|
86 | + $r=0; |
|
87 | + |
|
88 | + $this->rights[$r][0] = 10001; |
|
89 | + $this->rights[$r][1] = 'Read website content'; |
|
90 | + $this->rights[$r][3] = 0; |
|
91 | + $this->rights[$r][4] = 'read'; |
|
92 | + $r++; |
|
93 | + |
|
94 | + $this->rights[$r][0] = 10002; |
|
95 | + $this->rights[$r][1] = 'Create/modify website content'; |
|
96 | + $this->rights[$r][3] = 0; |
|
97 | + $this->rights[$r][4] = 'write'; |
|
98 | + $r++; |
|
99 | + |
|
100 | + $this->rights[$r][0] = 10003; |
|
101 | + $this->rights[$r][1] = 'Delete website content'; |
|
102 | + $this->rights[$r][3] = 0; |
|
103 | + $this->rights[$r][4] = 'delete'; |
|
104 | + $r++; |
|
105 | 105 | |
106 | 106 | // Main menu entries |
107 | 107 | $r=0; |
108 | 108 | $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
109 | - 'type'=>'top', // This is a Left menu entry |
|
110 | - 'titre'=>'WebSites', |
|
109 | + 'type'=>'top', // This is a Left menu entry |
|
110 | + 'titre'=>'WebSites', |
|
111 | 111 | 'mainmenu'=>'website', |
112 | - 'url'=>'/website/index.php', |
|
113 | - 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
114 | - 'position'=>100, |
|
115 | - 'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
116 | - 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
117 | - 'target'=>'', |
|
118 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
112 | + 'url'=>'/website/index.php', |
|
113 | + 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
114 | + 'position'=>100, |
|
115 | + 'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
116 | + 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
117 | + 'target'=>'', |
|
118 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
119 | 119 | $r++; |
120 | 120 | |
121 | 121 | // Exports |
@@ -147,34 +147,34 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function init($options='') |
149 | 149 | { |
150 | - global $conf,$langs; |
|
150 | + global $conf,$langs; |
|
151 | 151 | |
152 | - // Remove permissions and default values |
|
153 | - $this->remove($options); |
|
152 | + // Remove permissions and default values |
|
153 | + $this->remove($options); |
|
154 | 154 | |
155 | - // Copy flags and octicons directoru |
|
156 | - $dirarray=array('common/flags', 'common/octicons'); |
|
157 | - foreach($dirarray as $dir) |
|
158 | - { |
|
159 | - $src = DOL_DOCUMENT_ROOT . '/theme/' . $dir; |
|
155 | + // Copy flags and octicons directoru |
|
156 | + $dirarray=array('common/flags', 'common/octicons'); |
|
157 | + foreach($dirarray as $dir) |
|
158 | + { |
|
159 | + $src = DOL_DOCUMENT_ROOT . '/theme/' . $dir; |
|
160 | 160 | $dest = DOL_DATA_ROOT . '/medias/image/' . $dir; |
161 | 161 | |
162 | 162 | if (is_dir($src)) |
163 | - { |
|
164 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
165 | - dol_mkdir($dest); |
|
166 | - $result=dolCopyDir($src,$dest,0,0); |
|
167 | - if ($result < 0) |
|
168 | - { |
|
169 | - $langs->load("errors"); |
|
170 | - $this->error=$langs->trans('ErrorFailToCopyDir',$src,$dest); |
|
171 | - return 0; |
|
172 | - } |
|
173 | - } |
|
174 | - } |
|
175 | - |
|
176 | - $sql = array(); |
|
177 | - |
|
178 | - return $this->_init($sql, $options); |
|
163 | + { |
|
164 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
165 | + dol_mkdir($dest); |
|
166 | + $result=dolCopyDir($src,$dest,0,0); |
|
167 | + if ($result < 0) |
|
168 | + { |
|
169 | + $langs->load("errors"); |
|
170 | + $this->error=$langs->trans('ErrorFailToCopyDir',$src,$dest); |
|
171 | + return 0; |
|
172 | + } |
|
173 | + } |
|
174 | + } |
|
175 | + |
|
176 | + $sql = array(); |
|
177 | + |
|
178 | + return $this->_init($sql, $options); |
|
179 | 179 | } |
180 | 180 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \ingroup websites |
23 | 23 | * \brief Description and activation file for module Website |
24 | 24 | */ |
25 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
25 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function __construct($db) |
40 | 40 | { |
41 | - global $langs,$conf; |
|
41 | + global $langs, $conf; |
|
42 | 42 | |
43 | 43 | $this->db = $db; |
44 | 44 | $this->numero = 10000; |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | $this->family = "portal"; |
49 | 49 | $this->module_position = '50'; |
50 | 50 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
51 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
52 | 52 | $this->description = "Enable to build and serve public web sites with CMS features"; |
53 | 53 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
54 | 54 | $this->version = 'dolibarr'; |
55 | 55 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
57 | 57 | // Name of image file used for this module. |
58 | - $this->picto='globe'; |
|
58 | + $this->picto = 'globe'; |
|
59 | 59 | |
60 | 60 | // Data directories to create when module is enabled |
61 | 61 | $this->dirs = array("/website/temp"); |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $this->config_page_url = array('website.php'); |
65 | 65 | |
66 | 66 | // Dependencies |
67 | - $this->hidden = ! empty($conf->global->MODULE_WEBSITE_DISABLED); // A condition to disable module |
|
68 | - $this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled |
|
69 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
70 | - $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
71 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
67 | + $this->hidden = !empty($conf->global->MODULE_WEBSITE_DISABLED); // A condition to disable module |
|
68 | + $this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled |
|
69 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
70 | + $this->conflictwith = array(); // List of modules id this module is in conflict with |
|
71 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
72 | 72 | $this->langfiles = array("website"); |
73 | 73 | |
74 | 74 | // Constants |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | $this->boxes = array(); |
82 | 82 | |
83 | 83 | // Permissions |
84 | - $this->rights = array(); // Permission array used by this module |
|
84 | + $this->rights = array(); // Permission array used by this module |
|
85 | 85 | $this->rights_class = 'website'; |
86 | - $r=0; |
|
86 | + $r = 0; |
|
87 | 87 | |
88 | 88 | $this->rights[$r][0] = 10001; |
89 | 89 | $this->rights[$r][1] = 'Read website content'; |
@@ -104,35 +104,35 @@ discard block |
||
104 | 104 | $r++; |
105 | 105 | |
106 | 106 | // Main menu entries |
107 | - $r=0; |
|
108 | - $this->menu[$r]=array( 'fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
109 | - 'type'=>'top', // This is a Left menu entry |
|
107 | + $r = 0; |
|
108 | + $this->menu[$r] = array('fk_menu'=>'0', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
109 | + 'type'=>'top', // This is a Left menu entry |
|
110 | 110 | 'titre'=>'WebSites', |
111 | 111 | 'mainmenu'=>'website', |
112 | 112 | 'url'=>'/website/index.php', |
113 | - 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
113 | + 'langs'=>'website', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
114 | 114 | 'position'=>100, |
115 | - 'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
116 | - 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
115 | + 'enabled'=>'$conf->website->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
116 | + 'perms'=>'$user->rights->website->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules |
|
117 | 117 | 'target'=>'', |
118 | - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
118 | + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both |
|
119 | 119 | $r++; |
120 | 120 | |
121 | 121 | // Exports |
122 | - $r=1; |
|
122 | + $r = 1; |
|
123 | 123 | |
124 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
125 | - $this->export_label[$r]='MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
126 | - $this->export_icon[$r]='globe'; |
|
127 | - $keyforclass = 'WebsitePage'; $keyforclassfile='/website/class/websitepage.class.php'; $keyforelement='Website'; |
|
124 | + $this->export_code[$r] = $this->rights_class.'_'.$r; |
|
125 | + $this->export_label[$r] = 'MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
126 | + $this->export_icon[$r] = 'globe'; |
|
127 | + $keyforclass = 'WebsitePage'; $keyforclassfile = '/website/class/websitepage.class.php'; $keyforelement = 'Website'; |
|
128 | 128 | include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; |
129 | 129 | //$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra'; |
130 | 130 | //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
131 | 131 | //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) |
132 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
133 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'website_page as t, '.MAIN_DB_PREFIX.'website as p'; |
|
134 | - $this->export_sql_end[$r] .=' WHERE t.fk_website = p.rowid'; |
|
135 | - $this->export_sql_end[$r] .=' AND p.entity IN ('.getEntity('website').')'; |
|
132 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
133 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'website_page as t, '.MAIN_DB_PREFIX.'website as p'; |
|
134 | + $this->export_sql_end[$r] .= ' WHERE t.fk_website = p.rowid'; |
|
135 | + $this->export_sql_end[$r] .= ' AND p.entity IN ('.getEntity('website').')'; |
|
136 | 136 | $r++; |
137 | 137 | } |
138 | 138 | |
@@ -145,29 +145,29 @@ discard block |
||
145 | 145 | * @param string $options Options when enabling module ('', 'noboxes') |
146 | 146 | * @return int 1 if OK, 0 if KO |
147 | 147 | */ |
148 | - function init($options='') |
|
148 | + function init($options = '') |
|
149 | 149 | { |
150 | - global $conf,$langs; |
|
150 | + global $conf, $langs; |
|
151 | 151 | |
152 | 152 | // Remove permissions and default values |
153 | 153 | $this->remove($options); |
154 | 154 | |
155 | 155 | // Copy flags and octicons directoru |
156 | - $dirarray=array('common/flags', 'common/octicons'); |
|
157 | - foreach($dirarray as $dir) |
|
156 | + $dirarray = array('common/flags', 'common/octicons'); |
|
157 | + foreach ($dirarray as $dir) |
|
158 | 158 | { |
159 | - $src = DOL_DOCUMENT_ROOT . '/theme/' . $dir; |
|
160 | - $dest = DOL_DATA_ROOT . '/medias/image/' . $dir; |
|
159 | + $src = DOL_DOCUMENT_ROOT.'/theme/'.$dir; |
|
160 | + $dest = DOL_DATA_ROOT.'/medias/image/'.$dir; |
|
161 | 161 | |
162 | 162 | if (is_dir($src)) |
163 | 163 | { |
164 | 164 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
165 | 165 | dol_mkdir($dest); |
166 | - $result=dolCopyDir($src,$dest,0,0); |
|
166 | + $result = dolCopyDir($src, $dest, 0, 0); |
|
167 | 167 | if ($result < 0) |
168 | 168 | { |
169 | 169 | $langs->load("errors"); |
170 | - $this->error=$langs->trans('ErrorFailToCopyDir',$src,$dest); |
|
170 | + $this->error = $langs->trans('ErrorFailToCopyDir', $src, $dest); |
|
171 | 171 | return 0; |
172 | 172 | } |
173 | 173 | } |