From afe4057a976abd8d834a2cf698c249ff40ed83f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Oct 2015 21:17:19 +0200 Subject: [PATCH] FIX #3757 Can't set amount in a social contribution with some languages --- htdocs/compta/sociales/charges.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 7be1360287c..74e4d3f8aff 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -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);