fix edition of expense report without vat

This commit is contained in:
De Coninck Laurent 2017-02-24 12:07:32 +01:00
parent e981e719a1
commit 4fc0468356

View File

@ -950,7 +950,6 @@ if (empty($reshook))
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
if (empty($vatrate)) $vatrate = "0.000"; if (empty($vatrate)) $vatrate = "0.000";
$object_ligne->vatrate = price2num($vatrate); $object_ligne->vatrate = price2num($vatrate);
$object_ligne->fk_projet = $fk_projet; $object_ligne->fk_projet = $fk_projet;
@ -1079,6 +1078,10 @@ if (empty($reshook))
$qty = GETPOST('qty'); $qty = GETPOST('qty');
$value_unit = GETPOST('value_unit'); $value_unit = GETPOST('value_unit');
$vatrate = GETPOST('vatrate'); $vatrate = GETPOST('vatrate');
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
if (empty($vatrate)) $vatrate = "0.000";
$vatrate = price2num($vatrate);
if (! GETPOST('fk_c_type_fees') > 0) if (! GETPOST('fk_c_type_fees') > 0)
{ {
@ -1086,7 +1089,7 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$action=''; $action='';
} }
if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '') if ((int)$vatrate < 0 || $vatrate == '')
{ {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors');