From 6f80da5b2bb48112282bb5e330e3203c6c3b605f Mon Sep 17 00:00:00 2001 From: bMancone Date: Mon, 12 Dec 2011 15:25:51 +0000 Subject: [PATCH] // Updated re-stock git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11139 b9a71923-0436-4b27-9f14-aed3839534dd --- classes/order/OrderHistory.php | 7 ++++++- classes/stock/StockMvt.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php index e97422fb7..669aaea1f 100644 --- a/classes/order/OrderHistory.php +++ b/classes/order/OrderHistory.php @@ -93,10 +93,14 @@ class OrderHistoryCore extends ObjectModel } /* If becoming unlogable => removing sale */ elseif (!$newOS->logable AND ($oldOrderStatus AND $oldOrderStatus->logable)) + { ProductSale::removeProductSale($product['id_product'], $product['cart_quantity']); + // @since 1.5.0 + StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], (int)$product['cart_quantity'], $order->id_shop); + } if (!Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') && !$isValidated AND $newOS->logable AND isset($oldOrderStatus) AND $oldOrderStatus AND $oldOrderStatus->id == Configuration::get('PS_OS_ERROR')) - StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], (int)$product['cart_quantity']); + StockAvailable::updateQuantity($product['id_product'], $product['id_product_attribute'], (int)$product['cart_quantity'], $order->id_shop); // If order is shipped for the first time and // if we use advanced stock management system, decrement stock preperly. // The product is removed from the physical stock. $id_warehouse is needed @@ -134,6 +138,7 @@ class OrderHistoryCore extends ObjectModel true ); } + StockAvailable::synchronize($product['id_product']); } } diff --git a/classes/stock/StockMvt.php b/classes/stock/StockMvt.php index 05dc90241..551a5972d 100644 --- a/classes/stock/StockMvt.php +++ b/classes/stock/StockMvt.php @@ -196,7 +196,7 @@ class StockMvtCore extends ObjectModel } /** - * Gets the negative stock mvts that corresponds to the given order, for the given product, in the given quantity + * Gets the negative stock mvts that correspond to the given order, for the given product, in the given quantity * * @since 1.5.0 * @param int $id_order