FIX #3757 Can't set amount in a social contribution with some languages

This commit is contained in:
Laurent Destailleur 2015-10-18 21:17:19 +02:00
parent c64c1a0201
commit afe4057a97

View File

@ -79,7 +79,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
{
$dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
$amount=GETPOST('amount');
$amount=price2num(GETPOST('amount'));
$actioncode=GETPOST('actioncode');
if (! $dateech)
{
@ -114,7 +114,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
$chargesociales->lib=GETPOST('label');
$chargesociales->date_ech=$dateech;
$chargesociales->periode=$dateperiod;
$chargesociales->amount=price2num($amount);
$chargesociales->amount=$amount;
$id=$chargesociales->create($user);
if ($id <= 0)
@ -130,7 +130,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
{
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
$amount=GETPOST('amount');
$amount=price2num(GETPOST('amount'));
if (! $dateech)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors');
@ -146,7 +146,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
$action = 'edit';
}
else
elseif (! is_numeric($amount))
{
setEventMessage($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), 'errors');
$action = 'create';
}
else
{
$chargesociales=new ChargeSociales($db);
$result=$chargesociales->fetch($id);