@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | public $fin_validite; // code |
195 | 195 | public $user_author_id; // label |
196 | 196 | /** |
197 | - * @deprecated |
|
198 | - * @see $total_ht |
|
199 | - */ |
|
197 | + * @deprecated |
|
198 | + * @see $total_ht |
|
199 | + */ |
|
200 | 200 | public $price; // label doc |
201 | 201 | /** |
202 | 202 | * @deprecated |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public $tva; // code |
206 | 206 | /** |
207 | - * @deprecated |
|
208 | - * @see $total_ttc |
|
209 | - */ |
|
207 | + * @deprecated |
|
208 | + * @see $total_ttc |
|
209 | + */ |
|
210 | 210 | public $total; // label |
211 | 211 | public $cond_reglement_code; |
212 | 212 | public $cond_reglement; |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public $availability_id; // id |
228 | 228 | /** |
229 | - * @var int availability ID |
|
230 | - * @deprecated |
|
231 | - * @see $availability_id |
|
232 | - */ |
|
229 | + * @var int availability ID |
|
230 | + * @deprecated |
|
231 | + * @see $availability_id |
|
232 | + */ |
|
233 | 233 | public $fk_availability; // code |
234 | 234 | /** |
235 | - * @var string availability code |
|
236 | - */ |
|
235 | + * @var string availability code |
|
236 | + */ |
|
237 | 237 | public $availability_code; // label |
238 | 238 | /** |
239 | 239 | * @var string availability label |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 900), |
339 | 339 | ); |
340 | 340 | /** |
341 | - * {@inheritdoc} |
|
342 | - */ |
|
341 | + * {@inheritdoc} |
|
342 | + */ |
|
343 | 343 | protected $table_ref_field = 'ref'; // Todo rename into STATUS_CLOSE ? |
344 | 344 | |
345 | 345 | /** |
@@ -191,23 +191,23 @@ discard block |
||
191 | 191 | * @var integer|string $delivery_date ; |
192 | 192 | */ |
193 | 193 | public $delivery_date; |
194 | - public $fin_validite; // code |
|
195 | - public $user_author_id; // label |
|
194 | + public $fin_validite; // code |
|
195 | + public $user_author_id; // label |
|
196 | 196 | /** |
197 | 197 | * @deprecated |
198 | 198 | * @see $total_ht |
199 | 199 | */ |
200 | - public $price; // label doc |
|
200 | + public $price; // label doc |
|
201 | 201 | /** |
202 | 202 | * @deprecated |
203 | 203 | * @see $total_tva |
204 | 204 | */ |
205 | - public $tva; // code |
|
205 | + public $tva; // code |
|
206 | 206 | /** |
207 | 207 | * @deprecated |
208 | 208 | * @see $total_ttc |
209 | 209 | */ |
210 | - public $total; // label |
|
210 | + public $total; // label |
|
211 | 211 | public $cond_reglement_code; |
212 | 212 | public $cond_reglement; |
213 | 213 | public $cond_reglement_doc; |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | /** |
225 | 225 | * @var int availability ID |
226 | 226 | */ |
227 | - public $availability_id; // id |
|
227 | + public $availability_id; // id |
|
228 | 228 | /** |
229 | 229 | * @var int availability ID |
230 | 230 | * @deprecated |
231 | 231 | * @see $availability_id |
232 | 232 | */ |
233 | - public $fk_availability; // code |
|
233 | + public $fk_availability; // code |
|
234 | 234 | /** |
235 | 235 | * @var string availability code |
236 | 236 | */ |
237 | - public $availability_code; // label |
|
237 | + public $availability_code; // label |
|
238 | 238 | /** |
239 | 239 | * @var string availability label |
240 | 240 | */ |
@@ -513,14 +513,14 @@ discard block |
||
513 | 513 | |
514 | 514 | if (!empty($ref)) { |
515 | 515 | if (!empty($forceentity)) { |
516 | - $sql .= " WHERE p.entity = " . (int)$forceentity; // Check only the current entity because we may have the same reference in several entities |
|
516 | + $sql .= " WHERE p.entity = " . (int) $forceentity; // Check only the current entity because we may have the same reference in several entities |
|
517 | 517 | } else { |
518 | 518 | $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")"; |
519 | 519 | } |
520 | 520 | $sql .= " AND p.ref='" . $this->db->escape($ref) . "'"; |
521 | 521 | } else { |
522 | 522 | // Don't use entity if you use rowid |
523 | - $sql .= " WHERE p.rowid = " . ((int)$rowid); |
|
523 | + $sql .= " WHERE p.rowid = " . ((int) $rowid); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | $this->ref_customer = $obj->ref_client; |
538 | 538 | $this->ref_ext = $obj->ref_ext; |
539 | 539 | |
540 | - $this->total = $obj->total_ttc; // TODO deprecated |
|
540 | + $this->total = $obj->total_ttc; // TODO deprecated |
|
541 | 541 | $this->total_ttc = $obj->total_ttc; |
542 | 542 | $this->total_ht = $obj->total_ht; |
543 | 543 | $this->total_tva = $obj->total_tva; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | $this->note_private = $obj->note_private; |
557 | 557 | $this->note_public = $obj->note_public; |
558 | 558 | |
559 | - $this->status = (int)$obj->fk_statut; |
|
559 | + $this->status = (int) $obj->fk_statut; |
|
560 | 560 | $this->statut = $this->status; // deprecated |
561 | 561 | |
562 | 562 | $this->datec = $this->db->jdate($obj->datec); // TODO deprecated |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; |
590 | 590 | $this->deposit_percent = $obj->deposit_percent; |
591 | 591 | |
592 | - $this->extraparams = !empty($obj->extraparams) ? (array)json_decode($obj->extraparams, true) : array(); |
|
592 | + $this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); |
|
593 | 593 | |
594 | 594 | $this->user_author_id = $obj->fk_user_author; |
595 | 595 | $this->user_validation_id = $obj->fk_user_valid; |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $sql .= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; |
656 | 656 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'propaldet as d'; |
657 | 657 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON (d.fk_product = p.rowid)'; |
658 | - $sql .= ' WHERE d.fk_propal = ' . ((int)$this->id); |
|
658 | + $sql .= ' WHERE d.fk_propal = ' . ((int) $this->id); |
|
659 | 659 | if ($only_product) { |
660 | 660 | $sql .= ' AND p.fk_product_type = 0'; |
661 | 661 | } |
@@ -875,10 +875,10 @@ discard block |
||
875 | 875 | |
876 | 876 | // Clean parameters |
877 | 877 | $remise_percent = price2num($remise_percent); |
878 | - $qty = (float)price2num($qty); |
|
878 | + $qty = (float) price2num($qty); |
|
879 | 879 | $pu = price2num($pu); |
880 | 880 | $pu_ht_devise = price2num($pu_ht_devise); |
881 | - if (!preg_match('/\((.*)\)/', (string)$txtva)) { |
|
881 | + if (!preg_match('/\((.*)\)/', (string) $txtva)) { |
|
882 | 882 | $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' |
883 | 883 | } |
884 | 884 | $txlocaltax1 = price2num($txlocaltax1); |
@@ -939,9 +939,9 @@ discard block |
||
939 | 939 | // Anciens indicateurs: $price, $remise (a ne plus utiliser) |
940 | 940 | $price = $pu; |
941 | 941 | $remise = 0; |
942 | - if ((float)$remise_percent > 0) { |
|
943 | - $remise = round(((float)$pu * (float)$remise_percent / 100), 2); |
|
944 | - $price = (float)$pu - $remise; |
|
942 | + if ((float) $remise_percent > 0) { |
|
943 | + $remise = round(((float) $pu * (float) $remise_percent / 100), 2); |
|
944 | + $price = (float) $pu - $remise; |
|
945 | 945 | } |
946 | 946 | |
947 | 947 | //Fetch current line from the database and then clone the object and set it in $oldline property |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | $sql .= " note_public=" . (isset($this->note_public) ? "'" . $this->db->escape($this->note_public) . "'" : "null") . ","; |
1100 | 1100 | $sql .= " model_pdf=" . (isset($this->model_pdf) ? "'" . $this->db->escape($this->model_pdf) . "'" : "null") . ","; |
1101 | 1101 | $sql .= " import_key=" . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null"); |
1102 | - $sql .= " WHERE rowid=" . ((int)$this->id); |
|
1102 | + $sql .= " WHERE rowid=" . ((int) $this->id); |
|
1103 | 1103 | |
1104 | 1104 | $this->db->begin(); |
1105 | 1105 | |
@@ -1218,8 +1218,8 @@ discard block |
||
1218 | 1218 | // Delete extrafields of lines and lines |
1219 | 1219 | if (!$error && !empty($this->table_element_line)) { |
1220 | 1220 | $tabletodelete = $this->table_element_line; |
1221 | - $sqlef = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . "_extrafields WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int)$this->id) . ")"; |
|
1222 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
1221 | + $sqlef = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . "_extrafields WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int) $this->id) . ")"; |
|
1222 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
1223 | 1223 | if (!$this->db->query($sqlef) || !$this->db->query($sql)) { |
1224 | 1224 | $error++; |
1225 | 1225 | $this->error = $this->db->lasterror(); |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | |
1256 | 1256 | // Delete main record |
1257 | 1257 | if (!$error) { |
1258 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int)$this->id); |
|
1258 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int) $this->id); |
|
1259 | 1259 | $res = $this->db->query($sql); |
1260 | 1260 | if (!$res) { |
1261 | 1261 | $error++; |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | } |
1292 | 1292 | } |
1293 | 1293 | if (file_exists($dir)) { |
1294 | - $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables |
|
1294 | + $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables |
|
1295 | 1295 | if (!$res) { |
1296 | 1296 | $this->error = 'ErrorFailToDeleteDir'; |
1297 | 1297 | $this->errors[] = $this->error; |
@@ -1612,15 +1612,15 @@ discard block |
||
1612 | 1612 | $sql .= ", '" . $this->db->idate($this->date) . "'"; |
1613 | 1613 | $sql .= ", '" . $this->db->idate($now) . "'"; |
1614 | 1614 | $sql .= ", '(PROV)'"; |
1615 | - $sql .= ", " . ($user->id > 0 ? ((int)$user->id) : "NULL"); |
|
1615 | + $sql .= ", " . ($user->id > 0 ? ((int) $user->id) : "NULL"); |
|
1616 | 1616 | $sql .= ", '" . $this->db->escape($this->note_private) . "'"; |
1617 | 1617 | $sql .= ", '" . $this->db->escape($this->note_public) . "'"; |
1618 | 1618 | $sql .= ", '" . $this->db->escape($this->model_pdf) . "'"; |
1619 | 1619 | $sql .= ", " . ($this->fin_validite != '' ? "'" . $this->db->idate($this->fin_validite) . "'" : "NULL"); |
1620 | - $sql .= ", " . ($this->cond_reglement_id > 0 ? ((int)$this->cond_reglement_id) : 'NULL'); |
|
1620 | + $sql .= ", " . ($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : 'NULL'); |
|
1621 | 1621 | $sql .= ", " . (!empty($this->deposit_percent) ? "'" . $this->db->escape($this->deposit_percent) . "'" : 'NULL'); |
1622 | - $sql .= ", " . ($this->mode_reglement_id > 0 ? ((int)$this->mode_reglement_id) : 'NULL'); |
|
1623 | - $sql .= ", " . ($this->fk_account > 0 ? ((int)$this->fk_account) : 'NULL'); |
|
1622 | + $sql .= ", " . ($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL'); |
|
1623 | + $sql .= ", " . ($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL'); |
|
1624 | 1624 | $sql .= ", '" . $this->db->escape($this->ref_client) . "'"; |
1625 | 1625 | $sql .= ", '" . $this->db->escape($this->ref_ext) . "'"; |
1626 | 1626 | $sql .= ", " . (empty($delivery_date) ? "NULL" : "'" . $this->db->idate($delivery_date) . "'"); |
@@ -1629,12 +1629,12 @@ discard block |
||
1629 | 1629 | $sql .= ", " . $this->availability_id; |
1630 | 1630 | $sql .= ", " . $this->demand_reason_id; |
1631 | 1631 | $sql .= ", " . ($this->fk_project ? $this->fk_project : "null"); |
1632 | - $sql .= ", " . (int)$this->fk_incoterms; |
|
1632 | + $sql .= ", " . (int) $this->fk_incoterms; |
|
1633 | 1633 | $sql .= ", '" . $this->db->escape($this->location_incoterms) . "'"; |
1634 | 1634 | $sql .= ", " . setEntity($this); |
1635 | - $sql .= ", " . (int)$this->fk_multicurrency; |
|
1635 | + $sql .= ", " . (int) $this->fk_multicurrency; |
|
1636 | 1636 | $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
1637 | - $sql .= ", " . (float)$this->multicurrency_tx; |
|
1637 | + $sql .= ", " . (float) $this->multicurrency_tx; |
|
1638 | 1638 | $sql .= ")"; |
1639 | 1639 | |
1640 | 1640 | dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | |
1645 | 1645 | if ($this->id) { |
1646 | 1646 | $this->ref = '(PROV' . $this->id . ')'; |
1647 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . "propal SET ref='" . $this->db->escape($this->ref) . "' WHERE rowid=" . ((int)$this->id); |
|
1647 | + $sql = 'UPDATE ' . MAIN_DB_PREFIX . "propal SET ref='" . $this->db->escape($this->ref) . "' WHERE rowid=" . ((int) $this->id); |
|
1648 | 1648 | |
1649 | 1649 | dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
1650 | 1650 | $resql = $this->db->query($sql); |
@@ -1689,7 +1689,7 @@ discard block |
||
1689 | 1689 | for ($i = 0; $i < $num; $i++) { |
1690 | 1690 | if (!is_object($this->lines[$i])) { // If this->lines is not array of objects, coming from REST API |
1691 | 1691 | // Convert into object this->lines[$i]. |
1692 | - $line = (object)$this->lines[$i]; |
|
1692 | + $line = (object) $this->lines[$i]; |
|
1693 | 1693 | } else { |
1694 | 1694 | $line = $this->lines[$i]; |
1695 | 1695 | } |
@@ -1882,11 +1882,11 @@ discard block |
||
1882 | 1882 | } |
1883 | 1883 | |
1884 | 1884 | $remise_percent = price2num($remise_percent); |
1885 | - $qty = (float)price2num($qty); |
|
1885 | + $qty = (float) price2num($qty); |
|
1886 | 1886 | $pu_ht = price2num($pu_ht); |
1887 | 1887 | $pu_ht_devise = price2num($pu_ht_devise); |
1888 | 1888 | $pu_ttc = price2num($pu_ttc); |
1889 | - if (!preg_match('/\((.*)\)/', (string)$txtva)) { |
|
1889 | + if (!preg_match('/\((.*)\)/', (string) $txtva)) { |
|
1890 | 1890 | $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' |
1891 | 1891 | } |
1892 | 1892 | $txlocaltax1 = price2num($txlocaltax1); |
@@ -1968,9 +1968,9 @@ discard block |
||
1968 | 1968 | // Anciens indicateurs: $price, $remise (a ne plus utiliser) |
1969 | 1969 | $price = $pu; |
1970 | 1970 | $remise = 0; |
1971 | - if ((float)$remise_percent > 0) { |
|
1972 | - $remise = round(((float)$pu * (float)$remise_percent / 100), 2); |
|
1973 | - $price = (float)$pu - $remise; |
|
1971 | + if ((float) $remise_percent > 0) { |
|
1972 | + $remise = round(((float) $pu * (float) $remise_percent / 100), 2); |
|
1973 | + $price = (float) $pu - $remise; |
|
1974 | 1974 | } |
1975 | 1975 | |
1976 | 1976 | // Insert line |
@@ -2121,8 +2121,8 @@ discard block |
||
2121 | 2121 | |
2122 | 2122 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2123 | 2123 | $sql .= " SET ref = '" . $this->db->escape($num) . "',"; |
2124 | - $sql .= " fk_statut = " . self::STATUS_VALIDATED . ", date_valid='" . $this->db->idate($now) . "', fk_user_valid=" . ((int)$user->id); |
|
2125 | - $sql .= " WHERE rowid = " . ((int)$this->id) . " AND fk_statut = " . self::STATUS_DRAFT; |
|
2124 | + $sql .= " fk_statut = " . self::STATUS_VALIDATED . ", date_valid='" . $this->db->idate($now) . "', fk_user_valid=" . ((int) $user->id); |
|
2125 | + $sql .= " WHERE rowid = " . ((int) $this->id) . " AND fk_statut = " . self::STATUS_DRAFT; |
|
2126 | 2126 | |
2127 | 2127 | dol_syslog(get_class($this) . "::valid", LOG_DEBUG); |
2128 | 2128 | $resql = $this->db->query($sql); |
@@ -2148,7 +2148,7 @@ discard block |
||
2148 | 2148 | if (preg_match('/^[\(]?PROV/i', $this->ref)) { |
2149 | 2149 | // Now we rename also files into index |
2150 | 2150 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'propale/" . $this->db->escape($this->newref) . "'"; |
2151 | - $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'propale/" . $this->db->escape($this->ref) . "' and entity = " . ((int)$conf->entity); |
|
2151 | + $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'propale/" . $this->db->escape($this->ref) . "' and entity = " . ((int) $conf->entity); |
|
2152 | 2152 | $resql = $this->db->query($sql); |
2153 | 2153 | if (!$resql) { |
2154 | 2154 | $error++; |
@@ -2219,12 +2219,12 @@ discard block |
||
2219 | 2219 | $file = $classname . ".php"; |
2220 | 2220 | |
2221 | 2221 | // Include file with class |
2222 | - $dirmodels = array_merge(array('/'), (array)$conf->modules_parts['models']); |
|
2222 | + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
|
2223 | 2223 | foreach ($dirmodels as $reldir) { |
2224 | 2224 | $dir = dol_buildpath($reldir . "core/modules/propale/"); |
2225 | 2225 | |
2226 | 2226 | // Load file with numbering class (if found) |
2227 | - $mybool = ((bool)@include_once $dir . $file) || $mybool; |
|
2227 | + $mybool = ((bool) @include_once $dir . $file) || $mybool; |
|
2228 | 2228 | } |
2229 | 2229 | |
2230 | 2230 | if (!$mybool) { |
@@ -2275,7 +2275,7 @@ discard block |
||
2275 | 2275 | $this->db->begin(); |
2276 | 2276 | |
2277 | 2277 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET datep = '" . $this->db->idate($date) . "'"; |
2278 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2278 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2279 | 2279 | |
2280 | 2280 | dol_syslog(__METHOD__, LOG_DEBUG); |
2281 | 2281 | $resql = $this->db->query($sql); |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | $this->db->begin(); |
2335 | 2335 | |
2336 | 2336 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET fin_validite = " . ($date_end_validity != '' ? "'" . $this->db->idate($date_end_validity) . "'" : 'null'); |
2337 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2337 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2338 | 2338 | |
2339 | 2339 | dol_syslog(__METHOD__, LOG_DEBUG); |
2340 | 2340 | |
@@ -2409,7 +2409,7 @@ discard block |
||
2409 | 2409 | |
2410 | 2410 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal "; |
2411 | 2411 | $sql .= " SET date_livraison = " . ($delivery_date != '' ? "'" . $this->db->idate($delivery_date) . "'" : 'null'); |
2412 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2412 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2413 | 2413 | |
2414 | 2414 | dol_syslog(__METHOD__, LOG_DEBUG); |
2415 | 2415 | $resql = $this->db->query($sql); |
@@ -2465,8 +2465,8 @@ discard block |
||
2465 | 2465 | $this->db->begin(); |
2466 | 2466 | |
2467 | 2467 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2468 | - $sql .= " SET fk_availability = " . ((int)$id); |
|
2469 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2468 | + $sql .= " SET fk_availability = " . ((int) $id); |
|
2469 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2470 | 2470 | |
2471 | 2471 | dol_syslog(__METHOD__ . ' availability(' . $id . ')', LOG_DEBUG); |
2472 | 2472 | $resql = $this->db->query($sql); |
@@ -2527,8 +2527,8 @@ discard block |
||
2527 | 2527 | $this->db->begin(); |
2528 | 2528 | |
2529 | 2529 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal "; |
2530 | - $sql .= " SET fk_input_reason = " . ((int)$id); |
|
2531 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2530 | + $sql .= " SET fk_input_reason = " . ((int) $id); |
|
2531 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2532 | 2532 | |
2533 | 2533 | dol_syslog(__METHOD__, LOG_DEBUG); |
2534 | 2534 | $resql = $this->db->query($sql); |
@@ -2591,7 +2591,7 @@ discard block |
||
2591 | 2591 | $this->db->begin(); |
2592 | 2592 | |
2593 | 2593 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET ref_client = " . (empty($ref_client) ? 'NULL' : "'" . $this->db->escape($ref_client) . "'"); |
2594 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2594 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2595 | 2595 | |
2596 | 2596 | dol_syslog(__METHOD__ . ' $this->id=' . $this->id . ', ref_client=' . $ref_client, LOG_DEBUG); |
2597 | 2597 | $resql = $this->db->query($sql); |
@@ -2646,12 +2646,12 @@ discard block |
||
2646 | 2646 | $error = 0; |
2647 | 2647 | |
2648 | 2648 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2649 | - $sql .= " SET fk_statut = " . ((int)$status) . ","; |
|
2649 | + $sql .= " SET fk_statut = " . ((int) $status) . ","; |
|
2650 | 2650 | if (!empty($note)) { |
2651 | 2651 | $sql .= " note_private = '" . $this->db->escape($note) . "',"; |
2652 | 2652 | } |
2653 | 2653 | $sql .= " date_cloture=NULL, fk_user_cloture=NULL"; |
2654 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2654 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2655 | 2655 | |
2656 | 2656 | $this->db->begin(); |
2657 | 2657 | |
@@ -2729,17 +2729,17 @@ discard block |
||
2729 | 2729 | } |
2730 | 2730 | |
2731 | 2731 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2732 | - $sql .= " SET fk_statut = " . ((int)$status) . ", note_private = '" . $this->db->escape($newprivatenote) . "', date_signature='" . $this->db->idate($date_signature) . "', fk_user_signature=" . $fk_user_signature; |
|
2733 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2732 | + $sql .= " SET fk_statut = " . ((int) $status) . ", note_private = '" . $this->db->escape($newprivatenote) . "', date_signature='" . $this->db->idate($date_signature) . "', fk_user_signature=" . $fk_user_signature; |
|
2733 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2734 | 2734 | |
2735 | 2735 | $resql = $this->db->query($sql); |
2736 | 2736 | if ($resql) { |
2737 | 2737 | // Status self::STATUS_REFUSED by default |
2738 | 2738 | $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED', $this->model_pdf); |
2739 | - $trigger_name = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() |
|
2739 | + $trigger_name = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() |
|
2740 | 2740 | |
2741 | 2741 | if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED |
2742 | - $trigger_name = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger() |
|
2742 | + $trigger_name = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger() |
|
2743 | 2743 | $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL') ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL : $this->model_pdf; |
2744 | 2744 | |
2745 | 2745 | // The connected company is classified as a client |
@@ -2820,7 +2820,7 @@ discard block |
||
2820 | 2820 | $sql .= " c.datec, c.date_valid as datev, c.date_signature, c.date_cloture,"; |
2821 | 2821 | $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_signature, c.fk_user_cloture"; |
2822 | 2822 | $sql .= " FROM " . MAIN_DB_PREFIX . "propal as c"; |
2823 | - $sql .= " WHERE c.rowid = " . ((int)$id); |
|
2823 | + $sql .= " WHERE c.rowid = " . ((int) $id); |
|
2824 | 2824 | |
2825 | 2825 | $result = $this->db->query($sql); |
2826 | 2826 | |
@@ -2911,8 +2911,8 @@ discard block |
||
2911 | 2911 | $newprivatenote = dol_concatdesc($this->note_private, $note); |
2912 | 2912 | |
2913 | 2913 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal SET fk_statut = ' . self::STATUS_BILLED . ", "; |
2914 | - $sql .= " note_private = '" . $this->db->escape($newprivatenote) . "', date_cloture='" . $this->db->idate($now) . "', fk_user_cloture=" . ((int)$user->id); |
|
2915 | - $sql .= ' WHERE rowid = ' . ((int)$this->id) . ' AND fk_statut = ' . ((int)self::STATUS_SIGNED); |
|
2914 | + $sql .= " note_private = '" . $this->db->escape($newprivatenote) . "', date_cloture='" . $this->db->idate($now) . "', fk_user_cloture=" . ((int) $user->id); |
|
2915 | + $sql .= ' WHERE rowid = ' . ((int) $this->id) . ' AND fk_statut = ' . ((int) self::STATUS_SIGNED); |
|
2916 | 2916 | |
2917 | 2917 | dol_syslog(__METHOD__, LOG_DEBUG); |
2918 | 2918 | $resql = $this->db->query($sql); |
@@ -2986,8 +2986,8 @@ discard block |
||
2986 | 2986 | |
2987 | 2987 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2988 | 2988 | $sql .= " SET fk_statut = " . self::STATUS_CANCELED . ","; |
2989 | - $sql .= " fk_user_modif = " . ((int)$user->id); |
|
2990 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2989 | + $sql .= " fk_user_modif = " . ((int) $user->id); |
|
2990 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2991 | 2991 | |
2992 | 2992 | dol_syslog(get_class($this) . "::cancel", LOG_DEBUG); |
2993 | 2993 | if ($this->db->query($sql)) { |
@@ -3045,7 +3045,7 @@ discard block |
||
3045 | 3045 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
3046 | 3046 | $sql .= " SET fk_statut = " . self::STATUS_DRAFT; |
3047 | 3047 | $sql .= ", online_sign_ip = NULL , online_sign_name = NULL"; |
3048 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
3048 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
3049 | 3049 | |
3050 | 3050 | $resql = $this->db->query($sql); |
3051 | 3051 | if (!$resql) { |
@@ -3120,18 +3120,18 @@ discard block |
||
3120 | 3120 | if ($search_sale == -2) { |
3121 | 3121 | $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)"; |
3122 | 3122 | } elseif ($search_sale > 0) { |
3123 | - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")"; |
|
3123 | + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")"; |
|
3124 | 3124 | } |
3125 | 3125 | } |
3126 | 3126 | // Search on socid |
3127 | 3127 | if ($socid) { |
3128 | - $sql .= " AND p.fk_soc = " . ((int)$socid); |
|
3128 | + $sql .= " AND p.fk_soc = " . ((int) $socid); |
|
3129 | 3129 | } |
3130 | 3130 | if ($draft) { |
3131 | - $sql .= " AND p.fk_statut = " . ((int)self::STATUS_DRAFT); |
|
3131 | + $sql .= " AND p.fk_statut = " . ((int) self::STATUS_DRAFT); |
|
3132 | 3132 | } |
3133 | 3133 | if ($notcurrentuser > 0) { |
3134 | - $sql .= " AND p.fk_user_author <> " . ((int)$user->id); |
|
3134 | + $sql .= " AND p.fk_user_author <> " . ((int) $user->id); |
|
3135 | 3135 | } |
3136 | 3136 | $sql .= $this->db->order($sortfield, $sortorder); |
3137 | 3137 | $sql .= $this->db->plimit($limit, $offset); |
@@ -3269,8 +3269,8 @@ discard block |
||
3269 | 3269 | $this->db->begin(); |
3270 | 3270 | |
3271 | 3271 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal'; |
3272 | - $sql .= ' SET fk_availability = ' . ((int)$availability_id); |
|
3273 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3272 | + $sql .= ' SET fk_availability = ' . ((int) $availability_id); |
|
3273 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3274 | 3274 | |
3275 | 3275 | dol_syslog(__METHOD__ . ' availability(' . $availability_id . ')', LOG_DEBUG); |
3276 | 3276 | $resql = $this->db->query($sql); |
@@ -3332,8 +3332,8 @@ discard block |
||
3332 | 3332 | $this->db->begin(); |
3333 | 3333 | |
3334 | 3334 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal'; |
3335 | - $sql .= ' SET fk_input_reason = ' . ((int)$demand_reason_id); |
|
3336 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3335 | + $sql .= ' SET fk_input_reason = ' . ((int) $demand_reason_id); |
|
3336 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3337 | 3337 | |
3338 | 3338 | dol_syslog(__METHOD__ . ' demand_reason(' . $demand_reason_id . ')', LOG_DEBUG); |
3339 | 3339 | $resql = $this->db->query($sql); |
@@ -3409,7 +3409,7 @@ discard block |
||
3409 | 3409 | if ($search_sale == -2) { |
3410 | 3410 | $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)"; |
3411 | 3411 | } elseif ($search_sale > 0) { |
3412 | - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")"; |
|
3412 | + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")"; |
|
3413 | 3413 | } |
3414 | 3414 | } |
3415 | 3415 | |
@@ -3585,7 +3585,7 @@ discard block |
||
3585 | 3585 | if ($search_sale == -2) { |
3586 | 3586 | $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)"; |
3587 | 3587 | } elseif ($search_sale > 0) { |
3588 | - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")"; |
|
3588 | + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")"; |
|
3589 | 3589 | } |
3590 | 3590 | } |
3591 | 3591 |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | } |
666 | 666 | } |
667 | 667 | |
668 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
668 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
669 | 669 | /** |
670 | 670 | * Update DB line fields total_xxx |
671 | 671 | * Used by migration |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function update_total() |
676 | 676 | { |
677 | - // phpcs:enable |
|
677 | + // phpcs:enable |
|
678 | 678 | $this->db->begin(); |
679 | 679 | |
680 | 680 | // Mise a jour ligne en base |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $error = 0; |
88 | 88 | $this->db->begin(); |
89 | 89 | |
90 | - if (! $error) { |
|
91 | - if (! $notrigger) { |
|
90 | + if (!$error) { |
|
91 | + if (!$notrigger) { |
|
92 | 92 | // Call triggers |
93 | 93 | $result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user); |
94 | 94 | if ($result < 0) { |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - if (! $error) { |
|
101 | + if (!$error) { |
|
102 | 102 | $result = $this->deleteExtraFields(); |
103 | 103 | if ($result < 0) { |
104 | 104 | $error++; |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - if (! $error) { |
|
108 | + if (!$error) { |
|
109 | 109 | $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id; |
110 | 110 | |
111 | 111 | $res = $this->db->query($sql); |
@@ -188,10 +188,10 @@ |
||
188 | 188 | $sqlsearchpackage .= ' WHERE entity IN (' . getEntity('product_fournisseur_price') . ")"; |
189 | 189 | $sqlsearchpackage .= " AND fk_product = " . ((int) $objp->fk_product); |
190 | 190 | $sqlsearchpackage .= " AND ref_fourn = '" . $this->db->escape($objp->ref_supplier) . "'"; |
191 | - $sqlsearchpackage .= " AND quantity <= " . ((float) $objp->qty); // required to be qualified |
|
192 | - $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= " . ((float) $objp->qty) . ")"; // required to be qualified |
|
191 | + $sqlsearchpackage .= " AND quantity <= " . ((float) $objp->qty); // required to be qualified |
|
192 | + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= " . ((float) $objp->qty) . ")"; // required to be qualified |
|
193 | 193 | $sqlsearchpackage .= " AND fk_soc = " . ((int) $objp->socid); |
194 | - $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
194 | + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
195 | 195 | $sqlsearchpackage .= " LIMIT 1"; |
196 | 196 | |
197 | 197 | $resqlsearchpackage = $this->db->query($sqlsearchpackage); |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | } |
777 | 777 | } |
778 | 778 | |
779 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
779 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
780 | 780 | /** |
781 | 781 | * Mise a jour de l'objet ligne de commande en base |
782 | 782 | * |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | */ |
785 | 785 | public function update_total() |
786 | 786 | { |
787 | - // phpcs:enable |
|
787 | + // phpcs:enable |
|
788 | 788 | $this->db->begin(); |
789 | 789 | |
790 | 790 | // Mise a jour ligne en base |
@@ -694,8 +694,7 @@ |
||
694 | 694 | $sql .= " " . ($this->fk_parent_line > 0 ? "'" . $this->db->escape($this->fk_parent_line) . "'" : "null") . ","; |
695 | 695 | $product_label |
696 | 696 | = !empty($this->product_label) |
697 | - ? $this->product_label : |
|
698 | - (!empty($this->label) ? $this->label : null); |
|
697 | + ? $this->product_label : (!empty($this->label) ? $this->label : null); |
|
699 | 698 | $sql .= " " . (!empty($product_label) ? "'" . $this->db->escape($product_label) . "'" : "null") . ","; |
700 | 699 | $sql .= " '" . $this->db->escape($this->desc ? $this->desc : $this->description) . "',"; |
701 | 700 | $sql .= " '" . $this->db->escape($this->ref_supplier) . "',"; |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | |
1018 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1018 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1019 | 1019 | /** |
1020 | 1020 | * Load this->lines |
1021 | 1021 | * |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | public function fetch_lines() |
1025 | 1025 | { |
1026 | - // phpcs:enable |
|
1026 | + // phpcs:enable |
|
1027 | 1027 | $this->lines = array(); |
1028 | 1028 | |
1029 | 1029 | $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description as line_desc, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | } |
1311 | 1311 | } |
1312 | 1312 | |
1313 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1313 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1314 | 1314 | /** |
1315 | 1315 | * Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount) |
1316 | 1316 | * |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | */ |
1320 | 1320 | public function insert_discount($idremise) |
1321 | 1321 | { |
1322 | - // phpcs:enable |
|
1322 | + // phpcs:enable |
|
1323 | 1323 | global $conf, $langs; |
1324 | 1324 | |
1325 | 1325 | include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; |
@@ -1545,7 +1545,7 @@ discard block |
||
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | |
1548 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1548 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1549 | 1549 | /** |
1550 | 1550 | * Tag invoice as a paid invoice |
1551 | 1551 | * |
@@ -1558,7 +1558,7 @@ discard block |
||
1558 | 1558 | */ |
1559 | 1559 | public function set_paid($user, $close_code = '', $close_note = '') |
1560 | 1560 | { |
1561 | - // phpcs:enable |
|
1561 | + // phpcs:enable |
|
1562 | 1562 | dol_syslog(get_class($this) . "::set_paid is deprecated, use setPaid instead", LOG_NOTICE); |
1563 | 1563 | return $this->setPaid($user, $close_code, $close_note); |
1564 | 1564 | } |
@@ -1623,7 +1623,7 @@ discard block |
||
1623 | 1623 | } |
1624 | 1624 | } |
1625 | 1625 | |
1626 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1626 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1627 | 1627 | /** |
1628 | 1628 | * Tag the invoice as not fully paid + trigger call BILL_UNPAYED |
1629 | 1629 | * Function used when a direct debit payment is refused, |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | */ |
1637 | 1637 | public function set_unpaid($user) |
1638 | 1638 | { |
1639 | - // phpcs:enable |
|
1639 | + // phpcs:enable |
|
1640 | 1640 | dol_syslog(get_class($this) . "::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE); |
1641 | 1641 | return $this->setUnpaid($user); |
1642 | 1642 | } |
@@ -2571,7 +2571,7 @@ discard block |
||
2571 | 2571 | } |
2572 | 2572 | } |
2573 | 2573 | |
2574 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2574 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2575 | 2575 | /** |
2576 | 2576 | * Return list of replaceable invoices |
2577 | 2577 | * Status valid or abandoned for other reason + not paid + no payment + not already replaced |
@@ -2582,7 +2582,7 @@ discard block |
||
2582 | 2582 | */ |
2583 | 2583 | public function list_replacable_supplier_invoices($socid = 0) |
2584 | 2584 | { |
2585 | - // phpcs:enable |
|
2585 | + // phpcs:enable |
|
2586 | 2586 | global $conf; |
2587 | 2587 | |
2588 | 2588 | $return = array(); |
@@ -2620,7 +2620,7 @@ discard block |
||
2620 | 2620 | } |
2621 | 2621 | } |
2622 | 2622 | |
2623 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2623 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2624 | 2624 | /** |
2625 | 2625 | * Return list of qualifying invoices for correction by credit note |
2626 | 2626 | * Invoices that respect the following rules are returned: |
@@ -2632,7 +2632,7 @@ discard block |
||
2632 | 2632 | */ |
2633 | 2633 | public function list_qualified_avoir_supplier_invoices($socid = 0) |
2634 | 2634 | { |
2635 | - // phpcs:enable |
|
2635 | + // phpcs:enable |
|
2636 | 2636 | global $conf; |
2637 | 2637 | |
2638 | 2638 | $return = array(); |
@@ -2674,7 +2674,7 @@ discard block |
||
2674 | 2674 | } |
2675 | 2675 | } |
2676 | 2676 | |
2677 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2677 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
2678 | 2678 | /** |
2679 | 2679 | * Load indicators for dashboard (this->nbtodo and this->nbtodolate) |
2680 | 2680 | * |
@@ -2683,7 +2683,7 @@ discard block |
||
2683 | 2683 | */ |
2684 | 2684 | public function load_board($user) |
2685 | 2685 | { |
2686 | - // phpcs:enable |
|
2686 | + // phpcs:enable |
|
2687 | 2687 | global $conf, $langs; |
2688 | 2688 | |
2689 | 2689 | $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut as status, ff.total_ht, ff.total_ttc'; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | /** |
231 | 231 | * @var int ID |
232 | 232 | */ |
233 | - public $fk_account; // default bank account |
|
233 | + public $fk_account; // default bank account |
|
234 | 234 | |
235 | 235 | /** |
236 | 236 | * @var int Transport mode id |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $this->location_incoterms = $_facrec->location_incoterms; |
467 | 467 | |
468 | 468 | // Clean parameters |
469 | - if (! $this->type) { |
|
469 | + if (!$this->type) { |
|
470 | 470 | $this->type = self::TYPE_STANDARD; |
471 | 471 | } |
472 | 472 | if (!empty(GETPOST('ref_supplier'))) { |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | |
481 | 481 | $this->array_options = $_facrec->array_options; |
482 | 482 | |
483 | - if (! $this->mode_reglement_id) { |
|
483 | + if (!$this->mode_reglement_id) { |
|
484 | 484 | $this->mode_reglement_id = 0; |
485 | 485 | } |
486 | 486 | $this->status = self::STATUS_DRAFT; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | /* |
730 | 730 | * Insert lines of template invoices |
731 | 731 | */ |
732 | - if (! $error && $this->fac_rec > 0 && $_facrec instanceof FactureFournisseurRec) { |
|
732 | + if (!$error && $this->fac_rec > 0 && $_facrec instanceof FactureFournisseurRec) { |
|
733 | 733 | foreach ($_facrec->lines as $i => $val) { |
734 | 734 | if ($_facrec->lines[$i]->fk_product) { |
735 | 735 | $prod = new Product($this->db); |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $buyprice = empty($_facrec->lines[$i]->buyprice) ? 0 : $_facrec->lines[$i]->buyprice; |
757 | 757 | |
758 | 758 | // If buyprice not defined from template invoice, we try to guess the best value |
759 | - if (! $buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
759 | + if (!$buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
760 | 760 | $producttmp = new ProductFournisseur($this->db); |
761 | 761 | $producttmp->fetch($_facrec->lines[$i]->fk_product); |
762 | 762 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | |
1007 | 1007 | $this->extraparams = isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); |
1008 | 1008 | |
1009 | - $this->socid = $obj->socid; |
|
1009 | + $this->socid = $obj->socid; |
|
1010 | 1010 | |
1011 | 1011 | // Retrieve all extrafield |
1012 | 1012 | // fetch optionals attributes and labels |
@@ -2280,7 +2280,7 @@ discard block |
||
2280 | 2280 | // Multicurrency |
2281 | 2281 | $supplierinvoiceline->fk_multicurrency = $this->fk_multicurrency; |
2282 | 2282 | $supplierinvoiceline->multicurrency_code = $this->multicurrency_code; |
2283 | - $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 |
|
2283 | + $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 |
|
2284 | 2284 | |
2285 | 2285 | $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 |
2286 | 2286 | $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 |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | |
2447 | 2447 | $line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs((float) $qty) : $qty); // For credit note, quantity is always positive and unit price negative |
2448 | 2448 | $line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise |
2449 | - $line->pu_ht = $line->subprice; // deprecated |
|
2449 | + $line->pu_ht = $line->subprice; // deprecated |
|
2450 | 2450 | $line->pu_ttc = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ttc) : $pu_ttc); // For credit note, unit price always negative, always positive otherwise |
2451 | 2451 | |
2452 | 2452 | $line->remise_percent = $remise_percent; |
@@ -2731,7 +2731,7 @@ discard block |
||
2731 | 2731 | |
2732 | 2732 | while ($obj = $this->db->fetch_object($resql)) { |
2733 | 2733 | $facturestatic->date_echeance = $this->db->jdate($obj->datefin); |
2734 | - $facturestatic->statut = $obj->status; // For backward compatibility |
|
2734 | + $facturestatic->statut = $obj->status; // For backward compatibility |
|
2735 | 2735 | $facturestatic->status = $obj->status; |
2736 | 2736 | |
2737 | 2737 | $response->nbtodo++; |
@@ -3165,15 +3165,15 @@ discard block |
||
3165 | 3165 | // Load source object |
3166 | 3166 | $object->fetch($fromid); |
3167 | 3167 | $object->id = 0; |
3168 | - $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
3168 | + $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
3169 | 3169 | $object->status = self::STATUS_DRAFT; |
3170 | 3170 | |
3171 | 3171 | $object->fetch_thirdparty(); // We need it to recalculate VAT localtaxes according to main sale taxes and vendor |
3172 | 3172 | |
3173 | 3173 | // Clear fields |
3174 | 3174 | $object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf") . ' ' . $object->ref_supplier : $this->ref_supplier); |
3175 | - $object->author = $user->id; // FIXME? user_validation_id is replacement for author |
|
3176 | - $object->user_validation_id = 0; // FIXME? user_validation_id is replacement for author |
|
3175 | + $object->author = $user->id; // FIXME? user_validation_id is replacement for author |
|
3176 | + $object->user_validation_id = 0; // FIXME? user_validation_id is replacement for author |
|
3177 | 3177 | $object->fk_facture_source = 0; |
3178 | 3178 | $object->date_creation = ''; |
3179 | 3179 | $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) { |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | $sql .= ", '" . $this->db->idate($now) . "'"; |
356 | 356 | $sql .= ", " . ((int) $this->suspended); |
357 | 357 | $sql .= ", '" . $this->db->escape($this->libelle) . "'"; |
358 | - $sql .= ", " . (!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
358 | + $sql .= ", " . (!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
359 | 359 | $sql .= ", " . ((int) $user->id); |
360 | 360 | $sql .= ", " . (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
361 | 361 | $sql .= ", " . (!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
362 | 362 | $sql .= ", " . ($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
363 | 363 | $sql .= ", " . ($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
364 | - $sql .= ", " . ($facfourn_src->date_echeance > 0 ? "'" . $this->db->idate($facfourn_src->date_echeance) . "'" : 'NULL'); // date_lim_reglement |
|
364 | + $sql .= ", " . ($facfourn_src->date_echeance > 0 ? "'" . $this->db->idate($facfourn_src->date_echeance) . "'" : 'NULL'); // date_lim_reglement |
|
365 | 365 | $sql .= ", " . (!empty($this->note_private) ? "'" . $this->db->escape($this->note_private) . "'" : 'NULL'); |
366 | 366 | $sql .= ", " . (!empty($this->note_public) ? "'" . $this->db->escape($this->note_public) . "'" : 'NULL'); |
367 | 367 | $sql .= ", " . (!empty($this->model_pdf) ? "'" . $this->db->escape($this->model_pdf) . "'" : 'NULL'); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | $error = 0; |
517 | 517 | |
518 | 518 | $sql = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_rec SET"; |
519 | - $sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "") . "'," ; |
|
519 | + $sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "") . "',"; |
|
520 | 520 | $sql .= " subtype=" . (isset($this->subtype) ? $this->db->escape($this->subtype) : "null") . ","; |
521 | 521 | $sql .= " ref_supplier = '" . (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "") . "',"; |
522 | 522 | $sql .= " entity = " . (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $this->id = $obj->rowid; |
635 | 635 | $this->titre = $obj->title; |
636 | 636 | $this->title = $obj->title; |
637 | - $this->subtype = $obj->subtype; |
|
637 | + $this->subtype = $obj->subtype; |
|
638 | 638 | $this->ref = $obj->title; |
639 | 639 | $this->ref_supplier = $obj->ref_supplier; |
640 | 640 | $this->entity = $obj->entity; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | $line->product_type = $objp->product_type; |
793 | 793 | $line->date_start = $objp->date_start; |
794 | 794 | $line->date_end = $objp->date_end; |
795 | - $line->info_bits = $objp->info_bits ; |
|
795 | + $line->info_bits = $objp->info_bits; |
|
796 | 796 | $line->special_code = $objp->special_code; |
797 | 797 | $line->rang = $objp->rang; |
798 | 798 | $line->fk_unit = $objp->fk_unit; |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | } |
876 | 876 | // End call triggers |
877 | 877 | } |
878 | - if (! $error) { |
|
878 | + if (!$error) { |
|
879 | 879 | $this->db->commit(); |
880 | 880 | return 1; |
881 | 881 | } else { |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $sql .= ', fk_user_author'; |
1020 | 1020 | $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
1021 | 1021 | $sql .= ') VALUES ('; |
1022 | - $sql .= ' ' . (int) $facid; // source supplier invoice id |
|
1022 | + $sql .= ' ' . (int) $facid; // source supplier invoice id |
|
1023 | 1023 | $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null'); |
1024 | 1024 | $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null'); |
1025 | 1025 | $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null'); |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | |
1361 | 1361 | $new_fac_fourn->type = self::TYPE_STANDARD; |
1362 | 1362 | $new_fac_fourn->subtype = $facturerec->subtype; |
1363 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1363 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1364 | 1364 | $new_fac_fourn->status = self::STATUS_DRAFT; |
1365 | 1365 | $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. |
1366 | 1366 | $new_fac_fourn->socid = $facturerec->socid; |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | $new_fac_fourn->model_pdf = $facturerec->model_pdf; |
1370 | 1370 | $new_fac_fourn->fk_project = $facturerec->fk_project; |
1371 | 1371 | $new_fac_fourn->label = $facturerec->label; |
1372 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1372 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1373 | 1373 | |
1374 | 1374 | $invoiceidgenerated = $new_fac_fourn->create($user); |
1375 | 1375 | $laststep = "Create invoiceidgenerated $invoiceidgenerated"; |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | $this->ref_supplier = $obj->ref_supplier; |
524 | 524 | $this->socid = $obj->fk_soc; |
525 | 525 | $this->fourn_id = $obj->fk_soc; |
526 | - $this->statut = $obj->status; // deprecated |
|
526 | + $this->statut = $obj->status; // deprecated |
|
527 | 527 | $this->status = $obj->status; |
528 | 528 | $this->billed = $obj->billed; |
529 | 529 | $this->user_author_id = $obj->user_author_id; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $this->fk_project = $obj->fk_project; |
555 | 555 | $this->cond_reglement_id = $obj->fk_cond_reglement; |
556 | 556 | $this->cond_reglement_code = $obj->cond_reglement_code; |
557 | - $this->cond_reglement = $obj->cond_reglement_label; // deprecated |
|
557 | + $this->cond_reglement = $obj->cond_reglement_label; // deprecated |
|
558 | 558 | $this->cond_reglement_label = $obj->cond_reglement_label; |
559 | 559 | $this->cond_reglement_doc = $obj->cond_reglement_doc; |
560 | 560 | $this->fk_account = $obj->fk_account; |
@@ -687,10 +687,10 @@ discard block |
||
687 | 687 | $sqlsearchpackage .= ' WHERE entity IN (' . getEntity('product_fournisseur_price') . ")"; |
688 | 688 | $sqlsearchpackage .= " AND fk_product = " . ((int) $objp->fk_product); |
689 | 689 | $sqlsearchpackage .= " AND ref_fourn = '" . $this->db->escape($objp->ref_supplier) . "'"; |
690 | - $sqlsearchpackage .= " AND quantity <= " . ((float) $objp->qty); // required to be qualified |
|
691 | - $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= " . ((float) $objp->qty) . ")"; // required to be qualified |
|
690 | + $sqlsearchpackage .= " AND quantity <= " . ((float) $objp->qty); // required to be qualified |
|
691 | + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= " . ((float) $objp->qty) . ")"; // required to be qualified |
|
692 | 692 | $sqlsearchpackage .= " AND fk_soc = " . ((int) $this->socid); |
693 | - $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
693 | + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
694 | 694 | $sqlsearchpackage .= " LIMIT 1"; |
695 | 695 | |
696 | 696 | $resqlsearchpackage = $this->db->query($sqlsearchpackage); |
@@ -1626,10 +1626,10 @@ discard block |
||
1626 | 1626 | $line->date_end, |
1627 | 1627 | $line->array_options, |
1628 | 1628 | $line->fk_unit, |
1629 | - $line->multicurrency_subprice, // pu_ht_devise |
|
1630 | - $line->origin, // origin |
|
1631 | - $line->origin_id, // origin_id |
|
1632 | - $line->rang, // rang |
|
1629 | + $line->multicurrency_subprice, // pu_ht_devise |
|
1630 | + $line->origin, // origin |
|
1631 | + $line->origin_id, // origin_id |
|
1632 | + $line->rang, // rang |
|
1633 | 1633 | $line->special_code |
1634 | 1634 | ); |
1635 | 1635 | if ($result < 0) { |
@@ -2003,7 +2003,7 @@ discard block |
||
2003 | 2003 | $this->db->begin(); |
2004 | 2004 | |
2005 | 2005 | $product_type = $type; |
2006 | - $label = ''; // deprecated |
|
2006 | + $label = ''; // deprecated |
|
2007 | 2007 | |
2008 | 2008 | if ($fk_product > 0) { |
2009 | 2009 | if (getDolGlobalString('SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY')) { // Not the common case |
@@ -2146,7 +2146,7 @@ discard block |
||
2146 | 2146 | $this->line->total_localtax2 = $total_localtax2; |
2147 | 2147 | $this->line->total_ttc = $total_ttc; |
2148 | 2148 | $this->line->product_type = $type; |
2149 | - $this->line->special_code = (!empty($special_code) ? $special_code : 0); |
|
2149 | + $this->line->special_code = (!empty($special_code) ? $special_code : 0); |
|
2150 | 2150 | $this->line->origin = $origin; |
2151 | 2151 | $this->line->origin_id = $origin_id; |
2152 | 2152 | $this->line->fk_unit = $fk_unit; |
@@ -3353,7 +3353,7 @@ discard block |
||
3353 | 3353 | global $conf, $langs; |
3354 | 3354 | |
3355 | 3355 | if (!dol_strlen($modele)) { |
3356 | - $modele = ''; // No doc template/generation by default |
|
3356 | + $modele = ''; // No doc template/generation by default |
|
3357 | 3357 | |
3358 | 3358 | if (!empty($this->model_pdf)) { |
3359 | 3359 | $modele = $this->model_pdf; |
@@ -336,7 +336,7 @@ |
||
336 | 336 | } elseif ($mode == 'mon' || $mode == 'EX_MON') { |
337 | 337 | $sql .= " AND DATE_FORMAT(d.date, '%Y-%m') = '" . dol_print_date($this->date, '%Y-%m') . "'"; // @todo DATE_FORMAT is forbidden |
338 | 338 | } elseif ($mode == 'year' || $mode == 'EX_YEA') { |
339 | - $sql .= " AND DATE_FORMAT(d.date, '%Y') = '" . dol_print_date($this->date, '%Y') . "'"; // @todo DATE_FORMAT is forbidden |
|
339 | + $sql .= " AND DATE_FORMAT(d.date, '%Y') = '" . dol_print_date($this->date, '%Y') . "'"; // @todo DATE_FORMAT is forbidden |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | dol_syslog('ExpenseReportLine::getExpAmount'); |