@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $page = 0; |
88 | 88 | } // If $page is not defined, or '' or -1 |
89 | 89 | $offset = $limit * $page; |
90 | -if (! $sortorder) { |
|
90 | +if (!$sortorder) { |
|
91 | 91 | $sortorder = 'DESC'; |
92 | 92 | } |
93 | -if (! $sortfield) { |
|
93 | +if (!$sortfield) { |
|
94 | 94 | $sortfield = 'f.titre'; |
95 | 95 | } |
96 | 96 | $pageprev = $page - 1; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $object = new FactureFournisseurRec($db); |
100 | 100 | if (($id > 0 || $title) && $action != 'create' && $action != 'add') { |
101 | 101 | $ret = $object->fetch($id, $title); |
102 | - if (! $ret) { |
|
102 | + if (!$ret) { |
|
103 | 103 | setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors'); |
104 | 104 | } |
105 | 105 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $action = 'list'; |
144 | 144 | $massaction = ''; |
145 | 145 | } |
146 | -if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { |
|
146 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { |
|
147 | 147 | $massaction = ''; |
148 | 148 | } |
149 | 149 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | // Create predefined invoice |
172 | 172 | if ($action == 'add') { |
173 | - if (! GETPOST('title', 'alphanohtml')) { |
|
173 | + if (!GETPOST('title', 'alphanohtml')) { |
|
174 | 174 | setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); |
175 | 175 | $action = "create"; |
176 | 176 | $error++; |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | - if (! $error) { |
|
196 | + if (!$error) { |
|
197 | 197 | $object->subtype = GETPOSTINT('subtype'); |
198 | 198 | $object->title = GETPOST('title', 'alphanohtml'); |
199 | - $object->libelle = GETPOST('libelle', 'alpha'); // deprecated |
|
199 | + $object->libelle = GETPOST('libelle', 'alpha'); // deprecated |
|
200 | 200 | $object->label = GETPOST('libelle', 'alpha'); |
201 | 201 | $object->fk_project = GETPOSTINT('projectid'); |
202 | 202 | $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $action = "create"; |
243 | 243 | } |
244 | 244 | |
245 | - if (! $error) { |
|
245 | + if (!$error) { |
|
246 | 246 | $db->commit(); |
247 | 247 | |
248 | 248 | header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $result = $object->setValueFrom('titre', $title, '', null, 'text', '', $user); |
293 | 293 | |
294 | 294 | if ($result > 0) { |
295 | - $object->titre = $title; // deprecated |
|
295 | + $object->titre = $title; // deprecated |
|
296 | 296 | $object->title = $title; |
297 | 297 | $object->ref = $object->title; |
298 | 298 | } else { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $error++; |
340 | 340 | } |
341 | 341 | |
342 | - if (! $error) { |
|
342 | + if (!$error) { |
|
343 | 343 | $db->commit(); |
344 | 344 | } else { |
345 | 345 | $db->rollback(); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $error++; |
357 | 357 | } |
358 | 358 | |
359 | - if (! $error) { |
|
359 | + if (!$error) { |
|
360 | 360 | $db->commit(); |
361 | 361 | } else { |
362 | 362 | $db->rollback(); |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $error++; |
416 | 416 | } |
417 | 417 | |
418 | - if (! $error) { |
|
418 | + if (!$error) { |
|
419 | 419 | $result = $object->insertExtraFields('BILLREC_MODIFY'); |
420 | 420 | if ($result < 0) { |
421 | 421 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); |
467 | 467 | $error++; |
468 | 468 | } |
469 | - if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (! ($price_ht >= 0) || $price_ht == '')) { // Unit price can be 0 but not '' |
|
469 | + if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht == '')) { // Unit price can be 0 but not '' |
|
470 | 470 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); |
471 | 471 | $error++; |
472 | 472 | } |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | } |
516 | 516 | } |
517 | 517 | |
518 | - if (! $error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { |
|
518 | + if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { |
|
519 | 519 | $ret = $object->fetch($id); |
520 | 520 | if ($ret < 0) { |
521 | 521 | dol_print_error($db, $object->error); |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | $action = ''; |
732 | 732 | } |
733 | 733 | } |
734 | - } elseif ($action == 'updateline' && $usercancreate && ! GETPOST('cancel', 'alpha')) { |
|
735 | - if (! $object->fetch($id) > 0) { |
|
734 | + } elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) { |
|
735 | + if (!$object->fetch($id) > 0) { |
|
736 | 736 | dol_print_error($db); |
737 | 737 | } |
738 | 738 | $object->fetch_thirdparty(); |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | |
784 | 784 | // Define special_code for special lines |
785 | 785 | $special_code = GETPOSTINT('special_code'); |
786 | - if (! GETPOST('qty', 'alpha')) { |
|
786 | + if (!GETPOST('qty', 'alpha')) { |
|
787 | 787 | $special_code = 3; |
788 | 788 | } |
789 | 789 | |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | $date_end_fill = !empty(GETPOSTINT('date_end_fill')) ? GETPOSTINT('date_end_fill') : 'NULL'; |
830 | 830 | |
831 | 831 | // Update line |
832 | - if (! $error) { |
|
832 | + if (!$error) { |
|
833 | 833 | $result = $object->updateline(GETPOSTINT('lineid'), GETPOSTINT('productid'), $ref_fourn, $label, $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax1_rate, 'HT', $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1); |
834 | 834 | if ($result >= 0) { |
835 | 835 | $object->fetch($object->id); // Reload lines |
@@ -1488,8 +1488,8 @@ discard block |
||
1488 | 1488 | print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $usercancreate, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached'); |
1489 | 1489 | } |
1490 | 1490 | //var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour')); |
1491 | - if (! $object->isMaxNbGenReached()) { |
|
1492 | - if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) { |
|
1491 | + if (!$object->isMaxNbGenReached()) { |
|
1492 | + if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) { |
|
1493 | 1493 | print img_warning($langs->trans("Late")); |
1494 | 1494 | } |
1495 | 1495 | } else { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | // Load object |
56 | 56 | include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
57 | 57 | |
58 | -$result = restrictedArea($user, $object->element, $object->id, 'paiementfourn', ''); // This also test permission on read invoice |
|
58 | +$result = restrictedArea($user, $object->element, $object->id, 'paiementfourn', ''); // This also test permission on read invoice |
|
59 | 59 | |
60 | 60 | // Security check |
61 | 61 | if ($user->socid) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $search_date_endday = GETPOSTINT('search_date_endday'); |
63 | 63 | $search_date_endmonth = GETPOSTINT('search_date_endmonth'); |
64 | 64 | $search_date_endyear = GETPOSTINT('search_date_endyear'); |
65 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
65 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
66 | 66 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
67 | 67 | $search_company = GETPOST('search_company', 'alpha'); |
68 | 68 | $search_payment_type = GETPOST('search_payment_type', 'alpha'); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'p.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 70), |
111 | 111 | ); |
112 | 112 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
113 | -'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
113 | +'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
114 | 114 | |
115 | 115 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
116 | 116 | $hookmanager->initHooks(array('paymentsupplierlist')); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'facture_fourn AS f ON f.rowid = pf.fk_facturefourn'; |
208 | 208 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON s.rowid = f.fk_soc'; |
209 | 209 | |
210 | -$sql .= ' WHERE f.entity IN (' . getEntity('supplier_invoice') . ')'; // TODO We should use p.entity that does not exists yet in this table |
|
210 | +$sql .= ' WHERE f.entity IN (' . getEntity('supplier_invoice') . ')'; // TODO We should use p.entity that does not exists yet in this table |
|
211 | 211 | if ($socid > 0) { |
212 | 212 | $sql .= " AND EXISTS (SELECT f.fk_soc FROM " . MAIN_DB_PREFIX . "facture_fourn as f, " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as pf"; |
213 | 213 | $sql .= " WHERE p.rowid = pf.fk_paiementfourn AND pf.fk_facturefourn = f.rowid AND f.fk_soc = " . ((int) $socid) . ")"; |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | $sql .= ", '" . $this->db->idate($now) . "'"; |
352 | 352 | $sql .= ", " . ((int) $this->suspended); |
353 | 353 | $sql .= ", '" . $this->db->escape($this->libelle) . "'"; |
354 | - $sql .= ", " . (!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
354 | + $sql .= ", " . (!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
355 | 355 | $sql .= ", " . ((int) $user->id); |
356 | 356 | $sql .= ", " . (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
357 | 357 | $sql .= ", " . (!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
358 | 358 | $sql .= ", " . ($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
359 | 359 | $sql .= ", " . ($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
360 | - $sql .= ", " . ($facfourn_src->date_echeance > 0 ? "'" . $this->db->idate($facfourn_src->date_echeance) . "'" : 'NULL'); // date_lim_reglement |
|
360 | + $sql .= ", " . ($facfourn_src->date_echeance > 0 ? "'" . $this->db->idate($facfourn_src->date_echeance) . "'" : 'NULL'); // date_lim_reglement |
|
361 | 361 | $sql .= ", " . (!empty($this->note_private) ? "'" . $this->db->escape($this->note_private) . "'" : 'NULL'); |
362 | 362 | $sql .= ", " . (!empty($this->note_public) ? "'" . $this->db->escape($this->note_public) . "'" : 'NULL'); |
363 | 363 | $sql .= ", " . (!empty($this->model_pdf) ? "'" . $this->db->escape($this->model_pdf) . "'" : 'NULL'); |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $error = 0; |
513 | 513 | |
514 | 514 | $sql = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_rec SET"; |
515 | - $sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "") . "'," ; |
|
515 | + $sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "") . "',"; |
|
516 | 516 | $sql .= " subtype=" . (isset($this->subtype) ? $this->db->escape($this->subtype) : "null") . ","; |
517 | 517 | $sql .= " ref_supplier = '" . (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "") . "',"; |
518 | 518 | $sql .= " entity = " . (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | $this->id = $obj->rowid; |
631 | 631 | $this->titre = $obj->title; |
632 | 632 | $this->title = $obj->title; |
633 | - $this->subtype = $obj->subtype; |
|
633 | + $this->subtype = $obj->subtype; |
|
634 | 634 | $this->ref = $obj->title; |
635 | 635 | $this->ref_supplier = $obj->ref_supplier; |
636 | 636 | $this->entity = $obj->entity; |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | $line->product_type = $objp->product_type; |
789 | 789 | $line->date_start = $objp->date_start; |
790 | 790 | $line->date_end = $objp->date_end; |
791 | - $line->info_bits = $objp->info_bits ; |
|
791 | + $line->info_bits = $objp->info_bits; |
|
792 | 792 | $line->special_code = $objp->special_code; |
793 | 793 | $line->rang = $objp->rang; |
794 | 794 | $line->fk_unit = $objp->fk_unit; |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | } |
872 | 872 | // End call triggers |
873 | 873 | } |
874 | - if (! $error) { |
|
874 | + if (!$error) { |
|
875 | 875 | $this->db->commit(); |
876 | 876 | return 1; |
877 | 877 | } else { |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | $sql .= ', fk_user_author'; |
1016 | 1016 | $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
1017 | 1017 | $sql .= ') VALUES ('; |
1018 | - $sql .= ' ' . (int) $facid; // source supplier invoice id |
|
1018 | + $sql .= ' ' . (int) $facid; // source supplier invoice id |
|
1019 | 1019 | $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null'); |
1020 | 1020 | $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null'); |
1021 | 1021 | $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null'); |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | |
1357 | 1357 | $new_fac_fourn->type = self::TYPE_STANDARD; |
1358 | 1358 | $new_fac_fourn->subtype = $facturerec->subtype; |
1359 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1359 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1360 | 1360 | $new_fac_fourn->status = self::STATUS_DRAFT; |
1361 | 1361 | $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. |
1362 | 1362 | $new_fac_fourn->socid = $facturerec->socid; |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | $new_fac_fourn->model_pdf = $facturerec->model_pdf; |
1366 | 1366 | $new_fac_fourn->fk_project = $facturerec->fk_project; |
1367 | 1367 | $new_fac_fourn->label = $facturerec->label; |
1368 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1368 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1369 | 1369 | |
1370 | 1370 | $invoiceidgenerated = $new_fac_fourn->create($user); |
1371 | 1371 | $laststep = "Create invoiceidgenerated $invoiceidgenerated"; |
@@ -2072,8 +2072,8 @@ discard block |
||
2072 | 2072 | $error = 0; |
2073 | 2073 | $this->db->begin(); |
2074 | 2074 | |
2075 | - if (! $error) { |
|
2076 | - if (! $notrigger) { |
|
2075 | + if (!$error) { |
|
2076 | + if (!$notrigger) { |
|
2077 | 2077 | // Call triggers |
2078 | 2078 | $result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user); |
2079 | 2079 | if ($result < 0) { |
@@ -2083,14 +2083,14 @@ discard block |
||
2083 | 2083 | } |
2084 | 2084 | } |
2085 | 2085 | |
2086 | - if (! $error) { |
|
2086 | + if (!$error) { |
|
2087 | 2087 | $result = $this->deleteExtraFields(); |
2088 | 2088 | if ($result < 0) { |
2089 | 2089 | $error++; |
2090 | 2090 | } |
2091 | 2091 | } |
2092 | 2092 | |
2093 | - if (! $error) { |
|
2093 | + if (!$error) { |
|
2094 | 2094 | $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id; |
2095 | 2095 | |
2096 | 2096 | $res = $this->db->query($sql); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->ref_supplier = $obj->ref_supplier; |
521 | 521 | $this->socid = $obj->fk_soc; |
522 | 522 | $this->fourn_id = $obj->fk_soc; |
523 | - $this->statut = $obj->status; // deprecated |
|
523 | + $this->statut = $obj->status; // deprecated |
|
524 | 524 | $this->status = $obj->status; |
525 | 525 | $this->billed = $obj->billed; |
526 | 526 | $this->user_author_id = $obj->user_author_id; |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | $this->fk_project = $obj->fk_project; |
552 | 552 | $this->cond_reglement_id = $obj->fk_cond_reglement; |
553 | 553 | $this->cond_reglement_code = $obj->cond_reglement_code; |
554 | - $this->cond_reglement = $obj->cond_reglement_label; // deprecated |
|
554 | + $this->cond_reglement = $obj->cond_reglement_label; // deprecated |
|
555 | 555 | $this->cond_reglement_label = $obj->cond_reglement_label; |
556 | 556 | $this->cond_reglement_doc = $obj->cond_reglement_doc; |
557 | 557 | $this->fk_account = $obj->fk_account; |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | $sqlsearchpackage .= ' WHERE entity IN (' . getEntity('product_fournisseur_price') . ")"; |
685 | 685 | $sqlsearchpackage .= " AND fk_product = " . ((int) $objp->fk_product); |
686 | 686 | $sqlsearchpackage .= " AND ref_fourn = '" . $this->db->escape($objp->ref_supplier) . "'"; |
687 | - $sqlsearchpackage .= " AND quantity <= " . ((float) $objp->qty); // required to be qualified |
|
688 | - $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= " . ((float) $objp->qty) . ")"; // required to be qualified |
|
687 | + $sqlsearchpackage .= " AND quantity <= " . ((float) $objp->qty); // required to be qualified |
|
688 | + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= " . ((float) $objp->qty) . ")"; // required to be qualified |
|
689 | 689 | $sqlsearchpackage .= " AND fk_soc = " . ((int) $this->socid); |
690 | - $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
690 | + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
691 | 691 | $sqlsearchpackage .= " LIMIT 1"; |
692 | 692 | |
693 | 693 | $resqlsearchpackage = $this->db->query($sqlsearchpackage); |
@@ -1623,10 +1623,10 @@ discard block |
||
1623 | 1623 | $line->date_end, |
1624 | 1624 | $line->array_options, |
1625 | 1625 | $line->fk_unit, |
1626 | - $line->multicurrency_subprice, // pu_ht_devise |
|
1627 | - $line->origin, // origin |
|
1628 | - $line->origin_id, // origin_id |
|
1629 | - $line->rang, // rang |
|
1626 | + $line->multicurrency_subprice, // pu_ht_devise |
|
1627 | + $line->origin, // origin |
|
1628 | + $line->origin_id, // origin_id |
|
1629 | + $line->rang, // rang |
|
1630 | 1630 | $line->special_code |
1631 | 1631 | ); |
1632 | 1632 | if ($result < 0) { |
@@ -2000,7 +2000,7 @@ discard block |
||
2000 | 2000 | $this->db->begin(); |
2001 | 2001 | |
2002 | 2002 | $product_type = $type; |
2003 | - $label = ''; // deprecated |
|
2003 | + $label = ''; // deprecated |
|
2004 | 2004 | |
2005 | 2005 | if ($fk_product > 0) { |
2006 | 2006 | if (getDolGlobalString('SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY')) { // Not the common case |
@@ -2143,7 +2143,7 @@ discard block |
||
2143 | 2143 | $this->line->total_localtax2 = $total_localtax2; |
2144 | 2144 | $this->line->total_ttc = $total_ttc; |
2145 | 2145 | $this->line->product_type = $type; |
2146 | - $this->line->special_code = (!empty($special_code) ? $special_code : 0); |
|
2146 | + $this->line->special_code = (!empty($special_code) ? $special_code : 0); |
|
2147 | 2147 | $this->line->origin = $origin; |
2148 | 2148 | $this->line->origin_id = $origin_id; |
2149 | 2149 | $this->line->fk_unit = $fk_unit; |
@@ -3350,7 +3350,7 @@ discard block |
||
3350 | 3350 | global $conf, $langs; |
3351 | 3351 | |
3352 | 3352 | if (!dol_strlen($modele)) { |
3353 | - $modele = ''; // No doc template/generation by default |
|
3353 | + $modele = ''; // No doc template/generation by default |
|
3354 | 3354 | |
3355 | 3355 | if (!empty($this->model_pdf)) { |
3356 | 3356 | $modele = $this->model_pdf; |
@@ -3892,10 +3892,10 @@ discard block |
||
3892 | 3892 | $sqlsearchpackage .= ' WHERE entity IN (' . getEntity('product_fournisseur_price') . ")"; |
3893 | 3893 | $sqlsearchpackage .= " AND fk_product = " . ((int) $objp->fk_product); |
3894 | 3894 | $sqlsearchpackage .= " AND ref_fourn = '" . $this->db->escape($objp->ref_supplier) . "'"; |
3895 | - $sqlsearchpackage .= " AND quantity <= " . ((float) $objp->qty); // required to be qualified |
|
3896 | - $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= " . ((float) $objp->qty) . ")"; // required to be qualified |
|
3895 | + $sqlsearchpackage .= " AND quantity <= " . ((float) $objp->qty); // required to be qualified |
|
3896 | + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= " . ((float) $objp->qty) . ")"; // required to be qualified |
|
3897 | 3897 | $sqlsearchpackage .= " AND fk_soc = " . ((int) $objp->socid); |
3898 | - $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
3898 | + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
3899 | 3899 | $sqlsearchpackage .= " LIMIT 1"; |
3900 | 3900 | |
3901 | 3901 | $resqlsearchpackage = $this->db->query($sqlsearchpackage); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | /** |
228 | 228 | * @var int ID |
229 | 229 | */ |
230 | - public $fk_account; // default bank account |
|
230 | + public $fk_account; // default bank account |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * @var int Transport mode id |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $this->location_incoterms = $_facrec->location_incoterms; |
464 | 464 | |
465 | 465 | // Clean parameters |
466 | - if (! $this->type) { |
|
466 | + if (!$this->type) { |
|
467 | 467 | $this->type = self::TYPE_STANDARD; |
468 | 468 | } |
469 | 469 | if (!empty(GETPOST('ref_supplier'))) { |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | |
478 | 478 | $this->array_options = $_facrec->array_options; |
479 | 479 | |
480 | - if (! $this->mode_reglement_id) { |
|
480 | + if (!$this->mode_reglement_id) { |
|
481 | 481 | $this->mode_reglement_id = 0; |
482 | 482 | } |
483 | 483 | $this->status = self::STATUS_DRAFT; |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | /* |
727 | 727 | * Insert lines of template invoices |
728 | 728 | */ |
729 | - if (! $error && $this->fac_rec > 0 && $_facrec instanceof FactureFournisseurRec) { |
|
729 | + if (!$error && $this->fac_rec > 0 && $_facrec instanceof FactureFournisseurRec) { |
|
730 | 730 | foreach ($_facrec->lines as $i => $val) { |
731 | 731 | if ($_facrec->lines[$i]->fk_product) { |
732 | 732 | $prod = new Product($this->db); |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $buyprice = empty($_facrec->lines[$i]->buyprice) ? 0 : $_facrec->lines[$i]->buyprice; |
754 | 754 | |
755 | 755 | // If buyprice not defined from template invoice, we try to guess the best value |
756 | - if (! $buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
756 | + if (!$buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
757 | 757 | require_once constant('DOL_DOCUMENT_ROOT') . '/fourn/class/fournisseur.product.class.php'; |
758 | 758 | $producttmp = new ProductFournisseur($this->db); |
759 | 759 | $producttmp->fetch($_facrec->lines[$i]->fk_product); |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | |
1005 | 1005 | $this->extraparams = isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); |
1006 | 1006 | |
1007 | - $this->socid = $obj->socid; |
|
1007 | + $this->socid = $obj->socid; |
|
1008 | 1008 | |
1009 | 1009 | // Retrieve all extrafield |
1010 | 1010 | // fetch optionals attributes and labels |
@@ -2278,7 +2278,7 @@ discard block |
||
2278 | 2278 | // Multicurrency |
2279 | 2279 | $supplierinvoiceline->fk_multicurrency = $this->fk_multicurrency; |
2280 | 2280 | $supplierinvoiceline->multicurrency_code = $this->multicurrency_code; |
2281 | - $supplierinvoiceline->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise |
|
2281 | + $supplierinvoiceline->multicurrency_subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht_devise) : $pu_ht_devise); // For credit note, unit price always negative, always positive otherwise |
|
2282 | 2282 | |
2283 | 2283 | $supplierinvoiceline->multicurrency_total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_ht) : $multicurrency_total_ht); // For credit note and if qty is negative, total is negative |
2284 | 2284 | $supplierinvoiceline->multicurrency_total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ? -abs($multicurrency_total_tva) : $multicurrency_total_tva); // For credit note and if qty is negative, total is negative |
@@ -2444,7 +2444,7 @@ discard block |
||
2444 | 2444 | |
2445 | 2445 | $line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs((float) $qty) : $qty); // For credit note, quantity is always positive and unit price negative |
2446 | 2446 | $line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise |
2447 | - $line->pu_ht = $line->subprice; // deprecated |
|
2447 | + $line->pu_ht = $line->subprice; // deprecated |
|
2448 | 2448 | $line->pu_ttc = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ttc) : $pu_ttc); // For credit note, unit price always negative, always positive otherwise |
2449 | 2449 | |
2450 | 2450 | $line->remise_percent = $remise_percent; |
@@ -2729,7 +2729,7 @@ discard block |
||
2729 | 2729 | |
2730 | 2730 | while ($obj = $this->db->fetch_object($resql)) { |
2731 | 2731 | $facturestatic->date_echeance = $this->db->jdate($obj->datefin); |
2732 | - $facturestatic->statut = $obj->status; // For backward compatibility |
|
2732 | + $facturestatic->statut = $obj->status; // For backward compatibility |
|
2733 | 2733 | $facturestatic->status = $obj->status; |
2734 | 2734 | |
2735 | 2735 | $response->nbtodo++; |
@@ -3164,15 +3164,15 @@ discard block |
||
3164 | 3164 | // Load source object |
3165 | 3165 | $object->fetch($fromid); |
3166 | 3166 | $object->id = 0; |
3167 | - $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
3167 | + $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
3168 | 3168 | $object->status = self::STATUS_DRAFT; |
3169 | 3169 | |
3170 | 3170 | $object->fetch_thirdparty(); // We need it to recalculate VAT localtaxes according to main sale taxes and vendor |
3171 | 3171 | |
3172 | 3172 | // Clear fields |
3173 | 3173 | $object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf") . ' ' . $object->ref_supplier : $this->ref_supplier); |
3174 | - $object->author = $user->id; // FIXME? user_validation_id is replacement for author |
|
3175 | - $object->user_validation_id = 0; // FIXME? user_validation_id is replacement for author |
|
3174 | + $object->author = $user->id; // FIXME? user_validation_id is replacement for author |
|
3175 | + $object->user_validation_id = 0; // FIXME? user_validation_id is replacement for author |
|
3176 | 3176 | $object->fk_facture_source = 0; |
3177 | 3177 | $object->date_creation = ''; |
3178 | 3178 | $object->date_validation = ''; |
@@ -3475,14 +3475,14 @@ discard block |
||
3475 | 3475 | if (!empty($paymentmode) && $paymentmode != 'all') { |
3476 | 3476 | $sql .= ", " . MAIN_DB_PREFIX . "c_paiement as cp"; |
3477 | 3477 | } |
3478 | - $sql .= " WHERE f.paye = 0"; // Only unpaid |
|
3479 | - $sql .= " AND f.fk_statut = " . self::STATUS_VALIDATED; // Only validated status |
|
3478 | + $sql .= " WHERE f.paye = 0"; // Only unpaid |
|
3479 | + $sql .= " AND f.fk_statut = " . self::STATUS_VALIDATED; // Only validated status |
|
3480 | 3480 | if ($datetouse == 'invoicedate') { |
3481 | 3481 | $sql .= " AND f.datef = '" . $this->db->idate($tmpidate, 'gmt') . "'"; |
3482 | 3482 | } else { |
3483 | 3483 | $sql .= " AND f.date_lim_reglement = '" . $this->db->idate($tmpidate, 'gmt') . "'"; |
3484 | 3484 | } |
3485 | - $sql .= " AND f.entity IN (" . getEntity('supplier_invoice', 0) . ")"; // One batch process only one company (no sharing) |
|
3485 | + $sql .= " AND f.entity IN (" . getEntity('supplier_invoice', 0) . ")"; // One batch process only one company (no sharing) |
|
3486 | 3486 | if (!empty($paymentmode) && $paymentmode != 'all') { |
3487 | 3487 | $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '" . $this->db->escape($paymentmode) . "'"; |
3488 | 3488 | } |
@@ -3702,7 +3702,7 @@ discard block |
||
3702 | 3702 | $actioncomm->create($user); |
3703 | 3703 | } |
3704 | 3704 | |
3705 | - $this->db->commit(); // We always commit |
|
3705 | + $this->db->commit(); // We always commit |
|
3706 | 3706 | } |
3707 | 3707 | |
3708 | 3708 | if ($errormesg) { |
@@ -4377,8 +4377,7 @@ discard block |
||
4377 | 4377 | $sql .= " " . ($this->fk_parent_line > 0 ? "'" . $this->db->escape($this->fk_parent_line) . "'" : "null") . ","; |
4378 | 4378 | $product_label |
4379 | 4379 | = !empty($this->product_label) |
4380 | - ? $this->product_label : |
|
4381 | - (!empty($this->label) ? $this->label : null); |
|
4380 | + ? $this->product_label : (!empty($this->label) ? $this->label : null); |
|
4382 | 4381 | $sql .= " " . (!empty($product_label) ? "'" . $this->db->escape($product_label) . "'" : "null") . ","; |
4383 | 4382 | $sql .= " '" . $this->db->escape($this->desc ? $this->desc : $this->description) . "',"; |
4384 | 4383 | $sql .= " '" . $this->db->escape($this->ref_supplier) . "',"; |
@@ -143,7 +143,7 @@ |
||
143 | 143 | $this->note_private = $obj->note; |
144 | 144 | $this->type_code = $obj->payment_code; |
145 | 145 | $this->type_label = $obj->payment_type; |
146 | - $this->fk_paiement = $obj->fk_paiement; |
|
146 | + $this->fk_paiement = $obj->fk_paiement; |
|
147 | 147 | $this->statut = $obj->statut; |
148 | 148 | |
149 | 149 | $error = 1; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public $fourn_remise; |
139 | 139 | |
140 | - public $fourn_charges; // when getDolGlobalString('PRODUCT_CHARGES') is set |
|
140 | + public $fourn_charges; // when getDolGlobalString('PRODUCT_CHARGES') is set |
|
141 | 141 | |
142 | 142 | /** |
143 | 143 | * @var int product-supplier id |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public $fk_availability; |
158 | 158 | |
159 | 159 | public $fourn_unitprice; |
160 | - public $fourn_unitprice_with_discount; // not saved into database |
|
160 | + public $fourn_unitprice_with_discount; // not saved into database |
|
161 | 161 | public $fourn_tva_tx; |
162 | 162 | public $fourn_tva_npr; |
163 | 163 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | } |
476 | 476 | $sql = "UPDATE " . MAIN_DB_PREFIX . "product_fournisseur_price"; |
477 | 477 | $sql .= " SET fk_user = " . ((int) $user->id) . " ,"; |
478 | - $sql .= " datec = '" . $this->db->idate($now) . "' ,"; // Note: Even if this is an update, we update the creation date as the log of each change is tracked into product_fournisseur_log. |
|
478 | + $sql .= " datec = '" . $this->db->idate($now) . "' ,"; // Note: Even if this is an update, we update the creation date as the log of each change is tracked into product_fournisseur_log. |
|
479 | 479 | $sql .= " ref_fourn = '" . $this->db->escape($ref_fourn) . "',"; |
480 | 480 | $sql .= " desc_fourn = '" . $this->db->escape($desc_fourn) . "',"; |
481 | 481 | $sql .= " price = " . ((float) $buyprice) . ","; |
@@ -825,10 +825,10 @@ discard block |
||
825 | 825 | $prodfourn->fourn_tva_tx = $record["tva_tx"]; |
826 | 826 | $prodfourn->fourn_id = $record["fourn_id"]; |
827 | 827 | $prodfourn->fourn_name = $record["supplier_name"]; |
828 | - $prodfourn->fk_availability = $record["fk_availability"]; |
|
828 | + $prodfourn->fk_availability = $record["fk_availability"]; |
|
829 | 829 | $prodfourn->delivery_time_days = $record["delivery_time_days"]; |
830 | 830 | $prodfourn->id = $prodid; |
831 | - $prodfourn->fourn_tva_npr = $record["info_bits"]; |
|
831 | + $prodfourn->fourn_tva_npr = $record["info_bits"]; |
|
832 | 832 | $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; |
833 | 833 | $prodfourn->supplier_reputation = $record["supplier_reputation"]; |
834 | 834 | $prodfourn->fourn_date_creation = $this->db->jdate($record['datec']); |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | $idprod = GETPOSTINT('idprod'); |
447 | 447 | } |
448 | 448 | |
449 | - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
449 | + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
450 | 450 | |
451 | 451 | $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); |
452 | 452 | $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); |
1250 | 1250 | $object->fk_account = GETPOSTINT('fk_account'); |
1251 | 1251 | $object->note_private = GETPOST('note_private', 'restricthtml'); |
1252 | - $object->note_public = GETPOST('note_public', 'restricthtml'); |
|
1252 | + $object->note_public = GETPOST('note_public', 'restricthtml'); |
|
1253 | 1253 | $object->delivery_date = $datelivraison; |
1254 | 1254 | $object->fk_incoterms = GETPOSTINT('incoterm_id'); |
1255 | 1255 | $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); |
@@ -1685,7 +1685,7 @@ discard block |
||
1685 | 1685 | $demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0)); |
1686 | 1686 | //$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0)); |
1687 | 1687 | //$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); |
1688 | - $dateinvoice = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : ''; |
|
1688 | + $dateinvoice = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : ''; |
|
1689 | 1689 | |
1690 | 1690 | $datedelivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); |
1691 | 1691 | |
@@ -1801,7 +1801,7 @@ discard block |
||
1801 | 1801 | // Payment term |
1802 | 1802 | print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td>'; |
1803 | 1803 | print img_picto('', 'payment', 'class="pictofixedwidth"'); |
1804 | - print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); |
|
1804 | + print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); |
|
1805 | 1805 | print '</td></tr>'; |
1806 | 1806 | |
1807 | 1807 | // Payment mode |
@@ -2051,7 +2051,7 @@ discard block |
||
2051 | 2051 | 'morecss' => 'minwidth300' |
2052 | 2052 | ) |
2053 | 2053 | ); |
2054 | - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . "?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1); |
|
2054 | + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . "?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1); |
|
2055 | 2055 | } |
2056 | 2056 | |
2057 | 2057 | // Confirmation of cancellation |