* Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France * * 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 * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/adherents/admin/member_emails.php * \ingroup member * \brief Page to setup the module Foundation */ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ // Load translation files required by the page $langs->loadLangs(array("admin", "members")); if (!$user->admin) { accessforbidden(); } $oldtypetonewone = array('texte'=>'text', 'chaine'=>'string'); // old type to new ones $action = GETPOST('action', 'aZ09'); $error = 0; $helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; $helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; $helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; //$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported // Editing global variables not related to a specific theme $constantes = array( 'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))), 'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>array('type'=>'emailtemplate:member','label'=>''), 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>array('type'=>'emailtemplate:member','label'=>''), 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>array('type'=>'emailtemplate:member','label'=>''), 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>array('type'=>'emailtemplate:member','label'=>''), 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>array('type'=>'emailtemplate:member','label'=>''), 'ADHERENT_EMAIL_TEMPLATE_EXCLUSION' =>array('type'=>'emailtemplate:member','label'=>''), 'ADHERENT_MAIL_FROM' =>array('type'=>'string','label'=>''), 'ADHERENT_CC_MAIL_FROM' =>array('type'=>'string','label'=>''), 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT' =>array('type'=>'string','label'=>''), 'ADHERENT_AUTOREGISTER_NOTIF_MAIL' =>array('type'=>'html', 'tooltip'=>$helptext,'label'=>'') ); /* * Actions */ // if ($action == 'updateall') { $db->begin(); $res = 0; foreach ($constantes as $constname => $value) { $constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alphanohtml') : GETPOST('constvalue')); $consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype')); $constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'restricthtml') : GETPOST('constnote')); $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype]; $constvalue = preg_replace('/:member$/', '', $constvalue); $res = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity); if ($res <= 0) { $error++; $action = 'list'; } } if ($error > 0) { setEventMessages('ErrorFailedToSaveDate', null, 'errors'); $db->rollback(); } else { setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); $db->commit(); } } // Action to update or add a constant if ($action == 'update' || $action == 'add') { $constlineid = GETPOSTINT('rowid'); $constname = GETPOST('constname', 'alpha'); $constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alphanohtml') : GETPOST('constvalue')); $consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype')); $constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'restricthtml') : GETPOST('constnote')); $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype]; $constvalue = preg_replace('/:member$/', '', $constvalue); $res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } /* * View */ $form = new Form($db); $title = $langs->trans("MembersSetup"); $help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-admin_emails'); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup'); $head = member_admin_prepare_head(); print dol_get_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user'); // TODO Use global form print '
'; print ''; print ''; print '
'; form_constantes($constantes, 3, ''); print '
'; print '
'; print dol_get_fiche_end(); // End of page llxFooter(); $db->close();