git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7643 b9a71923-0436-4b27-9f14-aed3839534dd

This commit is contained in:
rMalie
2011-07-18 15:37:31 +00:00
parent 7b8f139103
commit 0452f08f64
3 changed files with 10 additions and 9 deletions
+3 -3
View File
@@ -88,7 +88,7 @@ class StockMvtCore extends ObjectModel
public static function addMissingMvt($id_employee)
{
// Search missing stock movement on products without attributes
$sql = 'SELECT s.id_stock, (s.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
$sql = 'SELECT s.id_stock, (stock.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
FROM '._DB_PREFIX_.'product p
'.Product::sqlStock('p', null, true).'
LEFT JOIN '._DB_PREFIX_.'stock_mvt sm ON s.id_stock = sm.id_stock
@@ -102,9 +102,9 @@ class StockMvtCore extends ObjectModel
$products_without_attributes = Db::getInstance()->ExecuteS($sql);
// Search missing stock movement on products with attributes
$sql = 'SELECT s.id_stock, (s.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
$sql = 'SELECT s.id_stock, (stock.quantity - SUM(IFNULL(sm.quantity, 0))) AS qty
FROM '._DB_PREFIX_.'product_attribute pa
INNER JOIN '._DB_PREFIX_.'stock s ON s.id_product = pa.id_product AND s.id_product_attribute = pa.id_product_attribute
'.Product::sqlStock('pa', 'pa', true).'
LEFT JOIN '._DB_PREFIX_.'stock_mvt sm ON s.id_stock = sm.id_stock
WHERE s.id_product_attribute > 0
AND (