From 783e01588c1179eb65afd26ea4c1ff93b9ebcef9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Aug 2019 20:47:40 +0200 Subject: [PATCH] FIX It was possible to create cashfence without entering data. --- htdocs/compta/cashcontrol/cashcontrol_card.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 1fa95eb0b46ce..4f67f02d7f5cf 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -132,7 +132,16 @@ $error=0; foreach($arrayofpaymentmode as $key=>$val) { - $object->$key = price2num(GETPOST($key.'_amount', 'alpha')); + if (GETPOST($key.'_amount', 'alpha') == '') + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors'); + $action='start'; + $error++; + } + else + { + $object->$key = price2num(GETPOST($key.'_amount', 'alpha')); + } } if (! $error)