// OrderHistory : fixed r11441
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11471 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -80,15 +80,17 @@ class OrderHistoryCore extends ObjectModel
|
||||
foreach ($order->getProductsDetail() as $product)
|
||||
{
|
||||
/* If becoming logable => adding sale */
|
||||
if ($newOS->logable
|
||||
&& $oldOrderStatus instanceof OrderHistory
|
||||
&& $oldOrderStatus->logable)
|
||||
if ($newOS->logable
|
||||
&& !($oldOrderStatus instanceof OrderState
|
||||
&& $oldOrderStatus->logable))
|
||||
{
|
||||
ProductSale::addProductSale($product['product_id'], $product['product_quantity']);
|
||||
// @since 1.5.0
|
||||
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], -(int)$product['product_quantity'], $order->id_shop);
|
||||
}
|
||||
/* If becoming unlogable => removing sale */
|
||||
else if (!$newOS->logable
|
||||
&& $oldOrderStatus instanceof OrderHistory
|
||||
else if (!$newOS->logable
|
||||
&& $oldOrderStatus instanceof OrderState
|
||||
&& $oldOrderStatus->logable)
|
||||
{
|
||||
ProductSale::removeProductSale($product['product_id'], $product['product_quantity']);
|
||||
@@ -99,7 +101,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
if ((!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') || (int)$product['advanced_stock_management'] != 1)
|
||||
&& !$isValidated
|
||||
&& $newOS->logable
|
||||
&& $oldOrderStatus instanceof OrderHistory
|
||||
&& $oldOrderStatus instanceof OrderState
|
||||
&& $oldOrderStatus->id == Configuration::get('PS_OS_ERROR')
|
||||
)
|
||||
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], (int)$product['product_quantity'], $order->id_shop);
|
||||
@@ -108,7 +110,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
// The product is removed from the physical stock. $id_warehouse is needed
|
||||
// @TODO Checks $id_warehouse
|
||||
else if ($newOS->shipped == 1
|
||||
&& $oldOrderStatus instanceof OrderHistory
|
||||
&& $oldOrderStatus instanceof OrderState
|
||||
&& $oldOrderStatus->shipped == 0
|
||||
&& Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||
&& (int)$product['advanced_stock_management'] == 1
|
||||
@@ -133,7 +135,7 @@ class OrderHistoryCore extends ObjectModel
|
||||
StockAvailable::updateQuantity($product['product_id'], $product['product_attribute_id'], -(int)$product['product_quantity'], $order->id_shop);
|
||||
}
|
||||
else if ($newOS->shipped == 0
|
||||
&& $oldOrderStatus instanceof OrderHistory
|
||||
&& $oldOrderStatus instanceof OrderState
|
||||
&& $oldOrderStatus->shipped == 1
|
||||
&& Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')
|
||||
&& (int)$product['advanced_stock_management'] == 1
|
||||
|
||||
Reference in New Issue
Block a user