From b7ee10a0747062a2f1d16bcf30b2da801846327f Mon Sep 17 00:00:00 2001
From: Maxime Kohlhaas <maxime@atm-consulting.fr>
Date: Sat, 28 Jun 2014 17:17:37 +0200
Subject: [PATCH] New : can add all products in a shipment, even if qty is 0
 with SHIPMENT_GETS_ALL_ORDER_PRODUCTS

---
 htdocs/expedition/class/expedition.class.php | 2 ++
 htdocs/expedition/fiche.php                  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 93c7f63b4ad..c0c647698e8 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -590,6 +590,8 @@ class Expedition extends CommonObject
 			    $cpt = $this->db->num_rows($resql);
                 for ($i = 0; $i < $cpt; $i++)
 				{
+					if($obj->qty <= 0) continue;
+					
 					dol_syslog(get_class($this)."::valid movement index ".$i);
 					$obj = $this->db->fetch_object($resql);
 
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index 89d0995fb45..ff6b23c10be 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -163,7 +163,7 @@ if ($action == 'add')
         {
             $qty = "qtyl".$i;
 			if (! isset($batch_line[$i])) {
-				if (GETPOST($qty,'int') > 0)
+				if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))
 				{
 					$ent = "entl".$i;
 					$idl = "idl".$i;
-- 
GitLab