@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | |
191 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
191 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
192 | 192 | /** |
193 | 193 | * Clean sensible object datas |
194 | 194 | * |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | protected function _cleanObjectDatas($object) |
199 | 199 | { |
200 | - // phpcs:enable |
|
200 | + // phpcs:enable |
|
201 | 201 | $object = parent::_cleanObjectDatas($object); |
202 | 202 | |
203 | 203 | unset($object->name); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | // Number of supplier proposals open (expired) |
231 | - if (isModEnabled('supplier_proposal') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('supplier_proposal', 'lire')) { |
|
231 | + if (isModEnabled('supplier_proposal') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('supplier_proposal', 'lire')) { |
|
232 | 232 | $langs->load("supplier_proposal"); |
233 | 233 | $board = new SupplierProposal($db); |
234 | 234 | $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | // Number of sales orders |
240 | - if (isModEnabled('order') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CUSTOMER') && $user->hasRight('commande', 'lire')) { |
|
240 | + if (isModEnabled('order') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CUSTOMER') && $user->hasRight('commande', 'lire')) { |
|
241 | 241 | $board = new Commande($db); |
242 | 242 | // Number of customer orders to be shipped (validated and in progress) |
243 | 243 | $dashboardlines[$board->element . '_toship'] = $board->load_board($user, 'toship'); |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | // Number of suppliers orders |
253 | - if (isModEnabled('supplier_order') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('fournisseur', 'commande', 'lire')) { |
|
253 | + if (isModEnabled('supplier_order') && !getDolGlobalString('MAIN_DISABLE_BLOCK_SUPPLIER') && $user->hasRight('fournisseur', 'commande', 'lire')) { |
|
254 | 254 | $board = new CommandeFournisseur($db); |
255 | 255 | $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
256 | 256 | $dashboardlines[$board->element . '_awaiting'] = $board->load_board($user, 'awaiting'); |
257 | 257 | } |
258 | 258 | |
259 | 259 | // Number of contract / services enabled (delayed) |
260 | - if (isModEnabled('contract') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CONTRACT') && $user->hasRight('contrat', 'lire')) { |
|
260 | + if (isModEnabled('contract') && !getDolGlobalString('MAIN_DISABLE_BLOCK_CONTRACT') && $user->hasRight('contrat', 'lire')) { |
|
261 | 261 | $board = new Contrat($db); |
262 | 262 | $dashboardlines[$board->element . '_inactive'] = $board->load_board($user, "inactive"); |
263 | 263 | // Number of active services (expired) |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | // Number of tickets open |
268 | - if (isModEnabled('ticket') && !getDolGlobalString('MAIN_DISABLE_BLOCK_TICKET') && $user->hasRight('ticket', 'read')) { |
|
268 | + if (isModEnabled('ticket') && !getDolGlobalString('MAIN_DISABLE_BLOCK_TICKET') && $user->hasRight('ticket', 'read')) { |
|
269 | 269 | $board = new Ticket($db); |
270 | 270 | $dashboardlines[$board->element . '_opened'] = $board->load_board($user, "opened"); |
271 | 271 | // Number of active services (expired) |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | // Number of transactions to conciliate |
288 | - if (isModEnabled('bank') && !getDolGlobalString('MAIN_DISABLE_BLOCK_BANK') && $user->hasRight('banque', 'lire') && !$user->socid) { |
|
288 | + if (isModEnabled('bank') && !getDolGlobalString('MAIN_DISABLE_BLOCK_BANK') && $user->hasRight('banque', 'lire') && !$user->socid) { |
|
289 | 289 | $board = new Account($db); |
290 | 290 | $nb = $board->countAccountToReconcile(); // Get nb of account to reconciliate |
291 | 291 | if ($nb > 0) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | |
297 | 297 | // Number of cheque to send |
298 | - if (isModEnabled('bank') && !getDolGlobalString('MAIN_DISABLE_BLOCK_BANK') && $user->hasRight('banque', 'lire') && !$user->socid) { |
|
298 | + if (isModEnabled('bank') && !getDolGlobalString('MAIN_DISABLE_BLOCK_BANK') && $user->hasRight('banque', 'lire') && !$user->socid) { |
|
299 | 299 | if (!getDolGlobalString('BANK_DISABLE_CHECK_DEPOSIT')) { |
300 | 300 | $board = new RemiseCheque($db); |
301 | 301 | $dashboardlines[$board->element] = $board->load_board($user); |
@@ -311,26 +311,26 @@ discard block |
||
311 | 311 | } |
312 | 312 | |
313 | 313 | // Number of foundation members |
314 | - if (isModEnabled('member') && !getDolGlobalString('MAIN_DISABLE_BLOCK_ADHERENT') && $user->hasRight('adherent', 'lire') && !$user->socid) { |
|
314 | + if (isModEnabled('member') && !getDolGlobalString('MAIN_DISABLE_BLOCK_ADHERENT') && $user->hasRight('adherent', 'lire') && !$user->socid) { |
|
315 | 315 | $board = new Adherent($db); |
316 | 316 | $dashboardlines[$board->element . '_shift'] = $board->load_board($user, 'shift'); |
317 | 317 | $dashboardlines[$board->element . '_expired'] = $board->load_board($user, 'expired'); |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Number of expense reports to approve |
321 | - if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_DISABLE_BLOCK_EXPENSEREPORT') && $user->hasRight('expensereport', 'approve')) { |
|
321 | + if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_DISABLE_BLOCK_EXPENSEREPORT') && $user->hasRight('expensereport', 'approve')) { |
|
322 | 322 | $board = new ExpenseReport($db); |
323 | 323 | $dashboardlines[$board->element . '_toapprove'] = $board->load_board($user, 'toapprove'); |
324 | 324 | } |
325 | 325 | |
326 | 326 | // Number of expense reports to pay |
327 | - if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_DISABLE_BLOCK_EXPENSEREPORT') && $user->hasRight('expensereport', 'to_paid')) { |
|
327 | + if (isModEnabled('expensereport') && !getDolGlobalString('MAIN_DISABLE_BLOCK_EXPENSEREPORT') && $user->hasRight('expensereport', 'to_paid')) { |
|
328 | 328 | $board = new ExpenseReport($db); |
329 | 329 | $dashboardlines[$board->element . '_topay'] = $board->load_board($user, 'topay'); |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Number of holidays to approve |
333 | - if (isModEnabled('holiday') && !getDolGlobalString('MAIN_DISABLE_BLOCK_HOLIDAY') && $user->hasRight('holiday', 'approve')) { |
|
333 | + if (isModEnabled('holiday') && !getDolGlobalString('MAIN_DISABLE_BLOCK_HOLIDAY') && $user->hasRight('holiday', 'approve')) { |
|
334 | 334 | $board = new Holiday($db); |
335 | 335 | $dashboardlines[$board->element] = $board->load_board($user); |
336 | 336 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $search_address = GETPOST("search_address", 'alpha'); |
75 | 75 | $search_zip = GETPOST("search_zip", 'alpha'); |
76 | 76 | $search_town = GETPOST("search_town", 'alpha'); |
77 | -$search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state |
|
77 | +$search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state |
|
78 | 78 | $search_country = GETPOST("search_country", 'alpha'); |
79 | 79 | $search_phone = GETPOST("search_phone", 'alpha'); |
80 | 80 | $search_phone_perso = GETPOST("search_phone_perso", 'alpha'); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | $search_filter = GETPOST("search_filter", 'alpha'); |
94 | -$search_status = GETPOST("search_status", 'intcomma'); // status |
|
94 | +$search_status = GETPOST("search_status", 'intcomma'); // status |
|
95 | 95 | $search_datec_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datec_start_month'), GETPOSTINT('search_datec_start_day'), GETPOSTINT('search_datec_start_year')); |
96 | 96 | $search_datec_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datec_end_month'), GETPOSTINT('search_datec_end_day'), GETPOSTINT('search_datec_end_year')); |
97 | 97 | $search_datem_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datem_start_month'), GETPOSTINT('search_datem_start_day'), GETPOSTINT('search_datem_start_year')); |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | // If $val['visible']==0, then we never show the field |
206 | 206 | |
207 | 207 | if (!empty($val['visible'])) { |
208 | - $visible = (int)dol_eval($val['visible'], 1); |
|
208 | + $visible = (int) dol_eval($val['visible'], 1); |
|
209 | 209 | $arrayfields[$tableprefix . '.' . $key] = array( |
210 | 210 | 'label' => $val['label'], |
211 | 211 | 'checked' => (($visible < 0) ? 0 : 1), |
212 | - 'enabled' => (abs($visible) != 3 && (int)dol_eval($val['enabled'], 1)), |
|
212 | + 'enabled' => (abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)), |
|
213 | 213 | 'position' => $val['position'], |
214 | 214 | 'help' => isset($val['help']) ? $val['help'] : '' |
215 | 215 | ); |
216 | 216 | } |
217 | 217 | } |
218 | 218 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
219 | -'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
219 | +'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
220 | 220 | //var_dump($arrayfields);exit; |
221 | 221 | |
222 | 222 | // Security check |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $sqlfields = $sql; // $sql fields to remove for count total |
445 | 445 | |
446 | 446 | // SQL Alias adherent |
447 | -$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d"; // maybe better to use ad (adh) instead of d |
|
447 | +$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d"; // maybe better to use ad (adh) instead of d |
|
448 | 448 | if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { |
449 | 449 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (d.rowid = ef.fk_object)"; |
450 | 450 | } |
@@ -467,9 +467,9 @@ discard block |
||
467 | 467 | $searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_categorie FROM " . MAIN_DB_PREFIX . "categorie_member as ck WHERE d.rowid = ck.fk_member)"; |
468 | 468 | } elseif (intval($searchCategoryContact) > 0) { |
469 | 469 | if ($searchCategoryContactOperator == 0) { |
470 | - $searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM " . MAIN_DB_PREFIX . "categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie = " . ((int)$searchCategoryContact) . ")"; |
|
470 | + $searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM " . MAIN_DB_PREFIX . "categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie = " . ((int) $searchCategoryContact) . ")"; |
|
471 | 471 | } else { |
472 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') . ((int)$searchCategoryContact); |
|
472 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '') . ((int) $searchCategoryContact); |
|
473 | 473 | } |
474 | 474 | } |
475 | 475 | } |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $sql .= natural_search(array_keys($fieldstosearchall), $search_all); |
493 | 493 | } |
494 | 494 | if ($search_type > 0) { |
495 | - $sql .= " AND t.rowid=" . ((int)$search_type); |
|
495 | + $sql .= " AND t.rowid=" . ((int) $search_type); |
|
496 | 496 | } |
497 | 497 | if ($search_filter == 'withoutsubscription') { |
498 | 498 | $sql .= " AND (datefin IS NULL)"; |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | // Output page |
637 | 637 | // -------------------------------------------------------------------- |
638 | 638 | |
639 | -llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
639 | +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll |
|
640 | 640 | |
641 | 641 | $arrayofselected = is_array($toselect) ? $toselect : array(); |
642 | 642 | |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | $param .= '&contextpage=' . urlencode($contextpage); |
657 | 657 | } |
658 | 658 | if ($limit > 0 && $limit != $conf->liste_limit) { |
659 | - $param .= '&limit=' . ((int)$limit); |
|
659 | + $param .= '&limit=' . ((int) $limit); |
|
660 | 660 | } |
661 | 661 | if ($optioncss != '') { |
662 | 662 | $param .= '&optioncss=' . urlencode($optioncss); |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | $param .= "&search_email=" . urlencode($search_email); |
687 | 687 | } |
688 | 688 | if ($search_categ > 0 || $search_categ == -2) { |
689 | - $param .= "&search_categ=" . urlencode((string)($search_categ)); |
|
689 | + $param .= "&search_categ=" . urlencode((string) ($search_categ)); |
|
690 | 690 | } |
691 | 691 | if ($search_company) { |
692 | 692 | $param .= "&search_company=" . urlencode($search_company); |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | } |
833 | 833 | |
834 | 834 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
835 | -$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
835 | +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
836 | 836 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); |
837 | 837 | $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
838 | 838 |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | |
153 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
153 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
154 | 154 | /** |
155 | 155 | * Function to build pdf onto disk |
156 | 156 | * |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
166 | 166 | { |
167 | - // phpcs:enable |
|
167 | + // phpcs:enable |
|
168 | 168 | global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines; |
169 | 169 | |
170 | 170 | dol_syslog("write_file outputlangs->defaultlang=" . (is_object($outputlangs) ? $outputlangs->defaultlang : 'null')); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | if (file_exists($dir)) { |
281 | 281 | // Add pdfgeneration hook |
282 | 282 | if (!is_object($hookmanager)) { |
283 | - $hookmanager = new HookManager($this->db); |
|
283 | + $hookmanager = new HookManager($this->db); |
|
284 | 284 | } |
285 | 285 | $hookmanager->initHooks(array('pdfgeneration')); |
286 | 286 | $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs); |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
827 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
827 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
828 | 828 | /** |
829 | 829 | * Return list of active generation modules |
830 | 830 | * |
@@ -834,11 +834,11 @@ discard block |
||
834 | 834 | */ |
835 | 835 | public static function liste_modeles($db, $maxfilenamelength = 0) |
836 | 836 | { |
837 | - // phpcs:enable |
|
837 | + // phpcs:enable |
|
838 | 838 | return parent::liste_modeles($db, $maxfilenamelength); // TODO: Change the autogenerated stub |
839 | 839 | } |
840 | 840 | |
841 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
841 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
842 | 842 | /** |
843 | 843 | * Show table for lines |
844 | 844 | * |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | } |
900 | 900 | } |
901 | 901 | |
902 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
902 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
903 | 903 | /** |
904 | 904 | * Show top header of page. |
905 | 905 | * |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | */ |
913 | 913 | protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) |
914 | 914 | { |
915 | - // phpcs:enable |
|
915 | + // phpcs:enable |
|
916 | 916 | global $conf, $langs; |
917 | 917 | |
918 | 918 | $ltrdirection = 'L'; |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | return $top_shift; |
1164 | 1164 | } |
1165 | 1165 | |
1166 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
1166 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
1167 | 1167 | /** |
1168 | 1168 | * Show footer of page. Need this->emetteur object |
1169 | 1169 | * |
@@ -1488,7 +1488,7 @@ discard block |
||
1488 | 1488 | return $this->LibStatut($this->status, $mode, $this->date_debut); |
1489 | 1489 | } |
1490 | 1490 | |
1491 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1491 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1492 | 1492 | /** |
1493 | 1493 | * Returns the label of a status |
1494 | 1494 | * |
@@ -1499,7 +1499,7 @@ discard block |
||
1499 | 1499 | */ |
1500 | 1500 | public function LibStatut($status, $mode = 0, $startdate = '') |
1501 | 1501 | { |
1502 | - // phpcs:enable |
|
1502 | + // phpcs:enable |
|
1503 | 1503 | global $langs; |
1504 | 1504 | |
1505 | 1505 | if (empty($this->labelStatus) || empty($this->labelStatusShort)) { |
@@ -2041,7 +2041,7 @@ discard block |
||
2041 | 2041 | } |
2042 | 2042 | |
2043 | 2043 | |
2044 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2044 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2045 | 2045 | /** |
2046 | 2046 | * Return list of people with permission to validate leave requests. |
2047 | 2047 | * Search for permission "approve leave requests" |
@@ -2050,7 +2050,7 @@ discard block |
||
2050 | 2050 | */ |
2051 | 2051 | public function fetch_users_approver_holiday() |
2052 | 2052 | { |
2053 | - // phpcs:enable |
|
2053 | + // phpcs:enable |
|
2054 | 2054 | $users_validator = array(); |
2055 | 2055 | |
2056 | 2056 | $sql = "SELECT DISTINCT ur.fk_user"; |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | } |
2432 | 2432 | } |
2433 | 2433 | |
2434 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2434 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2435 | 2435 | /** |
2436 | 2436 | * Load indicators for dashboard (this->nbtodo and this->nbtodolate) |
2437 | 2437 | * |
@@ -2440,7 +2440,7 @@ discard block |
||
2440 | 2440 | */ |
2441 | 2441 | public function load_board($user) |
2442 | 2442 | { |
2443 | - // phpcs:enable |
|
2443 | + // phpcs:enable |
|
2444 | 2444 | global $conf, $langs; |
2445 | 2445 | |
2446 | 2446 | if ($user->socid) { |
@@ -451,7 +451,7 @@ |
||
451 | 451 | $this->date_fin_gmt = $this->db->jdate($obj->date_fin, 1); |
452 | 452 | $this->halfday = $obj->halfday; |
453 | 453 | $this->status = $obj->status; |
454 | - $this->statut = $obj->status; // deprecated |
|
454 | + $this->statut = $obj->status; // deprecated |
|
455 | 455 | $this->fk_validator = $obj->fk_validator; |
456 | 456 | $this->date_valid = $this->db->jdate($obj->date_valid); |
457 | 457 | $this->fk_user_valid = $obj->fk_user_valid; |
@@ -332,28 +332,28 @@ discard block |
||
332 | 332 | $sql .= ", fk_incoterms, location_incoterms"; |
333 | 333 | $sql .= ") VALUES ("; |
334 | 334 | $sql .= "'(PROV)'"; |
335 | - $sql .= ", " . ((int)$conf->entity); |
|
335 | + $sql .= ", " . ((int) $conf->entity); |
|
336 | 336 | $sql .= ", " . ($this->ref_customer ? "'" . $this->db->escape($this->ref_customer) . "'" : "null"); |
337 | 337 | $sql .= ", " . ($this->ref_ext ? "'" . $this->db->escape($this->ref_ext) . "'" : "null"); |
338 | 338 | $sql .= ", '" . $this->db->idate($now) . "'"; |
339 | - $sql .= ", " . ((int)$user->id); |
|
339 | + $sql .= ", " . ((int) $user->id); |
|
340 | 340 | $sql .= ", " . ($this->date_shipping > 0 ? "'" . $this->db->idate($this->date_shipping) . "'" : "null"); |
341 | 341 | $sql .= ", " . ($this->date_delivery > 0 ? "'" . $this->db->idate($this->date_delivery) . "'" : "null"); |
342 | - $sql .= ", " . ($this->socid > 0 ? ((int)$this->socid) : "null"); |
|
343 | - $sql .= ", " . ($this->fk_project > 0 ? ((int)$this->fk_project) : "null"); |
|
342 | + $sql .= ", " . ($this->socid > 0 ? ((int) $this->socid) : "null"); |
|
343 | + $sql .= ", " . ($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); |
|
344 | 344 | $sql .= ", " . ($this->fk_delivery_address > 0 ? $this->fk_delivery_address : "null"); |
345 | - $sql .= ", " . ($this->shipping_method_id > 0 ? ((int)$this->shipping_method_id) : "null"); |
|
345 | + $sql .= ", " . ($this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : "null"); |
|
346 | 346 | $sql .= ", '" . $this->db->escape($this->tracking_number) . "'"; |
347 | 347 | $sql .= ", " . (is_numeric($this->weight) ? $this->weight : 'NULL'); |
348 | 348 | $sql .= ", " . (is_numeric($this->sizeS) ? $this->sizeS : 'NULL'); // TODO Should use this->trueDepth |
349 | 349 | $sql .= ", " . (is_numeric($this->sizeW) ? $this->sizeW : 'NULL'); // TODO Should use this->trueWidth |
350 | 350 | $sql .= ", " . (is_numeric($this->sizeH) ? $this->sizeH : 'NULL'); // TODO Should use this->trueHeight |
351 | - $sql .= ", " . ($this->weight_units != '' ? (int)$this->weight_units : 'NULL'); |
|
352 | - $sql .= ", " . ($this->size_units != '' ? (int)$this->size_units : 'NULL'); |
|
351 | + $sql .= ", " . ($this->weight_units != '' ? (int) $this->weight_units : 'NULL'); |
|
352 | + $sql .= ", " . ($this->size_units != '' ? (int) $this->size_units : 'NULL'); |
|
353 | 353 | $sql .= ", " . (!empty($this->note_private) ? "'" . $this->db->escape($this->note_private) . "'" : "null"); |
354 | 354 | $sql .= ", " . (!empty($this->note_public) ? "'" . $this->db->escape($this->note_public) . "'" : "null"); |
355 | 355 | $sql .= ", " . (!empty($this->model_pdf) ? "'" . $this->db->escape($this->model_pdf) . "'" : "null"); |
356 | - $sql .= ", " . (int)$this->fk_incoterms; |
|
356 | + $sql .= ", " . (int) $this->fk_incoterms; |
|
357 | 357 | $sql .= ", '" . $this->db->escape($this->location_incoterms) . "'"; |
358 | 358 | $sql .= ")"; |
359 | 359 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | $sql = "UPDATE " . MAIN_DB_PREFIX . "expedition"; |
366 | 366 | $sql .= " SET ref = '(PROV" . $this->id . ")'"; |
367 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
367 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
368 | 368 | |
369 | 369 | dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
370 | 370 | if ($this->db->query($sql)) { |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | $sql .= ", fk_statut = 1"; |
580 | 580 | $sql .= ", date_valid = '" . $this->db->idate($now) . "'"; |
581 | 581 | $sql .= ", fk_user_valid = " . $user->id; |
582 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
582 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
583 | 583 | |
584 | 584 | dol_syslog(get_class($this) . "::valid update expedition", LOG_DEBUG); |
585 | 585 | $resql = $this->db->query($sql); |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | if (preg_match('/^[\(]?PROV/i', $this->ref)) { |
619 | 619 | // Now we rename also files into index |
620 | 620 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'expedition/sending/" . $this->db->escape($this->newref) . "'"; |
621 | - $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'expedition/sending/" . $this->db->escape($this->ref) . "' and entity = " . ((int)$conf->entity); |
|
621 | + $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'expedition/sending/" . $this->db->escape($this->ref) . "' and entity = " . ((int) $conf->entity); |
|
622 | 622 | $resql = $this->db->query($sql); |
623 | 623 | if (!$resql) { |
624 | 624 | $error++; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_shipment_mode as s ON e.fk_shipping_method = s.rowid'; |
708 | 708 | $sql .= " WHERE e.entity IN (" . getEntity('expedition') . ")"; |
709 | 709 | if ($id) { |
710 | - $sql .= " AND e.rowid = " . ((int)$id); |
|
710 | + $sql .= " AND e.rowid = " . ((int) $id); |
|
711 | 711 | } |
712 | 712 | if ($ref) { |
713 | 713 | $sql .= " AND e.ref='" . $this->db->escape($ref) . "'"; |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | if (!empty($this->shipping_method_id)) { |
827 | 827 | $sql = "SELECT em.code, em.tracking"; |
828 | 828 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_shipment_mode as em"; |
829 | - $sql .= " WHERE em.rowid = " . ((int)$this->shipping_method_id); |
|
829 | + $sql .= " WHERE em.rowid = " . ((int) $this->shipping_method_id); |
|
830 | 830 | |
831 | 831 | $resql = $this->db->query($sql); |
832 | 832 | if ($resql) { |
@@ -869,9 +869,9 @@ discard block |
||
869 | 869 | $sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch"; |
870 | 870 | $sql .= " FROM " . MAIN_DB_PREFIX . "expeditiondet as ed, " . MAIN_DB_PREFIX . "commandedet as cd"; |
871 | 871 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = cd.fk_product"; |
872 | - $sql .= " WHERE ed.fk_expedition = " . ((int)$this->id); |
|
872 | + $sql .= " WHERE ed.fk_expedition = " . ((int) $this->id); |
|
873 | 873 | $sql .= " AND ed.fk_elementdet = cd.rowid"; |
874 | - $sql .= " ORDER BY cd.rang, ed.fk_elementdet"; // We need after a break on fk_elementdet but when there is no break on fk_elementdet, cd.rang is same so we can add it as first order criteria. |
|
874 | + $sql .= " ORDER BY cd.rang, ed.fk_elementdet"; // We need after a break on fk_elementdet but when there is no break on fk_elementdet, cd.rang is same so we can add it as first order criteria. |
|
875 | 875 | |
876 | 876 | dol_syslog(get_class($this) . "::fetch_lines", LOG_DEBUG); |
877 | 877 | $resql = $this->db->query($sql); |
@@ -900,13 +900,13 @@ discard block |
||
900 | 900 | |
901 | 901 | |
902 | 902 | if ($originline > 0 && $originline == $obj->fk_elementdet) { |
903 | - '@phan-var-force ExpeditionLigne $line'; // $line from previous loop |
|
903 | + '@phan-var-force ExpeditionLigne $line'; // $line from previous loop |
|
904 | 904 | $line->entrepot_id = 0; // entrepod_id in details_entrepot |
905 | 905 | $line->qty_shipped += $obj->qty_shipped; |
906 | 906 | } else { |
907 | - $line = new ExpeditionLigne($this->db); // new group to start |
|
908 | - $line->entrepot_id = $obj->fk_entrepot; // this is a property of a shipment line |
|
909 | - $line->qty_shipped = $obj->qty_shipped; // this is a property of a shipment line |
|
907 | + $line = new ExpeditionLigne($this->db); // new group to start |
|
908 | + $line->entrepot_id = $obj->fk_entrepot; // this is a property of a shipment line |
|
909 | + $line->qty_shipped = $obj->qty_shipped; // this is a property of a shipment line |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | $detail_entrepot = new stdClass(); |
@@ -1067,13 +1067,13 @@ discard block |
||
1067 | 1067 | $classname = getDolGlobalString('EXPEDITION_ADDON_NUMBER'); |
1068 | 1068 | |
1069 | 1069 | // Include file with class |
1070 | - $dirmodels = array_merge(array('/'), (array)$conf->modules_parts['models']); |
|
1070 | + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
|
1071 | 1071 | |
1072 | 1072 | foreach ($dirmodels as $reldir) { |
1073 | 1073 | $dir = dol_buildpath($reldir . "core/modules/expedition/"); |
1074 | 1074 | |
1075 | 1075 | // Load file with numbering class (if found) |
1076 | - $mybool = ((bool)@include_once $dir . $file) || $mybool; |
|
1076 | + $mybool = ((bool) @include_once $dir . $file) || $mybool; |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | if (!$mybool) { |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | $sql .= " " . MAIN_DB_PREFIX . "expeditiondet as ed"; |
1127 | 1127 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid"; |
1128 | 1128 | $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expedition as e ON ed.fk_expedition = e.rowid"; |
1129 | - $sql .= " WHERE ed.fk_expedition = " . ((int)$this->id); |
|
1129 | + $sql .= " WHERE ed.fk_expedition = " . ((int) $this->id); |
|
1130 | 1130 | $sql .= " AND cd.rowid = ed.fk_elementdet"; |
1131 | 1131 | |
1132 | 1132 | dol_syslog(get_class($this) . "::valid select details", LOG_DEBUG); |
@@ -1395,31 +1395,31 @@ discard block |
||
1395 | 1395 | $this->ref = trim($this->ref); |
1396 | 1396 | } |
1397 | 1397 | if (isset($this->entity)) { |
1398 | - $this->entity = (int)$this->entity; |
|
1398 | + $this->entity = (int) $this->entity; |
|
1399 | 1399 | } |
1400 | 1400 | if (isset($this->ref_customer)) { |
1401 | 1401 | $this->ref_customer = trim($this->ref_customer); |
1402 | 1402 | } |
1403 | 1403 | if (isset($this->socid)) { |
1404 | - $this->socid = (int)$this->socid; |
|
1404 | + $this->socid = (int) $this->socid; |
|
1405 | 1405 | } |
1406 | 1406 | if (isset($this->fk_user_author)) { |
1407 | - $this->fk_user_author = (int)$this->fk_user_author; |
|
1407 | + $this->fk_user_author = (int) $this->fk_user_author; |
|
1408 | 1408 | } |
1409 | 1409 | if (isset($this->fk_user_valid)) { |
1410 | - $this->fk_user_valid = (int)$this->fk_user_valid; |
|
1410 | + $this->fk_user_valid = (int) $this->fk_user_valid; |
|
1411 | 1411 | } |
1412 | 1412 | if (isset($this->fk_delivery_address)) { |
1413 | - $this->fk_delivery_address = (int)$this->fk_delivery_address; |
|
1413 | + $this->fk_delivery_address = (int) $this->fk_delivery_address; |
|
1414 | 1414 | } |
1415 | 1415 | if (isset($this->shipping_method_id)) { |
1416 | - $this->shipping_method_id = (int)$this->shipping_method_id; |
|
1416 | + $this->shipping_method_id = (int) $this->shipping_method_id; |
|
1417 | 1417 | } |
1418 | 1418 | if (isset($this->tracking_number)) { |
1419 | 1419 | $this->tracking_number = trim($this->tracking_number); |
1420 | 1420 | } |
1421 | 1421 | if (isset($this->statut)) { |
1422 | - $this->statut = (int)$this->statut; |
|
1422 | + $this->statut = (int) $this->statut; |
|
1423 | 1423 | } |
1424 | 1424 | if (isset($this->trueDepth)) { |
1425 | 1425 | $this->trueDepth = trim($this->trueDepth); |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | $this->weight_units = trim($this->weight_units); |
1438 | 1438 | } |
1439 | 1439 | if (isset($this->trueWeight)) { |
1440 | - $this->weight = trim((string)$this->trueWeight); |
|
1440 | + $this->weight = trim((string) $this->trueWeight); |
|
1441 | 1441 | } |
1442 | 1442 | if (isset($this->note_private)) { |
1443 | 1443 | $this->note_private = trim($this->note_private); |
@@ -1479,7 +1479,7 @@ discard block |
||
1479 | 1479 | $sql .= " note_public=" . (isset($this->note_public) ? "'" . $this->db->escape($this->note_public) . "'" : "null") . ","; |
1480 | 1480 | $sql .= " model_pdf=" . (isset($this->model_pdf) ? "'" . $this->db->escape($this->model_pdf) . "'" : "null") . ","; |
1481 | 1481 | $sql .= " entity=" . $conf->entity; |
1482 | - $sql .= " WHERE rowid=" . ((int)$this->id); |
|
1482 | + $sql .= " WHERE rowid=" . ((int) $this->id); |
|
1483 | 1483 | |
1484 | 1484 | $this->db->begin(); |
1485 | 1485 | |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | $sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot, ed.rowid as expeditiondet_id"; |
1562 | 1562 | $sql .= " FROM " . MAIN_DB_PREFIX . "commandedet as cd,"; |
1563 | 1563 | $sql .= " " . MAIN_DB_PREFIX . "expeditiondet as ed"; |
1564 | - $sql .= " WHERE ed.fk_expedition = " . ((int)$this->id); |
|
1564 | + $sql .= " WHERE ed.fk_expedition = " . ((int) $this->id); |
|
1565 | 1565 | $sql .= " AND cd.rowid = ed.fk_elementdet"; |
1566 | 1566 | |
1567 | 1567 | dol_syslog(get_class($this) . "::delete select details", LOG_DEBUG); |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | |
1633 | 1633 | if (!$error) { |
1634 | 1634 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "expeditiondet"; |
1635 | - $sql .= " WHERE fk_expedition = " . ((int)$this->id); |
|
1635 | + $sql .= " WHERE fk_expedition = " . ((int) $this->id); |
|
1636 | 1636 | |
1637 | 1637 | if ($this->db->query($sql)) { |
1638 | 1638 | // Delete linked object |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | // No delete expedition |
1645 | 1645 | if (!$error) { |
1646 | 1646 | $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "expedition"; |
1647 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
1647 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
1648 | 1648 | |
1649 | 1649 | if ($this->db->query($sql)) { |
1650 | 1650 | if (!empty($this->origin) && $this->origin_id > 0) { |
@@ -1797,7 +1797,7 @@ discard block |
||
1797 | 1797 | $sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot, ed.rowid as expeditiondet_id"; |
1798 | 1798 | $sql .= " FROM " . MAIN_DB_PREFIX . "commandedet as cd,"; |
1799 | 1799 | $sql .= " " . MAIN_DB_PREFIX . "expeditiondet as ed"; |
1800 | - $sql .= " WHERE ed.fk_expedition = " . ((int)$this->id); |
|
1800 | + $sql .= " WHERE ed.fk_expedition = " . ((int) $this->id); |
|
1801 | 1801 | $sql .= " AND cd.rowid = ed.fk_elementdet"; |
1802 | 1802 | |
1803 | 1803 | dol_syslog(get_class($this) . "::delete select details", LOG_DEBUG); |
@@ -1861,10 +1861,10 @@ discard block |
||
1861 | 1861 | if (!$error) { |
1862 | 1862 | $main = MAIN_DB_PREFIX . 'expeditiondet'; |
1863 | 1863 | $ef = $main . "_extrafields"; |
1864 | - $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = " . ((int)$this->id) . ")"; |
|
1864 | + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = " . ((int) $this->id) . ")"; |
|
1865 | 1865 | |
1866 | 1866 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "expeditiondet"; |
1867 | - $sql .= " WHERE fk_expedition = " . ((int)$this->id); |
|
1867 | + $sql .= " WHERE fk_expedition = " . ((int) $this->id); |
|
1868 | 1868 | |
1869 | 1869 | if ($this->db->query($sqlef) && $this->db->query($sql)) { |
1870 | 1870 | // Delete linked object |
@@ -1881,7 +1881,7 @@ discard block |
||
1881 | 1881 | |
1882 | 1882 | if (!$error) { |
1883 | 1883 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "expedition"; |
1884 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
1884 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
1885 | 1885 | |
1886 | 1886 | if ($this->db->query($sql)) { |
1887 | 1887 | if (!empty($this->origin) && $this->origin_id > 0) { |
@@ -1900,8 +1900,8 @@ discard block |
||
1900 | 1900 | $this->db->commit(); |
1901 | 1901 | |
1902 | 1902 | // Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive |
1903 | - $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
1904 | - $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
1903 | + $this->deleteEcmFiles(0); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
1904 | + $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive |
|
1905 | 1905 | |
1906 | 1906 | // We delete PDFs |
1907 | 1907 | $ref = dol_sanitizeFileName($this->ref); |
@@ -2237,7 +2237,7 @@ discard block |
||
2237 | 2237 | if ($user->hasRight('expedition', 'creer')) { |
2238 | 2238 | $sql = "UPDATE " . MAIN_DB_PREFIX . "expedition"; |
2239 | 2239 | $sql .= " SET date_delivery = " . ($delivery_date ? "'" . $this->db->idate($delivery_date) . "'" : 'null'); |
2240 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2240 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2241 | 2241 | |
2242 | 2242 | dol_syslog(get_class($this) . "::setDeliveryDate", LOG_DEBUG); |
2243 | 2243 | $resql = $this->db->query($sql); |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | $sql = "SELECT em.rowid, em.code, em.libelle as label, em.description, em.tracking, em.active"; |
2296 | 2296 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_shipment_mode as em"; |
2297 | 2297 | if (!empty($id)) { |
2298 | - $sql .= " WHERE em.rowid=" . ((int)$id); |
|
2298 | + $sql .= " WHERE em.rowid=" . ((int) $id); |
|
2299 | 2299 | } |
2300 | 2300 | |
2301 | 2301 | $resql = $this->db->query($sql); |
@@ -2332,7 +2332,7 @@ discard block |
||
2332 | 2332 | $this->db->begin(); |
2333 | 2333 | |
2334 | 2334 | $sql = "UPDATE " . MAIN_DB_PREFIX . "expedition SET fk_statut = " . self::STATUS_CLOSED; |
2335 | - $sql .= " WHERE rowid = " . ((int)$this->id) . " AND fk_statut > 0"; |
|
2335 | + $sql .= " WHERE rowid = " . ((int) $this->id) . " AND fk_statut > 0"; |
|
2336 | 2336 | |
2337 | 2337 | $resql = $this->db->query($sql); |
2338 | 2338 | if ($resql) { |
@@ -2357,12 +2357,12 @@ discard block |
||
2357 | 2357 | if ($shipments_match_order) { |
2358 | 2358 | dol_syslog("Qty for the " . count($order->lines) . " lines of the origin order is same than qty for lines in the shipment we close (shipments_match_order is true), with new status Expedition::STATUS_CLOSED=" . self::STATUS_CLOSED . ', so we close order'); |
2359 | 2359 | // We close the order |
2360 | - $order->cloture($user); // Note this may also create an invoice if module workflow ask it |
|
2360 | + $order->cloture($user); // Note this may also create an invoice if module workflow ask it |
|
2361 | 2361 | } |
2362 | 2362 | } |
2363 | 2363 | |
2364 | - $this->statut = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
2365 | - $this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
2364 | + $this->statut = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
2365 | + $this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback |
|
2366 | 2366 | |
2367 | 2367 | // If stock increment is done on closing |
2368 | 2368 | if (!$error && isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { |
@@ -2409,7 +2409,7 @@ discard block |
||
2409 | 2409 | $this->db->begin(); |
2410 | 2410 | |
2411 | 2411 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'expedition SET billed = 1'; |
2412 | - $sql .= " WHERE rowid = " . ((int)$this->id) . ' AND fk_statut > 0'; |
|
2412 | + $sql .= " WHERE rowid = " . ((int) $this->id) . ' AND fk_statut > 0'; |
|
2413 | 2413 | |
2414 | 2414 | $resql = $this->db->query($sql); |
2415 | 2415 | if ($resql) { |
@@ -2473,7 +2473,7 @@ discard block |
||
2473 | 2473 | $oldbilled = $this->billed; |
2474 | 2474 | |
2475 | 2475 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'expedition SET fk_statut = 1'; |
2476 | - $sql .= " WHERE rowid = " . ((int)$this->id) . ' AND fk_statut > 0'; |
|
2476 | + $sql .= " WHERE rowid = " . ((int) $this->id) . ' AND fk_statut > 0'; |
|
2477 | 2477 | |
2478 | 2478 | $resql = $this->db->query($sql); |
2479 | 2479 | if ($resql) { |
@@ -2495,7 +2495,7 @@ discard block |
||
2495 | 2495 | $sql .= " FROM " . MAIN_DB_PREFIX . "commandedet as cd,"; |
2496 | 2496 | $sql .= " " . MAIN_DB_PREFIX . "expeditiondet as ed"; |
2497 | 2497 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid"; |
2498 | - $sql .= " WHERE ed.fk_expedition = " . ((int)$this->id); |
|
2498 | + $sql .= " WHERE ed.fk_expedition = " . ((int) $this->id); |
|
2499 | 2499 | $sql .= " AND cd.rowid = ed.fk_elementdet"; |
2500 | 2500 | |
2501 | 2501 | dol_syslog(get_class($this) . "::valid select details", LOG_DEBUG); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @var int |
76 | 76 | * @deprecated |
77 | 77 | */ |
78 | - public $line_id; // deprecated |
|
78 | + public $line_id; // deprecated |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * @var int ID Duplicate of origin_id (using origin_id is better) |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @var string |
110 | 110 | * @deprecated Use instead origin_type = element_type to guess the line of origin of the shipment line. |
111 | 111 | */ |
112 | - public $fk_origin; // Example: 'orderline' |
|
112 | + public $fk_origin; // Example: 'orderline' |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @var int Id of shipment |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | $sql .= ") VALUES ("; |
318 | 318 | $sql .= $this->fk_expedition; |
319 | 319 | $sql .= ", " . (empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id); |
320 | - $sql .= ", " . ((int)$this->fk_elementdet); |
|
320 | + $sql .= ", " . ((int) $this->fk_elementdet); |
|
321 | 321 | $sql .= ", '" . (empty($this->element_type) ? 'order' : $this->db->escape($this->element_type)) . "'"; |
322 | 322 | $sql .= ", " . price2num($this->qty, 'MS'); |
323 | - $sql .= ", " . ((int)$ranktouse); |
|
323 | + $sql .= ", " . ((int) $ranktouse); |
|
324 | 324 | $sql .= ")"; |
325 | 325 | |
326 | 326 | dol_syslog(get_class($this) . "::insert", LOG_DEBUG); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | // delete batch expedition line |
380 | 380 | if (isModEnabled('productbatch')) { |
381 | 381 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "expeditiondet_batch"; |
382 | - $sql .= " WHERE fk_expeditiondet = " . ((int)$this->id); |
|
382 | + $sql .= " WHERE fk_expeditiondet = " . ((int) $this->id); |
|
383 | 383 | |
384 | 384 | if (!$this->db->query($sql)) { |
385 | 385 | $this->errors[] = $this->db->lasterror() . " - sql=$sql"; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "expeditiondet"; |
391 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
391 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
392 | 392 | |
393 | 393 | if (!$error && $this->db->query($sql)) { |
394 | 394 | // Remove extrafields |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | if (!$error && !empty($expedition_batch_id)) { |
525 | 525 | // delete lot expedition line |
526 | 526 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "expeditiondet_batch"; |
527 | - $sql .= " WHERE fk_expeditiondet = " . ((int)$this->id); |
|
528 | - $sql .= " AND rowid = " . ((int)$expedition_batch_id); |
|
527 | + $sql .= " WHERE fk_expeditiondet = " . ((int) $this->id); |
|
528 | + $sql .= " AND rowid = " . ((int) $expedition_batch_id); |
|
529 | 529 | |
530 | 530 | if (!$this->db->query($sql)) { |
531 | 531 | $this->errors[] = $this->db->lasterror() . " - sql=$sql"; |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | // update line |
555 | 555 | $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
556 | 556 | $sql .= " fk_entrepot = " . ($this->entrepot_id > 0 ? $this->entrepot_id : 'null'); |
557 | - $sql .= " , qty = " . ((float)price2num($qty, 'MS')); |
|
558 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
557 | + $sql .= " , qty = " . ((float) price2num($qty, 'MS')); |
|
558 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
559 | 559 | |
560 | 560 | if (!$this->db->query($sql)) { |
561 | 561 | $this->errors[] = $this->db->lasterror() . " - sql=$sql"; |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | { |
604 | 604 | $sql = 'SELECT ed.rowid, ed.fk_expedition, ed.fk_entrepot, ed.fk_elementdet, ed.element_type, ed.qty, ed.rang'; |
605 | 605 | $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as ed'; |
606 | - $sql .= ' WHERE ed.rowid = ' . ((int)$rowid); |
|
606 | + $sql .= ' WHERE ed.rowid = ' . ((int) $rowid); |
|
607 | 607 | $result = $this->db->query($sql); |
608 | 608 | if ($result) { |
609 | 609 | $objp = $this->db->fetch_object($result); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | } elseif ($ref) { |
222 | 222 | $sql .= " AND b.rowid = '" . $this->db->escape($ref) . "'"; |
223 | 223 | } else { |
224 | - $sql .= " AND b.rowid = " . ((int)$rowid); |
|
224 | + $sql .= " AND b.rowid = " . ((int) $rowid); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $this->fk_user_rappro = $obj->fk_user_rappro; |
247 | 247 | |
248 | 248 | $this->fk_type = $obj->fk_type; // Type of transaction |
249 | - $this->rappro = (int)$obj->rappro; |
|
249 | + $this->rappro = (int) $obj->rappro; |
|
250 | 250 | $this->num_releve = $obj->num_releve; |
251 | 251 | |
252 | 252 | $this->num_chq = $obj->num_chq; |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | $sql .= ", '" . $this->db->escape($this->label) . "'"; |
304 | 304 | $sql .= ", " . price2num($this->amount); |
305 | 305 | $sql .= ", " . (empty($this->amount_main_currency) ? "NULL" : price2num($this->amount_main_currency)); |
306 | - $sql .= ", " . ($this->fk_user_author > 0 ? ((int)$this->fk_user_author) : "null"); |
|
306 | + $sql .= ", " . ($this->fk_user_author > 0 ? ((int) $this->fk_user_author) : "null"); |
|
307 | 307 | $sql .= ", " . ($this->num_chq ? "'" . $this->db->escape($this->num_chq) . "'" : "null"); |
308 | 308 | $sql .= ", '" . $this->db->escape($this->fk_account) . "'"; |
309 | 309 | $sql .= ", '" . $this->db->escape($this->fk_type) . "'"; |
310 | 310 | $sql .= ", " . ($this->emetteur ? "'" . $this->db->escape($this->emetteur) . "'" : "null"); |
311 | 311 | $sql .= ", " . ($this->bank_chq ? "'" . $this->db->escape($this->bank_chq) . "'" : "null"); |
312 | - $sql .= ", " . (int)$this->rappro; |
|
312 | + $sql .= ", " . (int) $this->rappro; |
|
313 | 313 | $sql .= ", " . ($this->numero_compte ? "'" . $this->db->escape($this->numero_compte) . "'" : "''"); |
314 | 314 | $sql .= ", " . ($this->num_releve ? "'" . $this->db->escape($this->num_releve) . "'" : "null"); |
315 | 315 | $sql .= ")"; |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | |
371 | 371 | // Protection to avoid any delete of accounted lines. Protection on by default |
372 | 372 | if (!getDolGlobalString('BANK_ALLOW_TRANSACTION_DELETION_EVEN_IF_IN_ACCOUNTING')) { |
373 | - $sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'bank' AND fk_doc = " . ((int)$this->id); |
|
373 | + $sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'bank' AND fk_doc = " . ((int) $this->id); |
|
374 | 374 | $resql = $this->db->query($sql); |
375 | 375 | if ($resql) { |
376 | 376 | $obj = $this->db->fetch_object($resql); |
@@ -392,20 +392,20 @@ discard block |
||
392 | 392 | $nbko++; |
393 | 393 | } |
394 | 394 | |
395 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank_class WHERE lineid=" . (int)$this->rowid; |
|
395 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank_class WHERE lineid=" . (int) $this->rowid; |
|
396 | 396 | dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
397 | 397 | $result = $this->db->query($sql); |
398 | 398 | if (!$result) { |
399 | 399 | $nbko++; |
400 | 400 | } |
401 | 401 | |
402 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank_extrafields WHERE fk_object=" . (int)$this->rowid; |
|
402 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank_extrafields WHERE fk_object=" . (int) $this->rowid; |
|
403 | 403 | $result = $this->db->query($sql); |
404 | 404 | if (!$result) { |
405 | 405 | $nbko++; |
406 | 406 | } |
407 | 407 | |
408 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank WHERE rowid=" . (int)$this->rowid; |
|
408 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank WHERE rowid=" . (int) $this->rowid; |
|
409 | 409 | dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
410 | 410 | $result = $this->db->query($sql); |
411 | 411 | if (!$result) { |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | |
444 | 444 | $this->db->begin(); |
445 | 445 | |
446 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank_url WHERE fk_bank=" . (int)$this->rowid; |
|
446 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "bank_url WHERE fk_bank=" . (int) $this->rowid; |
|
447 | 447 | dol_syslog(get_class($this) . "::delete_urls", LOG_DEBUG); |
448 | 448 | $result = $this->db->query($sql); |
449 | 449 | if (!$result) { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $sql .= " amount = " . price2num($this->amount) . ","; |
476 | 476 | $sql .= " datev='" . $this->db->idate($this->datev) . "',"; |
477 | 477 | $sql .= " dateo='" . $this->db->idate($this->dateo) . "'"; |
478 | - $sql .= " WHERE rowid = " . ((int)$this->rowid); |
|
478 | + $sql .= " WHERE rowid = " . ((int) $this->rowid); |
|
479 | 479 | |
480 | 480 | dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
481 | 481 | $resql = $this->db->query($sql); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | |
502 | 502 | $sql = "UPDATE " . MAIN_DB_PREFIX . "bank SET"; |
503 | 503 | $sql .= " label = '" . $this->db->escape($this->label) . "'"; |
504 | - $sql .= " WHERE rowid = " . ((int)$this->rowid); |
|
504 | + $sql .= " WHERE rowid = " . ((int) $this->rowid); |
|
505 | 505 | |
506 | 506 | dol_syslog(get_class($this) . "::update_label", LOG_DEBUG); |
507 | 507 | $resql = $this->db->query($sql); |
@@ -542,12 +542,12 @@ discard block |
||
542 | 542 | } |
543 | 543 | |
544 | 544 | $sql = "UPDATE " . MAIN_DB_PREFIX . "bank SET"; |
545 | - $sql .= " rappro = " . ((int)$conciliated); |
|
545 | + $sql .= " rappro = " . ((int) $conciliated); |
|
546 | 546 | $sql .= ", num_releve = '" . $this->db->escape($this->num_releve) . "'"; |
547 | 547 | if ($conciliated) { |
548 | 548 | $sql .= ", fk_user_rappro = " . $user->id; |
549 | 549 | } |
550 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
550 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
551 | 551 | |
552 | 552 | dol_syslog(get_class($this) . "::update_conciliation", LOG_DEBUG); |
553 | 553 | $resql = $this->db->query($sql); |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | $sql .= ", fk_categ"; |
559 | 559 | $sql .= ") VALUES ("; |
560 | 560 | $sql .= $this->id; |
561 | - $sql .= ", " . ((int)$cat); |
|
561 | + $sql .= ", " . ((int) $cat); |
|
562 | 562 | $sql .= ")"; |
563 | 563 | |
564 | 564 | dol_syslog(get_class($this) . "::update_conciliation", LOG_DEBUG); |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | public function datev_change($rowid, $sign = 1) |
592 | 592 | { |
593 | 593 | // phpcs:enable |
594 | - $sql = "SELECT datev FROM " . MAIN_DB_PREFIX . "bank WHERE rowid = " . ((int)$rowid); |
|
594 | + $sql = "SELECT datev FROM " . MAIN_DB_PREFIX . "bank WHERE rowid = " . ((int) $rowid); |
|
595 | 595 | $resql = $this->db->query($sql); |
596 | 596 | if ($resql) { |
597 | 597 | $obj = $this->db->fetch_object($resql); |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | $sql = "UPDATE " . MAIN_DB_PREFIX . "bank SET"; |
601 | 601 | $sql .= " datev = '" . $this->db->idate($newdate) . "'"; |
602 | - $sql .= " WHERE rowid = " . ((int)$rowid); |
|
602 | + $sql .= " WHERE rowid = " . ((int) $rowid); |
|
603 | 603 | |
604 | 604 | $result = $this->db->query($sql); |
605 | 605 | if ($result) { |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | public function dateo_change($rowid, $sign = 1) |
658 | 658 | { |
659 | 659 | // phpcs:enable |
660 | - $sql = "SELECT dateo FROM " . MAIN_DB_PREFIX . "bank WHERE rowid = " . ((int)$rowid); |
|
660 | + $sql = "SELECT dateo FROM " . MAIN_DB_PREFIX . "bank WHERE rowid = " . ((int) $rowid); |
|
661 | 661 | $resql = $this->db->query($sql); |
662 | 662 | if ($resql) { |
663 | 663 | $obj = $this->db->fetch_object($resql); |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | |
666 | 666 | $sql = "UPDATE " . MAIN_DB_PREFIX . "bank SET"; |
667 | 667 | $sql .= " dateo = '" . $this->db->idate($newdate) . "'"; |
668 | - $sql .= " WHERE rowid = " . ((int)$rowid); |
|
668 | + $sql .= " WHERE rowid = " . ((int) $rowid); |
|
669 | 669 | |
670 | 670 | $result = $this->db->query($sql); |
671 | 671 | if ($result) { |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | $sql = 'SELECT b.rowid, b.datec, b.tms as datem,'; |
723 | 723 | $sql .= ' b.fk_user_author, b.fk_user_rappro'; |
724 | 724 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bank as b'; |
725 | - $sql .= ' WHERE b.rowid = ' . ((int)$id); |
|
725 | + $sql .= ' WHERE b.rowid = ' . ((int) $id); |
|
726 | 726 | |
727 | 727 | $result = $this->db->query($sql); |
728 | 728 | if ($result) { |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | $label .= '<br><strong>' . $langs->trans("Amount") . ':</strong> ' . price($this->amount, 0, $langs, 1, -1, -1, $conf->currency); |
766 | 766 | } |
767 | 767 | |
768 | - $linkstart = '<a href="' . constant('BASE_URL') . '/compta/bank/line.php?rowid=' . ((int)$this->id) . '&save_lastsearch_values=1" title="' . dol_escape_htmltag($label, 1) . '" class="classfortooltip">'; |
|
768 | + $linkstart = '<a href="' . constant('BASE_URL') . '/compta/bank/line.php?rowid=' . ((int) $this->id) . '&save_lastsearch_values=1" title="' . dol_escape_htmltag($label, 1) . '" class="classfortooltip">'; |
|
769 | 769 | $linkend = '</a>'; |
770 | 770 | |
771 | 771 | $result .= $linkstart; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | } |
796 | 796 | if (isModEnabled('accounting') && ($option == 'showall' || $option == 'showconciliatedandaccounted')) { |
797 | 797 | $sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; |
798 | - $sql .= " WHERE doc_type = 'bank' AND fk_doc = " . ((int)$this->id); |
|
798 | + $sql .= " WHERE doc_type = 'bank' AND fk_doc = " . ((int) $this->id); |
|
799 | 799 | $resql = $this->db->query($sql); |
800 | 800 | if ($resql) { |
801 | 801 | $obj = $this->db->fetch_object($resql); |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | |
852 | 852 | $type = 'bank'; |
853 | 853 | |
854 | - $sql = " SELECT COUNT(ab.rowid) as nb FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='" . $this->db->escape($type) . "' AND ab.fk_doc = " . ((int)$this->id); |
|
854 | + $sql = " SELECT COUNT(ab.rowid) as nb FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='" . $this->db->escape($type) . "' AND ab.fk_doc = " . ((int) $this->id); |
|
855 | 855 | $resql = $this->db->query($sql); |
856 | 856 | if ($resql) { |
857 | 857 | $obj = $this->db->fetch_object($resql); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc'; |
175 | 175 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facturedet as fd'; |
176 | 176 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON fd.fk_product = p.rowid'; |
177 | - $sql .= ' WHERE fd.rowid = ' . ((int)$rowid); |
|
177 | + $sql .= ' WHERE fd.rowid = ' . ((int) $rowid); |
|
178 | 178 | |
179 | 179 | $result = $this->db->query($sql); |
180 | 180 | if ($result) { |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | if (empty($this->fk_prev_id)) { |
314 | 314 | $this->fk_prev_id = 0; |
315 | 315 | } |
316 | - if (!isset($this->situation_percent) || $this->situation_percent > 100 || (string)$this->situation_percent == '') { |
|
316 | + if (!isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') { |
|
317 | 317 | $this->situation_percent = 100; |
318 | 318 | } |
319 | 319 | |
@@ -384,16 +384,16 @@ discard block |
||
384 | 384 | $sql .= " '" . $this->db->escape($this->localtax1_type) . "',"; |
385 | 385 | $sql .= " '" . $this->db->escape($this->localtax2_type) . "',"; |
386 | 386 | $sql .= ' ' . ((!empty($this->fk_product) && $this->fk_product > 0) ? $this->fk_product : "null") . ','; |
387 | - $sql .= " " . ((int)$this->product_type) . ","; |
|
387 | + $sql .= " " . ((int) $this->product_type) . ","; |
|
388 | 388 | $sql .= " " . price2num($this->remise_percent) . ","; |
389 | 389 | $sql .= " " . price2num($this->subprice) . ","; |
390 | 390 | $sql .= " '" . $this->db->escape($this->ref_ext) . "',"; |
391 | 391 | $sql .= ' ' . (!empty($this->fk_remise_except) ? $this->fk_remise_except : "null") . ','; |
392 | 392 | $sql .= " " . (!empty($this->date_start) ? "'" . $this->db->idate($this->date_start) . "'" : "null") . ","; |
393 | 393 | $sql .= " " . (!empty($this->date_end) ? "'" . $this->db->idate($this->date_end) . "'" : "null") . ","; |
394 | - $sql .= ' ' . ((int)$this->fk_code_ventilation) . ','; |
|
395 | - $sql .= ' ' . ((int)$this->rang) . ','; |
|
396 | - $sql .= ' ' . ((int)$this->special_code) . ','; |
|
394 | + $sql .= ' ' . ((int) $this->fk_code_ventilation) . ','; |
|
395 | + $sql .= ' ' . ((int) $this->rang) . ','; |
|
396 | + $sql .= ' ' . ((int) $this->special_code) . ','; |
|
397 | 397 | $sql .= ' ' . (!empty($this->fk_fournprice) ? $this->fk_fournprice : "null") . ','; |
398 | 398 | $sql .= ' ' . price2num($this->pa_ht) . ','; |
399 | 399 | $sql .= " '" . $this->db->escape($this->info_bits) . "',"; |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | $sql .= " " . price2num($this->total_ttc) . ","; |
403 | 403 | $sql .= " " . price2num($this->total_localtax1) . ","; |
404 | 404 | $sql .= " " . price2num($this->total_localtax2); |
405 | - $sql .= ", " . ((float)$this->situation_percent); |
|
405 | + $sql .= ", " . ((float) $this->situation_percent); |
|
406 | 406 | $sql .= ", " . (!empty($this->fk_prev_id) ? $this->fk_prev_id : "null"); |
407 | 407 | $sql .= ", " . (!$this->fk_unit ? 'NULL' : $this->fk_unit); |
408 | - $sql .= ", " . ((int)$user->id); |
|
409 | - $sql .= ", " . ((int)$user->id); |
|
410 | - $sql .= ", " . (int)$this->fk_multicurrency; |
|
408 | + $sql .= ", " . ((int) $user->id); |
|
409 | + $sql .= ", " . ((int) $user->id); |
|
410 | + $sql .= ", " . (int) $this->fk_multicurrency; |
|
411 | 411 | $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
412 | 412 | $sql .= ", " . price2num($this->multicurrency_subprice); |
413 | 413 | $sql .= ", " . price2num($this->multicurrency_total_ht); |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | if (empty($this->fk_parent_line)) { |
543 | 543 | $this->fk_parent_line = 0; |
544 | 544 | } |
545 | - if (!isset($this->situation_percent) || $this->situation_percent > 100 || (string)$this->situation_percent == '') { |
|
545 | + if (!isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') { |
|
546 | 546 | $this->situation_percent = 100; |
547 | 547 | } |
548 | 548 | if (empty($this->pa_ht)) { |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | $sql .= ", date_end=" . (!empty($this->date_end) ? "'" . $this->db->idate($this->date_end) . "'" : "null"); |
604 | 604 | $sql .= ", product_type=" . $this->product_type; |
605 | 605 | $sql .= ", info_bits='" . $this->db->escape($this->info_bits) . "'"; |
606 | - $sql .= ", special_code=" . (int)$this->special_code; |
|
606 | + $sql .= ", special_code=" . (int) $this->special_code; |
|
607 | 607 | if (empty($this->skip_update_total)) { |
608 | 608 | $sql .= ", total_ht=" . price2num($this->total_ht); |
609 | 609 | $sql .= ", total_tva=" . price2num($this->total_tva); |
@@ -612,14 +612,14 @@ discard block |
||
612 | 612 | $sql .= ", total_localtax2=" . price2num($this->total_localtax2); |
613 | 613 | } |
614 | 614 | $sql .= ", fk_product_fournisseur_price=" . (!empty($this->fk_fournprice) ? "'" . $this->db->escape($this->fk_fournprice) . "'" : "null"); |
615 | - $sql .= ", buy_price_ht=" . (($this->pa_ht || (string)$this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option) |
|
615 | + $sql .= ", buy_price_ht=" . (($this->pa_ht || (string) $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option) |
|
616 | 616 | $sql .= ", fk_parent_line=" . ($this->fk_parent_line > 0 ? $this->fk_parent_line : "null"); |
617 | 617 | if (!empty($this->rang)) { |
618 | - $sql .= ", rang=" . ((int)$this->rang); |
|
618 | + $sql .= ", rang=" . ((int) $this->rang); |
|
619 | 619 | } |
620 | - $sql .= ", situation_percent = " . ((float)$this->situation_percent); |
|
620 | + $sql .= ", situation_percent = " . ((float) $this->situation_percent); |
|
621 | 621 | $sql .= ", fk_unit = " . (!$this->fk_unit ? 'NULL' : $this->fk_unit); |
622 | - $sql .= ", fk_user_modif = " . ((int)$user->id); |
|
622 | + $sql .= ", fk_user_modif = " . ((int) $user->id); |
|
623 | 623 | |
624 | 624 | // Multicurrency |
625 | 625 | $sql .= ", multicurrency_subprice=" . price2num($this->multicurrency_subprice); |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | $sql .= ", multicurrency_total_tva=" . price2num($this->multicurrency_total_tva); |
628 | 628 | $sql .= ", multicurrency_total_ttc=" . price2num($this->multicurrency_total_ttc); |
629 | 629 | |
630 | - $sql .= " WHERE rowid = " . ((int)$this->rowid); |
|
630 | + $sql .= " WHERE rowid = " . ((int) $this->rowid); |
|
631 | 631 | |
632 | 632 | dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
633 | 633 | $resql = $this->db->query($sql); |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | // Free discount linked to invoice line |
692 | 692 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'societe_remise_except'; |
693 | 693 | $sql .= ' SET fk_facture_line = NULL'; |
694 | - $sql .= ' WHERE fk_facture_line = ' . ((int)$this->id); |
|
694 | + $sql .= ' WHERE fk_facture_line = ' . ((int) $this->id); |
|
695 | 695 | |
696 | 696 | dol_syslog(get_class($this) . "::deleteline", LOG_DEBUG); |
697 | 697 | $result = $this->db->query($sql); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | |
705 | 705 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'element_time'; |
706 | 706 | $sql .= ' SET invoice_id = NULL, invoice_line_id = NULL'; |
707 | - $sql .= ' WHERE invoice_line_id = ' . ((int)$this->id); |
|
707 | + $sql .= ' WHERE invoice_line_id = ' . ((int) $this->id); |
|
708 | 708 | if (!$this->db->query($sql)) { |
709 | 709 | $this->error = $this->db->error() . " sql=" . $sql; |
710 | 710 | $this->errors[] = $this->error; |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | return -1; |
713 | 713 | } |
714 | 714 | |
715 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet WHERE rowid = " . ((int)$this->id); |
|
715 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "facturedet WHERE rowid = " . ((int) $this->id); |
|
716 | 716 | |
717 | 717 | if ($this->db->query($sql)) { |
718 | 718 | $this->db->commit(); |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | $sql .= ",total_localtax1=" . price2num($this->total_localtax1); |
755 | 755 | $sql .= ",total_localtax2=" . price2num($this->total_localtax2); |
756 | 756 | $sql .= ",total_ttc=" . price2num($this->total_ttc); |
757 | - $sql .= " WHERE rowid = " . ((int)$this->rowid); |
|
757 | + $sql .= " WHERE rowid = " . ((int) $this->rowid); |
|
758 | 758 | |
759 | 759 | dol_syslog(get_class($this) . "::update_total", LOG_DEBUG); |
760 | 760 | |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | } |
799 | 799 | |
800 | 800 | $sql = "SELECT situation_percent FROM " . MAIN_DB_PREFIX . "facturedet"; |
801 | - $sql .= " WHERE rowid = " . ((int)$this->fk_prev_id); |
|
801 | + $sql .= " WHERE rowid = " . ((int) $this->fk_prev_id); |
|
802 | 802 | |
803 | 803 | $resql = $this->db->query($sql); |
804 | 804 | |
@@ -807,20 +807,20 @@ discard block |
||
807 | 807 | |
808 | 808 | $obj = $this->db->fetch_object($resql); |
809 | 809 | if ($obj) { |
810 | - $returnPercent = (float)$obj->situation_percent; |
|
810 | + $returnPercent = (float) $obj->situation_percent; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | if ($include_credit_note) { |
814 | 814 | $sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd'; |
815 | 815 | $sql .= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) '; |
816 | - $sql .= " WHERE fd.fk_prev_id = " . ((int)$this->fk_prev_id); |
|
817 | - $sql .= " AND f.situation_cycle_ref = " . ((int)$invoicecache[$invoiceid]->situation_cycle_ref); // Prevent cycle outed |
|
816 | + $sql .= " WHERE fd.fk_prev_id = " . ((int) $this->fk_prev_id); |
|
817 | + $sql .= " AND f.situation_cycle_ref = " . ((int) $invoicecache[$invoiceid]->situation_cycle_ref); // Prevent cycle outed |
|
818 | 818 | $sql .= " AND f.type = " . Facture::TYPE_CREDIT_NOTE; |
819 | 819 | |
820 | 820 | $res = $this->db->query($sql); |
821 | 821 | if ($res) { |
822 | 822 | while ($obj = $this->db->fetch_object($res)) { |
823 | - $returnPercent = $returnPercent + (float)$obj->situation_percent; |
|
823 | + $returnPercent = $returnPercent + (float) $obj->situation_percent; |
|
824 | 824 | } |
825 | 825 | } else { |
826 | 826 | dol_print_error($this->db); |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | $cumulated_percent = 0.0; |
871 | 871 | |
872 | 872 | while (!$all_found) { |
873 | - $sql = "SELECT situation_percent, fk_prev_id FROM " . MAIN_DB_PREFIX . "facturedet WHERE rowid = " . ((int)$lastprevid); |
|
873 | + $sql = "SELECT situation_percent, fk_prev_id FROM " . MAIN_DB_PREFIX . "facturedet WHERE rowid = " . ((int) $lastprevid); |
|
874 | 874 | $resql = $this->db->query($sql); |
875 | 875 | |
876 | 876 | if ($resql && $this->db->num_rows($resql) > 0) { |
@@ -880,8 +880,8 @@ discard block |
||
880 | 880 | if ($include_credit_note) { |
881 | 881 | $sql_credit_note = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd'; |
882 | 882 | $sql_credit_note .= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) '; |
883 | - $sql_credit_note .= " WHERE fd.fk_prev_id = " . ((int)$lastprevid); |
|
884 | - $sql_credit_note .= " AND f.situation_cycle_ref = " . ((int)$invoicecache[$invoiceid]->situation_cycle_ref); // Prevent cycle outed |
|
883 | + $sql_credit_note .= " WHERE fd.fk_prev_id = " . ((int) $lastprevid); |
|
884 | + $sql_credit_note .= " AND f.situation_cycle_ref = " . ((int) $invoicecache[$invoiceid]->situation_cycle_ref); // Prevent cycle outed |
|
885 | 885 | $sql_credit_note .= " AND f.type = " . Facture::TYPE_CREDIT_NOTE; |
886 | 886 | |
887 | 887 | $res_credit_note = $this->db->query($sql_credit_note); |