Fix a useless group by

This commit is contained in:
Laurent Destailleur 2022-03-17 13:57:50 +01:00
parent 7aeaaab7f0
commit 98cc40ac8d

View File

@ -373,7 +373,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
}
}
if (!$notrigger && !$error) {
if (!$error) {
global $conf, $langs, $user;
// Call trigger
@ -682,7 +682,8 @@ if ($id > 0 || !empty($ref)) {
$db->free($resql);
}
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,";
//$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,";
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, l.qty as qty,";
$sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse";
// Enable hooks to alter the SQL query (SELECT)
@ -718,7 +719,7 @@ if ($id > 0 || !empty($ref)) {
}
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY p.ref, p.label, p.tobatch, p.fk_default_warehouse, l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
//$sql .= " GROUP BY p.ref, p.label, p.tobatch, p.fk_default_warehouse, l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
$sql .= " ORDER BY l.rang, p.ref, p.label";
$resql = $db->query($sql);