diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 5b94cc9c07c..9be8c722afa 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -7578,12 +7578,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -7602,12 +7596,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -7734,12 +7722,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -7770,12 +7752,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php - - message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7794,12 +7770,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -8586,12 +8556,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/mrp/doc/pdf_vinci.modules.php - - message: '#^Property Mo\:\:\$lines \(array\\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -8718,24 +8682,12 @@ parameters: count: 3 path: ../../../htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 3 - path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse count: 1 path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 5 - path: ../../../htdocs/core/modules/propale/doc/pdf_cyan.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -8772,12 +8724,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/societe/doc/doc_generic_odt.modules.php - - - message: '#^Property CommonObject\:\:\$multicurrency_tx \(array\\|float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php - - message: '#^Right side of \|\| is always false\.$#' identifier: booleanOr.rightAlwaysFalse @@ -8796,12 +8742,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php - - - message: '#^Property CommandeFournisseur\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php - - message: '#^Right side of \|\| is always false\.$#' identifier: booleanOr.rightAlwaysFalse @@ -8820,12 +8760,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - - message: '#^Property CommandeFournisseur\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php - - message: '#^Right side of \|\| is always false\.$#' identifier: booleanOr.rightAlwaysFalse @@ -8844,12 +8778,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php - - - message: '#^Property SupplierProposal\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse @@ -8862,12 +8790,6 @@ parameters: count: 1 path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php - - - message: '#^Property SupplierProposal\:\:\$multicurrency_tx \(float\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../../htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php - - message: '#^Right side of \|\| is always false\.$#' identifier: booleanOr.rightAlwaysFalse diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 872cb575009..a81f98260ea 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -554,7 +554,7 @@ abstract class CommonObject public $multicurrency_code; /** - * @var float|float[] Multicurrency rate ("tx" = "taux" in French) + * @var null|float|float[] Multicurrency rate ("tx" = "taux" in French) * Or, just for the Paiement object, an array: invoice ID => currency rate for that invoice. */ public $multicurrency_tx; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8551275d894..4ae80b92bfc 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -276,7 +276,7 @@ class Expedition extends CommonObject */ public $multicurrency_code; /** - * @var float + * @var ?float */ public $multicurrency_tx; /** diff --git a/htdocs/expensereport/class/expensereportline.class.php b/htdocs/expensereport/class/expensereportline.class.php index 37cf2bc1657..ddce5c718ce 100644 --- a/htdocs/expensereport/class/expensereportline.class.php +++ b/htdocs/expensereport/class/expensereportline.class.php @@ -198,7 +198,7 @@ class ExpenseReportLine extends CommonObjectLine public $multicurrency_code; /** - * @var float + * @var ?float */ public $multicurrency_tx; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 33752c0fa37..0c36ef87656 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -330,7 +330,7 @@ class CommandeFournisseur extends CommonOrder public $multicurrency_code; /** - * @var float Rate + * @var ?float Rate */ public $multicurrency_tx; diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 7a5f5f31cfd..2b1ea94008b 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -217,7 +217,7 @@ class ProductFournisseurPrice extends CommonObject */ public $multicurrency_code; /** - * @var float + * @var ?float */ public $multicurrency_tx; /** diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index ed82ae8c82a..0ee4e7fb94b 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -234,7 +234,7 @@ class SupplierProposal extends CommonObject */ public $multicurrency_code; /** - * @var float + * @var ?float */ public $multicurrency_tx; /** @@ -542,15 +542,13 @@ class SupplierProposal extends CommonObject return -1; } if ($result < -1) { - $this->error = $productsupplier->error; - $this->errors = $productsupplier->errors; + $this->setErrorsFromObject($productsupplier); $this->db->rollback(); dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR); return -1; } } else { - $this->error = $productsupplier->error; - $this->errors = $productsupplier->errors; + $this->setErrorsFromObject($productsupplier); $this->db->rollback(); return -1; } @@ -578,7 +576,23 @@ class SupplierProposal extends CommonObject $pu = 0; } - $tabprice = calcul_price_total($qty, $pu, (float) $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); + $tabprice = calcul_price_total( + $qty, + $pu, + (float) $remise_percent, + $txtva, + (float) $txlocaltax1, + (float) $txlocaltax2, + 0, + $price_base_type, + $info_bits, + $type, + $this->thirdparty, + $localtaxes_type, + 100, + (float) $this->multicurrency_tx, + $pu_ht_devise + ); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -769,7 +783,23 @@ class SupplierProposal extends CommonObject $pu = 0; } - $tabprice = calcul_price_total($qty, $pu, (float) $remise_percent, $txtva, (float) $txlocaltax1, (float) $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); + $tabprice = calcul_price_total( + $qty, + $pu, + (float) $remise_percent, + $txtva, + (float) $txlocaltax1, + (float) $txlocaltax2, + 0, + $price_base_type, + $info_bits, + $type, + $this->thirdparty, + $localtaxes_type, + 100, + (float) $this->multicurrency_tx, + $pu_ht_devise + ); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2];