Correction when adding line with price as '0'

This commit is contained in:
Gauthier 2014-03-17 15:38:12 +01:00
parent ed4f7fd083
commit eb43bc4982

View File

@ -219,8 +219,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
$error++; $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'); setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors');
$error++; $error++;
} }
@ -239,7 +240,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
// Ecrase $pu par celui du produit // Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit // Ecrase $desc par celui du produit
// Ecrase $txtva 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; $idprod=0;
$productsupplier = new ProductFournisseur($db); $productsupplier = new ProductFournisseur($db);
@ -299,7 +300,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors'); setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors');
} }
} }
else else if( GETPOST('pu')!=='' || GETPOST('amountttc')!=='' )
{ {
$type=$_POST["type"]; $type=$_POST["type"];
$desc=$_POST['dp_desc']; $desc=$_POST['dp_desc'];