// Fixed StockCover

// Removed id_stock_mvt_reason from StockManager::transferBetweenWarehouses()
// It is now allowed to transfer stock within one warehouse if and only if it only changes, for a given quantity, its usable state
This commit is contained in:
bMancone
2011-10-24 12:58:24 +00:00
parent 3d0c38a987
commit 32853c481e
4 changed files with 8 additions and 9 deletions
+4 -4
View File
@@ -444,7 +444,6 @@ class StockManagerCore implements StockManagerInterface
public function transferBetweenWarehouses($id_product,
$id_product_attribute,
$quantity,
$id_stock_mvt_reason,
$id_warehouse_from,
$id_warehouse_to,
$usable_from = true,
@@ -454,7 +453,7 @@ class StockManagerCore implements StockManagerInterface
if ($this->getProductPhysicalQuantities($id_product, $id_product_attribute, array($id_warehouse_from), $usable_from) < $quantity)
return false;
if ($id_warehouse_from == $id_warehouse_to)
if ($id_warehouse_from == $id_warehouse_to && $usable_from == $usable_to)
return false;
// Checks if the given warehouses are available
@@ -469,7 +468,7 @@ class StockManagerCore implements StockManagerInterface
$id_product_attribute,
$warehouse_from,
$quantity,
$id_stock_mvt_reason,
Configuration::get('PS_STOCK_MVT_TRANSFER_FROM'),
$usable_from);
if (!count($stocks))
return false;
@@ -493,7 +492,7 @@ class StockManagerCore implements StockManagerInterface
$id_product_attribute,
$warehouse_to,
$stock['quantity'],
$id_stock_mvt_reason,
Configuration::get('PS_STOCK_MVT_TRANSFER_TO'),
$price,
$usable_to))
return false;
@@ -522,6 +521,7 @@ class StockManagerCore implements StockManagerInterface
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = s.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product`)
WHERE sm.`sign` = -1
AND sm.`id_stock_mvt_reason` != '.Configuration::get('PS_STOCK_MVT_TRANSFER_FROM').'
AND TO_DAYS(NOW()) - TO_DAYS(sm.`date_add`) <= '.(int)$coverage.'
AND s.`id_product` = '.(int)$id_product.'
AND s.`id_product_attribute` = '.(int)$id_product_attribute.