diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 32fd5f48f05..5f483adc9cf 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -53,16 +53,13 @@ if ($user->societe_id > 0) if ($_POST["action"] == 'setremise') { - if (! price2num($_POST["amount_ht"]) > 0) - { - $mesg='
'.$langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")).'
'; - } - elseif (! $_POST["desc"]) - { - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")).'
'; - } - else + if (price2num($_POST["amount_ht"]) > 0) { + if (! $_POST["desc"]) + { + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")).'
'; + } + $soc = New Societe($db); $soc->fetch($_GET["id"]); $soc->set_remise_except($_POST["amount_ht"],$user,$_POST["desc"],$_POST["tva_tx"]); @@ -77,6 +74,10 @@ if ($_POST["action"] == 'setremise') $mesg='
'.$soc->error.'
'; } } + else + { + $mesg='
'.$langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")).'
'; + } } if ($_GET["action"] == 'remove')