Browse Source

Sort Supplier Order commandedet lines by id when receive

Mathieu Moulin 2 years ago
parent
commit
fcfe0a8979
1 changed files with 7 additions and 2 deletions
  1. 7 2
      htdocs/fourn/commande/dispatch.php

+ 7 - 2
htdocs/fourn/commande/dispatch.php

@@ -709,8 +709,13 @@ 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 .= " ORDER BY p.ref, p.label";
-
+		// Added by MMI Mathieu Moulin iProspective
+		// Sort commandedet lines by id when receive
+		if (!empty($conf->global->ORDER_DISPATCH_BY_COMMANDEDET_ID))
+			$sql .= " ORDER BY l.rowid";
+		else
+			$sql .= " ORDER BY p.ref, p.label";
+		
 		$resql = $db->query($sql);
 		if ($resql) {
 			$num = $db->num_rows($resql);