Uniformize code
This commit is contained in:
parent
aacad07511
commit
8e75a21df9
@ -68,14 +68,17 @@ if ($action == 'setcodecompta')
|
|||||||
|
|
||||||
if ($action == 'COMPANY_USE_SEARCH_TO_SELECT')
|
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))
|
$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)
|
||||||
{
|
{
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
$db->commit();
|
||||||
exit;
|
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
$db->rollback();
|
||||||
|
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,17 +86,30 @@ if ($action == 'COMPANY_USE_SEARCH_TO_SELECT')
|
|||||||
if ($action == 'setModuleOptions')
|
if ($action == 'setModuleOptions')
|
||||||
{
|
{
|
||||||
$post_size=count($_POST);
|
$post_size=count($_POST);
|
||||||
|
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
for($i=0;$i < $post_size;$i++)
|
for($i=0;$i < $post_size;$i++)
|
||||||
{
|
{
|
||||||
if (array_key_exists('param'.$i,$_POST))
|
if (array_key_exists('param'.$i,$_POST))
|
||||||
{
|
{
|
||||||
$param=$_POST["param".$i];
|
$param=$_POST["param".$i];
|
||||||
$value=$_POST["value".$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++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Activate a document generator module
|
// Activate a document generator module
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user