diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php
index 90cb0d836e5..cc8f228275d 100644
--- a/htdocs/admin/societe.php
+++ b/htdocs/admin/societe.php
@@ -68,14 +68,17 @@ if ($action == 'setcodecompta')
if ($action == 'COMPANY_USE_SEARCH_TO_SELECT')
{
- if (dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_COMPANY_USE_SEARCH_TO_SELECT"],'chaine',0,'',$conf->entity))
- {
- Header("Location: ".$_SERVER["PHP_SELF"]);
- exit;
- }
- else
- {
- dol_print_error($db);
+ $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_COMPANY_USE_SEARCH_TO_SELECT"],'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
+ if (! $error)
+ {
+ $db->commit();
+ $mesg = "".$langs->trans("SetupSaved")."";
+ }
+ else
+ {
+ $db->rollback();
+ $mesg = "".$langs->trans("Error")."";
}
}
@@ -83,16 +86,29 @@ if ($action == 'COMPANY_USE_SEARCH_TO_SELECT')
if ($action == 'setModuleOptions')
{
$post_size=count($_POST);
+
+ $db->begin();
+
for($i=0;$i < $post_size;$i++)
{
if (array_key_exists('param'.$i,$_POST))
{
$param=$_POST["param".$i];
$value=$_POST["value".$i];
- if ($param) dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
+ if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
}
}
- $mesg = "".$langs->trans("SetupSaved")."";
+ if (! $error)
+ {
+ $db->commit();
+ $mesg = "".$langs->trans("SetupSaved")."";
+ }
+ else
+ {
+ $db->rollback();
+ $mesg = "".$langs->trans("Error")."";
+ }
}
// Activate a document generator module