From d62a1c70207e7e879c838d990928cfbf7f6b87aa Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 2 Sep 2011 12:51:12 +0000 Subject: [PATCH] Uniformize code --- htdocs/admin/prelevement.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 85b5ee9b08e..89ff251f65e 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -40,11 +40,9 @@ $action = GETPOST("action"); if ($action == "set") { - $db->begin(); for ($i = 0 ; $i < 2 ; $i++) { $res = dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; } $id=$_POST["PRELEVEMENT_ID_BANKACCOUNT"]; @@ -53,32 +51,23 @@ if ($action == "set") if($account->fetch($id)>0) { $res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); - if (! $res > 0) $error++; } - else $error++; + if (! $res > 0) $error++; + if (! $error) { - $db->commit(); $mesg = "".$langs->trans("SetupSaved").""; } else { - $db->rollback(); $mesg = "".$langs->trans("Error").""; } }