Просмотр исходного кода

MMIDocument Option to order shipping lines by ref

Mathieu Moulin 2 лет назад
Родитель
Сommit
38ec16fafd
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      htdocs/core/modules/expedition/doc/pdf_espadon.modules.php

+ 6 - 0
htdocs/core/modules/expedition/doc/pdf_espadon.modules.php

@@ -188,6 +188,12 @@ class pdf_espadon extends ModelePdfExpedition
 			$outputlangsbis->loadLangs(array("main", "bills", "orders", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
 		}
 
+		// Added by MMI Mathieu Moulin iProspective
+		// Sort by Product Ref
+		if (!empty($conf->global->MMI_EXPE_ORDER_LINES_BY_REF))
+			usort($object->lines, function($i, $j){
+				return ($i->ref > $j->ref) ?1 :(($i->ref < $j->ref) ?-1 :0);
+			});
 		$nblines = count($object->lines);
 
 		// Loop on each lines to detect if there is at least one image to show