diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index dd1a86d1a747af449a89d65cbb6a5409db171327..596636c74b065dff898c0c9ac7cb30dd653e0426 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -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 (empty($vatrate)) $vatrate = "0.000"; - $object_ligne->vatrate = price2num($vatrate); $object_ligne->fk_projet = $fk_projet; @@ -1079,6 +1078,10 @@ if (empty($reshook)) $qty = GETPOST('qty'); $value_unit = GETPOST('value_unit'); $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) { @@ -1086,7 +1089,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $action=''; } - if (GETPOST('vatrate') < 0 || GETPOST('vatrate') == '') + if ((int) $vatrate < 0 || $vatrate == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); @@ -2092,7 +2095,7 @@ if ($action != 'create' && $action != 'edit') */ if ($user->rights->expensereport->creer && $object->fk_statut==0) { - if (in_array($object->fk_user_author, $user->getAllChildIds(1))) + if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || !empty($user->rights->expensereport->writeall_advance)) { // Modify print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans('Modify').'</a></div>';