dolibarr  9.0.0
adherent_emails.php
1 <?php
2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
6  * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
7  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
8  * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
9  * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
10  * Copyright (C) 2015 Jean-Fran├žois Ferry <jfefe@aternatik.fr>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
32 require '../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
35 
36 // Load translation files required by the page
37 $langs->loadLangs(array("admin","members"));
38 
39 if (! $user->admin) accessforbidden();
40 
41 
42 $oldtypetonewone=array('texte'=>'text','chaine'=>'string'); // old type to new ones
43 
44 $action = GETPOST('action','alpha');
45 
46 $error = 0;
47 
48 // Editing global variables not related to a specific theme
49 $constantes=array(
50  'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
51  'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
52  'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
53  'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
54  'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
55  'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
56  'ADHERENT_MAIL_FROM'=>'string',
57  'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
58  'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
59 );
60 
61 
62 
63 /*
64  * Actions
65  */
66 
67 //
68 if ($action == 'updateall')
69 {
70  $db->begin();
71  $res1=$res2=$res3=$res4=$res5=$res6=0;
72  $res1=dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
73  if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
74  {
75  setEventMessages('ErrorFailedToSaveDate', null, 'errors');
76  $db->rollback();
77  }
78  else
79  {
80  setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
81  $db->commit();
82  }
83 }
84 
85 // Action mise a jour ou ajout d'une constante
86 if ($action == 'update' || $action == 'add')
87 {
88  $constlineid = GETPOST('rowid','int');
89  $constname=GETPOST('constname','alpha');
90 
91  $constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
92  $consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
93  $constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
94 
95  $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
96 
97  $res=dolibarr_set_const($db,$constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
98 
99  if (! $res > 0) $error++;
100 
101  if (! $error)
102  {
103  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
104  }
105  else
106  {
107  setEventMessages($langs->trans("Error"), null, 'errors');
108  }
109 }
110 
111 // Action activation d'un sous module du module adherent
112 if ($action == 'set')
113 {
114  $result=dolibarr_set_const($db, GETPOST('name','alpha'), GETPOST('value'), '', 0, '', $conf->entity);
115  if ($result < 0)
116  {
117  print $db->error();
118  }
119 }
120 
121 // Action desactivation d'un sous module du module adherent
122 if ($action == 'unset')
123 {
124  $result=dolibarr_del_const($db,GETPOST('name','alpha'),$conf->entity);
125  if ($result < 0)
126  {
127  print $db->error();
128  }
129 }
130 
131 
132 
133 /*
134  * View
135  */
136 
137 $form = new Form($db);
138 
139 $help_url='EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
140 
141 llxHeader('',$langs->trans("MembersSetup"),$help_url);
142 
143 
144 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
145 print load_fiche_titre($langs->trans("MembersSetup"),$linkback,'title_setup');
146 
147 
148 $head = member_admin_prepare_head();
149 
150 dol_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user');
151 
152 // TODO Use global form
153 //print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
154 //print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
155 //print '<input type="hidden" name="action" value="updateall">';
156 
157 $helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
158 $helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
159 $helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
160 //$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
161 
162 form_constantes($constantes, 0, $helptext);
163 
164 //print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
165 //print '</form>';
166 
167 dol_fiche_end();
168 
169 // End of page
170 llxFooter();
171 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
member_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: member.lib.php:158
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:510
form_constantes($tableau, $strictw3c=0, $helptext='')
Show array with constants to edit.
Definition: admin.lib.php:1365
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting a parameter.
dolibarr_del_const($db, $name, $entity=1)
Effacement d&#39;une constante dans la base de donnees.
Definition: admin.lib.php:435
dol_fiche_end($notab=0)
Show tab footer of a card.
llxHeader()
Empty header.
Definition: wrapper.php:44
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.