// Introduct "PS_ADVANCED_STOCK_MANAGEMENT", the new stock management

This commit is contained in:
mDeflotte
2011-10-20 14:09:04 +00:00
parent 388f231885
commit e8a0385668
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -91,8 +91,10 @@ class OrderHistoryCore extends ObjectModel
/* If becoming unlogable => removing sale */ /* If becoming unlogable => removing sale */
else if (!$newOS->logable AND ($oldOrderStatus AND $oldOrderStatus->logable)) else if (!$newOS->logable AND ($oldOrderStatus AND $oldOrderStatus->logable))
ProductSale::removeProductSale($product['id_product'], $product['cart_quantity']); ProductSale::removeProductSale($product['id_product'], $product['cart_quantity']);
// The product is removed from the physical stock. $id_warehouse is needed
if ($newOS->shipped == 1 && $oldOrderStatus->shipped == 0) 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']);
else if ($newOS->shipped == 1 && $oldOrderStatus->shipped == 0) // The product is removed from the physical stock. $id_warehouse is needed
Stock::updateQuantity($product['id_product'], $product['id_product_attribute'], -$product['cart_quantity'], $id_warehouse, $id_order); Stock::updateQuantity($product['id_product'], $product['id_product_attribute'], -$product['cart_quantity'], $id_warehouse, $id_order);
// @todo If the old order states was "shipped" and the new is "not shipped" the stock is not decremented // @todo If the old order states was "shipped" and the new is "not shipped" the stock is not decremented
} }
+2 -1
View File
@@ -239,7 +239,8 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
(151, 'PS_SHOP_DEFAULT', '1', NOW(), NOW()), (151, 'PS_SHOP_DEFAULT', '1', NOW(), NOW()),
(152, 'PS_CARRIER_DEFAULT_SORT', '0', NOW(), NOW()), (152, 'PS_CARRIER_DEFAULT_SORT', '0', NOW(), NOW()),
(153, 'PS_STOCK_MVT_INC_REASON_DEFAULT', '1', NOW(), NOW()), (153, 'PS_STOCK_MVT_INC_REASON_DEFAULT', '1', NOW(), NOW()),
(154, 'PS_STOCK_MVT_DEC_REASON_DEFAULT', '2', NOW(), NOW()); (154, 'PS_STOCK_MVT_DEC_REASON_DEFAULT', '2', NOW(), NOW()),
(155, 'PS_ADVANCED_STOCK_MANAGEMENT', '1', NOW(), NOW());
INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES
(36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()), (36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()),