@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | if (dol_is_file($filetpl)) { |
152 | 152 | if ($backupold) { |
153 | 153 | $result = archiveOrBackupFile($filetpl); |
154 | - if (! $result) { |
|
154 | + if (!$result) { |
|
155 | 155 | return false; |
156 | 156 | } |
157 | 157 | } else { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; |
376 | 376 | $indexcontent .= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n"; |
377 | 377 | $indexcontent .= "}\n"; |
378 | - $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
378 | + $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
379 | 379 | $indexcontent .= '// END PHP ?>'."\n"; |
380 | 380 | $result = file_put_contents($fileindexsub, $indexcontent); |
381 | 381 | if ($result === false) { |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once")); |
735 | 735 | if (!getDolGlobalString('WEBSITE_PHP_ALLOW_EXEC')) { // If option is not on, we disallow functions to execute commands |
736 | 736 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen")); |
737 | - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions |
|
737 | + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions |
|
738 | 738 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities |
739 | 739 | } |
740 | 740 | if (!getDolGlobalString('WEBSITE_PHP_ALLOW_WRITE')) { // If option is not on, we disallow functions to write files |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | } |
744 | 744 | //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include")); |
745 | 745 | |
746 | - $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
746 | + $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
747 | 747 | |
748 | 748 | foreach ($forbiddenphpstrings as $forbiddenphpstring) { |
749 | 749 | if (preg_match('/'.preg_quote($forbiddenphpstring, '/').'/ims', $phpfullcodestring)) { |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | if (empty($this->piece_num)) { |
373 | 373 | $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; |
374 | 374 | $sqlnum .= " FROM ".$this->db->prefix().$this->table_element; |
375 | - $sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
375 | + $sqlnum .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
376 | 376 | |
377 | 377 | $resqlnum = $this->db->query($sqlnum); |
378 | 378 | if ($resqlnum) { |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | } |
469 | 469 | |
470 | 470 | // Call triggers |
471 | - if (! $error && ! $notrigger) { |
|
471 | + if (!$error && !$notrigger) { |
|
472 | 472 | $result = $this->call_trigger('BOOKKEEPING_CREATE', $user); |
473 | 473 | if ($result < 0) { |
474 | 474 | $error++; |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
553 | 553 | |
554 | 554 | global $action; |
555 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
555 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
556 | 556 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
557 | 557 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
558 | 558 | if ($reshook > 0) { |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | if (!$error) { |
720 | 720 | $this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element.$mode); |
721 | 721 | // Call triggers |
722 | - if (! $notrigger) { |
|
722 | + if (!$notrigger) { |
|
723 | 723 | $result = $this->call_trigger('BOOKKEEPING_CREATE', $user); |
724 | 724 | if ($result < 0) { |
725 | 725 | $error++; |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | $sql .= " t.date_validated as date_validation"; |
785 | 785 | $sql .= ' FROM '.$this->db->prefix().$this->table_element.$mode.' as t'; |
786 | 786 | $sql .= ' WHERE 1 = 1'; |
787 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
787 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
788 | 788 | if (null !== $ref) { |
789 | 789 | $sql .= " AND t.rowid = ".((int) $ref); |
790 | 790 | } else { |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | } |
957 | 957 | } |
958 | 958 | $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
959 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
959 | + $sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
960 | 960 | if (count($sqlwhere) > 0) { |
961 | 961 | $sql .= " AND ".implode(" ".$this->db->sanitize($filtermode)." ", $sqlwhere); |
962 | 962 | } |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | $sql .= " t.date_validated as date_validation"; |
1092 | 1092 | $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
1093 | 1093 | |
1094 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1094 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
1095 | 1095 | if ($showAlreadyExportMovements == 0) { |
1096 | 1096 | $sql .= " AND t.date_export IS NULL"; |
1097 | 1097 | } |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | $sql .= " SUM(t.debit) as debit,"; |
1260 | 1260 | $sql .= " SUM(t.credit) as credit"; |
1261 | 1261 | $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
1262 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1262 | + $sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
1263 | 1263 | |
1264 | 1264 | // Manage filter |
1265 | 1265 | if (is_array($filter)) { |
@@ -1487,7 +1487,7 @@ discard block |
||
1487 | 1487 | } |
1488 | 1488 | |
1489 | 1489 | // Call triggers |
1490 | - if (! $error && ! $notrigger) { |
|
1490 | + if (!$error && !$notrigger) { |
|
1491 | 1491 | $result = $this->call_trigger('BOOKKEEPING_MODIFY', $user); |
1492 | 1492 | if ($result < 0) { |
1493 | 1493 | $error++; |
@@ -1580,7 +1580,7 @@ discard block |
||
1580 | 1580 | $this->db->begin(); |
1581 | 1581 | |
1582 | 1582 | // Call triggers |
1583 | - if (! $error && ! $notrigger) { |
|
1583 | + if (!$error && !$notrigger) { |
|
1584 | 1584 | $result = $this->call_trigger('BOOKKEEPING_DELETE', $user); |
1585 | 1585 | if ($result < 0) { |
1586 | 1586 | $error++; |
@@ -1683,7 +1683,7 @@ discard block |
||
1683 | 1683 | if (!empty($journal)) { |
1684 | 1684 | $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; |
1685 | 1685 | } |
1686 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1686 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1687 | 1687 | // Exclusion of validated entries at the time of deletion |
1688 | 1688 | $sql .= " AND date_validated IS NULL"; |
1689 | 1689 | $sql .= $sql_filter; |
@@ -1730,8 +1730,8 @@ discard block |
||
1730 | 1730 | $sql = "DELETE"; |
1731 | 1731 | $sql .= " FROM ".$this->db->prefix().$this->table_element.$mode; |
1732 | 1732 | $sql .= " WHERE piece_num = ".(int) $piecenum; |
1733 | - $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
1734 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1733 | + $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
1734 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1735 | 1735 | $sql .= $sql_filter; |
1736 | 1736 | |
1737 | 1737 | $resql = $this->db->query($sql); |
@@ -1859,7 +1859,7 @@ discard block |
||
1859 | 1859 | } |
1860 | 1860 | $sql .= " FROM ".$this->db->prefix().$this->table_element.$mode; |
1861 | 1861 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
1862 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1862 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1863 | 1863 | |
1864 | 1864 | dol_syslog(__METHOD__, LOG_DEBUG); |
1865 | 1865 | $result = $this->db->query($sql); |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | global $conf; |
1901 | 1901 | |
1902 | 1902 | $sql = "SELECT MAX(piece_num)+1 as max FROM ".$this->db->prefix().$this->table_element.$mode; |
1903 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1903 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1904 | 1904 | |
1905 | 1905 | dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG); |
1906 | 1906 | |
@@ -1944,7 +1944,7 @@ discard block |
||
1944 | 1944 | } |
1945 | 1945 | $sql .= " FROM ".$this->db->prefix().$this->table_element.$mode; |
1946 | 1946 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
1947 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
1947 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
1948 | 1948 | |
1949 | 1949 | dol_syslog(__METHOD__, LOG_DEBUG); |
1950 | 1950 | $result = $this->db->query($sql); |
@@ -2009,7 +2009,7 @@ discard block |
||
2009 | 2009 | $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; |
2010 | 2010 | $sql .= " date_validated as date_validation"; |
2011 | 2011 | $sql .= " FROM ".$this->db->prefix().$this->table_element; |
2012 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2012 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2013 | 2013 | |
2014 | 2014 | dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG); |
2015 | 2015 | |
@@ -2087,7 +2087,7 @@ discard block |
||
2087 | 2087 | |
2088 | 2088 | if (!$error) { |
2089 | 2089 | // Delete if there is an empty line |
2090 | - $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0"; |
|
2090 | + $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0"; |
|
2091 | 2091 | $resql = $this->db->query($sql); |
2092 | 2092 | if (!$resql) { |
2093 | 2093 | $error++; |
@@ -2105,7 +2105,7 @@ discard block |
||
2105 | 2105 | $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; |
2106 | 2106 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
2107 | 2107 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'"; |
2108 | - $sql .= ' FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity); |
|
2108 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = '.((int) $conf->entity); |
|
2109 | 2109 | $sql .= $sql_filter; |
2110 | 2110 | $resql = $this->db->query($sql); |
2111 | 2111 | if (!$resql) { |
@@ -2116,7 +2116,7 @@ discard block |
||
2116 | 2116 | } |
2117 | 2117 | |
2118 | 2118 | if (!$error) { |
2119 | - $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2119 | + $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2120 | 2120 | $resql = $this->db->query($sql); |
2121 | 2121 | if (!$resql) { |
2122 | 2122 | $error++; |
@@ -2126,7 +2126,7 @@ discard block |
||
2126 | 2126 | } |
2127 | 2127 | } elseif ($direction == 1) { |
2128 | 2128 | if (!$error) { |
2129 | - $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2129 | + $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2130 | 2130 | $resql = $this->db->query($sql); |
2131 | 2131 | if (!$resql) { |
2132 | 2132 | $error++; |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; |
2145 | 2145 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
2146 | 2146 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num'; |
2147 | - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2147 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2148 | 2148 | $sql .= $sql_filter; |
2149 | 2149 | $resql = $this->db->query($sql); |
2150 | 2150 | if (!$resql) { |
@@ -2155,7 +2155,7 @@ discard block |
||
2155 | 2155 | } |
2156 | 2156 | |
2157 | 2157 | if (!$error) { |
2158 | - $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
2158 | + $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
2159 | 2159 | $sql .= $sql_filter; |
2160 | 2160 | $resql = $this->db->query($sql); |
2161 | 2161 | if (!$resql) { |
@@ -2212,7 +2212,7 @@ discard block |
||
2212 | 2212 | $sql .= " AND aa.active = 1"; |
2213 | 2213 | $sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; |
2214 | 2214 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
2215 | - $sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2215 | + $sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2216 | 2216 | $sql .= " ORDER BY account_number ASC"; |
2217 | 2217 | |
2218 | 2218 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
@@ -2276,7 +2276,7 @@ discard block |
||
2276 | 2276 | $sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1"; |
2277 | 2277 | $sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1"; |
2278 | 2278 | $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; |
2279 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2279 | + $sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2280 | 2280 | |
2281 | 2281 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
2282 | 2282 | $resql = $this->db->query($sql); |
@@ -2316,7 +2316,7 @@ discard block |
||
2316 | 2316 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
2317 | 2317 | $sql .= " AND aa.active = 1"; |
2318 | 2318 | $sql .= " LEFT JOIN ".$this->db->prefix()."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; |
2319 | - $sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2319 | + $sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
2320 | 2320 | |
2321 | 2321 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
2322 | 2322 | $resql = $this->db->query($sql); |
@@ -2349,7 +2349,7 @@ discard block |
||
2349 | 2349 | global $conf; |
2350 | 2350 | |
2351 | 2351 | $alias = trim($alias); |
2352 | - $alias = !empty($alias) && strpos($alias, '.') === false ? $alias . "." : $alias; |
|
2352 | + $alias = !empty($alias) && strpos($alias, '.') === false ? $alias."." : $alias; |
|
2353 | 2353 | |
2354 | 2354 | if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) { |
2355 | 2355 | $result = $this->loadFiscalPeriods($force, 'active'); |
@@ -2362,10 +2362,10 @@ discard block |
||
2362 | 2362 | $i = 0; |
2363 | 2363 | foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) { |
2364 | 2364 | $sql_list[$i] = "("; |
2365 | - $sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date"; |
|
2365 | + $sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start'])."' <= ".$this->db->sanitize($alias)."doc_date"; |
|
2366 | 2366 | if (!empty($fiscal_period['date_end'])) { |
2367 | 2367 | $sql_list[$i] .= " AND "; |
2368 | - $sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end'])."'"; |
|
2368 | + $sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '".$this->db->idate($fiscal_period['date_end'])."'"; |
|
2369 | 2369 | } |
2370 | 2370 | $sql_list[$i] .= ")"; |
2371 | 2371 | $i++; |
@@ -2454,17 +2454,17 @@ discard block |
||
2454 | 2454 | // Avoid trunc with dot in accountancy for the compatibility with another accounting software |
2455 | 2455 | $accountingLabelOperation = dol_trunc($thirdpartyname, $truncThirdpartyName, 'right', 'UTF-8', 1); |
2456 | 2456 | if (!empty($reference)) { |
2457 | - $accountingLabelOperation .= ' - '. $reference; |
|
2457 | + $accountingLabelOperation .= ' - '.$reference; |
|
2458 | 2458 | } |
2459 | 2459 | if (!empty($labelaccount)) { |
2460 | - $accountingLabelOperation .= ' - '. $labelaccount; |
|
2460 | + $accountingLabelOperation .= ' - '.$labelaccount; |
|
2461 | 2461 | } |
2462 | 2462 | } elseif (getDolGlobalString('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 1) { |
2463 | 2463 | $truncThirdpartyName = 32; |
2464 | 2464 | // Avoid trunc with dot in accountancy for the compatibility with another accounting software |
2465 | 2465 | $accountingLabelOperation = dol_trunc($thirdpartyname, $truncThirdpartyName, 'right', 'UTF-8', 1); |
2466 | 2466 | if (!empty($reference)) { |
2467 | - $accountingLabelOperation .= ' - '. $reference; |
|
2467 | + $accountingLabelOperation .= ' - '.$reference; |
|
2468 | 2468 | } |
2469 | 2469 | } elseif (getDolGlobalString('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 2) { |
2470 | 2470 | $truncThirdpartyName = 64; |
@@ -2534,8 +2534,8 @@ discard block |
||
2534 | 2534 | if ($mode == 'active') { |
2535 | 2535 | if (!isset($conf->cache['active_fiscal_period_cached']) || $force) { |
2536 | 2536 | $sql = "SELECT date_start, date_end"; |
2537 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2538 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2537 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2538 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2539 | 2539 | $sql .= " AND statut = 0"; |
2540 | 2540 | |
2541 | 2541 | $resql = $this->db->query($sql); |
@@ -2557,8 +2557,8 @@ discard block |
||
2557 | 2557 | if ($mode == 'closed') { |
2558 | 2558 | if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) { |
2559 | 2559 | $sql = "SELECT date_start, date_end"; |
2560 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2561 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2560 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2561 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2562 | 2562 | $sql .= " AND statut = 1"; |
2563 | 2563 | |
2564 | 2564 | $resql = $this->db->query($sql); |
@@ -2593,10 +2593,10 @@ discard block |
||
2593 | 2593 | $list = array(); |
2594 | 2594 | |
2595 | 2595 | $sql = "SELECT rowid, label, date_start, date_end, statut"; |
2596 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
2597 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2596 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
2597 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2598 | 2598 | if (!empty($filter)) { |
2599 | - $sql .= " AND (" . $this->db->sanitize($filter, 1, 1, 1) . ')'; |
|
2599 | + $sql .= " AND (".$this->db->sanitize($filter, 1, 1, 1).')'; |
|
2600 | 2600 | } |
2601 | 2601 | $sql .= $this->db->order('date_start', 'ASC'); |
2602 | 2602 | |
@@ -2636,13 +2636,13 @@ discard block |
||
2636 | 2636 | |
2637 | 2637 | $sql = "SELECT YEAR(b.doc_date) as year"; |
2638 | 2638 | for ($i = 1; $i <= 12; $i++) { |
2639 | - $sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0") . ") AS month".((int) $i); |
|
2639 | + $sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0").") AS month".((int) $i); |
|
2640 | 2640 | } |
2641 | 2641 | $sql .= ", COUNT(b.rowid) as total"; |
2642 | - $sql .= " FROM " . $this->db->prefix() . $this->table_element . " as b"; |
|
2643 | - $sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'"; |
|
2644 | - $sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'"; |
|
2645 | - $sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy |
|
2642 | + $sql .= " FROM ".$this->db->prefix().$this->table_element." as b"; |
|
2643 | + $sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'"; |
|
2644 | + $sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'"; |
|
2645 | + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy |
|
2646 | 2646 | |
2647 | 2647 | // Get count for each month into the fiscal period |
2648 | 2648 | if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { |
@@ -2650,7 +2650,7 @@ discard block |
||
2650 | 2650 | $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX.'accounting_fiscalyear as af WHERE b.doc_date >= af.date_start AND b.doc_date <= af.date_end AND af.entity = '.((int) $conf->entity)." AND af.statut = 1)"; |
2651 | 2651 | } else { |
2652 | 2652 | // Filter on the unitary flag/date lock on each record |
2653 | - $sql .= " AND date_validated IS NULL"; // not locked |
|
2653 | + $sql .= " AND date_validated IS NULL"; // not locked |
|
2654 | 2654 | } |
2655 | 2655 | |
2656 | 2656 | $sql .= " GROUP BY YEAR(b.doc_date)"; |
@@ -2671,7 +2671,7 @@ discard block |
||
2671 | 2671 | 'total' => (int) $obj->total, |
2672 | 2672 | ); |
2673 | 2673 | for ($i = 1; $i <= 12; $i++) { |
2674 | - $year_list['count'][$i] = (int) $obj->{'month' . $i}; |
|
2674 | + $year_list['count'][$i] = (int) $obj->{'month'.$i}; |
|
2675 | 2675 | } |
2676 | 2676 | |
2677 | 2677 | $list[] = $year_list; |
@@ -2699,11 +2699,11 @@ discard block |
||
2699 | 2699 | $now = dol_now(); |
2700 | 2700 | |
2701 | 2701 | // Specify as export : update field date_validated on selected month/year |
2702 | - $sql = " UPDATE " . $this->db->prefix() . $this->table_element; |
|
2703 | - $sql .= " SET date_validated = '" . $this->db->idate($now) . "'"; |
|
2704 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
2705 | - $sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
2706 | - $sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
2702 | + $sql = " UPDATE ".$this->db->prefix().$this->table_element; |
|
2703 | + $sql .= " SET date_validated = '".$this->db->idate($now)."'"; |
|
2704 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
2705 | + $sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'"; |
|
2706 | + $sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'"; |
|
2707 | 2707 | $sql .= " AND date_validated IS NULL"; |
2708 | 2708 | |
2709 | 2709 | dol_syslog(__METHOD__, LOG_DEBUG); |
@@ -2736,27 +2736,27 @@ discard block |
||
2736 | 2736 | |
2737 | 2737 | $pcg_type_filter = array(); |
2738 | 2738 | foreach ($accounting_groups_used_for_income_statement as $item) { |
2739 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
2739 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
2740 | 2740 | } |
2741 | 2741 | |
2742 | 2742 | $sql = 'SELECT'; |
2743 | 2743 | $sql .= " t.numero_compte,"; |
2744 | 2744 | $sql .= " aa.pcg_type,"; |
2745 | 2745 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result"; |
2746 | - $sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t'; |
|
2747 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2748 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2749 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); |
|
2750 | - $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . $this->db->prefix() . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')'; |
|
2751 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
2752 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
2753 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
2746 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
|
2747 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2748 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
2749 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
2750 | + $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
|
2751 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
2752 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
2753 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
2754 | 2754 | $sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; |
2755 | 2755 | |
2756 | 2756 | $resql = $this->db->query($sql); |
2757 | 2757 | if (!$resql) { |
2758 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
2759 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2758 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
2759 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2760 | 2760 | } else { |
2761 | 2761 | while ($obj = $this->db->fetch_object($resql)) { |
2762 | 2762 | $income_statement_amount += $obj->accounting_result; |
@@ -2795,7 +2795,7 @@ discard block |
||
2795 | 2795 | return -1; |
2796 | 2796 | } elseif (empty($fiscal_period->id)) { |
2797 | 2797 | $langs->loadLangs(array('errors', 'compta')); |
2798 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
2798 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
2799 | 2799 | return -1; |
2800 | 2800 | } |
2801 | 2801 | |
@@ -2814,7 +2814,7 @@ discard block |
||
2814 | 2814 | return -1; |
2815 | 2815 | } elseif (empty($new_fiscal_period->id)) { |
2816 | 2816 | $langs->loadLangs(array('errors', 'compta')); |
2817 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
2817 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
2818 | 2818 | return -1; |
2819 | 2819 | } |
2820 | 2820 | |
@@ -2834,7 +2834,7 @@ discard block |
||
2834 | 2834 | $journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL')); |
2835 | 2835 | if (empty($journal_id)) { |
2836 | 2836 | $langs->loadLangs(array('errors', 'accountancy')); |
2837 | - $this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
2837 | + $this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
2838 | 2838 | $error++; |
2839 | 2839 | } |
2840 | 2840 | |
@@ -2848,7 +2848,7 @@ discard block |
||
2848 | 2848 | $error++; |
2849 | 2849 | } elseif ($result == 0) { |
2850 | 2850 | $langs->loadLangs(array('errors', 'accountancy')); |
2851 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
2851 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
2852 | 2852 | $error++; |
2853 | 2853 | } |
2854 | 2854 | } else { |
@@ -2862,7 +2862,7 @@ discard block |
||
2862 | 2862 | $pcg_type_filter = array(); |
2863 | 2863 | $tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement); |
2864 | 2864 | foreach ($tmp as $item) { |
2865 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
2865 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
2866 | 2866 | } |
2867 | 2867 | |
2868 | 2868 | $sql = 'SELECT'; |
@@ -2872,14 +2872,14 @@ discard block |
||
2872 | 2872 | } |
2873 | 2873 | $sql .= " aa.pcg_type,"; |
2874 | 2874 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance"; |
2875 | - $sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t'; |
|
2876 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2877 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
2878 | - $sql .= " AND aa.entity = ". ((int) $conf->entity); |
|
2875 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
|
2876 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
2877 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
2878 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
2879 | 2879 | $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
2880 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
2881 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
2882 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
2880 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
2881 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
2882 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
2883 | 2883 | $sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; |
2884 | 2884 | if ($separate_auxiliary_account) { |
2885 | 2885 | $sql .= " , NULLIF(t.subledger_account, '')"; |
@@ -2889,8 +2889,8 @@ discard block |
||
2889 | 2889 | |
2890 | 2890 | $resql = $this->db->query($sql); |
2891 | 2891 | if (!$resql) { |
2892 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
2893 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2892 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
2893 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2894 | 2894 | |
2895 | 2895 | $error++; |
2896 | 2896 | } else { |
@@ -2919,14 +2919,14 @@ discard block |
||
2919 | 2919 | $bookkeeping->subledger_account = $obj->subledger_account; |
2920 | 2920 | $sql = 'SELECT'; |
2921 | 2921 | $sql .= " subledger_label"; |
2922 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
2923 | - $sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'"; |
|
2922 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
2923 | + $sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'"; |
|
2924 | 2924 | $sql .= " ORDER BY doc_date DESC"; |
2925 | 2925 | $sql .= " LIMIT 1"; |
2926 | 2926 | $result = $this->db->query($sql); |
2927 | 2927 | if (!$result) { |
2928 | - $this->errors[] = 'Error: ' . $this->db->lasterror(); |
|
2929 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2928 | + $this->errors[] = 'Error: '.$this->db->lasterror(); |
|
2929 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2930 | 2930 | $error++; |
2931 | 2931 | } |
2932 | 2932 | $objtmp = $this->db->fetch_object($result); |
@@ -2982,14 +2982,14 @@ discard block |
||
2982 | 2982 | $bookkeeping->subledger_account = $obj->subledger_account; |
2983 | 2983 | $sql = 'SELECT'; |
2984 | 2984 | $sql .= " subledger_label"; |
2985 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
2986 | - $sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'"; |
|
2985 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
2986 | + $sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'"; |
|
2987 | 2987 | $sql .= " ORDER BY doc_date DESC"; |
2988 | 2988 | $sql .= " LIMIT 1"; |
2989 | 2989 | $result = $this->db->query($sql); |
2990 | 2990 | if (!$result) { |
2991 | - $this->errors[] = 'Error: ' . $this->db->lasterror(); |
|
2992 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
2991 | + $this->errors[] = 'Error: '.$this->db->lasterror(); |
|
2992 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
2993 | 2993 | $error++; |
2994 | 2994 | } |
2995 | 2995 | $objtmp = $this->db->fetch_object($result); |
@@ -3061,7 +3061,7 @@ discard block |
||
3061 | 3061 | return -1; |
3062 | 3062 | } elseif (empty($fiscal_period->id)) { |
3063 | 3063 | $langs->loadLangs(array('errors', 'compta')); |
3064 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
3064 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
3065 | 3065 | return -1; |
3066 | 3066 | } |
3067 | 3067 | |
@@ -3080,7 +3080,7 @@ discard block |
||
3080 | 3080 | return -1; |
3081 | 3081 | } elseif (empty($new_fiscal_period->id)) { |
3082 | 3082 | $langs->loadLangs(array('errors', 'compta')); |
3083 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
3083 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
3084 | 3084 | return -1; |
3085 | 3085 | } |
3086 | 3086 | |
@@ -3100,7 +3100,7 @@ discard block |
||
3100 | 3100 | return -1; |
3101 | 3101 | } elseif ($result == 0) { |
3102 | 3102 | $langs->loadLangs(array('errors', 'accountancy')); |
3103 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal'); |
|
3103 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal'); |
|
3104 | 3104 | return -1; |
3105 | 3105 | } |
3106 | 3106 | |
@@ -3108,18 +3108,18 @@ discard block |
||
3108 | 3108 | $this->db->begin(); |
3109 | 3109 | |
3110 | 3110 | $sql = 'SELECT t.rowid'; |
3111 | - $sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t'; |
|
3112 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
3113 | - $sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'"; |
|
3114 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
3115 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
3116 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
3117 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
3111 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
|
3112 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
3113 | + $sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'"; |
|
3114 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
3115 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
3116 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
3117 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
3118 | 3118 | |
3119 | 3119 | $resql = $this->db->query($sql); |
3120 | 3120 | if (!$resql) { |
3121 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
3122 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
3121 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
3122 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
3123 | 3123 | |
3124 | 3124 | $error++; |
3125 | 3125 | } else { |
@@ -3134,7 +3134,7 @@ discard block |
||
3134 | 3134 | break; |
3135 | 3135 | } elseif ($result == 0) { |
3136 | 3136 | $langs->loadLangs(array('errors', 'accountancy')); |
3137 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid; |
|
3137 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid; |
|
3138 | 3138 | $error++; |
3139 | 3139 | break; |
3140 | 3140 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $conf->global->AGENDA_EXT_NB = 5; |
59 | 59 | } |
60 | 60 | $MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB'); |
61 | -$DELAYFORCACHE = 300; // 300 seconds |
|
61 | +$DELAYFORCACHE = 300; // 300 seconds |
|
62 | 62 | |
63 | 63 | $disabledefaultvalues = GETPOSTINT('disabledefaultvalues'); |
64 | 64 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $mode = GETPOST('mode', 'aZ09'); |
117 | 117 | if (empty($mode) && preg_match('/show_/', $action)) { |
118 | - $mode = $action; // For backward compatibility |
|
118 | + $mode = $action; // For backward compatibility |
|
119 | 119 | } |
120 | 120 | $resourceid = GETPOST("search_resourceid", 'int'); |
121 | 121 | $year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y"); |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); |
153 | 153 | } |
154 | 154 | |
155 | -$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app |
|
156 | -$defaultview = getDolUserString('AGENDA_DEFAULT_VIEW', $defaultview); // default for user |
|
155 | +$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app |
|
156 | +$defaultview = getDolUserString('AGENDA_DEFAULT_VIEW', $defaultview); // default for user |
|
157 | 157 | if (empty($mode) && !GETPOSTISSET('mode')) { |
158 | 158 | $mode = $defaultview; |
159 | 159 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | |
564 | 564 | $viewmode .= '</div>'; |
565 | 565 | |
566 | -$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools |
|
566 | +$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools |
|
567 | 567 | |
568 | 568 | |
569 | 569 | $newparam = ''; |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | $sql .= " WHERE bc.status = 1"; |
601 | 601 | $sql .= " AND ba.status = 1"; |
602 | 602 | if (!empty($filtert) && $filtert != -1) { |
603 | - $sql .= " AND bc.visibility = ".(int) $filtert ; |
|
603 | + $sql .= " AND bc.visibility = ".(int) $filtert; |
|
604 | 604 | } |
605 | 605 | $resql = $db->query($sql); |
606 | 606 | if ($resql) { |
@@ -654,9 +654,9 @@ discard block |
||
654 | 654 | if ($user->hasRight("holiday", "read")) { |
655 | 655 | $s .= ' |
656 | 656 | <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday |
657 | - ? ' checked' : '') . '> |
|
657 | + ? ' checked' : '').'> |
|
658 | 658 | <label for="check_holiday" class="labelcalendar"> |
659 | - <span class="check_holiday_text">' . $langs->trans("Holidays") . '</span> |
|
659 | + <span class="check_holiday_text">' . $langs->trans("Holidays").'</span> |
|
660 | 660 | </label> |
661 | 661 | </div>'; |
662 | 662 | } |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $s .= '</script>'."\n"; |
683 | 683 | |
684 | 684 | foreach ($showextcals as $val) { |
685 | - $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
685 | + $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
686 | 686 | |
687 | 687 | if (!empty($val['default']) || GETPOSTINT('check_ext'.$htmlname)) { |
688 | 688 | $default = "checked"; |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | // event->datep and event->datef must be GMT date. |
932 | 932 | if ($event->fulldayevent) { |
933 | 933 | $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); |
934 | - $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
934 | + $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
935 | 935 | $event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver'); |
936 | 936 | } else { |
937 | 937 | // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) |
@@ -1009,8 +1009,8 @@ discard block |
||
1009 | 1009 | // Loop on each day covered by action to prepare an index to show on calendar |
1010 | 1010 | $loop = true; |
1011 | 1011 | $j = 0; |
1012 | - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
1013 | - $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
1012 | + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
1013 | + $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
1014 | 1014 | /* |
1015 | 1015 | print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>'; |
1016 | 1016 | print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>'; |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | |
1139 | 1139 | if ($mode == 'show_day') { |
1140 | 1140 | // Request only leaves for the current selected day |
1141 | - $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time |
|
1141 | + $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time |
|
1142 | 1142 | } elseif ($mode == 'show_week') { |
1143 | 1143 | // Restrict on current month (we get more, but we will filter later) |
1144 | 1144 | $sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'"; |
@@ -1684,7 +1684,7 @@ discard block |
||
1684 | 1684 | |
1685 | 1685 | for ($iter_day = 0; $iter_day < 7; $iter_day++) { |
1686 | 1686 | // Show days of the current week |
1687 | - $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server |
|
1687 | + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server |
|
1688 | 1688 | $tmpday = (int) dol_print_date($curtime, '%d', 'tzuserrel'); |
1689 | 1689 | $tmpmonth = (int) dol_print_date($curtime, '%m', 'tzuserrel'); |
1690 | 1690 | $tmpyear = (int) dol_print_date($curtime, '%Y', 'tzuserrel'); |
@@ -1919,9 +1919,9 @@ discard block |
||
1919 | 1919 | $tmpholiday = new Holiday($db); |
1920 | 1920 | |
1921 | 1921 | foreach ($eventarray as $daykey => $notused) { // daykey is the 'YYYYMMDD' to show according to user |
1922 | - $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1923 | - $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1924 | - $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1922 | + $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1923 | + $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1924 | + $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
1925 | 1925 | |
1926 | 1926 | //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n"; |
1927 | 1927 | //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' day='.$day.' month='.$month.' year='.$year."<br>\n"; |
@@ -2215,7 +2215,7 @@ discard block |
||
2215 | 2215 | $event->label = $titletoshow; |
2216 | 2216 | // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user. |
2217 | 2217 | $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : ''); |
2218 | - $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...' |
|
2218 | + $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...' |
|
2219 | 2219 | $event->label = $savlabel; |
2220 | 2220 | } |
2221 | 2221 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $offsetunit = GETPOST('offsetunittype_duration', 'aZ09'); |
83 | 83 | $remindertype = GETPOST('selectremindertype', 'aZ09'); |
84 | 84 | $modelmail = GETPOSTINT('actioncommsendmodel_mail'); |
85 | -$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed |
|
85 | +$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed |
|
86 | 86 | $private = GETPOST('private', 'alphanohtml'); |
87 | 87 | if ($complete == 'na' || $complete == -2) { |
88 | 88 | $complete = -1; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | if (GETPOSTISSET("contactid")) { |
458 | 458 | $object->contact_id = GETPOSTINT("contactid"); |
459 | 459 | |
460 | - $object->contact = $contact; // For backward compatibility |
|
460 | + $object->contact = $contact; // For backward compatibility |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | if (GETPOSTINT('socid') > 0) { |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | if (is_array($listofresourceid) && count($listofresourceid)) { |
552 | 552 | foreach ($listofresourceid as $resource_id => $val) { |
553 | 553 | $resource_type = 'dolresource'; |
554 | - $busy = 1;//GETPOSTINT('busy'); |
|
554 | + $busy = 1; //GETPOSTINT('busy'); |
|
555 | 555 | |
556 | 556 | // Resources association |
557 | 557 | if (getDolGlobalString('RESOURCE_USED_IN_EVENT_CHECK')) { |
@@ -567,24 +567,24 @@ discard block |
||
567 | 567 | } |
568 | 568 | |
569 | 569 | $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; |
570 | - $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; |
|
571 | - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($resource_type) . "'"; |
|
572 | - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; |
|
573 | - $sql .= " WHERE er.resource_id = " . ((int) $resource_id); |
|
570 | + $sql .= " FROM ".MAIN_DB_PREFIX."element_resources as er"; |
|
571 | + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."resource as r ON r.rowid = er.resource_id AND er.resource_type = '".$db->escape($resource_type)."'"; |
|
572 | + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as ac ON ac.id = er.element_id AND er.element_type = '".$db->escape($object->element)."'"; |
|
573 | + $sql .= " WHERE er.resource_id = ".((int) $resource_id); |
|
574 | 574 | $sql .= " AND er.busy = 1"; |
575 | 575 | $sql .= " AND ("; |
576 | 576 | |
577 | 577 | // event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end) |
578 | - $sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))"; |
|
578 | + $sql .= " (ac.datep <= '".$db->idate($eventDateStart)."' AND (ac.datep2 IS NULL OR ac.datep2 >= '".$db->idate($eventDateStart)."'))"; |
|
579 | 579 | // event date end between ac.datep and ac.datep2 |
580 | 580 | if (!empty($eventDateEnd)) { |
581 | - $sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))"; |
|
581 | + $sql .= " OR (ac.datep <= '".$db->idate($eventDateEnd)."' AND (ac.datep2 >= '".$db->idate($eventDateEnd)."'))"; |
|
582 | 582 | } |
583 | 583 | // event date start before ac.datep and event date end after ac.datep2 |
584 | 584 | $sql .= " OR ("; |
585 | - $sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'"; |
|
585 | + $sql .= "ac.datep >= '".$db->idate($eventDateStart)."'"; |
|
586 | 586 | if (!empty($eventDateEnd)) { |
587 | - $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')"; |
|
587 | + $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($eventDateEnd)."')"; |
|
588 | 588 | } |
589 | 589 | $sql .= ")"; |
590 | 590 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | if ($db->num_rows($resql) > 0) { |
599 | 599 | // Resource already in use |
600 | 600 | $error++; |
601 | - $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; |
|
601 | + $object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : '; |
|
602 | 602 | while ($obj = $db->fetch_object($resql)) { |
603 | - $object->error .= '<br> - ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); |
|
603 | + $object->error .= '<br> - '.$langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label.' ['.$obj->ac_id.']'); |
|
604 | 604 | } |
605 | 605 | $object->errors[] = $object->error; |
606 | 606 | } |
@@ -705,12 +705,12 @@ discard block |
||
705 | 705 | if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) { |
706 | 706 | $firstdatearray = dol_get_first_day_week(GETPOSTINT("apday"), GETPOSTINT("apmonth"), GETPOSTINT("apyear")); |
707 | 707 | $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel'); |
708 | - $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd');//We begin the week after |
|
708 | + $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd'); //We begin the week after |
|
709 | 709 | $dayoffset = 7; |
710 | 710 | $monthoffset = 0; |
711 | 711 | } elseif ($selectedrecurrulefreq == 'MONTHLY' && !empty($selectedrecurrulebymonthday)) { |
712 | 712 | $firstday = $selectedrecurrulebymonthday; |
713 | - $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth");//We begin the week after |
|
713 | + $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth"); //We begin the week after |
|
714 | 714 | $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel'); |
715 | 715 | $dayoffset = 0; |
716 | 716 | $monthoffset = 1; |
@@ -815,9 +815,9 @@ discard block |
||
815 | 815 | |
816 | 816 | // increment date for recurrent events |
817 | 817 | $datep = dol_time_plus_duree($datep, $dayoffset, 'd'); |
818 | - $datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
818 | + $datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
819 | 819 | $datef = dol_time_plus_duree($datef, $dayoffset, 'd'); |
820 | - $datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
820 | + $datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
821 | 821 | } |
822 | 822 | } |
823 | 823 | if (!empty($backtopage) && !$error) { |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') { |
1161 | 1161 | $error = 0; |
1162 | 1162 | |
1163 | - $shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. |
|
1163 | + $shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. |
|
1164 | 1164 | $smin = (int) dol_print_date($object->datep, "%M", 'tzuserrel'); |
1165 | 1165 | |
1166 | 1166 | $newdate = GETPOST('newdate', 'alpha'); |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | if (new_startdate > old_enddate) { |
1335 | 1335 | var timeDiff = old_enddate - old_startdate; |
1336 | 1336 | var new_enddate = new Date(new_startdate.getTime() + timeDiff); |
1337 | - $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); |
|
1337 | + $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'")); |
|
1338 | 1338 | $("#p2day").val(new_enddate.getDate()); |
1339 | 1339 | $("#p2month").val(new_enddate.getMonth() + 1); |
1340 | 1340 | $("#p2year").val(new_enddate.getFullYear()); |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | $default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV'); |
1393 | 1393 | print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"'); |
1394 | 1394 | $selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default); |
1395 | - print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot |
|
1395 | + print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot |
|
1396 | 1396 | print '</td></tr>'; |
1397 | 1397 | } |
1398 | 1398 | |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | } |
1732 | 1732 | //var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject); |
1733 | 1733 | |
1734 | - if (! in_array($origin, array('societe', 'project', 'task', 'user'))) { |
|
1734 | + if (!in_array($origin, array('societe', 'project', 'task', 'user'))) { |
|
1735 | 1735 | // We do not use link for object that already contains a hard coded field to make links with agenda events |
1736 | 1736 | print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>'; |
1737 | 1737 | print '<td colspan="3">'; |
@@ -1820,7 +1820,7 @@ discard block |
||
1820 | 1820 | $("#addreminder").prop("checked", true); |
1821 | 1821 | |
1822 | 1822 | // Set period with default reminder period |
1823 | - $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset) . '\'); |
|
1823 | + $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset).'\'); |
|
1824 | 1824 | $("#select_offsetunittype_duration").select2("destroy"); |
1825 | 1825 | $("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\'); |
1826 | 1826 | $("#select_offsetunittype_duration").select2(); |
@@ -1917,7 +1917,7 @@ discard block |
||
1917 | 1917 | $object->socpeopleassigned[$id] = array('id' => $tmpid); |
1918 | 1918 | } |
1919 | 1919 | $object->contact_id = GETPOSTINT("contactid"); |
1920 | - $object->fk_project = GETPOSTINT("projectid"); |
|
1920 | + $object->fk_project = GETPOSTINT("projectid"); |
|
1921 | 1921 | |
1922 | 1922 | $object->note_private = GETPOST("note", 'restricthtml'); |
1923 | 1923 | } |
@@ -1995,7 +1995,7 @@ discard block |
||
1995 | 1995 | if (new_startdate > old_enddate) { |
1996 | 1996 | var timeDiff = old_enddate - old_startdate; |
1997 | 1997 | var new_enddate = new Date(new_startdate.getTime() + timeDiff); |
1998 | - $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); |
|
1998 | + $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'")); |
|
1999 | 1999 | $("#p2day").val(new_enddate.getDate()); |
2000 | 2000 | $("#p2month").val(new_enddate.getMonth() + 1); |
2001 | 2001 | $("#p2year").val(new_enddate.getFullYear()); |
@@ -2020,7 +2020,7 @@ discard block |
||
2020 | 2020 | if ($backtopage) { |
2021 | 2021 | print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">'; |
2022 | 2022 | } |
2023 | - if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { |
|
2023 | + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && !preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { |
|
2024 | 2024 | print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">'; |
2025 | 2025 | } |
2026 | 2026 | |
@@ -2144,8 +2144,8 @@ discard block |
||
2144 | 2144 | 'type' => 'user', |
2145 | 2145 | //'transparency'=>$object->userassigned[$user->id]['transparency'], |
2146 | 2146 | 'transparency' => $object->transparency, // Force transparency on ownerfrom event |
2147 | - 'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status']: null), |
|
2148 | - 'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory']:null) |
|
2147 | + 'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status'] : null), |
|
2148 | + 'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory'] : null) |
|
2149 | 2149 | ); |
2150 | 2150 | } |
2151 | 2151 | if (!empty($object->userassigned)) { // Now concat assigned users |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | }); |
2447 | 2447 | })'; |
2448 | 2448 | print '</script>'."\n"; |
2449 | - print '</div>'; // End of div for reminderparameters |
|
2449 | + print '</div>'; // End of div for reminderparameters |
|
2450 | 2450 | } |
2451 | 2451 | |
2452 | 2452 | print dol_get_fiche_end(); |
@@ -2718,7 +2718,7 @@ discard block |
||
2718 | 2718 | |
2719 | 2719 | // Priority |
2720 | 2720 | if (getDolGlobalString('AGENDA_SUPPORT_PRIORITY_IN_EVENTS')) { |
2721 | - print '<tr><td class="nowrap" class="titlefield">' . $langs->trans("Priority") . '</td><td>'; |
|
2721 | + print '<tr><td class="nowrap" class="titlefield">'.$langs->trans("Priority").'</td><td>'; |
|
2722 | 2722 | print($object->priority ? $object->priority : ''); |
2723 | 2723 | print '</td></tr>'; |
2724 | 2724 | } |
@@ -341,10 +341,10 @@ discard block |
||
341 | 341 | if (getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { |
342 | 342 | if ($tmpsource && $REF) { |
343 | 343 | // Use the source in the hash to avoid duplicates if the references are identical |
344 | - $tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $tmpsource.$REF, $SECUREKEY, '2'); |
|
344 | + $tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$tmpsource.$REF, $SECUREKEY, '2'); |
|
345 | 345 | // Do a second test for retro-compatibility (token may have been hashed with membersubscription in external module) |
346 | 346 | if ($tmpsource != $source) { |
347 | - $tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $source.$REF, $SECUREKEY, '2'); |
|
347 | + $tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$source.$REF, $SECUREKEY, '2'); |
|
348 | 348 | } |
349 | 349 | } else { |
350 | 350 | $tokenisok = dol_verifyHash($conf->global->PAYMENT_SECURITY_TOKEN, $SECUREKEY, '2'); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $tokenisok = ($conf->global->PAYMENT_SECURITY_TOKEN == $SECUREKEY); |
354 | 354 | } |
355 | 355 | |
356 | - if (! $tokenisok) { |
|
356 | + if (!$tokenisok) { |
|
357 | 357 | if (!getDolGlobalString('PAYMENT_SECURITY_ACCEPT_ANY_TOKEN')) { |
358 | 358 | $valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility |
359 | 359 | } else { |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | $paramcreditor = 'ONLINE_PAYMENT_CREDITOR'; |
383 | 383 | $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix; |
384 | 384 | if (getDolGlobalString($paramcreditorlong)) { |
385 | - $creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show |
|
385 | + $creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show |
|
386 | 386 | } elseif (getDolGlobalString($paramcreditor)) { |
387 | - $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show |
|
387 | + $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $mesg = ''; |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | $remoteip = getUserRemoteIP(); |
835 | 835 | |
836 | 836 | $_SESSION["onlinetoken"] = $stripeToken; |
837 | - $_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php. |
|
838 | - $_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php. |
|
837 | + $_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php. |
|
838 | + $_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php. |
|
839 | 839 | $_SESSION["paymentType"] = ''; |
840 | 840 | $_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip |
841 | 841 | $_SESSION['payerID'] = is_object($customer) ? $customer->id : ''; |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | |
882 | 882 | $head = ''; |
883 | 883 | if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) { |
884 | - $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.(!empty($getpostlang) ? $getpostlang : $langs->defaultlang).'">'."\n"; |
|
884 | + $head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.(!empty($getpostlang) ? $getpostlang : $langs->defaultlang).'">'."\n"; |
|
885 | 885 | } |
886 | 886 | |
887 | 887 | $conf->dol_hide_topmenu = 1; |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | if (preg_match('/^\((.*)\)$/', $conf->global->PAYMENT_NEWFORM_TEXT, $reg)) { |
1006 | 1006 | $text .= $langs->trans($reg[1])."<br>\n"; |
1007 | 1007 | } else { |
1008 | - $text .= getDolGlobalString('PAYMENT_NEWFORM_TEXT') . "<br>\n"; |
|
1008 | + $text .= getDolGlobalString('PAYMENT_NEWFORM_TEXT')."<br>\n"; |
|
1009 | 1009 | } |
1010 | 1010 | $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
1011 | 1011 | } |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | print $text; |
1017 | 1017 | |
1018 | 1018 | // Output payment summary form |
1019 | -print '<tr><td align="center">'; // class=center does not have the payment button centered so we keep align here. |
|
1019 | +print '<tr><td align="center">'; // class=center does not have the payment button centered so we keep align here. |
|
1020 | 1020 | print '<table class="centpercent left" id="tablepublicpayment">'; |
1021 | 1021 | print '<tr class="hideonsmartphone"><td colspan="2" align="left" class="opacitymedium">'.$langs->trans("ThisIsInformationOnPayment").' :</td></tr>'."\n"; |
1022 | 1022 | |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | // Currency |
1059 | 1059 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
1060 | 1060 | } else { |
1061 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1061 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1062 | 1062 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
1063 | 1063 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
1064 | 1064 | } |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | // Currency |
1160 | 1160 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
1161 | 1161 | } else { |
1162 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1162 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1163 | 1163 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
1164 | 1164 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
1165 | 1165 | } |
@@ -1291,12 +1291,12 @@ discard block |
||
1291 | 1291 | print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">'; |
1292 | 1292 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
1293 | 1293 | } else { |
1294 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1294 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1295 | 1295 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
1296 | 1296 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
1297 | 1297 | } |
1298 | 1298 | } else { |
1299 | - print '<b class="amount">'.price($object->total_ttc, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1299 | + print '<b class="amount">'.price($object->total_ttc, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1300 | 1300 | } |
1301 | 1301 | print '<input type="hidden" name="currency" value="'.$currency.'">'; |
1302 | 1302 | print '</td></tr>'."\n"; |
@@ -1500,7 +1500,7 @@ discard block |
||
1500 | 1500 | // Currency |
1501 | 1501 | print ' <b>'.$langs->trans("Currency".$currency).'</b>'; |
1502 | 1502 | } else { |
1503 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1503 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1504 | 1504 | print '<input type="hidden" name="amount" value="'.$amount.'">'; |
1505 | 1505 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
1506 | 1506 | } |
@@ -1562,7 +1562,7 @@ discard block |
||
1562 | 1562 | $member = new Adherent($db); |
1563 | 1563 | $adht = new AdherentType($db); |
1564 | 1564 | |
1565 | - $result = $member->fetch(0, $ref, 0, '', true, true); // This fetch also ->last_subscription_amount |
|
1565 | + $result = $member->fetch(0, $ref, 0, '', true, true); // This fetch also ->last_subscription_amount |
|
1566 | 1566 | if ($result <= 0) { |
1567 | 1567 | $mesg = $member->error; |
1568 | 1568 | $error++; |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | $newtypeid = (int) (GETPOSTISSET("typeid") ? GETPOSTINT("typeid") : $member->typeid); |
1667 | 1667 | if (getDolGlobalString('MEMBER_ALLOW_CHANGE_OF_TYPE')) { |
1668 | 1668 | $typeid = $newtypeid; |
1669 | - $adht->fetch($typeid); // Reload with the new type id |
|
1669 | + $adht->fetch($typeid); // Reload with the new type id |
|
1670 | 1670 | } |
1671 | 1671 | |
1672 | 1672 | $caneditamount = $adht->caneditamount; |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount"); |
1727 | 1727 | // This place no longer allows amount edition |
1728 | 1728 | if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) { |
1729 | - print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
1729 | + print ' - <a href="'.getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
1730 | 1730 | } |
1731 | 1731 | print '</td><td class="CTableRow2">'; |
1732 | 1732 | |
@@ -1740,9 +1740,9 @@ discard block |
||
1740 | 1740 | print '<input type="text" class="width75" name="newamount" value="'.price($amount, 1, $langs, 1, -1, -1).'">'; |
1741 | 1741 | } |
1742 | 1742 | } else { |
1743 | - print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1743 | + print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1744 | 1744 | if ($minimumamount > $amount) { |
1745 | - print ' <span class="opacitymedium small">'. $langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)).'</span>'; |
|
1745 | + print ' <span class="opacitymedium small">'.$langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)).'</span>'; |
|
1746 | 1746 | } |
1747 | 1747 | print '<input type="hidden" name="newamount" value="'.$amount.'">'; |
1748 | 1748 | } |
@@ -1863,7 +1863,7 @@ discard block |
||
1863 | 1863 | print ' ('.$langs->trans("ToComplete"); |
1864 | 1864 | } |
1865 | 1865 | if (getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO')) { |
1866 | - print ' - <a href="' . getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
1866 | + print ' - <a href="'.getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>'; |
|
1867 | 1867 | } |
1868 | 1868 | if (!getDolGlobalString('DONATION_NEWFORM_AMOUNT')) { |
1869 | 1869 | print ')'; |
@@ -1901,7 +1901,7 @@ discard block |
||
1901 | 1901 | $valtoshow = max(getDolGlobalString('DONATION_MIN_AMOUNT'), $valtoshow); |
1902 | 1902 | $amount = $valtoshow; |
1903 | 1903 | } |
1904 | - print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1904 | + print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1905 | 1905 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
1906 | 1906 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
1907 | 1907 | } |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | print '</b>'; |
1978 | 1978 | print '</td></tr>'."\n"; |
1979 | 1979 | |
1980 | - if (! is_object($attendee->project)) { |
|
1980 | + if (!is_object($attendee->project)) { |
|
1981 | 1981 | $text = 'ErrorProjectNotFound'; |
1982 | 1982 | } else { |
1983 | 1983 | $text = $langs->trans("PaymentEvent").' - '.$attendee->project->title; |
@@ -1994,7 +1994,7 @@ discard block |
||
1994 | 1994 | print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount"); |
1995 | 1995 | print '</td><td class="CTableRow2">'; |
1996 | 1996 | $valtoshow = $amount; |
1997 | - print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1997 | + print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
1998 | 1998 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
1999 | 1999 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
2000 | 2000 | print '<input type="hidden" name="currency" value="'.$currency.'">'; |
@@ -2078,7 +2078,7 @@ discard block |
||
2078 | 2078 | print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount"); |
2079 | 2079 | print '</td><td class="CTableRow2">'; |
2080 | 2080 | $valtoshow = $amount; |
2081 | - print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
2081 | + print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency |
|
2082 | 2082 | print '<input type="hidden" name="amount" value="'.$valtoshow.'">'; |
2083 | 2083 | print '<input type="hidden" name="newamount" value="'.$valtoshow.'">'; |
2084 | 2084 | print '<input type="hidden" name="currency" value="'.$currency.'">'; |
@@ -2335,7 +2335,7 @@ discard block |
||
2335 | 2335 | |
2336 | 2336 | //print '<br>'; |
2337 | 2337 | |
2338 | - print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = ' . getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION').' STRIPE_USE_NEW_CHECKOUT = ' . getDolGlobalString('STRIPE_USE_NEW_CHECKOUT').' -->'."\n"; |
|
2338 | + print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = '.getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION').' STRIPE_USE_NEW_CHECKOUT = '.getDolGlobalString('STRIPE_USE_NEW_CHECKOUT').' -->'."\n"; |
|
2339 | 2339 | print '<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" id="payment-form">'."\n"; |
2340 | 2340 | |
2341 | 2341 | print '<input type="hidden" name="token" value="'.newToken().'">'."\n"; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm'); |
294 | 294 | } else { |
295 | 295 | // Note date_ech is often a little bit higher than dateperiod |
296 | - $newdateech = dol_mktime(0, 0, 0, GETPOSTINT('clone_date_echmonth'), GETPOSTINT('clone_date_echday'), GETPOSTINT('clone_date_echyear')); // = date of creation or due date |
|
296 | + $newdateech = dol_mktime(0, 0, 0, GETPOSTINT('clone_date_echmonth'), GETPOSTINT('clone_date_echday'), GETPOSTINT('clone_date_echyear')); // = date of creation or due date |
|
297 | 297 | $newdateperiod = dol_mktime(0, 0, 0, GETPOSTINT('clone_periodmonth'), GETPOSTINT('clone_periodday'), GETPOSTINT('clone_periodyear')); |
298 | 298 | |
299 | 299 | if ($newdateperiod) { |
@@ -535,10 +535,10 @@ discard block |
||
535 | 535 | $userstatic = new User($db); |
536 | 536 | $result = $userstatic->fetch($object->fk_user); |
537 | 537 | if ($result > 0) { |
538 | - $morehtmlref .= '<br>' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1); |
|
538 | + $morehtmlref .= '<br>'.$langs->trans('Employee').' : '.$userstatic->getNomUrl(1); |
|
539 | 539 | } |
540 | 540 | } else { |
541 | - $morehtmlref .= '<br>' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->hasRight('salaries', 'write'), 'string', '', 0, 1); |
|
541 | + $morehtmlref .= '<br>'.$form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->hasRight('salaries', 'write'), 'string', '', 0, 1); |
|
542 | 542 | if ($object->fk_user > 0) { |
543 | 543 | $userstatic = new User($db); |
544 | 544 | $result = $userstatic->fetch($object->fk_user); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | /** |
151 | 151 | * @var string |
152 | 152 | */ |
153 | - public $price_formated; // used by takepos/ajax/ajax.php |
|
153 | + public $price_formated; // used by takepos/ajax/ajax.php |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Selling price with tax |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * @var string |
164 | 164 | */ |
165 | - public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
165 | + public $price_ttc_formated; // used by takepos/ajax/ajax.php |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * Minimum price net |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | /** |
512 | 512 | * @var int|string |
513 | 513 | */ |
514 | - public $weight_units; // scale -3, 0, 3, 6 |
|
514 | + public $weight_units; // scale -3, 0, 3, 6 |
|
515 | 515 | /** |
516 | 516 | * @var float|string |
517 | 517 | */ |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | /** |
520 | 520 | * @var int|string |
521 | 521 | */ |
522 | - public $length_units; // scale -3, 0, 3, 6 |
|
522 | + public $length_units; // scale -3, 0, 3, 6 |
|
523 | 523 | /** |
524 | 524 | * @var float|string |
525 | 525 | */ |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | /** |
528 | 528 | * @var int|string |
529 | 529 | */ |
530 | - public $width_units; // scale -3, 0, 3, 6 |
|
530 | + public $width_units; // scale -3, 0, 3, 6 |
|
531 | 531 | /** |
532 | 532 | * @var float|string|null |
533 | 533 | */ |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | /** |
536 | 536 | * @var int|string|null |
537 | 537 | */ |
538 | - public $height_units; // scale -3, 0, 3, 6 |
|
538 | + public $height_units; // scale -3, 0, 3, 6 |
|
539 | 539 | /** |
540 | 540 | * @var float|string|null |
541 | 541 | */ |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | /** |
544 | 544 | * @var int|string|null |
545 | 545 | */ |
546 | - public $surface_units; // scale -3, 0, 3, 6 |
|
546 | + public $surface_units; // scale -3, 0, 3, 6 |
|
547 | 547 | /** |
548 | 548 | * @var float|string|null |
549 | 549 | */ |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | /** |
552 | 552 | * @var int|string|null |
553 | 553 | */ |
554 | - public $volume_units; // scale -3, 0, 3, 6 |
|
554 | + public $volume_units; // scale -3, 0, 3, 6 |
|
555 | 555 | |
556 | 556 | /** |
557 | 557 | * @var float|string|null |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | /** |
561 | 561 | * @var ?string |
562 | 562 | */ |
563 | - public $net_measure_units; // scale -3, 0, 3, 6 |
|
563 | + public $net_measure_units; // scale -3, 0, 3, 6 |
|
564 | 564 | |
565 | 565 | /** |
566 | 566 | * @var string |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000), |
871 | 871 | //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), |
872 | 872 | //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>'0', 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), |
873 | - 'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000), |
|
873 | + 'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000), |
|
874 | 874 | ); |
875 | 875 | |
876 | 876 | /** |
@@ -1174,9 +1174,9 @@ discard block |
||
1174 | 1174 | |
1175 | 1175 | // update accountancy for this entity |
1176 | 1176 | if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
1177 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
1177 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
1178 | 1178 | |
1179 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
1179 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
1180 | 1180 | $sql .= " fk_product"; |
1181 | 1181 | $sql .= ", entity"; |
1182 | 1182 | $sql .= ", accountancy_code_buy"; |
@@ -1187,13 +1187,13 @@ discard block |
||
1187 | 1187 | $sql .= ", accountancy_code_sell_export"; |
1188 | 1188 | $sql .= ") VALUES ("; |
1189 | 1189 | $sql .= $this->id; |
1190 | - $sql .= ", " . ((int) $conf->entity); |
|
1191 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1192 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
1193 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
1194 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1195 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
1196 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
1190 | + $sql .= ", ".((int) $conf->entity); |
|
1191 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1192 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
1193 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
1194 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1195 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
1196 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
1197 | 1197 | $sql .= ")"; |
1198 | 1198 | $result = $this->db->query($sql); |
1199 | 1199 | if (!$result) { |
@@ -1574,12 +1574,12 @@ discard block |
||
1574 | 1574 | $sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null'); |
1575 | 1575 | $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; |
1576 | 1576 | if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
1577 | - $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1578 | - $sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
1579 | - $sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
1580 | - $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1581 | - $sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
1582 | - $sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
1577 | + $sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1578 | + $sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
1579 | + $sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
1580 | + $sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1581 | + $sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
1582 | + $sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
1583 | 1583 | } |
1584 | 1584 | $sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null"); |
1585 | 1585 | $sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null'); |
@@ -1609,9 +1609,9 @@ discard block |
||
1609 | 1609 | |
1610 | 1610 | // update accountancy for this entity |
1611 | 1611 | if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
1612 | - $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); |
|
1612 | + $this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity)); |
|
1613 | 1613 | |
1614 | - $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; |
|
1614 | + $sql = "INSERT INTO ".$this->db->prefix()."product_perentity ("; |
|
1615 | 1615 | $sql .= " fk_product"; |
1616 | 1616 | $sql .= ", entity"; |
1617 | 1617 | $sql .= ", accountancy_code_buy"; |
@@ -1622,13 +1622,13 @@ discard block |
||
1622 | 1622 | $sql .= ", accountancy_code_sell_export"; |
1623 | 1623 | $sql .= ") VALUES ("; |
1624 | 1624 | $sql .= ((int) $this->id); |
1625 | - $sql .= ", " . ((int) $conf->entity); |
|
1626 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; |
|
1627 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; |
|
1628 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; |
|
1629 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; |
|
1630 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'"; |
|
1631 | - $sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; |
|
1625 | + $sql .= ", ".((int) $conf->entity); |
|
1626 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; |
|
1627 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; |
|
1628 | + $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; |
|
1629 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; |
|
1630 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'"; |
|
1631 | + $sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'"; |
|
1632 | 1632 | $sql .= ")"; |
1633 | 1633 | $result = $this->db->query($sql); |
1634 | 1634 | if (!$result) { |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | $error++; |
1707 | 1707 | } else { |
1708 | 1708 | // to keep old entries with the new dir |
1709 | - require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php'; |
|
1709 | + require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; |
|
1710 | 1710 | $ecmfiles = new EcmFiles($this->db); |
1711 | 1711 | $ecmfiles->updateAfterRename("produit/".dol_sanitizeFileName($this->oldcopy->ref), "produit/".dol_sanitizeFileName($this->ref)); |
1712 | 1712 | } |
@@ -2004,7 +2004,7 @@ discard block |
||
2004 | 2004 | } |
2005 | 2005 | } elseif (isset($this->multilangs[$key])) { |
2006 | 2006 | if (empty($this->multilangs[$key]["label"])) { |
2007 | - $this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); |
|
2007 | + $this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")); |
|
2008 | 2008 | return -1; |
2009 | 2009 | } |
2010 | 2010 | |
@@ -2201,7 +2201,7 @@ discard block |
||
2201 | 2201 | */ |
2202 | 2202 | private function getArrayForPriceCompare($level = 0) |
2203 | 2203 | { |
2204 | - $testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly'); |
|
2204 | + $testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly'); |
|
2205 | 2205 | |
2206 | 2206 | foreach ($testExit as $field) { |
2207 | 2207 | if (!isset($this->$field)) { |
@@ -2891,12 +2891,12 @@ discard block |
||
2891 | 2891 | |
2892 | 2892 | // For MultiCompany |
2893 | 2893 | // PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity |
2894 | - $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
2895 | - $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. |
|
2894 | + $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. |
|
2895 | + $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. |
|
2896 | 2896 | $visibleWarehousesEntities = $conf->entity; |
2897 | 2897 | if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) { |
2898 | 2898 | if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) { |
2899 | - $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
2899 | + $checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); |
|
2900 | 2900 | if ($this->db->num_rows($checkPMPPerEntity) > 0) { |
2901 | 2901 | $separatedEntityPMP = true; |
2902 | 2902 | } |
@@ -2904,7 +2904,7 @@ discard block |
||
2904 | 2904 | global $mc; |
2905 | 2905 | $separatedStock = true; |
2906 | 2906 | if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { |
2907 | - $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); |
|
2907 | + $visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']); |
|
2908 | 2908 | } |
2909 | 2909 | } |
2910 | 2910 | if ($separatedEntityPMP) { |
@@ -2922,10 +2922,10 @@ discard block |
||
2922 | 2922 | } |
2923 | 2923 | $sql .= " FROM ".$this->db->prefix()."product as p"; |
2924 | 2924 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') || $separatedEntityPMP) { |
2925 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
2925 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
2926 | 2926 | } |
2927 | 2927 | if ($separatedStock) { |
2928 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))"; |
|
2928 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))"; |
|
2929 | 2929 | } |
2930 | 2930 | |
2931 | 2931 | if ($id) { |
@@ -3087,15 +3087,15 @@ discard block |
||
3087 | 3087 | $sql .= " WHERE entity IN (".getEntity('productprice').")"; |
3088 | 3088 | $sql .= " AND price_level=".((int) $i); |
3089 | 3089 | $sql .= " AND fk_product = ".((int) $this->id); |
3090 | - $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
3091 | - $sql .= " LIMIT 1"; // Only the first one |
|
3090 | + $sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line |
|
3091 | + $sql .= " LIMIT 1"; // Only the first one |
|
3092 | 3092 | $resql = $this->db->query($sql); |
3093 | 3093 | if ($resql) { |
3094 | 3094 | $result = $this->db->fetch_array($resql); |
3095 | 3095 | |
3096 | 3096 | $this->multiprices[$i] = $result ? $result["price"] : null; |
3097 | 3097 | $this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null; |
3098 | - $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
3098 | + $this->multiprices_min[$i] = $result ? $result["price_min"] : null; |
|
3099 | 3099 | $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; |
3100 | 3100 | $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; |
3101 | 3101 | // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on |
@@ -3320,7 +3320,7 @@ discard block |
||
3320 | 3320 | $obj = $this->db->fetch_object($result); |
3321 | 3321 | $this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0; |
3322 | 3322 | $this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0; |
3323 | - $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
3323 | + $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
3324 | 3324 | } else { |
3325 | 3325 | $this->error = $this->db->error(); |
3326 | 3326 | $error++; |
@@ -4823,7 +4823,7 @@ discard block |
||
4823 | 4823 | //Addition of a product with the highest rank +1 |
4824 | 4824 | $sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)"; |
4825 | 4825 | $sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".((int) $incdec).", ".((int) $rank).")"; |
4826 | - if (! $this->db->query($sql)) { |
|
4826 | + if (!$this->db->query($sql)) { |
|
4827 | 4827 | dol_print_error($this->db); |
4828 | 4828 | return -1; |
4829 | 4829 | } else { |
@@ -4944,7 +4944,7 @@ discard block |
||
4944 | 4944 | $sql = "UPDATE ".$this->db->prefix()."product_association"; |
4945 | 4945 | $sql .= " SET rang = ".((int) $cpt); |
4946 | 4946 | $sql .= " WHERE rowid = ".((int) $objrank->rowid); |
4947 | - if (! $this->db->query($sql)) { |
|
4947 | + if (!$this->db->query($sql)) { |
|
4948 | 4948 | dol_print_error($this->db); |
4949 | 4949 | return -1; |
4950 | 4950 | } |
@@ -5379,7 +5379,7 @@ discard block |
||
5379 | 5379 | if (isset($this->sousprods) && is_array($this->sousprods)) { |
5380 | 5380 | foreach ($this->sousprods as $prod_name => $desc_product) { |
5381 | 5381 | if (is_array($desc_product)) { |
5382 | - $this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res |
|
5382 | + $this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res |
|
5383 | 5383 | } |
5384 | 5384 | } |
5385 | 5385 | } |
@@ -5536,7 +5536,7 @@ discard block |
||
5536 | 5536 | $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens |
5537 | 5537 | $sql .= " ORDER BY pa.rang"; |
5538 | 5538 | |
5539 | - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG); |
|
5539 | + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG); |
|
5540 | 5540 | |
5541 | 5541 | if ($level == 1) { |
5542 | 5542 | $alreadyfound = array($id => 1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediately |
@@ -5601,7 +5601,7 @@ discard block |
||
5601 | 5601 | $parent[$this->label][$keyChild] = $valueChild; |
5602 | 5602 | } |
5603 | 5603 | foreach ($parent as $key => $value) { // key=label, value is array of children |
5604 | - $this->sousprods[$key] = $value; // @phan-suppress-current-line PhanTypeMismatchProperty |
|
5604 | + $this->sousprods[$key] = $value; // @phan-suppress-current-line PhanTypeMismatchProperty |
|
5605 | 5605 | } |
5606 | 5606 | } |
5607 | 5607 | |
@@ -5637,7 +5637,7 @@ discard block |
||
5637 | 5637 | if (!empty($this->entity) && $permissiontoreadproduct) { |
5638 | 5638 | $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, '1'); |
5639 | 5639 | if ($this->nbphoto > 0) { |
5640 | - $datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>'; |
|
5640 | + $datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>'; |
|
5641 | 5641 | } |
5642 | 5642 | } |
5643 | 5643 | |
@@ -5647,7 +5647,7 @@ discard block |
||
5647 | 5647 | $datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>'; |
5648 | 5648 | } |
5649 | 5649 | if (isset($this->status) && isset($this->status_buy)) { |
5650 | - $datas['status'] = ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1); |
|
5650 | + $datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1); |
|
5651 | 5651 | } |
5652 | 5652 | |
5653 | 5653 | if (!empty($this->ref)) { |
@@ -5697,7 +5697,7 @@ discard block |
||
5697 | 5697 | $labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units); |
5698 | 5698 | } |
5699 | 5699 | if ($labelsurfacevolume) { |
5700 | - $datas['surface'] = "<br>" . $labelsurfacevolume; |
|
5700 | + $datas['surface'] = "<br>".$labelsurfacevolume; |
|
5701 | 5701 | } |
5702 | 5702 | } |
5703 | 5703 | if ($this->isService() && !empty($this->duration_value)) { |
@@ -5739,9 +5739,9 @@ discard block |
||
5739 | 5739 | } |
5740 | 5740 | // show categories for this record only in ajax to not overload lists |
5741 | 5741 | if (isModEnabled('category') && !$nofetch) { |
5742 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
5742 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
5743 | 5743 | $form = new Form($this->db); |
5744 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); |
|
5744 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); |
|
5745 | 5745 | } |
5746 | 5746 | } |
5747 | 5747 | |
@@ -6265,7 +6265,7 @@ discard block |
||
6265 | 6265 | if (isModEnabled("supplier_order")) { |
6266 | 6266 | $filterStatus = getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK', '3,4'); |
6267 | 6267 | if (isset($includedraftpoforvirtual)) { |
6268 | - $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them |
|
6268 | + $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them |
|
6269 | 6269 | } |
6270 | 6270 | $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock); |
6271 | 6271 | if ($result < 0) { |
@@ -6682,7 +6682,7 @@ discard block |
||
6682 | 6682 | if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) { |
6683 | 6683 | $dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); |
6684 | 6684 | foreach ($dirsociete as $dirroot) { |
6685 | - $res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php'); |
|
6685 | + $res = dol_include_once($dirroot.getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php'); |
|
6686 | 6686 | if ($res) { |
6687 | 6687 | break; |
6688 | 6688 | } |
@@ -25,36 +25,36 @@ discard block |
||
25 | 25 | * \remarks To run this script as CLI: phpunit filename.php |
26 | 26 | */ |
27 | 27 | |
28 | -global $conf,$user,$langs,$db; |
|
28 | +global $conf, $user, $langs, $db; |
|
29 | 29 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
30 | 30 | //require_once 'PHPUnit/Autoload.php'; |
31 | 31 | |
32 | -if (! defined('NOREQUIRESOC')) { |
|
32 | +if (!defined('NOREQUIRESOC')) { |
|
33 | 33 | define('NOREQUIRESOC', '1'); |
34 | 34 | } |
35 | -if (! defined('NOCSRFCHECK')) { |
|
35 | +if (!defined('NOCSRFCHECK')) { |
|
36 | 36 | define('NOCSRFCHECK', '1'); |
37 | 37 | } |
38 | -if (! defined('NOTOKENRENEWAL')) { |
|
38 | +if (!defined('NOTOKENRENEWAL')) { |
|
39 | 39 | define('NOTOKENRENEWAL', '1'); |
40 | 40 | } |
41 | -if (! defined('NOREQUIREMENU')) { |
|
41 | +if (!defined('NOREQUIREMENU')) { |
|
42 | 42 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
43 | 43 | } |
44 | -if (! defined('NOREQUIREHTML')) { |
|
44 | +if (!defined('NOREQUIREHTML')) { |
|
45 | 45 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
46 | 46 | } |
47 | -if (! defined('NOREQUIREAJAX')) { |
|
47 | +if (!defined('NOREQUIREAJAX')) { |
|
48 | 48 | define('NOREQUIREAJAX', '1'); |
49 | 49 | } |
50 | -if (! defined("NOLOGIN")) { |
|
51 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
50 | +if (!defined("NOLOGIN")) { |
|
51 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
52 | 52 | } |
53 | -if (! defined("NOSESSION")) { |
|
53 | +if (!defined("NOSESSION")) { |
|
54 | 54 | define("NOSESSION", '1'); |
55 | 55 | } |
56 | 56 | |
57 | -require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. |
|
57 | +require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; // We force include of main.inc.php instead of master.inc.php even if we are in CLI mode because it contains a lot of security components we want to test. |
|
58 | 58 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php'; |
59 | 59 | require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php'; |
60 | 60 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $result = testSqlAndScriptInject($test, 0); |
229 | 229 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject eee'); |
230 | 230 | |
231 | - $test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer. |
|
232 | - $test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same |
|
231 | + $test = "<IMG SRC=\"jav\tascript:alert('XSS');\">"; // Is locked by some browser like chrome because the default directive no-referrer-when-downgrade is sent when requesting the SRC and then refused because of browser protection on img src load without referrer. |
|
232 | + $test = "<IMG SRC=\"jav
ascript:alert('XSS');\">"; // Same |
|
233 | 233 | |
234 | 234 | $test = '<SCRIPT/XSS SRC="http://xss.rocks/xss.js"></SCRIPT>'; |
235 | 235 | $result = testSqlAndScriptInject($test, 0); |
@@ -263,21 +263,21 @@ discard block |
||
263 | 263 | $result = testSqlAndScriptInject($test, 0); |
264 | 264 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll'); |
265 | 265 | |
266 | - $test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable |
|
266 | + $test = '<a onscrollend=alert(1) style="display:block;overflow:auto;border:1px+dashed;width:500px;height:100px;"><br><br><br><br><br><span+id=x>test</span></a>'; // Add the char %F6 into the variable |
|
267 | 267 | $result = testSqlAndScriptInject($test, 0); |
268 | 268 | //print "test=".$test." result=".$result."\n"; |
269 | 269 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm'); |
270 | 270 | |
271 | 271 | |
272 | 272 | $test = "Text with ' encoded with the numeric html entity converted into text entity ' (like when submitted by CKEditor)"; |
273 | - $result = testSqlAndScriptInject($test, 0); // result must be 0 |
|
273 | + $result = testSqlAndScriptInject($test, 0); // result must be 0 |
|
274 | 274 | $this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm, result should be 0 and is not'); |
275 | 275 | |
276 | 276 | $test = '<a href="j	a	v	asc
ri	pt:(a	l	e	r	t	(document.cookie))">XSS</a>'; |
277 | 277 | $result = testSqlAndScriptInject($test, 0); |
278 | 278 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject nnn, result should be >= 1 and is not'); |
279 | 279 | |
280 | - $test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable |
|
280 | + $test = "/dolibarr/htdocs/index.php/".chr('246')."abc"; // Add the char %F6 into the variable |
|
281 | 281 | $result = testSqlAndScriptInject($test, 2); |
282 | 282 | //print "test=".$test." result=".$result."\n"; |
283 | 283 | $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject with a non valid UTF8 char'); |
@@ -389,21 +389,21 @@ discard block |
||
389 | 389 | { |
390 | 390 | global $conf; |
391 | 391 | |
392 | - $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) |
|
392 | + $genpass1 = getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5) |
|
393 | 393 | print __METHOD__." genpass1=".$genpass1."\n"; |
394 | 394 | $this->assertEquals(strlen($genpass1), 32); |
395 | 395 | |
396 | - $genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) |
|
396 | + $genpass1 = getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5) |
|
397 | 397 | print __METHOD__." genpass1=".$genpass1."\n"; |
398 | 398 | $this->assertEquals(strlen($genpass1), 32); |
399 | 399 | |
400 | 400 | $conf->global->USER_PASSWORD_GENERATED = 'None'; |
401 | - $genpass2 = getRandomPassword(false); // Should return an empty string |
|
401 | + $genpass2 = getRandomPassword(false); // Should return an empty string |
|
402 | 402 | print __METHOD__." genpass2=".$genpass2."\n"; |
403 | 403 | $this->assertEquals($genpass2, ''); |
404 | 404 | |
405 | 405 | $conf->global->USER_PASSWORD_GENERATED = 'Standard'; |
406 | - $genpass3 = getRandomPassword(false); // Should return a password of 12 chars |
|
406 | + $genpass3 = getRandomPassword(false); // Should return a password of 12 chars |
|
407 | 407 | print __METHOD__." genpass3=".$genpass3."\n"; |
408 | 408 | $this->assertEquals(strlen($genpass3), 12); |
409 | 409 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function testRestrictedArea() |
419 | 419 | { |
420 | - global $conf,$user,$langs,$db; |
|
420 | + global $conf, $user, $langs, $db; |
|
421 | 421 | $conf = $this->savconf; |
422 | 422 | $user = $this->savuser; |
423 | 423 | $langs = $this->savlangs; |
@@ -448,40 +448,40 @@ discard block |
||
448 | 448 | $tmpvar = preg_match('/not supported/', $tmp['curl_error_msg']); |
449 | 449 | $this->assertEquals(1, $tmpvar, "Did not find the /not supported/ in getURLContent error message. We should."); |
450 | 450 | |
451 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
452 | - $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow |
|
451 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
452 | + $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow |
|
453 | 453 | print __METHOD__." url=".$url."\n"; |
454 | 454 | $this->assertEquals(301, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 response'); |
455 | 455 | |
456 | - $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
457 | - $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 |
|
456 | + $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page |
|
457 | + $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 |
|
458 | 458 | print __METHOD__." url=".$url."\n"; |
459 | 459 | $this->assertEquals(200, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url 301 with a follow -> 200 but we get '.(empty($tmp['http_code']) ? 0 : $tmp['http_code'])); |
460 | 460 | |
461 | 461 | $url = 'http://localhost'; |
462 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
462 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
463 | 463 | print __METHOD__." url=".$url."\n"; |
464 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL |
|
464 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL |
|
465 | 465 | |
466 | 466 | $url = 'http://127.0.0.1'; |
467 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
467 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
468 | 468 | print __METHOD__." url=".$url."\n"; |
469 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL |
|
469 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL |
|
470 | 470 | |
471 | 471 | $url = 'http://127.0.2.1'; |
472 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
472 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
473 | 473 | print __METHOD__." url=".$url."\n"; |
474 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL |
|
474 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL |
|
475 | 475 | |
476 | 476 | $url = 'https://169.254.0.1'; |
477 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
477 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
478 | 478 | print __METHOD__." url=".$url."\n"; |
479 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL |
|
479 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL |
|
480 | 480 | |
481 | 481 | $url = 'http://[::1]'; |
482 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
482 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
|
483 | 483 | print __METHOD__." url=".$url."\n"; |
484 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL |
|
484 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL |
|
485 | 485 | |
486 | 486 | /*$url = 'localtest.me'; |
487 | 487 | $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL |
@@ -490,9 +490,9 @@ discard block |
||
490 | 490 | */ |
491 | 491 | |
492 | 492 | $url = 'http://192.0.0.192'; |
493 | - $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist |
|
493 | + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL but on an IP in blacklist |
|
494 | 494 | print __METHOD__." url=".$url." tmp['http_code'] = ".(empty($tmp['http_code']) ? 0 : $tmp['http_code'])."\n"; |
495 | - $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist |
|
495 | + $this->assertEquals(400, (empty($tmp['http_code']) ? 0 : $tmp['http_code']), 'Access should be refused and was not'); // Test we receive an error because ip is in blacklist |
|
496 | 496 | |
497 | 497 | return 0; |
498 | 498 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | */ |
505 | 505 | public function testDolSanitizeUrl() |
506 | 506 | { |
507 | - global $conf,$user,$langs,$db; |
|
507 | + global $conf, $user, $langs, $db; |
|
508 | 508 | $conf = $this->savconf; |
509 | 509 | $user = $this->savuser; |
510 | 510 | $langs = $this->savlangs; |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | */ |
531 | 531 | public function testDolSanitizeEmail() |
532 | 532 | { |
533 | - global $conf,$user,$langs,$db; |
|
533 | + global $conf, $user, $langs, $db; |
|
534 | 534 | $conf = $this->savconf; |
535 | 535 | $user = $this->savuser; |
536 | 536 | $langs = $this->savlangs; |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | */ |
561 | 561 | public function testDolSanitizeFileName() |
562 | 562 | { |
563 | - global $conf,$user,$langs,$db; |
|
563 | + global $conf, $user, $langs, $db; |
|
564 | 564 | $conf = $this->savconf; |
565 | 565 | $user = $this->savuser; |
566 | 566 | $langs = $this->savlangs; |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | */ |
584 | 584 | public function testDolEval() |
585 | 585 | { |
586 | - global $conf,$user,$langs,$db; |
|
586 | + global $conf, $user, $langs, $db; |
|
587 | 587 | $conf = $this->savconf; |
588 | 588 | $user = $this->savuser; |
589 | 589 | $langs = $this->savlangs; |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
594 | 594 | include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
595 | 595 | |
596 | - $result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char. |
|
596 | + $result = dol_eval('1==\x01', 1, 0); // Check that we can't make dol_eval on string containing \ char. |
|
597 | 597 | print "result0 = ".$result."\n"; |
598 | 598 | $this->assertStringContainsString('Bad string syntax to evaluate', $result); |
599 | 599 | |
@@ -640,12 +640,12 @@ discard block |
||
640 | 640 | // Now string not allowed |
641 | 641 | |
642 | 642 | $s = '4 <5'; |
643 | - $result = (string) dol_eval($s, 1, 1, '2'); // in mode 2, char < is allowed only if followed by a space |
|
643 | + $result = (string) dol_eval($s, 1, 1, '2'); // in mode 2, char < is allowed only if followed by a space |
|
644 | 644 | print "result = ".$result."\n"; |
645 | 645 | $this->assertStringContainsString('Bad string syntax to evaluate', $result, 'Test 4 <5 - The string was not detected as evil'); |
646 | 646 | |
647 | 647 | $s = '4 < 5'; |
648 | - $result = (string) dol_eval($s, 1, 1, '1'); // in mode 1, char < is always forbidden |
|
648 | + $result = (string) dol_eval($s, 1, 1, '1'); // in mode 1, char < is always forbidden |
|
649 | 649 | print "result = ".$result."\n"; |
650 | 650 | $this->assertStringContainsString('Bad string syntax to evaluate', $result, 'Test 4 < 5 - The string was not detected as evil'); |
651 | 651 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | print "result = ".$result."\n"; |
660 | 660 | $this->assertStringContainsString('Bad string syntax to evaluate', $result, 'The string was not detected as evil'); |
661 | 661 | |
662 | - $result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure |
|
662 | + $result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure |
|
663 | 663 | print "result5 = ".json_encode($result)."\n"; |
664 | 664 | $this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil'); |
665 | 665 | |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | |
702 | 702 | // Must be allowed |
703 | 703 | |
704 | - global $leftmenu; // Used into strings to eval |
|
704 | + global $leftmenu; // Used into strings to eval |
|
705 | 705 | |
706 | 706 | $leftmenu = 'AAA'; |
707 | 707 | $result = dol_eval('$conf->currency && preg_match(\'/^(AAA|BBB)/\',$leftmenu)', 1, 1, '1'); |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | $this->assertFalse($result); |
726 | 726 | |
727 | 727 | $leftmenu = 'XXX'; |
728 | - $conf->global->MAIN_FEATURES_LEVEL = 1; // Force for the case option is -1 |
|
728 | + $conf->global->MAIN_FEATURES_LEVEL = 1; // Force for the case option is -1 |
|
729 | 729 | $string = '(isModEnabled("agenda") || isModEnabled("resource")) && getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 0 && preg_match(\'/^(admintools|all|XXX)/\', $leftmenu)'; |
730 | 730 | $result = dol_eval($string, 1, 1, '1'); |
731 | 731 | print "result17 = ".$result."\n"; |
732 | 732 | $this->assertTrue($result); |
733 | 733 | |
734 | - $result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' |
|
734 | + $result = dol_eval('1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL', 1, 0); // Should return false and not a 'Bad string syntax to evaluate ...' |
|
735 | 735 | print "result18 = ".$result."\n"; |
736 | 736 | $this->assertFalse($result); |
737 | 737 | |
@@ -771,12 +771,12 @@ discard block |
||
771 | 771 | global $conf; |
772 | 772 | |
773 | 773 | // Set options for cleaning data |
774 | - $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
774 | + $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; // disabled, does not work on HTML5 and some libxml versions |
|
775 | 775 | // Enabled option MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY if possible |
776 | 776 | if (extension_loaded('tidy') && class_exists("tidy")) { |
777 | 777 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
778 | 778 | } |
779 | - $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions |
|
779 | + $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0; // disabled, does not work on HTML5 and some libxml versions |
|
780 | 780 | |
781 | 781 | |
782 | 782 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | //$result = dol_escape_htmltag(dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($stringtotest), 1, 1, 1, 0)), 1, 1, 'common', 0, 1); |
789 | 789 | $result = dolPrintHTML($stringtotest); |
790 | 790 | print __METHOD__." result=".$result."\n"; |
791 | - $this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
791 | + $this->assertEquals($stringfixed, $result, 'Error'); // Expected '' because should failed because login 'auto' does not exists |
|
792 | 792 | |
793 | 793 | |
794 | 794 | // For a string that is already HTML (contains HTML tags) with special tags but badly formatted |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | // With cleaning options of HTML TIDY |
858 | 858 | if (extension_loaded('tidy') && class_exists("tidy")) { |
859 | 859 | $stringtotest = "Message<br>with ' and è and ' !"; |
860 | - $stringexpected = "Message<br>\nwith ' and è and ' !"; // The ' is modified into ' because html tidy fix it. |
|
860 | + $stringexpected = "Message<br>\nwith ' and è and ' !"; // The ' is modified into ' because html tidy fix it. |
|
861 | 861 | /* |
862 | 862 | var_dump($stringtotest); |
863 | 863 | var_dump(dol_htmlentitiesbr($stringtotest)); |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | $this->assertEquals('a', $result); |
890 | 890 | |
891 | 891 | // Test that testRealCharforNumericEntities return an emoji utf8 char when code is inside Emoji range |
892 | - $arraytmp = array(0 => '✅', 1 => '9989;'); // Encoded as decimal |
|
892 | + $arraytmp = array(0 => '✅', 1 => '9989;'); // Encoded as decimal |
|
893 | 893 | $result = realCharForNumericEntities($arraytmp); |
894 | 894 | $this->assertEquals('✅', $result); |
895 | 895 | |
896 | - $arraytmp = array(0 => '✅', 1 => 'x2705;'); // Encoded as hexadecimal |
|
896 | + $arraytmp = array(0 => '✅', 1 => 'x2705;'); // Encoded as hexadecimal |
|
897 | 897 | $result = realCharForNumericEntities($arraytmp); |
898 | 898 | $this->assertEquals('✅', $result); |
899 | 899 | |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | // For a string with js and link with restricthtmlallowlinkscript |
964 | 964 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
965 | 965 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; |
966 | - $s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
966 | + $s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
967 | 967 | <link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> |
968 | 968 | <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
969 | 969 | <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>'; |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | // For a string with js and link with restricthtmlallowlinkscript |
977 | 977 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0; |
978 | 978 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1; |
979 | - $s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
979 | + $s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
980 | 980 | <link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> |
981 | 981 | <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
982 | 982 | <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>'; |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | // For a string with js and link with restricthtmlallowlinkscript |
990 | 990 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1; |
991 | 991 | $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0; |
992 | - $s='<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
992 | + $s = '<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans:300,400,700"> |
|
993 | 993 | <link rel="stylesheet" id="font-wasesome-css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> |
994 | 994 | <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
995 | 995 | <script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>'; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | // Includes |
36 | -require_once DOL_DOCUMENT_ROOT . '/admin/tools/ui/class/documentation.class.php'; |
|
36 | +require_once DOL_DOCUMENT_ROOT.'/admin/tools/ui/class/documentation.class.php'; |
|
37 | 37 | |
38 | 38 | // Load documentation translations |
39 | 39 | $langs->load('uxdocumentation'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | // Set view for menu and breadcrumb |
51 | 51 | // Menu must be set in constructor of documentation class |
52 | -$documentation->view = array('Content','Tables'); |
|
52 | +$documentation->view = array('Content', 'Tables'); |
|
53 | 53 | |
54 | 54 | // Output sidebar |
55 | 55 | $documentation->showSidebar(); ?> |