* Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 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/datapolicy/admin/setupmail.php * \ingroup datapolicy * \brief Datapolicy setup page to define email content end send email for end user agreement. */ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/datapolicy/lib/datapolicy.lib.php'; // Translations $langs->loadLangs(array('admin', 'companies', 'members', 'datapolicy')); // Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); if (GETPOST('l')) { $l = GETPOST('l'); } else { $l = $langs->defaultlang; } // Security if (!isModEnabled("datapolicy")) { accessforbidden(); } if (!$user->admin) { accessforbidden(); } /* * Actions */ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'setvalue' && $user->admin) { $db->begin(); $sub = "DATAPOLICYSUBJECT_".$l; $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); $cont = "DATAPOLICYCONTENT_".$l; $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); $cont = "TXTLINKDATAPOLICYACCEPT_".$l; $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); $cont = "TXTLINKDATAPOLICYREFUSE_".$l; $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity); $sub = "DATAPOLICYACCEPT_".$l; $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); $sub = "DATAPOLICYREFUSE_".$l; $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity); if (!($result > 0)) { $error++; } if (!$error) { $db->commit(); setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); dol_print_error($db); } } /* * View */ $formadmin = new FormAdmin($db); $page_name = "datapolicySetup"; llxHeader('', $langs->trans($page_name)); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans($page_name), $linkback, 'generic'); // Configuration header $head = datapolicyAdminPrepareHead(); print dol_get_fiche_head($head, 'emailing', '', -1, ''); print ""; print '
'; print ''; print ''; print ''; if (getDolGlobalInt('MAIN_MULTILANGS')) { print ''; } $subject = 'DATAPOLICYSUBJECT_'.$l; $linka = 'TXTLINKDATAPOLICYACCEPT_'.$l; $linkr = 'TXTLINKDATAPOLICYREFUSE_'.$l; $content = 'DATAPOLICYCONTENT_'.$l; $acc = 'DATAPOLICYACCEPT_'.$l; $ref = 'DATAPOLICYREFUSE_'.$l; print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', null, 0).''."\n"; print img_picto('', 'language', 'class="pictofixedwidth"'); print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); print '
'; print $langs->trans('DATAPOLICYSUBJECTMAIL').''; print ''; print '
'; print $langs->trans('DATAPOLICYCONTENTMAIL').''; print ''; print $langs->trans('DATAPOLICYSUBSITUTION'); print '__LINKACCEPT__,__LINKREFUSED__,__FIRSTNAME__,__NAME__,__CIVILITY__'; print ''; $doleditor = new DolEditor($content, $conf->global->$content, '', 250, 'Full', '', false, true, 1, 200, 70); $doleditor->Create(); print '
'; print $langs->trans('TXTLINKDATAPOLICYACCEPT').''; print ''; print '
'; print $langs->trans('TXTLINKDATAPOLICYREFUSE').''; print ''; print '
'; print $langs->trans('DATAPOLICYACCEPT').''; $doleditor = new DolEditor($acc, $conf->global->$acc, '', 250, 'Full', '', false, true, 1, 200, 70); $doleditor->Create(); print '
'; print $langs->trans('DATAPOLICYREFUSE').''; print $langs->trans(''); $doleditor = new DolEditor($ref, $conf->global->$ref, '', 250, 'Full', '', false, true, 1, 200, 70); $doleditor->Create(); print '
'; print '
'; print '
'; print dol_get_fiche_end(); print '

'; print $langs->trans('SendAgreementText'); print ''.$langs->trans('SendAgreementRequestByEmail').''; llxFooter(); $db->close();