From 5bae9db0a82292d2eb2c01268cce2b738bc488e3 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 2 Jun 2020 17:29:55 +0200 Subject: [PATCH] FIX: Fix detect distached product and set to received completely when the supplier order have services (support STOCK_SUPPORTS_SERVICES) --- htdocs/fourn/class/fournisseur.commande.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 092c3df8dc2..66788cdb126 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3063,6 +3063,7 @@ class CommandeFournisseur extends CommonOrder { if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0) { + require_once DOL_DOCUMENT_ROOT.'/htdocs/product/class/product.class.php'; $date_liv = dol_now(); // Build array with quantity deliverd by product @@ -3070,7 +3071,11 @@ class CommandeFournisseur extends CommonOrder $qtydelivered[$line->fk_product]+=$line->qty; } foreach($this->lines as $line) { - $qtywished[$line->fk_product]+=$line->qty; + if ($line->product_type == Product::TYPE_PRODUCT || + ($line->product_type == Product::TYPE_SERVICE && !empty($conf->global->STOCK_SUPPORTS_SERVICES)) + ) { + $qtywished[$line->fk_product] += $line->qty; + } } //Compare array $diff_array=array_diff_assoc($qtydelivered, $qtywished); // Warning: $diff_array is done only on common keys.