dolibarr  16.0.5
setupmail.php
1 <?php
2 
3 /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
5  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 require '../../main.inc.php';
22 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
23 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
24 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
25 require_once '../lib/datapolicy.lib.php';
26 
27 // Translations
28 $langs->loadLangs(array('admin', 'companies', 'members', 'datapolicy'));
29 
30 
31 // Parameters
32 $action = GETPOST('action', 'aZ09');
33 $backtopage = GETPOST('backtopage', 'alpha');
34 $formadmin = new FormAdmin($db);
35 
36 if (GETPOST('l')) {
37  $l = GETPOST('l');
38 } else {
39  $l = $langs->defaultlang;
40 }
41 // Access control
42 if (!$user->admin) {
44 }
45 
46 /*
47  * Actions
48  */
49 
50 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
51 
52 if ($action == 'setvalue' && $user->admin) {
53  $db->begin();
54  $sub = "DATAPOLICIESSUBJECT_".$l;
55  $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
56  $cont = "DATAPOLICIESCONTENT_".$l;
57  $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
58  $cont = "TXTLINKDATAPOLICIESACCEPT_".$l;
59  $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
60  $cont = "TXTLINKDATAPOLICIESREFUSE_".$l;
61  $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
62  $sub = "DATAPOLICIESACCEPT_".$l;
63  $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
64  $sub = "DATAPOLICIESREFUSE_".$l;
65  $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
66  if (!($result > 0)) {
67  $error++;
68  }
69  if (!$error) {
70  $db->commit();
71  setEventMessage($langs->trans("SetupSaved"));
72  } else {
73  $db->rollback();
74  dol_print_error($db);
75  }
76 }
77 
78 
79 /*
80  * View
81  */
82 
83 $page_name = "datapolicySetup";
84 llxHeader('', $langs->trans($page_name));
85 
86 // Subheader
87 $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
88 
89 print load_fiche_titre($langs->trans($page_name), $linkback, 'object_datapolicy@datapolicy');
90 
91 // Configuration header
93 print dol_get_fiche_head($head, 'settings', '', -1, "datapolicy@datapolicy");
94 
95 
96 print "<script type='text/javascript'>
97  $(document).ready(function(){
98  $('#default_lang').change(function(){
99  lang=$('#default_lang').val();
100  window.location.replace('" . $_SERVER['PHP_SELF']."?l='+lang);
101  });
102  });
103 </script>";
104 
105 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?l='.$l.'">';
106 print '<input type="hidden" name="token" value="'.newToken().'">';
107 print '<input type="hidden" name="action" value="setvalue">';
108 print '<table>';
109 if ($conf->global->MAIN_MULTILANGS) {
110  print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', null, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
111  print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
112  print '</tr>';
113 }
114 $subject = 'DATAPOLICIESSUBJECT_'.$l;
115 $linka = 'TXTLINKDATAPOLICIESACCEPT_'.$l;
116 $linkr = 'TXTLINKDATAPOLICIESREFUSE_'.$l;
117 $content = 'DATAPOLICIESCONTENT_'.$l;
118 $acc = 'DATAPOLICIESACCEPT_'.$l;
119 $ref = 'DATAPOLICIESREFUSE_'.$l;
120 print '<tr class"oddeven"><td class="fieldrequired">';
121 print $langs->trans('DATAPOLICIESSUBJECTMAIL').'</td><td>';
122 print '<input type="text" size="100" name="'.$subject.'" value="'.$conf->global->$subject.'" />';
123 print '</td><tr>';
124 print '<tr class"oddeven"><td class="fieldrequired">';
125 print $langs->trans('DATAPOLICIESCONTENTMAIL').'</td><td>';
126 print $langs->trans('DATAPOLICIESSUBSITUTION'); echo'__LINKACCEPT__,__LINKREFUSED__,__FIRSTNAME__,__NAME__,__CIVILITY__';
127 $doleditor = new DolEditor($content, $conf->global->$content, '', 250, 'Full', '', false, true, 1, 200, 70);
128 $doleditor->Create();
129 print '</td><tr>';
130 print '<tr class"oddeven"><td class="fieldrequired">';
131 print $langs->trans('TXTLINKDATAPOLICIESACCEPT').'</td><td>';
132 print '<input type="text" size="200" name="'.$linka.'" value="'.$conf->global->$linka.'" />';
133 print '</td><tr>';
134 print '<tr class"oddeven"><td class="fieldrequired">';
135 print $langs->trans('TXTLINKDATAPOLICIESREFUSE').'</td><td>';
136 print '<input type="text" size="200" name="'.$linkr.'" value="'.$conf->global->$linkr.'" />';
137 print '</td><tr>';
138 print '<tr class"oddeven"><td class="fieldrequired">';
139 
140 print $langs->trans('DATAPOLICIESACCEPT').'</td><td>';
141 
142 $doleditor = new DolEditor($acc, $conf->global->$acc, '', 250, 'Full', '', false, true, 1, 200, 70);
143 $doleditor->Create();
144 print '</td><tr>';
145 print '<tr class"oddeven"><td class="fieldrequired">';
146 print $langs->trans('DATAPOLICIESREFUSE').'</td><td>';
147 
148 print $langs->trans('');
149 $doleditor = new DolEditor($ref, $conf->global->$ref, '', 250, 'Full', '', false, true, 1, 200, 70);
150 $doleditor->Create();
151 print '</td><tr>';
152 print '</table>';
153 
154 print '<br><center><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></center>';
155 
156 print '</form>';
157 
158 print dol_get_fiche_end();
159 
160 print '<br><br>';
161 
162 print $langs->trans('SendAgreementText');
163 print '<a class="button" href="'.DOL_URL_ROOT.'/datapolicy/mailing.php">'.$langs->trans('SendAgreement').'</a>';
164 
165 llxFooter();
166 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
FormAdmin
Class to generate html code for admin pages.
Definition: html.formadmin.class.php:30
datapolicyAdminPrepareHead
datapolicyAdminPrepareHead()
Prepare admin pages header.
Definition: datapolicy.lib.php:30
setEventMessage
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
Definition: functions.lib.php:8108
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
dolibarr_set_const
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:627
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59
DolEditor
Class to manage a WYSIWYG editor.
Definition: doleditor.class.php:30