From 4fe9f621045355ec3d3a5617cfa61427f84aa505 Mon Sep 17 00:00:00 2001 From: Regis Houssin <regis@dolibarr.fr> Date: Thu, 30 Sep 2010 20:06:37 +0000 Subject: [PATCH] Fix: bad error management --- htdocs/compta/paiement_charge.php | 5 ++++- .../sociales/class/paymentsocialcontribution.class.php | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 5ec1599c2cb..abe7eb24555 100755 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -46,6 +46,8 @@ if ($user->societe_id > 0) */ if ($_POST["action"] == 'add_paiement') { + $error=0; + if ($_POST["cancel"]) { $loc = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid; @@ -76,6 +78,7 @@ if ($_POST["action"] == 'add_paiement') $paymentid = 0; // Read possible payments + // FIXME add error message if no payment is defined foreach ($_POST as $key => $value) { if (substr($key,0,7) == 'amount_') @@ -99,7 +102,7 @@ if ($_POST["action"] == 'add_paiement') if (! $error) { $paymentid = $paiement->create($user); - if (! $paymentid > 0) + if ($paymentid < 0) { $errmsg=$paiement->error; $error++; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 60caa013278..6b91c2bb69d 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -71,6 +71,7 @@ class PaymentSocialContribution extends CommonObject function create($user) { global $conf, $langs; + $error=0; // Validation parametres -- GitLab