35require
'../../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
47$langs->loadLangs(array(
"admin",
"members"));
54$oldtypetonewone = array(
'texte'=>
'text',
'chaine'=>
'string');
56$action =
GETPOST(
'action',
'aZ09');
60$helptext =
'*'.$langs->trans(
"FollowingConstantsWillBeSubstituted").
'<br>';
61$helptext .=
'__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
62$helptext .=
'__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
67 'MEMBER_REMINDER_EMAIL' => array(
'type'=>
'yesno',
'label' => $langs->trans(
'MEMBER_REMINDER_EMAIL', $langs->transnoentities(
"Module2300Name")),
'help' => $langs->trans(
'MEMBER_REMINDER_EMAILHelp', $langs->transnoentities(
"Module2300Name"))),
68 'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' => array(
'type'=>
'emailtemplate:member',
'label'=>
''),
69 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' => array(
'type'=>
'emailtemplate:member',
'label'=>
''),
70 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' => array(
'type'=>
'emailtemplate:member',
'label'=>
''),
71 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' => array(
'type'=>
'emailtemplate:member',
'label'=>
''),
72 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' => array(
'type'=>
'emailtemplate:member',
'label'=>
''),
73 'ADHERENT_EMAIL_TEMPLATE_EXCLUSION' => array(
'type'=>
'emailtemplate:member',
'label'=>
''),
74 'ADHERENT_MAIL_FROM' => array(
'type'=>
'string',
'label'=>
''),
75 'ADHERENT_CC_MAIL_FROM' => array(
'type'=>
'string',
'label'=>
''),
76 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT' => array(
'type'=>
'string',
'label'=>
''),
77 'ADHERENT_AUTOREGISTER_NOTIF_MAIL' => array(
'type'=>
'html',
'tooltip' => $helptext,
'label' =>
'')
86if ($action ==
'updateall') {
90 foreach ($constantes as $constname => $value) {
91 $constvalue = (GETPOSTISSET(
'constvalue_'.$constname) ?
GETPOST(
'constvalue_'.$constname,
'alphanohtml') :
GETPOST(
'constvalue'));
92 $consttype = (GETPOSTISSET(
'consttype_'.$constname) ?
GETPOST(
'consttype_'.$constname,
'alphanohtml') :
GETPOST(
'consttype'));
93 $constnote = (GETPOSTISSET(
'constnote_'.$constname) ?
GETPOST(
'constnote_'.$constname,
'restricthtml') :
GETPOST(
'constnote'));
95 $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
96 $constvalue = preg_replace(
'/:member$/',
'', $constvalue);
115if ($action ==
'update' || $action ==
'add') {
117 $constname =
GETPOST(
'constname',
'alpha');
119 $constvalue = (GETPOSTISSET(
'constvalue_'.$constname) ?
GETPOST(
'constvalue_'.$constname,
'alphanohtml') :
GETPOST(
'constvalue'));
120 $consttype = (GETPOSTISSET(
'consttype_'.$constname) ?
GETPOST(
'consttype_'.$constname,
'alphanohtml') :
GETPOST(
'consttype'));
121 $constnote = (GETPOSTISSET(
'constnote_'.$constname) ?
GETPOST(
'constnote_'.$constname,
'restricthtml') :
GETPOST(
'constnote'));
123 $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
124 $constvalue = preg_replace(
'/:member$/',
'', $constvalue);
146$title = $langs->trans(
"MembersSetup");
147$help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
149llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-member page-admin_emails');
151$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
153print
load_fiche_titre($langs->trans(
"MembersSetup"), $linkback,
'title_setup');
161print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
162print
'<input type="hidden" name="token" value="'.newToken().
'">';
163print
'<input type="hidden" name="action" value="updateall">';
169$tableau = $constantes;
171print
'<div class="div-table-responsive-no-min">';
172print
'<table class="noborder centpercent">';
173print
'<tr class="liste_titre">';
174print
'<td class="">'.$langs->trans(
"Parameter").
'</td>';
179foreach ($tableau as $key => $const) {
181 $type = $const[
'type'];
182 $label = $const[
'label'];
183 $help = empty($const[
'help']) ?
'' : $const[
'help'];
186 $sql =
"SELECT rowid, ".$db->decrypt(
'name').
" as name, ".
$db->decrypt(
'value').
" as value, type, note";
187 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const";
188 $sql .=
" WHERE ".$db->decrypt(
'name').
" = '".
$db->escape($const).
"'";
189 $sql .=
" AND entity IN (0, ".$conf->entity.
")";
190 $sql .=
" ORDER BY name ASC, entity DESC";
191 $resql =
$db->query($sql);
196 $obj =
$db->fetch_object($resql);
199 $obj = (object) array(
'rowid' =>
'',
'name' => $const,
'value' =>
'',
'type' => $type,
'note' =>
'');
201 if ($const ==
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' && !
getDolGlobalString(
'MEMBER_REMINDER_EMAIL')) {
205 print
'<tr class="oddeven">';
209 print
'<input type="hidden" name="rowid[]" value="'.$obj->rowid.
'">';
210 print
'<input type="hidden" name="constname[]" value="'.$const.
'">';
211 print
'<input type="hidden" name="constnote_'.$obj->name.
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
212 print
'<input type="hidden" name="consttype_'.$obj->name.
'" value="'.($obj->type ? $obj->type :
'string').
'">';
215 $tmparray = explode(
':', $obj->type);
216 if (!empty($tmparray[1])) {
217 $picto = preg_replace(
'/_send$/',
'', $tmparray[1]);
220 print
img_picto(
'', $picto,
'class="pictofixedwidth"');
223 if (!empty($tableau[$key][
'tooltip'])) {
224 print $form->textwithpicto($label ? $label : $langs->trans(
'Desc'.$const), $tableau[$key][
'tooltip'] . $help);
226 print
'<span class="valignmiddle">';
227 print($label ? $label : $langs->trans(
'Desc'.$const));
230 print $form->textwithpicto(
'', $help);
234 if (in_array($const, [
'ADHERENT_MAIL_FROM',
'ADHERENT_CC_MAIL_FROM'])) {
235 print
' '.img_help(1, $langs->trans(
"EMailHelpMsgSPFDKIM"));
242 print
'<input type="hidden" name="consttype_'.$const.
'" value="'.($obj->type ? $obj->type :
'string').
'">';
243 print
'<input type="hidden" name="constnote_'.$const.
'" value="'.nl2br(
dol_escape_htmltag($obj->note)).
'">';
244 if ($obj->type ==
'textarea') {
245 print
'<textarea class="flat" name="constvalue_'.$const.
'" cols="50" rows="5" wrap="soft">'.
"\n";
247 print
"</textarea>\n";
248 } elseif ($obj->type ==
'html') {
249 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
250 $doleditor =
new DolEditor(
'constvalue_'.$const, $obj->value,
'', 160,
'dolibarr_notes',
'',
false,
false,
isModEnabled(
'fckeditor'), ROWS_5,
'90%');
251 $doleditor->Create();
252 } elseif ($obj->type ==
'yesno') {
253 print $form->selectyesno(
'constvalue_'.$const, $obj->value, 1,
false, 0, 1);
254 } elseif (preg_match(
'/emailtemplate/', $obj->type)) {
255 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
258 $tmp = explode(
':', $obj->type);
260 $formmail->fetchAllEMailTemplate($tmp[1], $user,
null, -1);
261 $arrayofmessagename = array();
262 if (is_array($formmail->lines_model)) {
263 foreach ($formmail->lines_model as $modelmail) {
266 if (!empty($arrayofmessagename[$modelmail->label])) {
267 $moreonlabel =
' <span class="opacitymedium">('.$langs->trans(
"SeveralLangugeVariatFound").
')</span>';
270 $arrayofmessagename[$modelmail->label.
':'.$tmp[1]] = $langs->trans(preg_replace(
'/\(|\)/',
'', $modelmail->label)).$moreonlabel;
275 print $form->selectarray(
'constvalue_'.$const, $arrayofmessagename, $obj->value.
':'.$tmp[1],
'None', 0, 0,
'', 0, 0, 0,
'',
'', 1);
277 print
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/mails_templates.php', [
'action' =>
'create',
'type_template' => $tmp[1],
'backtopage' =>
dolBuildUrl($_SERVER[
"PHP_SELF"])]).
'">'.
img_picto(
'',
'add').
'</a>';
278 } elseif (preg_match(
'/MAIL_FROM$/i', $const)) {
279 print
img_picto(
'',
'email',
'class="pictofixedwidth"').
'<input type="text" class="flat minwidth300" name="constvalue_'.$const.
'" value="'.
dol_escape_htmltag($obj->value).
'">';
281 print
'<input type="text" class="flat minwidth300" name="constvalue_'.$const .
'" value="'.
dol_escape_htmltag($obj->value).
'">';
292print
'<div class="center"><input type="submit" class="button" value="'.$langs->trans(
"Update").
'" name="update"></div>';
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).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
member_admin_prepare_head()
Return array head with list of tabs to view object information.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.