diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index add5090e081a551d860eac304371fefd3c6b1568..73a62207af15e5f00872da6e80fd6cca541a05fb 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -219,8 +219,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); $error++; } - if (! GETPOST('addline_predefined') && (! GETPOST('pu') || GETPOST('pu')=='')) // Unit price can be 0 but not '' + if (! GETPOST('addline_predefined') && ( GETPOST('pu')==='')) // Unit price can be 0 but not '' { + setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors'); $error++; } @@ -239,7 +240,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit - if (GETPOST('addline_predefined') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' + if ((GETPOST('addline_predefined') || GETPOST('idprodfournprice')) && ( GETPOST('pu')!=='')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' { $idprod=0; $productsupplier = new ProductFournisseur($db); @@ -299,7 +300,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors'); } } - else + else if( GETPOST('pu')!=='' || GETPOST('amountttc')!=='' ) { $type=$_POST["type"]; $desc=$_POST['dp_desc']; @@ -326,7 +327,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) $ttc = price2num($_POST['amountttc']); $ht = $ttc / (1 + ($tauxtva / 100)); $price_base_type = 'HT'; - $result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type); + $result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type); } } }