Uniformize code
This commit is contained in:
parent
7ced92a40b
commit
64f4ad4bda
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -40,32 +40,43 @@ accessforbidden();
|
|||||||
|
|
||||||
$typeconst=array('yesno','texte','chaine');
|
$typeconst=array('yesno','texte','chaine');
|
||||||
|
|
||||||
|
$action = getpost("action");
|
||||||
|
|
||||||
|
|
||||||
// Action mise a jour ou ajout d'une constante
|
// Action mise a jour ou ajout d'une constante
|
||||||
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
|
if ($action == 'update' || $action == 'add')
|
||||||
{
|
{
|
||||||
if (($_POST["constname"]=='ADHERENT_CARD_TYPE' || $_POST["constname"]=='ADHERENT_ETIQUETTE_TYPE')
|
$const=GETPOST("constname");
|
||||||
&& $_POST["constvalue"] == -1) $_POST["constvalue"]='';
|
$value=GETPOST("constvalue");
|
||||||
if ($_POST["constname"]=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
|
||||||
|
if (($const=='ADHERENT_CARD_TYPE' || $const=='ADHERENT_ETIQUETTE_TYPE')
|
||||||
|
&& $value == -1) $value='';
|
||||||
|
if ($const=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||||
{
|
{
|
||||||
if ($_POST["constvalue"]) $_POST["constvalue"]=0;
|
if ($value) $value=0;
|
||||||
else $_POST["constvalue"]=1;
|
else $value=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$const=$_POST["constname"];
|
|
||||||
$value=$_POST["constvalue"];
|
|
||||||
if (in_array($const,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $value=$_POST["constvalue".$const];
|
if (in_array($const,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $value=$_POST["constvalue".$const];
|
||||||
$type=$_POST["consttype"];
|
$type=$_POST["consttype"];
|
||||||
$constnote=isset($_POST["constnote"])?$_POST["constnote"]:'';
|
$constnote=GETPOST("constnote");
|
||||||
$result=dolibarr_set_const($db,$const,$value,$typeconst[$type],0,$constnote,$conf->entity);
|
$res=dolibarr_set_const($db,$const,$value,$typeconst[$type],0,$constnote,$conf->entity);
|
||||||
if ($result < 0)
|
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
print $db->error();
|
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action activation d'un sous module du module adherent
|
// Action activation d'un sous module du module adherent
|
||||||
if ($_GET["action"] == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
$result=dolibarr_set_const($db, $_GET["name"],$_GET["value"],'',0,'',$conf->entity);
|
$result=dolibarr_set_const($db, $_GET["name"],$_GET["value"],'',0,'',$conf->entity);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -75,7 +86,7 @@ if ($_GET["action"] == 'set')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Action desactivation d'un sous module du module adherent
|
// Action desactivation d'un sous module du module adherent
|
||||||
if ($_GET["action"] == 'unset')
|
if ($action == 'unset')
|
||||||
{
|
{
|
||||||
$result=dolibarr_del_const($db,$_GET["name"],$conf->entity);
|
$result=dolibarr_del_const($db,$_GET["name"],$conf->entity);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -466,4 +477,10 @@ function form_constantes($tableau)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -44,7 +44,7 @@ if ($action == 'update')
|
|||||||
$res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$_POST["MEMBER_ENABLE_PUBLIC"],'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$_POST["MEMBER_ENABLE_PUBLIC"],'chaine',0,'',$conf->entity);
|
||||||
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$_POST["MEMBER_NEWFORM_AMOUNT"],'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$_POST["MEMBER_NEWFORM_AMOUNT"],'chaine',0,'',$conf->entity);
|
||||||
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$_POST["MEMBER_NEWFORM_EDITAMOUNT"],'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$_POST["MEMBER_NEWFORM_EDITAMOUNT"],'chaine',0,'',$conf->entity);
|
||||||
$$res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$_POST["MEMBER_NEWFORM_PAYONLINE"],'chaine',0,'',$conf->entity);
|
$res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$_POST["MEMBER_NEWFORM_PAYONLINE"],'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user