diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 484ac638554..89ff251f65e 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -31,18 +31,18 @@ require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); $langs->load("admin"); $langs->load("withdrawals"); -$langs->load("bills"); -$langs->load("other"); // Security check if (!$user->admin) accessforbidden(); -if ($_GET["action"] == "set") +$action = GETPOST("action"); + +if ($action == "set") { for ($i = 0 ; $i < 2 ; $i++) { - dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity); } $id=$_POST["PRELEVEMENT_ID_BANKACCOUNT"]; @@ -50,21 +50,29 @@ if ($_GET["action"] == "set") if($account->fetch($id)>0) { - dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); } - Header("Location: prelevement.php"); - exit; + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } -if ($_GET["action"] == "addnotif") +if ($action == "addnotif") { $bon = new BonPrelevement($db); $bon->AddNotification($db,$_POST["user"],$_POST["action"]); @@ -73,7 +81,7 @@ if ($_GET["action"] == "addnotif") exit; } -if ($_GET["action"] == "deletenotif") +if ($action == "deletenotif") { $bon = new BonPrelevement($db); $bon->DeleteNotificationById($_GET["notif"]); @@ -242,6 +250,8 @@ if ($resql) print ''; print ''; +dol_htmloutput_mesg($mesg); + $db->close(); llxFooter(); diff --git a/htdocs/compta/bank/admin/bank.php b/htdocs/compta/bank/admin/bank.php index 23dad4bbd76..4c33f0e3bd5 100644 --- a/htdocs/compta/bank/admin/bank.php +++ b/htdocs/compta/bank/admin/bank.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010 Juanjo Menent +/* Copyright (C) 2009 Laurent Destailleur + * Copyright (C) 2010-2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,20 +36,32 @@ $langs->load("banks"); if (!$user->admin) accessforbidden(); -$typeconst=array('yesno','texte','chaine'); +$action = GETPOST("action"); /* * Actions */ -if ($_POST["action"] == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') +if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') { - dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$_POST["BANK_CHEQUERECEIPT_FREE_TEXT"],'chaine',0,'',$conf->entity); + $free = GETPOST("BANK_CHEQUERECEIPT_FREE_TEXT"); + $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$free,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } //Order display of bank account -if ($_GET["action"] == 'setbankorder') +if ($action == 'setbankorder') { if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",$_GET["value"],'chaine',0,'',$conf->entity) > 0) { @@ -168,6 +180,8 @@ while ($i < sizeof($bankorder)) print "\n"; +dol_htmloutput_mesg($mesg); + $db->close(); llxFooter();