diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 884eb99f033..52c2aeb9220 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2267,8 +2267,8 @@ class Commande extends CommonOrder $line->total_tva = $objp->total_tva; $line->total_localtax1 = $objp->total_localtax1; $line->total_localtax2 = $objp->total_localtax2; - $line->subprice = $objp->subprice; - $line->subprice_ttc = $objp->subprice_ttc; + $line->subprice = (float) $objp->subprice; + $line->subprice_ttc = (float) $objp->subprice_ttc; $line->fk_remise_except = $objp->fk_remise_except; $line->remise_percent = $objp->remise_percent; $line->price = $objp->price; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5a5a0f2fb26..6f3273b8584 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5695,7 +5695,7 @@ abstract class CommonObject } // Recalculate unit price with tax if not defined - if (empty($line->subprice_ttc) && $line->qty) { // subprice_ttc may be not stored on old version or not defined for lines with no unit price (like a discount) + if (empty((float) $line->subprice_ttc) && $line->qty) { // subprice_ttc may be not stored on old version or not defined for lines with no unit price (like a discount) // So we calculate an estimated value just to show something on screen if ($line->remise_percent != 100) { $line->subprice_ttc = (float) price2num($line->total_ttc / $line->qty / (1 - $line->remise_percent / 100), 'MU');