From af8608ab7aa2fe8fc188e53cde6290ce35b7dadf Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas <maxime@atm-consulting.fr>
Date: Mon, 16 May 2016 10:49:43 +0200
Subject: [PATCH] Fix services dispatch on supplier order only if
 STOCK_SUPPORTS_SERVICES

---
 htdocs/fourn/commande/dispatch.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index fd992dbeeb1..9d7d2bfeefe 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -386,6 +386,7 @@ if ($id > 0 || ! empty($ref))
 			$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
 			$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid";
 			$sql.= " WHERE l.fk_commande = ".$commande->id;
+			if(empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND l.product_type = 0";
 			$sql.= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent";	// Calculation of amount dispatched is done per fk_product so we must group by fk_product
 			$sql.= " ORDER BY p.ref, p.label";
 
-- 
GitLab