From 5b7d358c4e6a8a19d9cc451da57557af4af4a7db Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 24 Oct 2025 18:46:20 +0200 Subject: [PATCH] FIX #35634 (#35912) * FIX #35634 * FIX phan error --- htdocs/product/price.php | 46 ---------------------------------------- 1 file changed, 46 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 6427f28c854..f7b428194cb 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -519,52 +519,6 @@ if (empty($reshook)) { // If price has changed, we update it if (!array_key_exists($key, $object->multiprices) || $object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) { $res = $object->updatePrice((float) $newprice, $val['price_base_type'], $user, (float) $val['vat_tx'], (float) $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code'], $val['price_label']); - if ($res > 0) { - $extralabels = $extrafields->fetch_name_optionals_label("product"); - if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES') && !empty($extralabels)) { - // Default price - $extrafield_values = $extrafields->getOptionalsFromPost("product"); - foreach ($extrafield_values as $efkey => $value) { - $object->array_options[$efkey] = $value; - } - $result = $object->insertExtraFields(); - if ($result < 0) { - $error++; - } - } elseif ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($extralabels)) { - $price_extralabels = $extrafields->fetch_name_optionals_label("product_price"); - $sql = "SELECT rowid"; - $sql .= " FROM ".$object->db->prefix()."product_price"; - $sql .= " WHERE entity IN (".getEntity('productprice').")"; - $sql .= " AND price_level=".((int) $key); // $i - $sql .= " AND fk_product = ".((int) $object->id); - $sql .= " ORDER BY date_price DESC, rowid DESC"; - $sql .= " LIMIT 1"; - $resql = $object->db->query($sql); - if ($resql) { - $lineid = $object->db->fetch_object($resql); - $db->free($resql); - } - if (!empty($lineid->rowid)) { - if (!empty($price_extralabels) && is_array($price_extralabels)) { - foreach ($price_extralabels as $code => $label) { - $code_array = GETPOST($code, 'array'); - $object->array_options['options_'.$code] = $code_array[$key]; - } - // We need to force table to update product_price and not product extrafields - $object->id = $lineid->rowid; - $object->table_element = 'product_price'; - $result = $object->insertExtraFields(); - } - // Back to product table - $object->id = $id; - $object->table_element = 'product'; - if ($result < 0) { - $error++; - } - } - } - } } else { $res = 0; }