From edb5dab96cb5ac0ef97dd0fcd930a85ac4181d95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2009 12:17:28 +0000 Subject: [PATCH] Fix: Bad error mangement --- htdocs/comm/remx.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index da85e26f174..95bb336eeb6 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -49,23 +49,29 @@ if ($_POST["action"] == 'setremise') { if (price2num($_POST["amount_ht"]) > 0) { - if (! $_POST["desc"]) + $error=0; + if (empty($_POST["desc"])) { $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")).'
'; + $error++; } - $soc = new Societe($db); - $soc->fetch($_GET["id"]); - $soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]); + if (! $error) + { + $soc = new Societe($db); + $soc->fetch($_GET["id"]); + $soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]); - if ($result > 0) - { - Header("Location: remx.php?id=".$_GET["id"]); - exit; - } - else - { - $mesg='
'.$soc->error.'
'; + if ($result > 0) + { + Header("Location: remx.php?id=".$_GET["id"]); + exit; + } + else + { + $error++; + $mesg='
'.$soc->error.'
'; + } } } else