[-] BugFix : Bad count in request for admin stock instant states
This commit is contained in:
1 parent
62e8f827a4
commit
2df86d2489
1 file changed
+17
-5
@@ -203,12 +203,22 @@ class AdminStockInstantStateControllerCore extends AdminController
|
|||||||
$order_way = $this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderway') : 'ASC';
|
$order_way = $this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderway') : 'ASC';
|
||||||
|
|
||||||
$query = 'SELECT SQL_CALC_FOUND_ROWS
|
$query = 'SELECT SQL_CALC_FOUND_ROWS
|
||||||
|
id_stock,
|
||||||
|
id_product,
|
||||||
|
id_product_attribute,
|
||||||
|
designation,
|
||||||
|
IF((count(id_stock)=1), s.price_te, \'--\') as price_te,
|
||||||
|
SUM(physical_quantity) physical_quantity,
|
||||||
|
SUM(usable_quantity) usable_quantity,
|
||||||
|
ean13,
|
||||||
|
reference,
|
||||||
|
IF((count(id_stock)=1), 0, 1) as need_details
|
||||||
|
FROM (SELECT
|
||||||
IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(agl.`name`, \' - \', al.name SEPARATOR \', \')), pl.name) as designation,
|
IFNULL(CONCAT(pl.name, \' : \', GROUP_CONCAT(agl.`name`, \' - \', al.name SEPARATOR \', \')), pl.name) as designation,
|
||||||
id_stock, p.id_product, s.id_product_attribute, ean13, p.reference,
|
id_stock, p.id_product, s.id_product_attribute, ean13, p.reference,
|
||||||
IF((count(DISTINCT id_stock)=1), s.price_te, \'--\') as price_te,
|
s.price_te,
|
||||||
IF((count(DISTINCT id_stock)=1), 0, 1) as need_details,
|
physical_quantity,
|
||||||
CAST((SUM(physical_quantity) / (count(id_stock) - count(DISTINCT id_stock) + 1)) AS SIGNED INTEGER) AS physical_quantity,
|
usable_quantity
|
||||||
CAST((SUM(usable_quantity) / (count(id_stock) - count(DISTINCT id_stock) + 1)) AS SIGNED INTEGER) AS usable_quantity
|
|
||||||
FROM '._DB_PREFIX_.'stock s
|
FROM '._DB_PREFIX_.'stock s
|
||||||
INNER JOIN '._DB_PREFIX_.'product p
|
INNER JOIN '._DB_PREFIX_.'product p
|
||||||
ON (p.id_product = s.id_product)
|
ON (p.id_product = s.id_product)
|
||||||
@@ -225,10 +235,12 @@ class AdminStockInstantStateControllerCore extends AdminController
|
|||||||
WHERE id_warehouse = '.$this->getCurrentWarehouseId().' '.(isset($this->_where) ? $this->_where.' ' : '').
|
WHERE id_warehouse = '.$this->getCurrentWarehouseId().' '.(isset($this->_where) ? $this->_where.' ' : '').
|
||||||
($this->deleted ? 'AND a.`deleted` = 0 ' : '').
|
($this->deleted ? 'AND a.`deleted` = 0 ' : '').
|
||||||
(isset($this->_filter) ? $this->_filter : '').'
|
(isset($this->_filter) ? $this->_filter : '').'
|
||||||
GROUP BY pac.id_product_attribute, p.id_product
|
GROUP BY id_stock
|
||||||
'.((isset($this->_filterHaving) || isset($this->_having)) ? 'HAVING ' : '').
|
'.((isset($this->_filterHaving) || isset($this->_having)) ? 'HAVING ' : '').
|
||||||
(isset($this->_filterHaving) ? ltrim($this->_filterHaving, ' AND ') : '').
|
(isset($this->_filterHaving) ? ltrim($this->_filterHaving, ' AND ') : '').
|
||||||
(isset($this->_having) ? $this->_having.' ' : '').'
|
(isset($this->_having) ? $this->_having.' ' : '').'
|
||||||
|
) s
|
||||||
|
GROUP BY id_product_attribute, id_product
|
||||||
ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'
|
ORDER BY `'.pSQL($order_by).'` '.pSQL($order_way).'
|
||||||
LIMIT '.(int)$start.','.(int)$limit;
|
LIMIT '.(int)$start.','.(int)$limit;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user