// StockManager: added test for time_left in getProductCoverage()
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9480 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
cef6e4f65a
commit
eb2e1826e5
1 file changed
+5
-1
@@ -482,6 +482,9 @@ class StockManagerCore implements StockManagerInterface
|
|||||||
if (!$id_product_attribute)
|
if (!$id_product_attribute)
|
||||||
$id_product_attribute = 0;
|
$id_product_attribute = 0;
|
||||||
|
|
||||||
|
if ($coverage == 0 || !$coverage)
|
||||||
|
$coverage = 7; // Week by default
|
||||||
|
|
||||||
// gets all stock_mvt for the given coverage period
|
// gets all stock_mvt for the given coverage period
|
||||||
$query = '
|
$query = '
|
||||||
SELECT SUM(sm.`physical_quantity`) as quantity_out
|
SELECT SUM(sm.`physical_quantity`) as quantity_out
|
||||||
@@ -504,7 +507,8 @@ class StockManagerCore implements StockManagerInterface
|
|||||||
$id_product_attribute,
|
$id_product_attribute,
|
||||||
($id_warehouse ? array($id_warehouse) : null),
|
($id_warehouse ? array($id_warehouse) : null),
|
||||||
true);
|
true);
|
||||||
$time_left = round($physical_quantity / $quantity_per_day);
|
|
||||||
|
$time_left = ($quantity_per_day == 0) ? 365 : round($physical_quantity / $quantity_per_day);
|
||||||
|
|
||||||
return $time_left;
|
return $time_left;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user