// Fixed #PSTEST-447

This commit is contained in:
bMancone
2012-01-16 15:55:51 +00:00
parent 4b5b4f8966
commit b677c2b988
2 changed files with 7 additions and 5 deletions
@@ -2311,13 +2311,14 @@ class AdminProductsControllerCore extends AdminController
{ {
$product->wholesale_price = (float)Tools::convertPrice($price, $id_currency); //converted in the default currency $product->wholesale_price = (float)Tools::convertPrice($price, $id_currency); //converted in the default currency
$product->supplier_reference = pSQL($reference); $product->supplier_reference = pSQL($reference);
$update_product = true; $product->update();
} }
} }
} }
else else
{ {
$product_supplier = new ProductSupplier($existing_id); $product_supplier = new ProductSupplier($existing_id);
$product_supplier->id_currency = (int)$id_currency;
$product_supplier->product_supplier_price_te = (float)Tools::convertPrice($price, $id_currency); //converted in the default currency $product_supplier->product_supplier_price_te = (float)Tools::convertPrice($price, $id_currency); //converted in the default currency
$product_supplier->product_supplier_reference = pSQL($reference); $product_supplier->product_supplier_reference = pSQL($reference);
$product_supplier->update(); $product_supplier->update();
@@ -278,7 +278,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
'name' => 'load_products', 'name' => 'load_products',
'size' => 7, 'size' => 7,
'required' => false, 'required' => false,
'hint' => 'This will reset the order', 'hint' => $this->l('This will reset the order'),
'desc' => $this->l('If specified, each product which quantity is less or equal to this value will be loaded.'), 'desc' => $this->l('If specified, each product which quantity is less or equal to this value will be loaded.'),
), ),
), ),
@@ -1927,7 +1927,8 @@ class AdminSupplyOrdersControllerCore extends AdminController
$manager = StockManagerFactory::getManager(); $manager = StockManagerFactory::getManager();
foreach ($items as $item) foreach ($items as $item)
{ {
if ($manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $supply_order->id_warehouse, true) <= $threshold) $diff = (int)$threshold - (int)$manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $supply_order->id_warehouse, true);
if ($diff > 0)
{ {
// sets supply_order_detail // sets supply_order_detail
$supply_order_detail = new SupplyOrderDetail(); $supply_order_detail = new SupplyOrderDetail();
@@ -1940,7 +1941,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
$supply_order_detail->name = Product::getProductName($item['id_product'], $item['id_product_attribute'], $supply_order->id_lang); $supply_order_detail->name = Product::getProductName($item['id_product'], $item['id_product_attribute'], $supply_order->id_lang);
$supply_order_detail->ean13 = $item['ean13']; $supply_order_detail->ean13 = $item['ean13'];
$supply_order_detail->upc = $item['upc']; $supply_order_detail->upc = $item['upc'];
$supply_order_detail->quantity_expected = (int)$threshold; $supply_order_detail->quantity_expected = (int)$diff;
$supply_order_detail->exchange_rate = $order_currency->conversion_rate; $supply_order_detail->exchange_rate = $order_currency->conversion_rate;
$product_currency = new Currency($item['id_currency']); $product_currency = new Currency($item['id_currency']);
@@ -1948,8 +1949,8 @@ class AdminSupplyOrdersControllerCore extends AdminController
$supply_order_detail->unit_price_te = Tools::convertPriceFull($item['unit_price_te'], $order_currency, $product_currency); $supply_order_detail->unit_price_te = Tools::convertPriceFull($item['unit_price_te'], $order_currency, $product_currency);
else else
$supply_order_detail->unit_price_te = 0; $supply_order_detail->unit_price_te = 0;
$supply_order_detail->save(); $supply_order_detail->save();
unset($product_currency);
} }
} }
} }