dolibarr  13.0.2
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  * Actions
47  */
48 
49 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
50 
51 if ($action == 'setvalue' && $user->admin) {
52  $db->begin();
53  $sub = "DATAPOLICIESSUBJECT_".$l;
54  $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
55  $cont = "DATAPOLICIESCONTENT_".$l;
56  $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
57  $cont = "TXTLINKDATAPOLICIESACCEPT_".$l;
58  $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
59  $cont = "TXTLINKDATAPOLICIESREFUSE_".$l;
60  $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
61  $sub = "DATAPOLICIESACCEPT_".$l;
62  $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
63  $sub = "DATAPOLICIESREFUSE_".$l;
64  $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
65  if (!$result > 0)
66  $error++;
67  if (!$error) {
68  $db->commit();
69  setEventMessage($langs->trans("SetupSaved"));
70  } else {
71  $db->rollback();
72  dol_print_error($db);
73  }
74 }
75 
76 
77 /*
78  * View
79  */
80 
81 $page_name = "datapolicySetup";
82 llxHeader('', $langs->trans($page_name));
83 
84 // Subheader
85 $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
86 
87 print load_fiche_titre($langs->trans($page_name), $linkback, 'object_datapolicy@datapolicy');
88 
89 // Configuration header
91 print dol_get_fiche_head($head, 'settings', '', -1, "datapolicy@datapolicy");
92 
93 
94 print "<script type='text/javascript'>
95  $(document).ready(function(){
96  $('#default_lang').change(function(){
97  lang=$('#default_lang').val();
98  window.location.replace('" . $_SERVER['PHP_SELF']."?l='+lang);
99  });
100  });
101 </script>";
102 
103 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?l='.$l.'">';
104 print '<input type="hidden" name="token" value="'.newToken().'">';
105 print '<input type="hidden" name="action" value="setvalue">';
106 print '<table>';
107 if ($conf->global->MAIN_MULTILANGS) {
108  print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', null, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
109  print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
110  print '</tr>';
111 }
112 $subject = 'DATAPOLICIESSUBJECT_'.$l;
113 $linka = 'TXTLINKDATAPOLICIESACCEPT_'.$l;
114 $linkr = 'TXTLINKDATAPOLICIESREFUSE_'.$l;
115 $content = 'DATAPOLICIESCONTENT_'.$l;
116 $acc = 'DATAPOLICIESACCEPT_'.$l;
117 $ref = 'DATAPOLICIESREFUSE_'.$l;
118 print '<tr class"oddeven"><td class="fieldrequired">';
119 print $langs->trans('DATAPOLICIESSUBJECTMAIL').'</td><td>';
120 print '<input type="text" size="100" name="'.$subject.'" value="'.$conf->global->$subject.'" />';
121 print '</td><tr>';
122 print '<tr class"oddeven"><td class="fieldrequired">';
123 print $langs->trans('DATAPOLICIESCONTENTMAIL').'</td><td>';
124 print $langs->trans('DATAPOLICIESSUBSITUTION'); echo'__LINKACCEPT__,__LINKREFUSED__,__FIRSTNAME__,__NAME__,__CIVILITY__';
125 $doleditor = new DolEditor($content, $conf->global->$content, '', 250, 'Full', '', false, true, 1, 200, 70);
126 $doleditor->Create();
127 print '</td><tr>';
128 print '<tr class"oddeven"><td class="fieldrequired">';
129 print $langs->trans('TXTLINKDATAPOLICIESACCEPT').'</td><td>';
130 print '<input type="text" size="200" name="'.$linka.'" value="'.$conf->global->$linka.'" />';
131 print '</td><tr>';
132 print '<tr class"oddeven"><td class="fieldrequired">';
133 print $langs->trans('TXTLINKDATAPOLICIESREFUSE').'</td><td>';
134 print '<input type="text" size="200" name="'.$linkr.'" value="'.$conf->global->$linkr.'" />';
135 print '</td><tr>';
136 print '<tr class"oddeven"><td class="fieldrequired">';
137 
138 print $langs->trans('DATAPOLICIESACCEPT').'</td><td>';
139 
140 $doleditor = new DolEditor($acc, $conf->global->$acc, '', 250, 'Full', '', false, true, 1, 200, 70);
141 $doleditor->Create();
142 print '</td><tr>';
143 print '<tr class"oddeven"><td class="fieldrequired">';
144 print $langs->trans('DATAPOLICIESREFUSE').'</td><td>';
145 
146 print $langs->trans('');
147 $doleditor = new DolEditor($ref, $conf->global->$ref, '', 250, 'Full', '', false, true, 1, 200, 70);
148 $doleditor->Create();
149 print '</td><tr>';
150 print '</table>';
151 
152 print '<br><center><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center>';
153 
154 print '</form>';
155 
157 
158 print '<br><br>';
159 
160 print $langs->trans('SendAgreementText');
161 print '<a class="button" href="'.dol_buildpath('/datapolicy/mailing.php').'">'.$langs->trans('SendAgreement').'</a>';
162 
163 llxFooter();
164 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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:575
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
Class to generate html code for admin pages.
llxHeader()
Empty header.
Definition: wrapper.php:45
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
datapolicyAdminPrepareHead()
Prepare admin pages header.
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 ...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.
llxFooter()
Empty footer.
Definition: wrapper.php:59