From 9084de938848a40f8031d75dcdd032792ad5c20c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Jul 2009 01:11:04 +0000 Subject: [PATCH] Can add line invoice with qty = 0 --- htdocs/compta/facture.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8e41ce3b1e5..b6bfbeaa833 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -855,8 +855,7 @@ if (($_POST['action'] == 'addline' || $_POST['action'] == 'addline_predef') && $ $result = -1 ; } - // qty can't be null for invoice (no option) - if ($result >= 0 && $_POST['qty'] && (($_POST['pu']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod'])) + if ($result >= 0 && $_POST['qty']!='' && (($_POST['pu']!='' && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprod'])) { $ret=$fac->fetch($_POST['facid']); if ($ret < 0) @@ -959,6 +958,10 @@ if (($_POST['action'] == 'addline' || $_POST['action'] == 'addline_predef') && $ } } } + else + { + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'
'; + } if ($result > 0) {