[-] BO : fix bug #PSFV-298 - Cannot save supplier specific product price if no reference is set
This commit is contained in:
@@ -2284,10 +2284,10 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->confirmations[] = $this->l('Suppliers of the product have been updated');
|
$this->confirmations[] = $this->l('Suppliers of the product have been updated');
|
||||||
|
|
||||||
// Manage references and prices
|
// Manage references and prices
|
||||||
foreach ($attributes as $attribute)
|
foreach ($attributes as $attribute)
|
||||||
foreach ($associated_suppliers as $supplier)
|
foreach ($associated_suppliers as $supplier)
|
||||||
|
{
|
||||||
if (Tools::isSubmit('supplier_reference_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier)
|
if (Tools::isSubmit('supplier_reference_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier)
|
||||||
||
|
||
|
||||||
(
|
(
|
||||||
@@ -2311,6 +2311,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
0
|
0
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$price = Tools::ps_round($price, 6);
|
$price = Tools::ps_round($price, 6);
|
||||||
|
|
||||||
$id_currency = (int)Tools::getValue(
|
$id_currency = (int)Tools::getValue(
|
||||||
@@ -2321,10 +2322,8 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) ))
|
if ($id_currency <= 0 || ( !($result = Currency::getCurrency($id_currency)) || empty($result) ))
|
||||||
$this->_errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
|
$this->_errors[] = Tools::displayError($this->l('The selected currency is not valid.'));
|
||||||
|
|
||||||
if (!empty($reference))
|
// Save product-supplier data
|
||||||
{
|
|
||||||
$existing_id = (int)ProductSupplier::getIdByProductAndSupplier($product->id, $attribute['id_product_attribute'], $supplier->id_supplier);
|
$existing_id = (int)ProductSupplier::getIdByProductAndSupplier($product->id, $attribute['id_product_attribute'], $supplier->id_supplier);
|
||||||
|
|
||||||
if ($existing_id <= 0)
|
if ($existing_id <= 0)
|
||||||
{
|
{
|
||||||
//create new record
|
//create new record
|
||||||
@@ -2376,7 +2375,6 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (Tools::isSubmit('supplier_reference_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier))
|
else if (Tools::isSubmit('supplier_reference_'.$product->id.'_'.$attribute['id_product_attribute'].'_'.$supplier->id_supplier))
|
||||||
{
|
{
|
||||||
//int attribute with default values if possible
|
//int attribute with default values if possible
|
||||||
@@ -2389,7 +2387,7 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$product_supplier->save();
|
$product_supplier->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Manage defaut supplier for product
|
// Manage defaut supplier for product
|
||||||
if ($new_default_supplier != 0 && $new_default_supplier != $product->id_supplier && Supplier::supplierExists($new_default_supplier))
|
if ($new_default_supplier != 0 && $new_default_supplier != $product->id_supplier && Supplier::supplierExists($new_default_supplier))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user