@@ -309,11 +309,11 @@ discard block |
||
| 309 | 309 | $fromtype = GETPOST('fromtype', 'alpha'); |
| 310 | 310 | $emailsendersignature = ''; |
| 311 | 311 | if ($fromtype === 'robot') { |
| 312 | - $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>'; |
|
| 312 | + $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <'.getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>'; |
|
| 313 | 313 | } elseif ($fromtype === 'user') { |
| 314 | 314 | $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>'; |
| 315 | 315 | } elseif ($fromtype === 'company') { |
| 316 | - $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
| 316 | + $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; |
|
| 317 | 317 | } elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { |
| 318 | 318 | $tmp = explode(',', $user->email_aliases); |
| 319 | 319 | $from = trim($tmp[((int) $reg[1] - 1)]); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | // Autocomplete the $sendtobcc |
| 357 | 357 | // $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO... |
| 358 | 358 | if (!empty($autocopy)) { |
| 359 | - $sendtobcc .= (getDolGlobalString($autocopy) ? (($sendtobcc ? ", " : "") . getDolGlobalString($autocopy)) : ''); |
|
| 359 | + $sendtobcc .= (getDolGlobalString($autocopy) ? (($sendtobcc ? ", " : "").getDolGlobalString($autocopy)) : ''); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | $deliveryreceipt = GETPOSTINT('deliveryreceipt') ? 1 : 0; |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | $object->actionmsg = $message; // Long text |
| 428 | 428 | $object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentByTo')...); |
| 429 | 429 | if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { |
| 430 | - $object->actionmsg2 = $subject; // Short text |
|
| 430 | + $object->actionmsg2 = $subject; // Short text |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | $object->trackid = $trackid; |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | // Call of triggers (you should have set $triggersendname to execute trigger. |
| 451 | 451 | if (!empty($triggersendname)) { |
| 452 | - $result = $object->call_trigger($triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable |
|
| 452 | + $result = $object->call_trigger($triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable |
|
| 453 | 453 | if ($result < 0) { |
| 454 | 454 | $error++; |
| 455 | 455 | } |
@@ -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++; |
@@ -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; |
@@ -1729,7 +1729,7 @@ discard block |
||
| 1729 | 1729 | $this->db->begin(); |
| 1730 | 1730 | |
| 1731 | 1731 | // Call triggers |
| 1732 | - if (! $error && ! $notrigger) { |
|
| 1732 | + if (!$error && !$notrigger) { |
|
| 1733 | 1733 | $result = $this->call_trigger('BOOKKEEPING_DELETE', $user); |
| 1734 | 1734 | if ($result < 0) { |
| 1735 | 1735 | $error++; |
@@ -1741,8 +1741,8 @@ discard block |
||
| 1741 | 1741 | $sql = "DELETE"; |
| 1742 | 1742 | $sql .= " FROM ".$this->db->prefix().$this->table_element.$mode; |
| 1743 | 1743 | $sql .= " WHERE piece_num = ".(int) $piecenum; |
| 1744 | - $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
| 1745 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1744 | + $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
| 1745 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1746 | 1746 | $sql .= $sql_filter; |
| 1747 | 1747 | |
| 1748 | 1748 | $resql = $this->db->query($sql); |
@@ -1876,7 +1876,7 @@ discard block |
||
| 1876 | 1876 | } |
| 1877 | 1877 | $sql .= " FROM ".$this->db->prefix().$this->table_element.$mode; |
| 1878 | 1878 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
| 1879 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1879 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1880 | 1880 | |
| 1881 | 1881 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 1882 | 1882 | $result = $this->db->query($sql); |
@@ -1917,7 +1917,7 @@ discard block |
||
| 1917 | 1917 | global $conf; |
| 1918 | 1918 | |
| 1919 | 1919 | $sql = "SELECT MAX(piece_num)+1 as max FROM ".$this->db->prefix().$this->table_element.$mode; |
| 1920 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1920 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1921 | 1921 | |
| 1922 | 1922 | dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG); |
| 1923 | 1923 | |
@@ -1961,7 +1961,7 @@ discard block |
||
| 1961 | 1961 | } |
| 1962 | 1962 | $sql .= " FROM ".$this->db->prefix().$this->table_element.$mode; |
| 1963 | 1963 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
| 1964 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1964 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1965 | 1965 | |
| 1966 | 1966 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 1967 | 1967 | $result = $this->db->query($sql); |
@@ -2026,7 +2026,7 @@ discard block |
||
| 2026 | 2026 | $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; |
| 2027 | 2027 | $sql .= " date_validated as date_validation"; |
| 2028 | 2028 | $sql .= " FROM ".$this->db->prefix().$this->table_element; |
| 2029 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2029 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2030 | 2030 | |
| 2031 | 2031 | dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG); |
| 2032 | 2032 | |
@@ -2104,7 +2104,7 @@ discard block |
||
| 2104 | 2104 | |
| 2105 | 2105 | if (!$error) { |
| 2106 | 2106 | // Delete if there is an empty line |
| 2107 | - $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"; |
|
| 2107 | + $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"; |
|
| 2108 | 2108 | $resql = $this->db->query($sql); |
| 2109 | 2109 | if (!$resql) { |
| 2110 | 2110 | $error++; |
@@ -2122,7 +2122,7 @@ discard block |
||
| 2122 | 2122 | $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; |
| 2123 | 2123 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
| 2124 | 2124 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'"; |
| 2125 | - $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); |
|
| 2125 | + $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); |
|
| 2126 | 2126 | $sql .= $sql_filter; |
| 2127 | 2127 | $resql = $this->db->query($sql); |
| 2128 | 2128 | if (!$resql) { |
@@ -2133,7 +2133,7 @@ discard block |
||
| 2133 | 2133 | } |
| 2134 | 2134 | |
| 2135 | 2135 | if (!$error) { |
| 2136 | - $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
| 2136 | + $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
| 2137 | 2137 | $resql = $this->db->query($sql); |
| 2138 | 2138 | if (!$resql) { |
| 2139 | 2139 | $error++; |
@@ -2143,7 +2143,7 @@ discard block |
||
| 2143 | 2143 | } |
| 2144 | 2144 | } elseif ($direction == 1) { |
| 2145 | 2145 | if (!$error) { |
| 2146 | - $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
| 2146 | + $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
| 2147 | 2147 | $resql = $this->db->query($sql); |
| 2148 | 2148 | if (!$resql) { |
| 2149 | 2149 | $error++; |
@@ -2161,7 +2161,7 @@ discard block |
||
| 2161 | 2161 | $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; |
| 2162 | 2162 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
| 2163 | 2163 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num'; |
| 2164 | - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
| 2164 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
| 2165 | 2165 | $sql .= $sql_filter; |
| 2166 | 2166 | $resql = $this->db->query($sql); |
| 2167 | 2167 | if (!$resql) { |
@@ -2172,7 +2172,7 @@ discard block |
||
| 2172 | 2172 | } |
| 2173 | 2173 | |
| 2174 | 2174 | if (!$error) { |
| 2175 | - $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
| 2175 | + $sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
| 2176 | 2176 | $sql .= $sql_filter; |
| 2177 | 2177 | $resql = $this->db->query($sql); |
| 2178 | 2178 | if (!$resql) { |
@@ -2229,7 +2229,7 @@ discard block |
||
| 2229 | 2229 | $sql .= " AND aa.active = 1"; |
| 2230 | 2230 | $sql .= " INNER JOIN ".$this->db->prefix()."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; |
| 2231 | 2231 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
| 2232 | - $sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2232 | + $sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2233 | 2233 | $sql .= " ORDER BY account_number ASC"; |
| 2234 | 2234 | |
| 2235 | 2235 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
@@ -2293,7 +2293,7 @@ discard block |
||
| 2293 | 2293 | $sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1"; |
| 2294 | 2294 | $sql .= " LEFT JOIN ".$this->db->prefix()."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1"; |
| 2295 | 2295 | $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; |
| 2296 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2296 | + $sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2297 | 2297 | |
| 2298 | 2298 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
| 2299 | 2299 | $resql = $this->db->query($sql); |
@@ -2333,7 +2333,7 @@ discard block |
||
| 2333 | 2333 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
| 2334 | 2334 | $sql .= " AND aa.active = 1"; |
| 2335 | 2335 | $sql .= " LEFT JOIN ".$this->db->prefix()."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; |
| 2336 | - $sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2336 | + $sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2337 | 2337 | |
| 2338 | 2338 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
| 2339 | 2339 | $resql = $this->db->query($sql); |
@@ -2366,7 +2366,7 @@ discard block |
||
| 2366 | 2366 | global $conf; |
| 2367 | 2367 | |
| 2368 | 2368 | $alias = trim($alias); |
| 2369 | - $alias = !empty($alias) && strpos($alias, '.') === false ? $alias . "." : $alias; |
|
| 2369 | + $alias = !empty($alias) && strpos($alias, '.') === false ? $alias."." : $alias; |
|
| 2370 | 2370 | |
| 2371 | 2371 | if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) { |
| 2372 | 2372 | $result = $this->loadFiscalPeriods($force, 'active'); |
@@ -2379,10 +2379,10 @@ discard block |
||
| 2379 | 2379 | $i = 0; |
| 2380 | 2380 | foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) { |
| 2381 | 2381 | $sql_list[$i] = "("; |
| 2382 | - $sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start']) . "' <= ".$this->db->sanitize($alias)."doc_date"; |
|
| 2382 | + $sql_list[$i] .= "'".$this->db->idate($fiscal_period['date_start'])."' <= ".$this->db->sanitize($alias)."doc_date"; |
|
| 2383 | 2383 | if (!empty($fiscal_period['date_end'])) { |
| 2384 | 2384 | $sql_list[$i] .= " AND "; |
| 2385 | - $sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '" . $this->db->idate($fiscal_period['date_end'])."'"; |
|
| 2385 | + $sql_list[$i] .= $this->db->sanitize($alias)."doc_date <= '".$this->db->idate($fiscal_period['date_end'])."'"; |
|
| 2386 | 2386 | } |
| 2387 | 2387 | $sql_list[$i] .= ")"; |
| 2388 | 2388 | $i++; |
@@ -2471,17 +2471,17 @@ discard block |
||
| 2471 | 2471 | // Avoid trunc with dot in accountancy for the compatibility with another accounting software |
| 2472 | 2472 | $accountingLabelOperation = dol_trunc($thirdpartyname, $truncThirdpartyName, 'right', 'UTF-8', 1); |
| 2473 | 2473 | if (!empty($reference)) { |
| 2474 | - $accountingLabelOperation .= ' - '. $reference; |
|
| 2474 | + $accountingLabelOperation .= ' - '.$reference; |
|
| 2475 | 2475 | } |
| 2476 | 2476 | if (!empty($labelaccount)) { |
| 2477 | - $accountingLabelOperation .= ' - '. $labelaccount; |
|
| 2477 | + $accountingLabelOperation .= ' - '.$labelaccount; |
|
| 2478 | 2478 | } |
| 2479 | 2479 | } elseif (getDolGlobalString('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 1) { |
| 2480 | 2480 | $truncThirdpartyName = 32; |
| 2481 | 2481 | // Avoid trunc with dot in accountancy for the compatibility with another accounting software |
| 2482 | 2482 | $accountingLabelOperation = dol_trunc($thirdpartyname, $truncThirdpartyName, 'right', 'UTF-8', 1); |
| 2483 | 2483 | if (!empty($reference)) { |
| 2484 | - $accountingLabelOperation .= ' - '. $reference; |
|
| 2484 | + $accountingLabelOperation .= ' - '.$reference; |
|
| 2485 | 2485 | } |
| 2486 | 2486 | } elseif (getDolGlobalString('ACCOUNTING_LABEL_OPERATION_ON_TRANSFER') == 2) { |
| 2487 | 2487 | $truncThirdpartyName = 64; |
@@ -2551,8 +2551,8 @@ discard block |
||
| 2551 | 2551 | if ($mode == 'active') { |
| 2552 | 2552 | if (!isset($conf->cache['active_fiscal_period_cached']) || $force) { |
| 2553 | 2553 | $sql = "SELECT date_start, date_end"; |
| 2554 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
| 2555 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
| 2554 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
| 2555 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
| 2556 | 2556 | $sql .= " AND statut = 0"; |
| 2557 | 2557 | |
| 2558 | 2558 | $resql = $this->db->query($sql); |
@@ -2574,8 +2574,8 @@ discard block |
||
| 2574 | 2574 | if ($mode == 'closed') { |
| 2575 | 2575 | if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) { |
| 2576 | 2576 | $sql = "SELECT date_start, date_end"; |
| 2577 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
| 2578 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
| 2577 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
| 2578 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
| 2579 | 2579 | $sql .= " AND statut = 1"; |
| 2580 | 2580 | |
| 2581 | 2581 | $resql = $this->db->query($sql); |
@@ -2609,8 +2609,8 @@ discard block |
||
| 2609 | 2609 | $list = array(); |
| 2610 | 2610 | |
| 2611 | 2611 | $sql = "SELECT rowid, label, date_start, date_end, statut"; |
| 2612 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
| 2613 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
| 2612 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
| 2613 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
| 2614 | 2614 | $sql .= $this->db->order('date_start', 'ASC'); |
| 2615 | 2615 | |
| 2616 | 2616 | $resql = $this->db->query($sql); |
@@ -2649,13 +2649,13 @@ discard block |
||
| 2649 | 2649 | |
| 2650 | 2650 | $sql = "SELECT YEAR(b.doc_date) as year"; |
| 2651 | 2651 | for ($i = 1; $i <= 12; $i++) { |
| 2652 | - $sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0") . ") AS month".((int) $i); |
|
| 2652 | + $sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date) = ".((int) $i), "1", "0").") AS month".((int) $i); |
|
| 2653 | 2653 | } |
| 2654 | 2654 | $sql .= ", COUNT(b.rowid) as total"; |
| 2655 | - $sql .= " FROM " . $this->db->prefix() . $this->table_element . " as b"; |
|
| 2656 | - $sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'"; |
|
| 2657 | - $sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'"; |
|
| 2658 | - $sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy |
|
| 2655 | + $sql .= " FROM ".$this->db->prefix().$this->table_element." as b"; |
|
| 2656 | + $sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'"; |
|
| 2657 | + $sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'"; |
|
| 2658 | + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy |
|
| 2659 | 2659 | |
| 2660 | 2660 | // Get count for each month into the fiscal period |
| 2661 | 2661 | if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { |
@@ -2663,7 +2663,7 @@ discard block |
||
| 2663 | 2663 | $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)"; |
| 2664 | 2664 | } else { |
| 2665 | 2665 | // Filter on the unitary flag/date lock on each record |
| 2666 | - $sql .= " AND date_validated IS NULL"; // not locked |
|
| 2666 | + $sql .= " AND date_validated IS NULL"; // not locked |
|
| 2667 | 2667 | } |
| 2668 | 2668 | |
| 2669 | 2669 | $sql .= " GROUP BY YEAR(b.doc_date)"; |
@@ -2684,7 +2684,7 @@ discard block |
||
| 2684 | 2684 | 'total' => (int) $obj->total, |
| 2685 | 2685 | ); |
| 2686 | 2686 | for ($i = 1; $i <= 12; $i++) { |
| 2687 | - $year_list['count'][$i] = (int) $obj->{'month' . $i}; |
|
| 2687 | + $year_list['count'][$i] = (int) $obj->{'month'.$i}; |
|
| 2688 | 2688 | } |
| 2689 | 2689 | |
| 2690 | 2690 | $list[] = $year_list; |
@@ -2712,11 +2712,11 @@ discard block |
||
| 2712 | 2712 | $now = dol_now(); |
| 2713 | 2713 | |
| 2714 | 2714 | // Specify as export : update field date_validated on selected month/year |
| 2715 | - $sql = " UPDATE " . $this->db->prefix() . $this->table_element; |
|
| 2716 | - $sql .= " SET date_validated = '" . $this->db->idate($now) . "'"; |
|
| 2717 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
| 2718 | - $sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
| 2719 | - $sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
| 2715 | + $sql = " UPDATE ".$this->db->prefix().$this->table_element; |
|
| 2716 | + $sql .= " SET date_validated = '".$this->db->idate($now)."'"; |
|
| 2717 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
| 2718 | + $sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'"; |
|
| 2719 | + $sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'"; |
|
| 2720 | 2720 | $sql .= " AND date_validated IS NULL"; |
| 2721 | 2721 | |
| 2722 | 2722 | dol_syslog(__METHOD__, LOG_DEBUG); |
@@ -2749,27 +2749,27 @@ discard block |
||
| 2749 | 2749 | |
| 2750 | 2750 | $pcg_type_filter = array(); |
| 2751 | 2751 | foreach ($accounting_groups_used_for_income_statement as $item) { |
| 2752 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
| 2752 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
| 2753 | 2753 | } |
| 2754 | 2754 | |
| 2755 | 2755 | $sql = 'SELECT'; |
| 2756 | 2756 | $sql .= " t.numero_compte,"; |
| 2757 | 2757 | $sql .= " aa.pcg_type,"; |
| 2758 | 2758 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result"; |
| 2759 | - $sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t'; |
|
| 2760 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
| 2761 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2762 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); |
|
| 2763 | - $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . $this->db->prefix() . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')'; |
|
| 2764 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
| 2765 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
| 2766 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
| 2759 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
|
| 2760 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
| 2761 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2762 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
| 2763 | + $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
|
| 2764 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
| 2765 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
| 2766 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
| 2767 | 2767 | $sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; |
| 2768 | 2768 | |
| 2769 | 2769 | $resql = $this->db->query($sql); |
| 2770 | 2770 | if (!$resql) { |
| 2771 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
| 2772 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
| 2771 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
| 2772 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
| 2773 | 2773 | } else { |
| 2774 | 2774 | while ($obj = $this->db->fetch_object($resql)) { |
| 2775 | 2775 | $income_statement_amount += $obj->accounting_result; |
@@ -2808,7 +2808,7 @@ discard block |
||
| 2808 | 2808 | return -1; |
| 2809 | 2809 | } elseif (empty($fiscal_period->id)) { |
| 2810 | 2810 | $langs->loadLangs(array('errors', 'compta')); |
| 2811 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
| 2811 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
| 2812 | 2812 | return -1; |
| 2813 | 2813 | } |
| 2814 | 2814 | |
@@ -2827,7 +2827,7 @@ discard block |
||
| 2827 | 2827 | return -1; |
| 2828 | 2828 | } elseif (empty($new_fiscal_period->id)) { |
| 2829 | 2829 | $langs->loadLangs(array('errors', 'compta')); |
| 2830 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
| 2830 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
| 2831 | 2831 | return -1; |
| 2832 | 2832 | } |
| 2833 | 2833 | |
@@ -2847,7 +2847,7 @@ discard block |
||
| 2847 | 2847 | $journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL')); |
| 2848 | 2848 | if (empty($journal_id)) { |
| 2849 | 2849 | $langs->loadLangs(array('errors', 'accountancy')); |
| 2850 | - $this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
| 2850 | + $this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
| 2851 | 2851 | $error++; |
| 2852 | 2852 | } |
| 2853 | 2853 | |
@@ -2861,7 +2861,7 @@ discard block |
||
| 2861 | 2861 | $error++; |
| 2862 | 2862 | } elseif ($result == 0) { |
| 2863 | 2863 | $langs->loadLangs(array('errors', 'accountancy')); |
| 2864 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
| 2864 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
| 2865 | 2865 | $error++; |
| 2866 | 2866 | } |
| 2867 | 2867 | } else { |
@@ -2875,7 +2875,7 @@ discard block |
||
| 2875 | 2875 | $pcg_type_filter = array(); |
| 2876 | 2876 | $tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement); |
| 2877 | 2877 | foreach ($tmp as $item) { |
| 2878 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
| 2878 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
| 2879 | 2879 | } |
| 2880 | 2880 | |
| 2881 | 2881 | $sql = 'SELECT'; |
@@ -2885,14 +2885,14 @@ discard block |
||
| 2885 | 2885 | } |
| 2886 | 2886 | $sql .= " aa.pcg_type,"; |
| 2887 | 2887 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance"; |
| 2888 | - $sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t'; |
|
| 2889 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
| 2890 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2891 | - $sql .= " AND aa.entity = ". ((int) $conf->entity); |
|
| 2888 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
|
| 2889 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
| 2890 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2891 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
| 2892 | 2892 | $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.$this->db->prefix().'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
| 2893 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
| 2894 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
| 2895 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
| 2893 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
| 2894 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
| 2895 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
| 2896 | 2896 | $sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; |
| 2897 | 2897 | if ($separate_auxiliary_account) { |
| 2898 | 2898 | $sql .= " , NULLIF(t.subledger_account, '')"; |
@@ -2902,8 +2902,8 @@ discard block |
||
| 2902 | 2902 | |
| 2903 | 2903 | $resql = $this->db->query($sql); |
| 2904 | 2904 | if (!$resql) { |
| 2905 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
| 2906 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
| 2905 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
| 2906 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
| 2907 | 2907 | |
| 2908 | 2908 | $error++; |
| 2909 | 2909 | } else { |
@@ -2932,14 +2932,14 @@ discard block |
||
| 2932 | 2932 | $bookkeeping->subledger_account = $obj->subledger_account; |
| 2933 | 2933 | $sql = 'SELECT'; |
| 2934 | 2934 | $sql .= " subledger_label"; |
| 2935 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 2936 | - $sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'"; |
|
| 2935 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 2936 | + $sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'"; |
|
| 2937 | 2937 | $sql .= " ORDER BY doc_date DESC"; |
| 2938 | 2938 | $sql .= " LIMIT 1"; |
| 2939 | 2939 | $result = $this->db->query($sql); |
| 2940 | 2940 | if (!$result) { |
| 2941 | - $this->errors[] = 'Error: ' . $this->db->lasterror(); |
|
| 2942 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
| 2941 | + $this->errors[] = 'Error: '.$this->db->lasterror(); |
|
| 2942 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
| 2943 | 2943 | $error++; |
| 2944 | 2944 | } |
| 2945 | 2945 | $objtmp = $this->db->fetch_object($result); |
@@ -2995,14 +2995,14 @@ discard block |
||
| 2995 | 2995 | $bookkeeping->subledger_account = $obj->subledger_account; |
| 2996 | 2996 | $sql = 'SELECT'; |
| 2997 | 2997 | $sql .= " subledger_label"; |
| 2998 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 2999 | - $sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'"; |
|
| 2998 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 2999 | + $sql .= " WHERE subledger_account = '".$this->db->escape($obj->subledger_account)."'"; |
|
| 3000 | 3000 | $sql .= " ORDER BY doc_date DESC"; |
| 3001 | 3001 | $sql .= " LIMIT 1"; |
| 3002 | 3002 | $result = $this->db->query($sql); |
| 3003 | 3003 | if (!$result) { |
| 3004 | - $this->errors[] = 'Error: ' . $this->db->lasterror(); |
|
| 3005 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
| 3004 | + $this->errors[] = 'Error: '.$this->db->lasterror(); |
|
| 3005 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
| 3006 | 3006 | $error++; |
| 3007 | 3007 | } |
| 3008 | 3008 | $objtmp = $this->db->fetch_object($result); |
@@ -3074,7 +3074,7 @@ discard block |
||
| 3074 | 3074 | return -1; |
| 3075 | 3075 | } elseif (empty($fiscal_period->id)) { |
| 3076 | 3076 | $langs->loadLangs(array('errors', 'compta')); |
| 3077 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
| 3077 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
| 3078 | 3078 | return -1; |
| 3079 | 3079 | } |
| 3080 | 3080 | |
@@ -3093,7 +3093,7 @@ discard block |
||
| 3093 | 3093 | return -1; |
| 3094 | 3094 | } elseif (empty($new_fiscal_period->id)) { |
| 3095 | 3095 | $langs->loadLangs(array('errors', 'compta')); |
| 3096 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
| 3096 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
| 3097 | 3097 | return -1; |
| 3098 | 3098 | } |
| 3099 | 3099 | |
@@ -3113,7 +3113,7 @@ discard block |
||
| 3113 | 3113 | return -1; |
| 3114 | 3114 | } elseif ($result == 0) { |
| 3115 | 3115 | $langs->loadLangs(array('errors', 'accountancy')); |
| 3116 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal'); |
|
| 3116 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal'); |
|
| 3117 | 3117 | return -1; |
| 3118 | 3118 | } |
| 3119 | 3119 | |
@@ -3121,18 +3121,18 @@ discard block |
||
| 3121 | 3121 | $this->db->begin(); |
| 3122 | 3122 | |
| 3123 | 3123 | $sql = 'SELECT t.rowid'; |
| 3124 | - $sql .= ' FROM ' . $this->db->prefix() . $this->table_element . ' as t'; |
|
| 3125 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 3126 | - $sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'"; |
|
| 3127 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
| 3128 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
| 3129 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
| 3130 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
| 3124 | + $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; |
|
| 3125 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 3126 | + $sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'"; |
|
| 3127 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
| 3128 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
| 3129 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
| 3130 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
| 3131 | 3131 | |
| 3132 | 3132 | $resql = $this->db->query($sql); |
| 3133 | 3133 | if (!$resql) { |
| 3134 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
| 3135 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
| 3134 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
| 3135 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
| 3136 | 3136 | |
| 3137 | 3137 | $error++; |
| 3138 | 3138 | } else { |
@@ -3147,7 +3147,7 @@ discard block |
||
| 3147 | 3147 | break; |
| 3148 | 3148 | } elseif ($result == 0) { |
| 3149 | 3149 | $langs->loadLangs(array('errors', 'accountancy')); |
| 3150 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid; |
|
| 3150 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid; |
|
| 3151 | 3151 | $error++; |
| 3152 | 3152 | break; |
| 3153 | 3153 | } |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $now = dol_now(); |
| 347 | 347 | |
| 348 | 348 | // Clean parameters |
| 349 | - $this->titre = empty($this->titre) ? '' : $this->titre; // deprecated |
|
| 349 | + $this->titre = empty($this->titre) ? '' : $this->titre; // deprecated |
|
| 350 | 350 | $this->title = empty($this->title) ? '' : $this->title; |
| 351 | 351 | $keyforref = $this->table_ref_field; |
| 352 | 352 | $this->ref = $this->$keyforref; |
@@ -410,32 +410,32 @@ discard block |
||
| 410 | 410 | $sql .= ", '".$this->db->idate($now)."'"; |
| 411 | 411 | $sql .= ", ".((int) $this->suspended); |
| 412 | 412 | $sql .= ", '".$this->db->escape($this->libelle)."'"; |
| 413 | - $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
| 414 | - $sql .= ", " .((int) $user->id); |
|
| 415 | - $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
| 416 | - $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
| 417 | - $sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
| 418 | - $sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
| 419 | - $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
| 420 | - $sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
| 421 | - $sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
| 422 | - $sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
| 423 | - $sql .= ", " . (int) $facfourn_src->fk_multicurrency; |
|
| 413 | + $sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
| 414 | + $sql .= ", ".((int) $user->id); |
|
| 415 | + $sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
| 416 | + $sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
| 417 | + $sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
| 418 | + $sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
| 419 | + $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
| 420 | + $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
| 421 | + $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
| 422 | + $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
| 423 | + $sql .= ", ".(int) $facfourn_src->fk_multicurrency; |
|
| 424 | 424 | $sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'"; |
| 425 | - $sql .= ", " . (float) $facfourn_src->multicurrency_tx; |
|
| 426 | - $sql .= ", " . (int) $this->usenewprice; |
|
| 427 | - $sql .= ", " . (int) $this->frequency; |
|
| 425 | + $sql .= ", ".(float) $facfourn_src->multicurrency_tx; |
|
| 426 | + $sql .= ", ".(int) $this->usenewprice; |
|
| 427 | + $sql .= ", ".(int) $this->frequency; |
|
| 428 | 428 | $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; |
| 429 | - $sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
| 430 | - $sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
| 431 | - $sql .= ", " . (int) $this->nb_gen_done; |
|
| 432 | - $sql .= ", " . (int) $this->nb_gen_max; |
|
| 433 | - $sql .= ", " . (int) $this->auto_validate; |
|
| 434 | - $sql .= ", " . (int) $this->generate_pdf; |
|
| 429 | + $sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
| 430 | + $sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
| 431 | + $sql .= ", ".(int) $this->nb_gen_done; |
|
| 432 | + $sql .= ", ".(int) $this->nb_gen_max; |
|
| 433 | + $sql .= ", ".(int) $this->auto_validate; |
|
| 434 | + $sql .= ", ".(int) $this->generate_pdf; |
|
| 435 | 435 | $sql .= ')'; |
| 436 | 436 | |
| 437 | 437 | if ($this->db->query($sql)) { |
| 438 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec'); |
|
| 438 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec'); |
|
| 439 | 439 | |
| 440 | 440 | // Fields used into addline later |
| 441 | 441 | $this->fk_multicurrency = $facfourn_src->fk_multicurrency; |
@@ -574,47 +574,47 @@ discard block |
||
| 574 | 574 | $error = 0; |
| 575 | 575 | |
| 576 | 576 | $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET"; |
| 577 | - $sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ; |
|
| 577 | + $sql .= " titre = '".(!empty($this->title) ? $this->db->escape($this->title) : "")."',"; |
|
| 578 | 578 | $sql .= " subtype=".(isset($this->subtype) ? $this->db->escape($this->subtype) : "null").","; |
| 579 | - $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
| 580 | - $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
|
| 579 | + $sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
| 580 | + $sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).','; |
|
| 581 | 581 | if (!empty($this->socid) && $this->socid > 0) { |
| 582 | - $sql .= " fk_soc = ". ((int) $this->socid). ','; |
|
| 582 | + $sql .= " fk_soc = ".((int) $this->socid).','; |
|
| 583 | 583 | } elseif (!empty($this->fk_soc) && $this->fk_soc > 0) { // For backward compatibility |
| 584 | - $sql .= " fk_soc = ". ((int) $this->fk_soc). ','; |
|
| 584 | + $sql .= " fk_soc = ".((int) $this->fk_soc).','; |
|
| 585 | 585 | } |
| 586 | - $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; |
|
| 587 | - $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; |
|
| 588 | - $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; |
|
| 589 | - $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ','; |
|
| 590 | - $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ','; |
|
| 591 | - $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ','; |
|
| 592 | - $sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ','; |
|
| 593 | - $sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ','; |
|
| 594 | - $sql .= " fk_user_modif = ". ((int) $user->id) . ','; |
|
| 595 | - $sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ','; |
|
| 596 | - $sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ','; |
|
| 597 | - $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ','; |
|
| 598 | - $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ','; |
|
| 599 | - $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ','; |
|
| 600 | - $sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',"; |
|
| 601 | - $sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',"; |
|
| 602 | - $sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ","; |
|
| 603 | - $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ','; |
|
| 604 | - $sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ","; |
|
| 605 | - $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ','; |
|
| 606 | - $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ','; |
|
| 607 | - $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ','; |
|
| 608 | - $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ','; |
|
| 609 | - $sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ','; |
|
| 610 | - $sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ','; |
|
| 611 | - $sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',"; |
|
| 612 | - $sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ','; |
|
| 613 | - $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ','; |
|
| 614 | - $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ','; |
|
| 615 | - $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ','; |
|
| 616 | - $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
| 617 | - $sql .= " WHERE rowid = ". (int) $this->id; |
|
| 586 | + $sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).','; |
|
| 587 | + $sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').","; |
|
| 588 | + $sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').','; |
|
| 589 | + $sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).','; |
|
| 590 | + $sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).','; |
|
| 591 | + $sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).','; |
|
| 592 | + $sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).','; |
|
| 593 | + $sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).','; |
|
| 594 | + $sql .= " fk_user_modif = ".((int) $user->id).','; |
|
| 595 | + $sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').','; |
|
| 596 | + $sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').','; |
|
| 597 | + $sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').','; |
|
| 598 | + $sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').','; |
|
| 599 | + $sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').','; |
|
| 600 | + $sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',"; |
|
| 601 | + $sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',"; |
|
| 602 | + $sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').","; |
|
| 603 | + $sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').','; |
|
| 604 | + $sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').","; |
|
| 605 | + $sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).','; |
|
| 606 | + $sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).','; |
|
| 607 | + $sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).','; |
|
| 608 | + $sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).','; |
|
| 609 | + $sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).','; |
|
| 610 | + $sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).','; |
|
| 611 | + $sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',"; |
|
| 612 | + $sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').','; |
|
| 613 | + $sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').','; |
|
| 614 | + $sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).','; |
|
| 615 | + $sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).','; |
|
| 616 | + $sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
| 617 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 618 | 618 | |
| 619 | 619 | $this->db->begin(); |
| 620 | 620 | |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; |
| 676 | 676 | $sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; |
| 677 | 677 | if ($rowid) { |
| 678 | - $sql .= ' AND f.rowid='. (int) $rowid; |
|
| 678 | + $sql .= ' AND f.rowid='.(int) $rowid; |
|
| 679 | 679 | } elseif ($ref) { |
| 680 | 680 | $sql .= " AND f.titre='".$this->db->escape($ref)."'"; |
| 681 | 681 | } else { |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | $this->id = $obj->rowid; |
| 693 | 693 | $this->titre = $obj->title; |
| 694 | 694 | $this->title = $obj->title; |
| 695 | - $this->subtype = $obj->subtype; |
|
| 695 | + $this->subtype = $obj->subtype; |
|
| 696 | 696 | $this->ref = $obj->title; |
| 697 | 697 | $this->ref_supplier = $obj->ref_supplier; |
| 698 | 698 | $this->entity = $obj->entity; |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
| 810 | 810 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
| 811 | 811 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
| 812 | - $sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id; |
|
| 812 | + $sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id; |
|
| 813 | 813 | $sql .= ' ORDER BY l.rang'; |
| 814 | 814 | |
| 815 | 815 | dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG); |
@@ -850,14 +850,14 @@ discard block |
||
| 850 | 850 | $line->product_type = $objp->product_type; |
| 851 | 851 | $line->date_start = $objp->date_start; |
| 852 | 852 | $line->date_end = $objp->date_end; |
| 853 | - $line->info_bits = $objp->info_bits ; |
|
| 853 | + $line->info_bits = $objp->info_bits; |
|
| 854 | 854 | $line->special_code = $objp->special_code; |
| 855 | 855 | $line->rang = $objp->rang; |
| 856 | 856 | $line->fk_unit = $objp->fk_unit; |
| 857 | 857 | $line->import_key = $objp->import_key; |
| 858 | 858 | $line->fk_user_author = $objp->fk_user_author; |
| 859 | 859 | $line->fk_user_modif = $objp->fk_user_modif; |
| 860 | - $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
|
| 860 | + $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
|
| 861 | 861 | $line->fk_multicurrency = $objp->fk_multicurrency; |
| 862 | 862 | $line->multicurrency_code = $objp->multicurrency_code; |
| 863 | 863 | $line->multicurrency_subprice = $objp->multicurrency_subprice; |
@@ -901,11 +901,11 @@ discard block |
||
| 901 | 901 | $main = MAIN_DB_PREFIX.'facture_fourn_det_rec'; |
| 902 | 902 | $ef = $main."_extrafields"; |
| 903 | 903 | |
| 904 | - $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")"; |
|
| 905 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid; |
|
| 904 | + $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")"; |
|
| 905 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid; |
|
| 906 | 906 | |
| 907 | 907 | if ($this->db->query($sqlef) && $this->db->query($sql)) { |
| 908 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid; |
|
| 908 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid; |
|
| 909 | 909 | dol_syslog($sql); |
| 910 | 910 | if ($this->db->query($sql)) { |
| 911 | 911 | // Delete linked object |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | } |
| 935 | 935 | // End call triggers |
| 936 | 936 | } |
| 937 | - if (! $error) { |
|
| 937 | + if (!$error) { |
|
| 938 | 938 | $this->db->commit(); |
| 939 | 939 | return 1; |
| 940 | 940 | } else { |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | } |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | - $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec ('; |
|
| 1049 | + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec ('; |
|
| 1050 | 1050 | $sql .= 'fk_facture_fourn'; |
| 1051 | 1051 | $sql .= ', fk_product'; |
| 1052 | 1052 | $sql .= ', ref'; |
@@ -1078,46 +1078,46 @@ discard block |
||
| 1078 | 1078 | $sql .= ', fk_user_author'; |
| 1079 | 1079 | $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
| 1080 | 1080 | $sql .= ') VALUES ('; |
| 1081 | - $sql .= ' ' . (int) $facid; // source supplier invoice id |
|
| 1082 | - $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null'); |
|
| 1083 | - $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null'); |
|
| 1084 | - $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null'); |
|
| 1085 | - $sql .= ", '" . $this->db->escape($desc) . "'"; |
|
| 1086 | - $sql .= ', ' . price2num($pu_ht); |
|
| 1087 | - $sql .= ', ' . price2num($pu_ttc); |
|
| 1088 | - $sql .= ', ' . price2num($qty); |
|
| 1089 | - $sql .= ', ' . price2num($remise_percent); |
|
| 1081 | + $sql .= ' '.(int) $facid; // source supplier invoice id |
|
| 1082 | + $sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : 'null'); |
|
| 1083 | + $sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null'); |
|
| 1084 | + $sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null'); |
|
| 1085 | + $sql .= ", '".$this->db->escape($desc)."'"; |
|
| 1086 | + $sql .= ', '.price2num($pu_ht); |
|
| 1087 | + $sql .= ', '.price2num($pu_ttc); |
|
| 1088 | + $sql .= ', '.price2num($qty); |
|
| 1089 | + $sql .= ', '.price2num($remise_percent); |
|
| 1090 | 1090 | $sql .= ', null'; |
| 1091 | - $sql .= ", '" . $this->db->escape($vat_src_code) . "'"; |
|
| 1092 | - $sql .= ', ' . price2num($txtva); |
|
| 1093 | - $sql .= ', ' . price2num($txlocaltax1); |
|
| 1094 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'"; |
|
| 1095 | - $sql .= ', ' . price2num($txlocaltax2); |
|
| 1096 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'"; |
|
| 1097 | - $sql .= ', ' . price2num($total_ht); |
|
| 1098 | - $sql .= ', ' . price2num($total_tva); |
|
| 1099 | - $sql .= ', ' . price2num($total_localtax1); |
|
| 1100 | - $sql .= ', ' . price2num($total_localtax2); |
|
| 1101 | - $sql .= ', ' . price2num($total_ttc); |
|
| 1102 | - $sql .= ', ' . (int) $product_type; |
|
| 1103 | - $sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL'); |
|
| 1104 | - $sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL'); |
|
| 1105 | - $sql .= ', ' . (int) $info_bits; |
|
| 1106 | - $sql .= ', ' . (int) $special_code; |
|
| 1107 | - $sql .= ', ' . (int) $rang; |
|
| 1108 | - $sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL'); |
|
| 1109 | - $sql .= ', ' . (int) $user->id; |
|
| 1110 | - $sql .= ', ' . (int) $this->fk_multicurrency; |
|
| 1111 | - $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
|
| 1112 | - $sql .= ', ' . price2num($pu_ht_devise, 'CU'); |
|
| 1113 | - $sql .= ', ' . price2num($multicurrency_total_ht, 'CT'); |
|
| 1114 | - $sql .= ', ' . price2num($multicurrency_total_tva, 'CT'); |
|
| 1115 | - $sql .= ', ' . price2num($multicurrency_total_ttc, 'CT'); |
|
| 1091 | + $sql .= ", '".$this->db->escape($vat_src_code)."'"; |
|
| 1092 | + $sql .= ', '.price2num($txtva); |
|
| 1093 | + $sql .= ', '.price2num($txlocaltax1); |
|
| 1094 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'"; |
|
| 1095 | + $sql .= ', '.price2num($txlocaltax2); |
|
| 1096 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'"; |
|
| 1097 | + $sql .= ', '.price2num($total_ht); |
|
| 1098 | + $sql .= ', '.price2num($total_tva); |
|
| 1099 | + $sql .= ', '.price2num($total_localtax1); |
|
| 1100 | + $sql .= ', '.price2num($total_localtax2); |
|
| 1101 | + $sql .= ', '.price2num($total_ttc); |
|
| 1102 | + $sql .= ', '.(int) $product_type; |
|
| 1103 | + $sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL'); |
|
| 1104 | + $sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL'); |
|
| 1105 | + $sql .= ', '.(int) $info_bits; |
|
| 1106 | + $sql .= ', '.(int) $special_code; |
|
| 1107 | + $sql .= ', '.(int) $rang; |
|
| 1108 | + $sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL'); |
|
| 1109 | + $sql .= ', '.(int) $user->id; |
|
| 1110 | + $sql .= ', '.(int) $this->fk_multicurrency; |
|
| 1111 | + $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; |
|
| 1112 | + $sql .= ', '.price2num($pu_ht_devise, 'CU'); |
|
| 1113 | + $sql .= ', '.price2num($multicurrency_total_ht, 'CT'); |
|
| 1114 | + $sql .= ', '.price2num($multicurrency_total_tva, 'CT'); |
|
| 1115 | + $sql .= ', '.price2num($multicurrency_total_ttc, 'CT'); |
|
| 1116 | 1116 | $sql .= ')'; |
| 1117 | 1117 | |
| 1118 | - dol_syslog(get_class($this). '::addline', LOG_DEBUG); |
|
| 1118 | + dol_syslog(get_class($this).'::addline', LOG_DEBUG); |
|
| 1119 | 1119 | if ($this->db->query($sql)) { |
| 1120 | - $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec'); |
|
| 1120 | + $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec'); |
|
| 1121 | 1121 | $this->update_price(); |
| 1122 | 1122 | $this->id = $facid; |
| 1123 | 1123 | $this->db->commit(); |
@@ -1168,7 +1168,7 @@ discard block |
||
| 1168 | 1168 | |
| 1169 | 1169 | $facid = $this->id; |
| 1170 | 1170 | |
| 1171 | - dol_syslog(get_class($this). '::updateline facid=' .$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
| 1171 | + dol_syslog(get_class($this).'::updateline facid='.$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
| 1172 | 1172 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
| 1173 | 1173 | |
| 1174 | 1174 | // Check parameters |
@@ -1238,41 +1238,41 @@ discard block |
||
| 1238 | 1238 | $product_type = $product->type; |
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
| 1242 | - $sql .= ' fk_facture_fourn = ' . ((int) $facid); |
|
| 1243 | - $sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
| 1244 | - $sql .= ", ref = '" . $this->db->escape($ref) . "'"; |
|
| 1245 | - $sql .= ", label = '" . $this->db->escape($label) . "'"; |
|
| 1246 | - $sql .= ", description = '" . $this->db->escape($desc) . "'"; |
|
| 1247 | - $sql .= ', pu_ht = ' . price2num($pu_ht); |
|
| 1248 | - $sql .= ', qty = ' . price2num($qty); |
|
| 1249 | - $sql .= ", remise_percent = '" . price2num($remise_percent) . "'"; |
|
| 1250 | - $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'"; |
|
| 1251 | - $sql .= ', tva_tx = ' . price2num($txtva); |
|
| 1252 | - $sql .= ', localtax1_tx = ' . (float) $txlocaltax1; |
|
| 1253 | - $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'"; |
|
| 1254 | - $sql .= ', localtax2_tx = ' . (float) $txlocaltax2; |
|
| 1255 | - $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'"; |
|
| 1256 | - $sql .= ", total_ht = '" . price2num($total_ht) . "'"; |
|
| 1257 | - $sql .= ", total_tva = '" . price2num($total_tva) . "'"; |
|
| 1258 | - $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'"; |
|
| 1259 | - $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'"; |
|
| 1260 | - $sql .= ", total_ttc = '" . price2num($total_ttc) . "'"; |
|
| 1261 | - $sql .= ', product_type = ' . (int) $product_type; |
|
| 1262 | - $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start); |
|
| 1263 | - $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end); |
|
| 1264 | - $sql .= ', info_bits = ' . (int) $info_bits; |
|
| 1265 | - $sql .= ', special_code = ' . (int) $special_code; |
|
| 1266 | - $sql .= ', rang = ' . (int) $rang; |
|
| 1267 | - $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null'); |
|
| 1268 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
| 1241 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
| 1242 | + $sql .= ' fk_facture_fourn = '.((int) $facid); |
|
| 1243 | + $sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
| 1244 | + $sql .= ", ref = '".$this->db->escape($ref)."'"; |
|
| 1245 | + $sql .= ", label = '".$this->db->escape($label)."'"; |
|
| 1246 | + $sql .= ", description = '".$this->db->escape($desc)."'"; |
|
| 1247 | + $sql .= ', pu_ht = '.price2num($pu_ht); |
|
| 1248 | + $sql .= ', qty = '.price2num($qty); |
|
| 1249 | + $sql .= ", remise_percent = '".price2num($remise_percent)."'"; |
|
| 1250 | + $sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'"; |
|
| 1251 | + $sql .= ', tva_tx = '.price2num($txtva); |
|
| 1252 | + $sql .= ', localtax1_tx = '.(float) $txlocaltax1; |
|
| 1253 | + $sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'"; |
|
| 1254 | + $sql .= ', localtax2_tx = '.(float) $txlocaltax2; |
|
| 1255 | + $sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'"; |
|
| 1256 | + $sql .= ", total_ht = '".price2num($total_ht)."'"; |
|
| 1257 | + $sql .= ", total_tva = '".price2num($total_tva)."'"; |
|
| 1258 | + $sql .= ", total_localtax1 = '".price2num($total_localtax1)."'"; |
|
| 1259 | + $sql .= ", total_localtax2 = '".price2num($total_localtax2)."'"; |
|
| 1260 | + $sql .= ", total_ttc = '".price2num($total_ttc)."'"; |
|
| 1261 | + $sql .= ', product_type = '.(int) $product_type; |
|
| 1262 | + $sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start); |
|
| 1263 | + $sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end); |
|
| 1264 | + $sql .= ', info_bits = '.(int) $info_bits; |
|
| 1265 | + $sql .= ', special_code = '.(int) $special_code; |
|
| 1266 | + $sql .= ', rang = '.(int) $rang; |
|
| 1267 | + $sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null'); |
|
| 1268 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
| 1269 | 1269 | $sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise); |
| 1270 | 1270 | $sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht); |
| 1271 | 1271 | $sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva); |
| 1272 | 1272 | $sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc); |
| 1273 | - $sql .= ' WHERE rowid = ' . (int) $rowid; |
|
| 1273 | + $sql .= ' WHERE rowid = '.(int) $rowid; |
|
| 1274 | 1274 | |
| 1275 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
| 1275 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
| 1276 | 1276 | if ($this->db->query($sql)) { |
| 1277 | 1277 | $this->id = $facid; |
| 1278 | 1278 | $this->update_price(); |
@@ -1362,16 +1362,16 @@ discard block |
||
| 1362 | 1362 | $tmparray = dol_getdate($now); |
| 1363 | 1363 | $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day |
| 1364 | 1364 | |
| 1365 | - dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation); |
|
| 1365 | + dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation); |
|
| 1366 | 1366 | |
| 1367 | 1367 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec'; |
| 1368 | 1368 | $sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency |
| 1369 | 1369 | $sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')"; |
| 1370 | 1370 | $sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; |
| 1371 | 1371 | $sql .= ' AND suspended = 0'; |
| 1372 | - $sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here |
|
| 1372 | + $sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here |
|
| 1373 | 1373 | if ($restrictioninvoiceid > 0) { |
| 1374 | - $sql .= ' AND rowid = '. (int) $restrictioninvoiceid; |
|
| 1374 | + $sql .= ' AND rowid = '.(int) $restrictioninvoiceid; |
|
| 1375 | 1375 | } |
| 1376 | 1376 | $sql .= $this->db->order('entity', 'ASC'); |
| 1377 | 1377 | //print $sql;exit; |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | // Set entity context |
| 1412 | 1412 | $conf->entity = $facturerec->entity; |
| 1413 | 1413 | |
| 1414 | - dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity); |
|
| 1414 | + dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity); |
|
| 1415 | 1415 | |
| 1416 | 1416 | $new_fac_fourn = new FactureFournisseur($this->db); |
| 1417 | 1417 | $new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice |
@@ -1419,7 +1419,7 @@ discard block |
||
| 1419 | 1419 | |
| 1420 | 1420 | $new_fac_fourn->type = self::TYPE_STANDARD; |
| 1421 | 1421 | $new_fac_fourn->subtype = $facturerec->subtype; |
| 1422 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
| 1422 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
| 1423 | 1423 | $new_fac_fourn->status = self::STATUS_DRAFT; |
| 1424 | 1424 | $new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. |
| 1425 | 1425 | $new_fac_fourn->socid = $facturerec->socid; |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | $new_fac_fourn->model_pdf = $facturerec->model_pdf; |
| 1429 | 1429 | $new_fac_fourn->fk_project = $facturerec->fk_project; |
| 1430 | 1430 | $new_fac_fourn->label = $facturerec->label; |
| 1431 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
| 1431 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
| 1432 | 1432 | |
| 1433 | 1433 | $invoiceidgenerated = $new_fac_fourn->create($user); |
| 1434 | 1434 | $laststep = "Create invoiceidgenerated $invoiceidgenerated"; |
@@ -1461,9 +1461,9 @@ discard block |
||
| 1461 | 1461 | } |
| 1462 | 1462 | } else { |
| 1463 | 1463 | $error++; |
| 1464 | - $this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n"; |
|
| 1465 | - $this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity; |
|
| 1466 | - dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity); |
|
| 1464 | + $this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n"; |
|
| 1465 | + $this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity; |
|
| 1466 | + dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity); |
|
| 1467 | 1467 | } |
| 1468 | 1468 | |
| 1469 | 1469 | if (!$error && $invoiceidgenerated >= 0) { |
@@ -1472,12 +1472,12 @@ discard block |
||
| 1472 | 1472 | $nextDate = $facturerec->getNextDate(); |
| 1473 | 1473 | $facturerec->date_when = (($nextDate === false) ? null : $nextDate); |
| 1474 | 1474 | $facturerec->update($user); |
| 1475 | - $this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->title); |
|
| 1476 | - dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->title. ' is finished with a success generation'); |
|
| 1475 | + $this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->title); |
|
| 1476 | + dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->title.' is finished with a success generation'); |
|
| 1477 | 1477 | $nb_create++; |
| 1478 | 1478 | $this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->title)."\n"; |
| 1479 | 1479 | } else { |
| 1480 | - $this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id=' .$facturerec->id. ', title=' .$facturerec->title); |
|
| 1480 | + $this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id='.$facturerec->id.', title='.$facturerec->title); |
|
| 1481 | 1481 | } |
| 1482 | 1482 | |
| 1483 | 1483 | $parameters = array( |
@@ -1571,7 +1571,7 @@ discard block |
||
| 1571 | 1571 | } |
| 1572 | 1572 | $result .= $linkend; |
| 1573 | 1573 | global $action; |
| 1574 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1574 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1575 | 1575 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 1576 | 1576 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1577 | 1577 | if ($reshook > 0) { |
@@ -1751,8 +1751,8 @@ discard block |
||
| 1751 | 1751 | $prodids = array(); |
| 1752 | 1752 | |
| 1753 | 1753 | $sql = 'SELECT rowid'; |
| 1754 | - $sql .= ' FROM ' .MAIN_DB_PREFIX. 'product'; |
|
| 1755 | - $sql .= ' WHERE entity IN (' .getEntity('product'). ')'; |
|
| 1754 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'product'; |
|
| 1755 | + $sql .= ' WHERE entity IN ('.getEntity('product').')'; |
|
| 1756 | 1756 | $sql .= $this->db->plimit(100); |
| 1757 | 1757 | |
| 1758 | 1758 | $resql = $this->db->query($sql); |
@@ -1787,11 +1787,11 @@ discard block |
||
| 1787 | 1787 | |
| 1788 | 1788 | if (empty($option) || $option != 'nolines') { |
| 1789 | 1789 | // Lines |
| 1790 | - $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 1790 | + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
| 1791 | 1791 | $xnbp = 0; |
| 1792 | 1792 | while ($xnbp < $nbp) { |
| 1793 | 1793 | $line = new FactureLigne($this->db); |
| 1794 | - $line->desc = $langs->trans('Description'). ' ' .$xnbp; |
|
| 1794 | + $line->desc = $langs->trans('Description').' '.$xnbp; |
|
| 1795 | 1795 | $line->qty = 1; |
| 1796 | 1796 | $line->subprice = 100; |
| 1797 | 1797 | $line->tva_tx = 19.6; |
@@ -1838,7 +1838,7 @@ discard block |
||
| 1838 | 1838 | |
| 1839 | 1839 | // Add a line "offered" |
| 1840 | 1840 | $line = new FactureLigne($this->db); |
| 1841 | - $line->desc = $langs->trans('Description'). ' (offered line)'; |
|
| 1841 | + $line->desc = $langs->trans('Description').' (offered line)'; |
|
| 1842 | 1842 | $line->qty = 1; |
| 1843 | 1843 | $line->subprice = 100; |
| 1844 | 1844 | $line->tva_tx = 19.6; |
@@ -1887,12 +1887,12 @@ discard block |
||
| 1887 | 1887 | public function setFrequencyAndUnit($frequency, $unit) |
| 1888 | 1888 | { |
| 1889 | 1889 | if (!$this->table_element) { |
| 1890 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on object with property table_element not defined', LOG_ERR); |
|
| 1890 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on object with property table_element not defined', LOG_ERR); |
|
| 1891 | 1891 | return -1; |
| 1892 | 1892 | } |
| 1893 | 1893 | |
| 1894 | 1894 | if (!empty($frequency) && empty($unit)) { |
| 1895 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on object with params frequency defined but unit not defined', LOG_ERR); |
|
| 1895 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on object with params frequency defined but unit not defined', LOG_ERR); |
|
| 1896 | 1896 | return -2; |
| 1897 | 1897 | } |
| 1898 | 1898 | |
@@ -1931,11 +1931,11 @@ discard block |
||
| 1931 | 1931 | return -1; |
| 1932 | 1932 | } |
| 1933 | 1933 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 1934 | - $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
| 1934 | + $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
| 1935 | 1935 | if ($increment_nb_gen_done > 0) { |
| 1936 | 1936 | $sql .= ", nb_gen_done = nb_gen_done + 1"; |
| 1937 | 1937 | } |
| 1938 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 1938 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 1939 | 1939 | |
| 1940 | 1940 | dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG); |
| 1941 | 1941 | |
@@ -1969,8 +1969,8 @@ discard block |
||
| 1969 | 1969 | } |
| 1970 | 1970 | |
| 1971 | 1971 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 1972 | - $sql .= " SET nb_gen_max = ". (int) $nb; |
|
| 1973 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 1972 | + $sql .= " SET nb_gen_max = ".(int) $nb; |
|
| 1973 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 1974 | 1974 | |
| 1975 | 1975 | dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG); |
| 1976 | 1976 | |
@@ -1998,7 +1998,7 @@ discard block |
||
| 1998 | 1998 | |
| 1999 | 1999 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 2000 | 2000 | $sql .= " SET auto_validate = ".((int) $validate); |
| 2001 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 2001 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 2002 | 2002 | |
| 2003 | 2003 | dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG); |
| 2004 | 2004 | |
@@ -2025,8 +2025,8 @@ discard block |
||
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | 2027 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 2028 | - $sql .= " SET generate_pdf = ". (int) $validate; |
|
| 2029 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 2028 | + $sql .= " SET generate_pdf = ".(int) $validate; |
|
| 2029 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 2030 | 2030 | |
| 2031 | 2031 | dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG); |
| 2032 | 2032 | |
@@ -2054,7 +2054,7 @@ discard block |
||
| 2054 | 2054 | |
| 2055 | 2055 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 2056 | 2056 | $sql .= " SET modelpdf = '".$this->db->escape($model)."'"; |
| 2057 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
| 2057 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
| 2058 | 2058 | |
| 2059 | 2059 | dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG); |
| 2060 | 2060 | |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | $error = 0; |
| 193 | 193 | $this->db->begin(); |
| 194 | 194 | |
| 195 | - if (! $error) { |
|
| 196 | - if (! $notrigger) { |
|
| 195 | + if (!$error) { |
|
| 196 | + if (!$notrigger) { |
|
| 197 | 197 | // Call triggers |
| 198 | 198 | $result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user); |
| 199 | 199 | if ($result < 0) { |
@@ -203,15 +203,15 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if (! $error) { |
|
| 206 | + if (!$error) { |
|
| 207 | 207 | $result = $this->deleteExtraFields(); |
| 208 | 208 | if ($result < 0) { |
| 209 | 209 | $error++; |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if (! $error) { |
|
| 214 | - $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id; |
|
| 213 | + if (!$error) { |
|
| 214 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id; |
|
| 215 | 215 | |
| 216 | 216 | $res = $this->db->query($sql); |
| 217 | 217 | if ($res === false) { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
| 252 | 252 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
| 253 | 253 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
| 254 | - $sql .= ' WHERE l.rowid = '. (int) $rowid; |
|
| 254 | + $sql .= ' WHERE l.rowid = '.(int) $rowid; |
|
| 255 | 255 | $sql .= ' ORDER BY l.rang'; |
| 256 | 256 | |
| 257 | 257 | dol_syslog('FactureRec::fetch', LOG_DEBUG); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $this->ref_supplier = $objp->ref_supplier; |
| 267 | 267 | $this->label = $objp->label; |
| 268 | 268 | $this->description = $objp->line_desc; |
| 269 | - $this->desc = $objp->line_desc; |
|
| 269 | + $this->desc = $objp->line_desc; |
|
| 270 | 270 | $this->pu_ht = $objp->pu_ht; |
| 271 | 271 | $this->pu_ttc = $objp->pu_ttc; |
| 272 | 272 | $this->qty = $objp->qty; |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $this->rang = $objp->rang; |
| 292 | 292 | $this->fk_unit = $objp->fk_unit; |
| 293 | 293 | $this->import_key = $objp->import_key; |
| 294 | - $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
|
| 294 | + $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
|
| 295 | 295 | $this->fk_user_author = $objp->fk_user_author; |
| 296 | 296 | $this->fk_user_modif = $objp->fk_user_modif; |
| 297 | 297 | $this->fk_multicurrency = $objp->fk_multicurrency; |
@@ -325,44 +325,44 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
| 327 | 327 | |
| 328 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
| 329 | - $sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn; |
|
| 330 | - $sql .= ', fk_parent_line = ' . (int) $this->fk_parent; |
|
| 331 | - $sql .= ', fk_product = ' . (int) $this->fk_product; |
|
| 332 | - $sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL'); |
|
| 333 | - $sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL'); |
|
| 334 | - $sql .= ", description = '" . $this->db->escape($this->desc ? $this->desc : $this->description) . "'"; |
|
| 335 | - $sql .= ', pu_ht = ' . price2num($this->pu_ht); |
|
| 336 | - $sql .= ', pu_ttc = ' . price2num($this->pu_ttc); |
|
| 337 | - $sql .= ', qty = ' . price2num($this->qty); |
|
| 338 | - $sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'"; |
|
| 339 | - $sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except; |
|
| 340 | - $sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'"; |
|
| 341 | - $sql .= ', tva_tx = ' . price2num($this->tva_tx); |
|
| 342 | - $sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx); |
|
| 343 | - $sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'"; |
|
| 344 | - $sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx); |
|
| 345 | - $sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'"; |
|
| 328 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
| 329 | + $sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn; |
|
| 330 | + $sql .= ', fk_parent_line = '.(int) $this->fk_parent; |
|
| 331 | + $sql .= ', fk_product = '.(int) $this->fk_product; |
|
| 332 | + $sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL'); |
|
| 333 | + $sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL'); |
|
| 334 | + $sql .= ", description = '".$this->db->escape($this->desc ? $this->desc : $this->description)."'"; |
|
| 335 | + $sql .= ', pu_ht = '.price2num($this->pu_ht); |
|
| 336 | + $sql .= ', pu_ttc = '.price2num($this->pu_ttc); |
|
| 337 | + $sql .= ', qty = '.price2num($this->qty); |
|
| 338 | + $sql .= ", remise_percent = '".price2num($this->remise_percent)."'"; |
|
| 339 | + $sql .= ', fk_remise_except = '.(int) $this->fk_remise_except; |
|
| 340 | + $sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'"; |
|
| 341 | + $sql .= ', tva_tx = '.price2num($this->tva_tx); |
|
| 342 | + $sql .= ', localtax1_tx = '.price2num($this->localtax1_tx); |
|
| 343 | + $sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'"; |
|
| 344 | + $sql .= ', localtax2_tx = '.price2num($this->localtax2_tx); |
|
| 345 | + $sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'"; |
|
| 346 | 346 | if (empty($this->skip_update_total)) { |
| 347 | - $sql .= ', total_ht = ' . price2num($this->total_ht); |
|
| 348 | - $sql .= ', total_tva = ' . price2num($this->total_tva); |
|
| 349 | - $sql .= ', total_localtax1 = ' . price2num($this->total_localtax1); |
|
| 350 | - $sql .= ', total_localtax2 = ' . price2num($this->total_localtax2); |
|
| 351 | - $sql .= ', total_ttc = ' . price2num($this->total_ttc); |
|
| 347 | + $sql .= ', total_ht = '.price2num($this->total_ht); |
|
| 348 | + $sql .= ', total_tva = '.price2num($this->total_tva); |
|
| 349 | + $sql .= ', total_localtax1 = '.price2num($this->total_localtax1); |
|
| 350 | + $sql .= ', total_localtax2 = '.price2num($this->total_localtax2); |
|
| 351 | + $sql .= ', total_ttc = '.price2num($this->total_ttc); |
|
| 352 | 352 | } |
| 353 | - $sql .= ', product_type = ' . (int) $this->product_type; |
|
| 354 | - $sql .= ', date_start = ' . (int) $this->date_start; |
|
| 355 | - $sql .= ', date_end = ' . (int) $this->date_end; |
|
| 356 | - $sql .= ", info_bits = " . ((int) $this->info_bits); |
|
| 357 | - $sql .= ', special_code =' . (int) $this->special_code; |
|
| 358 | - $sql .= ', rang = ' . (int) $this->rang; |
|
| 359 | - $sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); |
|
| 360 | - $sql .= ', fk_user_modif = ' . (int) $user->id; |
|
| 361 | - $sql .= ' WHERE rowid = ' . (int) $this->id; |
|
| 353 | + $sql .= ', product_type = '.(int) $this->product_type; |
|
| 354 | + $sql .= ', date_start = '.(int) $this->date_start; |
|
| 355 | + $sql .= ', date_end = '.(int) $this->date_end; |
|
| 356 | + $sql .= ", info_bits = ".((int) $this->info_bits); |
|
| 357 | + $sql .= ', special_code ='.(int) $this->special_code; |
|
| 358 | + $sql .= ', rang = '.(int) $this->rang; |
|
| 359 | + $sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); |
|
| 360 | + $sql .= ', fk_user_modif = '.(int) $user->id; |
|
| 361 | + $sql .= ' WHERE rowid = '.(int) $this->id; |
|
| 362 | 362 | |
| 363 | 363 | $this->db->begin(); |
| 364 | 364 | |
| 365 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
| 365 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
| 366 | 366 | $resql = $this->db->query($sql); |
| 367 | 367 | if ($resql) { |
| 368 | 368 | if (!$error) { |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | $head = ''; |
| 240 | 240 | if (getDolGlobalString('MAIN_SIGN_CSS_URL')) { |
| 241 | - $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MAIN_SIGN_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 241 | + $head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('MAIN_SIGN_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n"; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $conf->dol_hide_topmenu = 1; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | if ($source == 'proposal' && getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN')) { |
| 319 | 319 | print '<div class="backimagepublicproposalsign">'; |
| 320 | - print '<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN').'">'; |
|
| 320 | + print '<img id="idPROPOSAL_IMAGE_PUBLIC_INTERFACE" src="'.getDolGlobalString('PROPOSAL_IMAGE_PUBLIC_SIGN').'">'; |
|
| 321 | 321 | print '</div>'; |
| 322 | 322 | } |
| 323 | 323 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | if (preg_match('/^\((.*)\)$/', $conf->global->ONLINE_SIGN_NEWFORM_TEXT, $reg)) { |
| 329 | 329 | $text .= $langs->trans($reg[1])."<br>\n"; |
| 330 | 330 | } else { |
| 331 | - $text .= getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT') . "<br>\n"; |
|
| 331 | + $text .= getDolGlobalString('ONLINE_SIGN_NEWFORM_TEXT')."<br>\n"; |
|
| 332 | 332 | } |
| 333 | 333 | $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n"; |
| 334 | 334 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 424 | 424 | // It seems document has never been generated, or was generated and then deleted. |
| 425 | 425 | // So we try to regenerate it with its default template. |
| 426 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 426 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 427 | 427 | $object->generateDocument($defaulttemplate, $langs); |
| 428 | 428 | } |
| 429 | 429 | |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 495 | 495 | // It seems document has never been generated, or was generated and then deleted. |
| 496 | 496 | // So we try to regenerate it with its default template. |
| 497 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 497 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 498 | 498 | $object->generateDocument($defaulttemplate, $langs); |
| 499 | 499 | } |
| 500 | 500 | |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 546 | 546 | // It seems document has never been generated, or was generated and then deleted. |
| 547 | 547 | // So we try to regenerate it with its default template. |
| 548 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 548 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 549 | 549 | $object->generateDocument($defaulttemplate, $langs); |
| 550 | 550 | } |
| 551 | 551 | |
@@ -569,24 +569,24 @@ discard block |
||
| 569 | 569 | $result = $object->fetch_thirdparty(); |
| 570 | 570 | |
| 571 | 571 | // Proposer |
| 572 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Proposer"); |
|
| 572 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Proposer"); |
|
| 573 | 573 | print '</td><td class="CTableRow2">'; |
| 574 | 574 | print img_picto('', 'company', 'class="pictofixedwidth"'); |
| 575 | - print '<b>' . $creditor . '</b>'; |
|
| 576 | - print '<input type="hidden" name="creditor" value="' . $creditor . '">'; |
|
| 577 | - print '</td></tr>' . "\n"; |
|
| 575 | + print '<b>'.$creditor.'</b>'; |
|
| 576 | + print '<input type="hidden" name="creditor" value="'.$creditor.'">'; |
|
| 577 | + print '</td></tr>'."\n"; |
|
| 578 | 578 | |
| 579 | 579 | // Target |
| 580 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("ThirdParty"); |
|
| 580 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty"); |
|
| 581 | 581 | print '</td><td class="CTableRow2">'; |
| 582 | 582 | print img_picto('', 'company', 'class="pictofixedwidth"'); |
| 583 | - print '<b>' . $object->thirdparty->name . '</b>'; |
|
| 584 | - print '</td></tr>' . "\n"; |
|
| 583 | + print '<b>'.$object->thirdparty->name.'</b>'; |
|
| 584 | + print '</td></tr>'."\n"; |
|
| 585 | 585 | |
| 586 | 586 | // Object |
| 587 | - $text = '<b>' . $langs->trans("Signature" . dol_ucfirst($source) . "Ref", $object->ref) . '</b>'; |
|
| 588 | - print '<tr class="CTableRow2"><td class="CTableRow2">' . $langs->trans("Designation"); |
|
| 589 | - print '</td><td class="CTableRow2">' . $text; |
|
| 587 | + $text = '<b>'.$langs->trans("Signature".dol_ucfirst($source)."Ref", $object->ref).'</b>'; |
|
| 588 | + print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation"); |
|
| 589 | + print '</td><td class="CTableRow2">'.$text; |
|
| 590 | 590 | |
| 591 | 591 | $last_main_doc_file = $object->last_main_doc; |
| 592 | 592 | $diroutput = $conf->societe->multidir_output[$object->thirdparty->entity].'/' |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 650 | 650 | // It seems document has never been generated, or was generated and then deleted. |
| 651 | 651 | // So we try to regenerate it with its default template. |
| 652 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 652 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 653 | 653 | $object->generateDocument($defaulttemplate, $langs); |
| 654 | 654 | } |
| 655 | 655 | $directdownloadlink = $object->getLastMainDocLink('', 0, 0); |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 699 | 699 | // It seems document has never been generated, or was generated and then deleted. |
| 700 | 700 | // So we try to regenerate it with its default template. |
| 701 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 701 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 702 | 702 | $object->generateDocument($defaulttemplate, $langs); |
| 703 | 703 | } |
| 704 | 704 | |
@@ -758,8 +758,8 @@ discard block |
||
| 758 | 758 | print '</div>'; |
| 759 | 759 | |
| 760 | 760 | // Define $urlwithroot |
| 761 | - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
| 762 | - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 761 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
| 762 | + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 763 | 763 | //$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. |
| 764 | 764 | // TODO Replace DOL_URL_ROOT with $urlwithroot ? |
| 765 | 765 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if (getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) { |
| 178 | 178 | print '<div class="clearboth"></div><strong>'.(getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC') : $langs->trans("BookCalSystem")).'</strong>'; |
| 179 | 179 | } |
| 180 | - if (empty($urllogo) && ! getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) { |
|
| 180 | + if (empty($urllogo) && !getDolGlobalString('BOOKCAL_PUBLIC_INTERFACE_TOPIC')) { |
|
| 181 | 181 | print $mysoc->name; |
| 182 | 182 | } |
| 183 | 183 | print '</div>'; |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | |
| 314 | 314 | // Define $urlwithroot |
| 315 | -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
| 316 | -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 315 | +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
| 316 | +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 317 | 317 | //$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. |
| 318 | 318 | // TODO Replace DOL_URL_ROOT with $urlwithroot ? |
| 319 | 319 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * \remarks To run this script as CLI: phpunit filename.php |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | -global $conf,$user,$langs,$db,$mysoc; |
|
| 28 | +global $conf, $user, $langs, $db, $mysoc; |
|
| 29 | 29 | //define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver |
| 30 | 30 | //require_once 'PHPUnit/Autoload.php'; |
| 31 | 31 | require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; |
@@ -33,35 +33,35 @@ discard block |
||
| 33 | 33 | require_once dirname(__FILE__).'/../../htdocs/product/class/product.class.php'; |
| 34 | 34 | require_once dirname(__FILE__).'/CommonClassTest.class.php'; |
| 35 | 35 | |
| 36 | -if (! defined('NOREQUIREUSER')) { |
|
| 36 | +if (!defined('NOREQUIREUSER')) { |
|
| 37 | 37 | define('NOREQUIREUSER', '1'); |
| 38 | 38 | } |
| 39 | -if (! defined('NOREQUIREDB')) { |
|
| 39 | +if (!defined('NOREQUIREDB')) { |
|
| 40 | 40 | define('NOREQUIREDB', '1'); |
| 41 | 41 | } |
| 42 | -if (! defined('NOREQUIRESOC')) { |
|
| 42 | +if (!defined('NOREQUIRESOC')) { |
|
| 43 | 43 | define('NOREQUIRESOC', '1'); |
| 44 | 44 | } |
| 45 | -if (! defined('NOREQUIRETRAN')) { |
|
| 45 | +if (!defined('NOREQUIRETRAN')) { |
|
| 46 | 46 | define('NOREQUIRETRAN', '1'); |
| 47 | 47 | } |
| 48 | -if (! defined('NOCSRFCHECK')) { |
|
| 48 | +if (!defined('NOCSRFCHECK')) { |
|
| 49 | 49 | define('NOCSRFCHECK', '1'); |
| 50 | 50 | } |
| 51 | -if (! defined('NOTOKENRENEWAL')) { |
|
| 51 | +if (!defined('NOTOKENRENEWAL')) { |
|
| 52 | 52 | define('NOTOKENRENEWAL', '1'); |
| 53 | 53 | } |
| 54 | -if (! defined('NOREQUIREMENU')) { |
|
| 54 | +if (!defined('NOREQUIREMENU')) { |
|
| 55 | 55 | define('NOREQUIREMENU', '1'); // If there is no menu to show |
| 56 | 56 | } |
| 57 | -if (! defined('NOREQUIREHTML')) { |
|
| 57 | +if (!defined('NOREQUIREHTML')) { |
|
| 58 | 58 | define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php |
| 59 | 59 | } |
| 60 | -if (! defined('NOREQUIREAJAX')) { |
|
| 60 | +if (!defined('NOREQUIREAJAX')) { |
|
| 61 | 61 | define('NOREQUIREAJAX', '1'); |
| 62 | 62 | } |
| 63 | -if (! defined("NOLOGIN")) { |
|
| 64 | - define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 63 | +if (!defined("NOLOGIN")) { |
|
| 64 | + define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | print "\n".$langs->trans("CurrentTimeZone").' : '.getServerTimeZoneString(); |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public static function setUpBeforeClass(): void |
| 87 | 87 | { |
| 88 | - global $conf,$user,$langs,$db; |
|
| 88 | + global $conf, $user, $langs, $db; |
|
| 89 | 89 | //$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. |
| 90 | 90 | |
| 91 | - if (! function_exists('mb_substr')) { |
|
| 91 | + if (!function_exists('mb_substr')) { |
|
| 92 | 92 | print "\n".__METHOD__." function mb_substr must be enabled.\n"; |
| 93 | 93 | die(1); |
| 94 | 94 | } |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | $sql = forgeSQLFromUniversalSearchCriteria($filter); |
| 257 | 257 | |
| 258 | 258 | if ($db->type == 'mysqli') { |
| 259 | - $this->assertEquals(" AND ((t.fieldstring = 'aaa\'ttt'))", $sql); // with mysql |
|
| 259 | + $this->assertEquals(" AND ((t.fieldstring = 'aaa\'ttt'))", $sql); // with mysql |
|
| 260 | 260 | } else { |
| 261 | - $this->assertEquals(" AND ((t.fieldstring = 'aaa''ttt'))", $sql); // with pgsql |
|
| 261 | + $this->assertEquals(" AND ((t.fieldstring = 'aaa''ttt'))", $sql); // with pgsql |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $filter = "(t.fk_soc:IN:1,2)"; |
@@ -695,13 +695,13 @@ discard block |
||
| 695 | 695 | $input = 'xxx < br>'; |
| 696 | 696 | $after = dol_textishtml($input); |
| 697 | 697 | $this->assertFalse($after); |
| 698 | - $input = 'xxx <[email protected]>'; // <em> is html, <em... is not |
|
| 698 | + $input = 'xxx <[email protected]>'; // <em> is html, <em... is not |
|
| 699 | 699 | $after = dol_textishtml($input); |
| 700 | 700 | $this->assertFalse($after); |
| 701 | 701 | $input = 'xxx <brstyle="ee">'; |
| 702 | 702 | $after = dol_textishtml($input); |
| 703 | 703 | $this->assertFalse($after); |
| 704 | - $input = 'This is a text with html comments <!-- comment -->'; // we suppose this is not enough to be html content |
|
| 704 | + $input = 'This is a text with html comments <!-- comment -->'; // we suppose this is not enough to be html content |
|
| 705 | 705 | $after = dol_textishtml($input); |
| 706 | 706 | $this->assertFalse($after); |
| 707 | 707 | |
@@ -757,17 +757,17 @@ discard block |
||
| 757 | 757 | public function testDolConcat() |
| 758 | 758 | { |
| 759 | 759 | $text1 = "A string 1"; |
| 760 | - $text2 = "A string 2"; // text 1 and 2 are text, concat need only \n |
|
| 760 | + $text2 = "A string 2"; // text 1 and 2 are text, concat need only \n |
|
| 761 | 761 | $after = dol_concatdesc($text1, $text2); |
| 762 | 762 | $this->assertEquals("A string 1\nA string 2", $after); |
| 763 | 763 | |
| 764 | 764 | $text1 = "A<br>string 1"; |
| 765 | - $text2 = "A string 2"; // text 1 is html, concat need <br>\n |
|
| 765 | + $text2 = "A string 2"; // text 1 is html, concat need <br>\n |
|
| 766 | 766 | $after = dol_concatdesc($text1, $text2); |
| 767 | 767 | $this->assertEquals("A<br>string 1<br>\nA string 2", $after); |
| 768 | 768 | |
| 769 | 769 | $text1 = "A string 1"; |
| 770 | - $text2 = "A <b>string</b> 2"; // text 2 is html, concat need <br>\n |
|
| 770 | + $text2 = "A <b>string</b> 2"; // text 2 is html, concat need <br>\n |
|
| 771 | 771 | $after = dol_concatdesc($text1, $text2); |
| 772 | 772 | $this->assertEquals("A string 1<br>\nA <b>string</b> 2", $after); |
| 773 | 773 | |
@@ -869,19 +869,19 @@ discard block |
||
| 869 | 869 | // Text not already HTML |
| 870 | 870 | |
| 871 | 871 | $input = "A string\nwith a é, &, < and >."; |
| 872 | - $after = dol_htmlentitiesbr($input, 0); // Add <br> before \n |
|
| 872 | + $after = dol_htmlentitiesbr($input, 0); // Add <br> before \n |
|
| 873 | 873 | $this->assertEquals("A string<br>\nwith a é, &, < and >.", $after); |
| 874 | 874 | |
| 875 | 875 | $input = "A string\nwith a é, &, < and >."; |
| 876 | - $after = dol_htmlentitiesbr($input, 1); // Replace \n with <br> |
|
| 876 | + $after = dol_htmlentitiesbr($input, 1); // Replace \n with <br> |
|
| 877 | 877 | $this->assertEquals("A string<br>with a é, &, < and >.", $after); |
| 878 | 878 | |
| 879 | - $input = "A string\nwith a é, &, < and >.\n\n"; // With some \n at end that should be cleaned |
|
| 880 | - $after = dol_htmlentitiesbr($input, 0); // Add <br> before \n |
|
| 879 | + $input = "A string\nwith a é, &, < and >.\n\n"; // With some \n at end that should be cleaned |
|
| 880 | + $after = dol_htmlentitiesbr($input, 0); // Add <br> before \n |
|
| 881 | 881 | $this->assertEquals("A string<br>\nwith a é, &, < and >.", $after); |
| 882 | 882 | |
| 883 | - $input = "A string\nwith a é, &, < and >.\n\n"; // With some \n at end that should be cleaned |
|
| 884 | - $after = dol_htmlentitiesbr($input, 1); // Replace \n with <br> |
|
| 883 | + $input = "A string\nwith a é, &, < and >.\n\n"; // With some \n at end that should be cleaned |
|
| 884 | + $after = dol_htmlentitiesbr($input, 1); // Replace \n with <br> |
|
| 885 | 885 | $this->assertEquals("A string<br>with a é, &, < and >.", $after); |
| 886 | 886 | |
| 887 | 887 | // Text already HTML, so &,<,> should not be converted |
@@ -894,11 +894,11 @@ discard block |
||
| 894 | 894 | $after = dol_htmlentitiesbr($input); |
| 895 | 895 | $this->assertEquals("<li>\nA string with a é, &, < and >.</li>\nAnother string", $after); |
| 896 | 896 | |
| 897 | - $input = "A string<br>\nwith a é, &, < and >.<br>"; // With some <br> at end that should be cleaned |
|
| 897 | + $input = "A string<br>\nwith a é, &, < and >.<br>"; // With some <br> at end that should be cleaned |
|
| 898 | 898 | $after = dol_htmlentitiesbr($input); |
| 899 | 899 | $this->assertEquals("A string<br>\nwith a é, &, < and >.", $after); |
| 900 | 900 | |
| 901 | - $input = "<li>\nA string with a é, &, < and >.</li>\nAnother string<br>"; // With some <br> at end that should be cleaned |
|
| 901 | + $input = "<li>\nA string with a é, &, < and >.</li>\nAnother string<br>"; // With some <br> at end that should be cleaned |
|
| 902 | 902 | $after = dol_htmlentitiesbr($input); |
| 903 | 903 | $this->assertEquals("<li>\nA string with a é, &, < and >.</li>\nAnother string", $after); |
| 904 | 904 | |
@@ -1062,43 +1062,43 @@ discard block |
||
| 1062 | 1062 | date_default_timezone_set('UTC'); |
| 1063 | 1063 | |
| 1064 | 1064 | // Check bad hours |
| 1065 | - $result = dol_mktime(25, 0, 0, 1, 1, 1970, 1, 1); // Error (25 hours) |
|
| 1065 | + $result = dol_mktime(25, 0, 0, 1, 1, 1970, 1, 1); // Error (25 hours) |
|
| 1066 | 1066 | print __METHOD__." result=".$result."\n"; |
| 1067 | 1067 | $this->assertEquals('', $result); |
| 1068 | - $result = dol_mktime(2, 61, 0, 1, 1, 1970, 1, 1); // Error (61 minutes) |
|
| 1068 | + $result = dol_mktime(2, 61, 0, 1, 1, 1970, 1, 1); // Error (61 minutes) |
|
| 1069 | 1069 | print __METHOD__." result=".$result."\n"; |
| 1070 | 1070 | $this->assertEquals('', $result); |
| 1071 | - $result = dol_mktime(2, 1, 61, 1, 1, 1970, 1, 1); // Error (61 seconds) |
|
| 1071 | + $result = dol_mktime(2, 1, 61, 1, 1, 1970, 1, 1); // Error (61 seconds) |
|
| 1072 | 1072 | print __METHOD__." result=".$result."\n"; |
| 1073 | 1073 | $this->assertEquals('', $result); |
| 1074 | - $result = dol_mktime(2, 1, 1, 1, 32, 1970, 1, 1); // Error (day 32) |
|
| 1074 | + $result = dol_mktime(2, 1, 1, 1, 32, 1970, 1, 1); // Error (day 32) |
|
| 1075 | 1075 | print __METHOD__." result=".$result."\n"; |
| 1076 | 1076 | $this->assertEquals('', $result); |
| 1077 | - $result = dol_mktime(2, 1, 1, 13, 1, 1970, 1, 1); // Error (month 13) |
|
| 1077 | + $result = dol_mktime(2, 1, 1, 13, 1, 1970, 1, 1); // Error (month 13) |
|
| 1078 | 1078 | print __METHOD__." result=".$result."\n"; |
| 1079 | 1079 | $this->assertEquals('', $result); |
| 1080 | 1080 | |
| 1081 | - $result = dol_mktime(2, 1, 1, 1, 1, 1970, 1); // 1970-01-01 02:01:01 in GMT area -> 7261 |
|
| 1081 | + $result = dol_mktime(2, 1, 1, 1, 1, 1970, 1); // 1970-01-01 02:01:01 in GMT area -> 7261 |
|
| 1082 | 1082 | print __METHOD__." result=".$result."\n"; |
| 1083 | 1083 | $this->assertEquals(7261, $result); |
| 1084 | 1084 | |
| 1085 | - $result = dol_mktime(2, 0, 0, 1, 1, 1970, 0); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT |
|
| 1085 | + $result = dol_mktime(2, 0, 0, 1, 1, 1970, 0); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT |
|
| 1086 | 1086 | print __METHOD__." result=".$result."\n"; |
| 1087 | - $tz = getServerTimeZoneInt('winter'); // +1 in Europe/Paris at this time (this time is winter) |
|
| 1088 | - $this->assertEquals(7200 - ($tz * 3600), $result); // 7200 if we are at greenwich winter, 7200-($tz*3600) at local winter |
|
| 1087 | + $tz = getServerTimeZoneInt('winter'); // +1 in Europe/Paris at this time (this time is winter) |
|
| 1088 | + $this->assertEquals(7200 - ($tz * 3600), $result); // 7200 if we are at greenwich winter, 7200-($tz*3600) at local winter |
|
| 1089 | 1089 | |
| 1090 | 1090 | // Some test for local TZ Europe/Paris |
| 1091 | 1091 | date_default_timezone_set('Europe/Paris'); |
| 1092 | 1092 | |
| 1093 | 1093 | // Check that tz for paris in winter is used |
| 1094 | - $result = dol_mktime(2, 0, 0, 1, 1, 1970, 'server'); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT |
|
| 1094 | + $result = dol_mktime(2, 0, 0, 1, 1, 1970, 'server'); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT |
|
| 1095 | 1095 | print __METHOD__." result=".$result."\n"; |
| 1096 | - $this->assertEquals(3600, $result); // 7200 if we are at greenwich winter, 3600 at Europe/Paris |
|
| 1096 | + $this->assertEquals(3600, $result); // 7200 if we are at greenwich winter, 3600 at Europe/Paris |
|
| 1097 | 1097 | |
| 1098 | 1098 | // Check that daylight saving time is used |
| 1099 | - $result = dol_mktime(2, 0, 0, 6, 1, 2014, 0); // 2014-06-01 02:00:00 = 1401588000-3600(location)-3600(daylight) in local area Europe/Paris = 1401588000 GMT |
|
| 1099 | + $result = dol_mktime(2, 0, 0, 6, 1, 2014, 0); // 2014-06-01 02:00:00 = 1401588000-3600(location)-3600(daylight) in local area Europe/Paris = 1401588000 GMT |
|
| 1100 | 1100 | print __METHOD__." result=".$result."\n"; |
| 1101 | - $this->assertEquals(1401588000 - 3600 - 3600, $result); // 1401588000 are at greenwich summer, 1401588000-3600(location)-3600(daylight) at Europe/Paris summer |
|
| 1101 | + $this->assertEquals(1401588000 - 3600 - 3600, $result); // 1401588000 are at greenwich summer, 1401588000-3600(location)-3600(daylight) at Europe/Paris summer |
|
| 1102 | 1102 | |
| 1103 | 1103 | date_default_timezone_set($savtz); |
| 1104 | 1104 | } |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | */ |
| 1112 | 1112 | public function testDolEscapeJs() |
| 1113 | 1113 | { |
| 1114 | - $input = "x&<b>#</b>,\"'"; // " will be converted into ' |
|
| 1114 | + $input = "x&<b>#</b>,\"'"; // " will be converted into ' |
|
| 1115 | 1115 | $result = dol_escape_js($input); |
| 1116 | 1116 | $this->assertEquals("x&<b>#</b>,\'\'", $result, "Test mode=0"); |
| 1117 | 1117 | |
@@ -1130,27 +1130,27 @@ discard block |
||
| 1130 | 1130 | */ |
| 1131 | 1131 | public function testDolEscapeHtmlTag() |
| 1132 | 1132 | { |
| 1133 | - $input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are removed |
|
| 1133 | + $input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are removed |
|
| 1134 | 1134 | $result = dol_escape_htmltag($input); |
| 1135 | 1135 | $this->assertEquals('x&#,"', $result); |
| 1136 | 1136 | |
| 1137 | - $input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are not removed |
|
| 1137 | + $input = 'x&<b>#</b>,"'; // & and " are converted into html entities, <b> are not removed |
|
| 1138 | 1138 | $result = dol_escape_htmltag($input, 1); |
| 1139 | 1139 | $this->assertEquals('x&<b>#</b>,"', $result); |
| 1140 | 1140 | |
| 1141 | - $input = '<img alt="" src="https://github.githubassets.com/assets/GitHub%20Mark-ea2971cee799.png">'; // & and " are converted into html entities, <b> are not removed |
|
| 1141 | + $input = '<img alt="" src="https://github.githubassets.com/assets/GitHub%20Mark-ea2971cee799.png">'; // & and " are converted into html entities, <b> are not removed |
|
| 1142 | 1142 | $result = dol_escape_htmltag($input, 1, 1, 'common', 0, 1); |
| 1143 | 1143 | $this->assertEquals('<img alt="" src="https://github.githubassets.com/assets/GitHub%20Mark-ea2971cee799.png">', $result); |
| 1144 | 1144 | |
| 1145 | - $input = '<img src="data:image/png;base64, 123/456+789==" style="height: 123px; width:456px">'; // & and " are converted into html entities, <b> are not removed |
|
| 1145 | + $input = '<img src="data:image/png;base64, 123/456+789==" style="height: 123px; width:456px">'; // & and " are converted into html entities, <b> are not removed |
|
| 1146 | 1146 | $result = dol_escape_htmltag($input, 1, 1, 'common'); |
| 1147 | 1147 | $this->assertEquals('<img src="data:image/png;base64, 123/456+789==" style="height: 123px; width:456px">', $result); |
| 1148 | 1148 | |
| 1149 | - $input = '<img src="data:image/png;base64, 123/456+789==" style="height: 123px; width:456px">'; // & and " are converted into html entities, <b> are not removed |
|
| 1149 | + $input = '<img src="data:image/png;base64, 123/456+789==" style="height: 123px; width:456px">'; // & and " are converted into html entities, <b> are not removed |
|
| 1150 | 1150 | $result = dol_escape_htmltag($input, 1); |
| 1151 | 1151 | $this->assertEquals('<img src="data:image/png;base64, 123/456+789==" style="height: 123px; width:456px">', $result); |
| 1152 | 1152 | |
| 1153 | - $input = '<img alt="" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png">'; // & and " are converted into html entities, <b> are not removed |
|
| 1153 | + $input = '<img alt="" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png">'; // & and " are converted into html entities, <b> are not removed |
|
| 1154 | 1154 | $result = dol_escape_htmltag($input, 1, 1, 'common', 0, 1); |
| 1155 | 1155 | $this->assertEquals('<img alt="" src="https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png">', $result); |
| 1156 | 1156 | |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | */ |
| 1176 | 1176 | public function testDolFormatAddress() |
| 1177 | 1177 | { |
| 1178 | - global $conf,$user,$langs,$db; |
|
| 1178 | + global $conf, $user, $langs, $db; |
|
| 1179 | 1179 | $conf = $this->savconf; |
| 1180 | 1180 | $user = $this->savuser; |
| 1181 | 1181 | $langs = $this->savlangs; |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | */ |
| 1214 | 1214 | public function testDolPrintPhone() |
| 1215 | 1215 | { |
| 1216 | - global $conf,$user,$langs,$db; |
|
| 1216 | + global $conf, $user, $langs, $db; |
|
| 1217 | 1217 | $conf = $this->savconf; |
| 1218 | 1218 | $user = $this->savuser; |
| 1219 | 1219 | $langs = $this->savlangs; |
@@ -1292,13 +1292,13 @@ discard block |
||
| 1292 | 1292 | public function verifCondDataProvider(): array |
| 1293 | 1293 | { |
| 1294 | 1294 | return [ |
| 1295 | - 'Test a true comparison' => ['1==1', true,], |
|
| 1296 | - 'Test a false comparison' => ['1==2', false,], |
|
| 1297 | - 'Test that the conf property of a module reports true when enabled' => ['isModEnabled("facture")', true,], |
|
| 1298 | - 'Test that the conf property of a module reports false when disabled' => ['isModEnabled("moduledummy")', false,], |
|
| 1299 | - 'Test that verifConf(0) returns false' => [0, false,], |
|
| 1300 | - 'Test that verifConf("0") returns false' => ["0", false,], |
|
| 1301 | - 'Test that verifConf("") returns false (special case)' => ['', true,], |
|
| 1295 | + 'Test a true comparison' => ['1==1', true, ], |
|
| 1296 | + 'Test a false comparison' => ['1==2', false, ], |
|
| 1297 | + 'Test that the conf property of a module reports true when enabled' => ['isModEnabled("facture")', true, ], |
|
| 1298 | + 'Test that the conf property of a module reports false when disabled' => ['isModEnabled("moduledummy")', false, ], |
|
| 1299 | + 'Test that verifConf(0) returns false' => [0, false, ], |
|
| 1300 | + 'Test that verifConf("0") returns false' => ["0", false, ], |
|
| 1301 | + 'Test that verifConf("") returns false (special case)' => ['', true, ], |
|
| 1302 | 1302 | ]; |
| 1303 | 1303 | } |
| 1304 | 1304 | |
@@ -1328,7 +1328,7 @@ discard block |
||
| 1328 | 1328 | */ |
| 1329 | 1329 | public function testGetDefaultTva() |
| 1330 | 1330 | { |
| 1331 | - global $conf,$user,$langs,$db; |
|
| 1331 | + global $conf, $user, $langs, $db; |
|
| 1332 | 1332 | $this->savconf = $conf; |
| 1333 | 1333 | $this->savuser = $user; |
| 1334 | 1334 | $this->savlangs = $langs; |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | */ |
| 1432 | 1432 | public function testGetDefaultLocalTax() |
| 1433 | 1433 | { |
| 1434 | - global $conf,$user,$langs,$db; |
|
| 1434 | + global $conf, $user, $langs, $db; |
|
| 1435 | 1435 | $this->savconf = $conf; |
| 1436 | 1436 | $this->savuser = $user; |
| 1437 | 1437 | $this->savlangs = $langs; |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | $vat1 = get_default_localtax($companyes, $companyes, 1, 0); |
| 1488 | 1488 | $vat2 = get_default_localtax($companyes, $companyes, 2, 0); |
| 1489 | 1489 | $this->assertEquals($vat1, 5.2); |
| 1490 | - $this->assertStringStartsWith((string) $vat2, '-19:-15:-9'); // Can be -19 (old version) or '-19:-15:-9' (new setup) |
|
| 1490 | + $this->assertStringStartsWith((string) $vat2, '-19:-15:-9'); // Can be -19 (old version) or '-19:-15:-9' (new setup) |
|
| 1491 | 1491 | |
| 1492 | 1492 | // Test RULE ES-IT |
| 1493 | 1493 | $vat1 = get_default_localtax($companyes, $companyit, 1, 0); |
@@ -1675,48 +1675,48 @@ discard block |
||
| 1675 | 1675 | |
| 1676 | 1676 | $conf->global->MAIN_START_WEEK = 0; |
| 1677 | 1677 | |
| 1678 | - $tmp = dol_getdate(24 * 60 * 60 + 1, false, 'UTC'); // 2/1/1970 and 1 second = friday |
|
| 1678 | + $tmp = dol_getdate(24 * 60 * 60 + 1, false, 'UTC'); // 2/1/1970 and 1 second = friday |
|
| 1679 | 1679 | $this->assertEquals(5, $tmp['wday'], 'Bad value of day in week'); |
| 1680 | 1680 | |
| 1681 | 1681 | $conf->global->MAIN_START_WEEK = 1; |
| 1682 | 1682 | |
| 1683 | - $tmp = dol_getdate(1, false, 'UTC'); // 1/1/1970 and 1 second = thirday |
|
| 1683 | + $tmp = dol_getdate(1, false, 'UTC'); // 1/1/1970 and 1 second = thirday |
|
| 1684 | 1684 | $this->assertEquals(4, $tmp['wday'], 'Bad value of day in week'); |
| 1685 | 1685 | |
| 1686 | - $tmp = dol_getdate(24 * 60 * 60 + 1, false, 'UTC'); // 2/1/1970 and 1 second = friday |
|
| 1686 | + $tmp = dol_getdate(24 * 60 * 60 + 1, false, 'UTC'); // 2/1/1970 and 1 second = friday |
|
| 1687 | 1687 | $this->assertEquals(5, $tmp['wday'], 'Bad value of day in week'); |
| 1688 | 1688 | |
| 1689 | - $tmp = dol_getdate(1, false, "Europe/Paris"); // 1/1/1970 and 1 second = thirday |
|
| 1689 | + $tmp = dol_getdate(1, false, "Europe/Paris"); // 1/1/1970 and 1 second = thirday |
|
| 1690 | 1690 | $this->assertEquals(1970, $tmp['year']); |
| 1691 | 1691 | $this->assertEquals(1, $tmp['mon']); |
| 1692 | 1692 | $this->assertEquals(1, $tmp['mday']); |
| 1693 | 1693 | $this->assertEquals(4, $tmp['wday']); |
| 1694 | 1694 | $this->assertEquals(0, $tmp['yday']); |
| 1695 | - $this->assertEquals(1, $tmp['hours']); // We are winter, so we are GMT+1 even during summer |
|
| 1695 | + $this->assertEquals(1, $tmp['hours']); // We are winter, so we are GMT+1 even during summer |
|
| 1696 | 1696 | $this->assertEquals(0, $tmp['minutes']); |
| 1697 | 1697 | $this->assertEquals(1, $tmp['seconds']); |
| 1698 | 1698 | |
| 1699 | - $tmp = dol_getdate(15638401, false, "Europe/Paris"); // 1/7/1970 and 1 second = wednesday |
|
| 1699 | + $tmp = dol_getdate(15638401, false, "Europe/Paris"); // 1/7/1970 and 1 second = wednesday |
|
| 1700 | 1700 | $this->assertEquals(1970, $tmp['year']); |
| 1701 | 1701 | $this->assertEquals(7, $tmp['mon']); |
| 1702 | 1702 | $this->assertEquals(1, $tmp['mday']); |
| 1703 | 1703 | $this->assertEquals(3, $tmp['wday']); |
| 1704 | 1704 | $this->assertEquals(181, $tmp['yday']); |
| 1705 | - $this->assertEquals(1, $tmp['hours']); // There is no daylight in 1970, so we are GMT+1 even during summer |
|
| 1705 | + $this->assertEquals(1, $tmp['hours']); // There is no daylight in 1970, so we are GMT+1 even during summer |
|
| 1706 | 1706 | $this->assertEquals(0, $tmp['minutes']); |
| 1707 | 1707 | $this->assertEquals(1, $tmp['seconds']); |
| 1708 | 1708 | |
| 1709 | - $tmp = dol_getdate(1593561601, false, "Europe/Paris"); // 1/7/2020 and 1 second = wednesday |
|
| 1709 | + $tmp = dol_getdate(1593561601, false, "Europe/Paris"); // 1/7/2020 and 1 second = wednesday |
|
| 1710 | 1710 | $this->assertEquals(2020, $tmp['year']); |
| 1711 | 1711 | $this->assertEquals(7, $tmp['mon']); |
| 1712 | 1712 | $this->assertEquals(1, $tmp['mday']); |
| 1713 | 1713 | $this->assertEquals(3, $tmp['wday']); |
| 1714 | - $this->assertEquals(182, $tmp['yday']); // 182 and not 181, due to the 29th february |
|
| 1715 | - $this->assertEquals(2, $tmp['hours']); // There is a daylight, so we are GMT+2 |
|
| 1714 | + $this->assertEquals(182, $tmp['yday']); // 182 and not 181, due to the 29th february |
|
| 1715 | + $this->assertEquals(2, $tmp['hours']); // There is a daylight, so we are GMT+2 |
|
| 1716 | 1716 | $this->assertEquals(0, $tmp['minutes']); |
| 1717 | 1717 | $this->assertEquals(1, $tmp['seconds']); |
| 1718 | 1718 | |
| 1719 | - $tmp = dol_getdate(1, false, 'UTC'); // 1/1/1970 and 1 second = thirday |
|
| 1719 | + $tmp = dol_getdate(1, false, 'UTC'); // 1/1/1970 and 1 second = thirday |
|
| 1720 | 1720 | $this->assertEquals(1970, $tmp['year']); |
| 1721 | 1721 | $this->assertEquals(1, $tmp['mon']); |
| 1722 | 1722 | $this->assertEquals(1, $tmp['mday']); |
@@ -1727,7 +1727,7 @@ discard block |
||
| 1727 | 1727 | $this->assertEquals(0, $tmp['minutes']); |
| 1728 | 1728 | $this->assertEquals(1, $tmp['seconds']); |
| 1729 | 1729 | |
| 1730 | - $tmp = dol_getdate(15638401, false, 'UTC'); // 1/7/1970 and 1 second = wednesday |
|
| 1730 | + $tmp = dol_getdate(15638401, false, 'UTC'); // 1/7/1970 and 1 second = wednesday |
|
| 1731 | 1731 | $this->assertEquals(1970, $tmp['year']); |
| 1732 | 1732 | $this->assertEquals(7, $tmp['mon']); |
| 1733 | 1733 | $this->assertEquals(1, $tmp['mday']); |
@@ -1738,12 +1738,12 @@ discard block |
||
| 1738 | 1738 | $this->assertEquals(0, $tmp['minutes']); |
| 1739 | 1739 | $this->assertEquals(1, $tmp['seconds']); |
| 1740 | 1740 | |
| 1741 | - $tmp = dol_getdate(1593561601, false, 'UTC'); // 1/7/2020 and 1 second = wednesday |
|
| 1741 | + $tmp = dol_getdate(1593561601, false, 'UTC'); // 1/7/2020 and 1 second = wednesday |
|
| 1742 | 1742 | $this->assertEquals(2020, $tmp['year']); |
| 1743 | 1743 | $this->assertEquals(7, $tmp['mon']); |
| 1744 | 1744 | $this->assertEquals(1, $tmp['mday']); |
| 1745 | 1745 | $this->assertEquals(3, $tmp['wday']); |
| 1746 | - $this->assertEquals(182, $tmp['yday']); // 182 and not 181, due to the 29th february |
|
| 1746 | + $this->assertEquals(182, $tmp['yday']); // 182 and not 181, due to the 29th february |
|
| 1747 | 1747 | // We must disable this because on CI, timezone is may be UTC or something else |
| 1748 | 1748 | //$this->assertEquals(2, $tmp['hours']); // There is a daylight, so we are GMT+2 |
| 1749 | 1749 | $this->assertEquals(0, $tmp['minutes']); |
@@ -1933,16 +1933,16 @@ discard block |
||
| 1933 | 1933 | $s = natural_search("t.field", "'abc def' ghi"); |
| 1934 | 1934 | $this->assertEquals(" AND (t.field LIKE '%abc def%' AND t.field LIKE '%ghi%')", $s); |
| 1935 | 1935 | |
| 1936 | - $s = natural_search("t.field", "abc def,ghi", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1936 | + $s = natural_search("t.field", "abc def,ghi", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1937 | 1937 | $this->assertEquals(" AND (t.field IN ('abc def','ghi'))", $s); |
| 1938 | 1938 | |
| 1939 | - $s = natural_search("t.field", "'ab\'c' def','ghi', 'jkl'", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1939 | + $s = natural_search("t.field", "'ab\'c' def','ghi', 'jkl'", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1940 | 1940 | $this->assertEquals(" AND (t.field IN ('abc def','ghi','jkl'))", $s); |
| 1941 | 1941 | |
| 1942 | - $s = natural_search("t.field", "a,b", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1942 | + $s = natural_search("t.field", "a,b", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1943 | 1943 | $this->assertEquals(" AND (t.field IN ('a','b'))", $s); |
| 1944 | 1944 | |
| 1945 | - $s = natural_search("t.field", "A'@%B", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1945 | + $s = natural_search("t.field", "A'@%B", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1946 | 1946 | $this->assertEquals(" AND (t.field IN ('AB'))", $s); |
| 1947 | 1947 | |
| 1948 | 1948 | /* |
@@ -1954,7 +1954,7 @@ discard block |
||
| 1954 | 1954 | var_dump($s); |
| 1955 | 1955 | */ |
| 1956 | 1956 | |
| 1957 | - $s = natural_search("t.field", "KØB", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1957 | + $s = natural_search("t.field", "KØB", 3); // mode 3 is to provide a list of string separated with coma |
|
| 1958 | 1958 | $this->assertEquals(" AND (t.field IN ('KØB'))", $s); |
| 1959 | 1959 | } |
| 1960 | 1960 | } |