New : After commit b7ee10a074 don't add product with qty 0 in invoices

This commit is contained in:
Maxime Kohlhaas 2014-08-07 14:07:44 +02:00
parent 3819529d86
commit 7deacdf851

View File

@ -744,7 +744,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
}
// Standard invoice or Deposit invoice created from a Predefined invoice
if (($_POST['type'] == 0 || $_POST['type'] == 3) && $_POST['fac_rec'] > 0)
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && $_POST['fac_rec'] > 0)
{
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($dateinvoice))
@ -773,7 +773,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
}
// Standard or deposit or proforma invoice
if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0)
if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT || $_POST['type'] == Facture::TYPE_PROFORMA) && $_POST['fac_rec'] <= 0)
{
if (GETPOST('socid', 'int') < 1)
{
@ -852,7 +852,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
if ($id > 0)
{
// If deposit invoice
if ($_POST['type'] == 3)
if ($_POST['type'] == Facture::TYPE_DEPOSIT)
{
$typeamount = GETPOST('typedeposit', 'alpha');
$valuedeposit = GETPOST('valuedeposit', 'int');
@ -938,6 +938,9 @@ else if ($action == 'add' && $user->rights->facture->creer)
$num=count($lines);
for ($i=0;$i<$num;$i++)
{
// Don't add lines with qty 0 when coming from a shipment including all order lines
if($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);