From 95e893f6974d07b915890802b6df3b1e24662a75 Mon Sep 17 00:00:00 2001 From: le-reparateur <162715304+le-reparateur@users.noreply.github.com> Date: Sat, 9 Mar 2024 13:20:01 +0100 Subject: [PATCH 1/2] Update fournisseur.product.class.php #28710 --- htdocs/fourn/class/fournisseur.product.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index fd9e0245ad819..6e7b1bb53a63d 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -391,6 +391,7 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn } $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql .= " SET fk_user = ".((int) $user->id)." ,"; + $sql .= " datec = '".$this->db->idate($now)."' ,"; $sql .= " ref_fourn = '".$this->db->escape($ref_fourn)."',"; $sql .= " desc_fourn = '".$this->db->escape($desc_fourn)."',"; $sql .= " price = ".((float) $buyprice).","; From ede7d736dcfd7c384fc85447f51dbf837767ac34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Mar 2024 15:14:10 +0100 Subject: [PATCH 2/2] Update fournisseur.product.class.php --- htdocs/fourn/class/fournisseur.product.class.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 6e7b1bb53a63d..cd512972033bc 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -327,10 +327,10 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn $fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $multicurrency_code); } - $buyprice = price2num($buyprice, 'MU'); - $charges = price2num($charges, 'MU'); - $qty = price2num($qty, 'MS'); - $unitBuyPrice = price2num($buyprice / $qty, 'MU'); + $buyprice = (float) price2num($buyprice, 'MU'); + $charges = (float) price2num($charges, 'MU'); + $qty = (float) price2num($qty, 'MS'); + $unitBuyPrice = (float) price2num($buyprice / $qty, 'MU'); // We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50. //$packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS'); @@ -359,10 +359,6 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn $localtax2 = 0; // If = '' then = 0 } - // Check parameters - if ($buyprice != '' && !is_numeric($buyprice)) { - } - $this->db->begin(); if ($this->product_fourn_price_id > 0) { @@ -391,7 +387,7 @@ public function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn } $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql .= " SET fk_user = ".((int) $user->id)." ,"; - $sql .= " datec = '".$this->db->idate($now)."' ,"; + $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. $sql .= " ref_fourn = '".$this->db->escape($ref_fourn)."',"; $sql .= " desc_fourn = '".$this->db->escape($desc_fourn)."',"; $sql .= " price = ".((float) $buyprice).",";