Try to replace error into warning, so we can still make the order if qty too low

This commit is contained in:
Laurent Destailleur 2017-09-26 20:57:09 +02:00 committed by GitHub
parent 7b106bc642
commit 7cf1a41853

View File

@ -555,18 +555,16 @@ if (empty($reshook))
$vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); $vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);
if ($lineid) if ($lineid)
{ {
$line = new CommandeFournisseurLigne($db); $line = new CommandeFournisseurLigne($db);
$res = $line->fetch($lineid); $res = $line->fetch($lineid);
if (!$res) dol_print_error($db); if (!$res) dol_print_error($db);
} }
if( $productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 ) if ($productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid','int')) < 0 )
{ {
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors'); setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
} }
else
{
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); $date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
@ -684,7 +682,7 @@ if (empty($reshook))
dol_print_error($db,$object->error); dol_print_error($db,$object->error);
exit; exit;
} }
}
} }
// Remove a product line // Remove a product line