diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index cc45226b9a08b94645dca4dfddd9dbc9c63022e4..876e2966ccd31ea94ef2c3cb5ec436b5b85137ae 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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);