diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 3a00b069b52..1d82527eaba 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin - * + * Copyright (C) 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 @@ -40,32 +40,43 @@ accessforbidden(); $typeconst=array('yesno','texte','chaine'); +$action = getpost("action"); + // 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') - && $_POST["constvalue"] == -1) $_POST["constvalue"]=''; - if ($_POST["constname"]=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice + $const=GETPOST("constname"); + $value=GETPOST("constvalue"); + + 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; - else $_POST["constvalue"]=1; + if ($value) $value=0; + 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]; $type=$_POST["consttype"]; - $constnote=isset($_POST["constnote"])?$_POST["constnote"]:''; - $result=dolibarr_set_const($db,$const,$value,$typeconst[$type],0,$constnote,$conf->entity); - if ($result < 0) + $constnote=GETPOST("constnote"); + $res=dolibarr_set_const($db,$const,$value,$typeconst[$type],0,$constnote,$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) { - print $db->error(); + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; } } // 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); if ($result < 0) @@ -75,7 +86,7 @@ if ($_GET["action"] == 'set') } // 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); if ($result < 0) @@ -466,4 +477,10 @@ function form_constantes($tableau) print ''; } +dol_htmloutput_mesg($mesg); + +$db->close(); + +llxFooter(); + ?> \ No newline at end of file diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 2c3c97eddde..69e038492c6 100755 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -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_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_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++;