dolibarr  13.0.2
setup.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 require '../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
27 require_once '../lib/datapolicy.lib.php';
28 
29 // Translations
30 $langs->load('admin');
31 $langs->load('companies');
32 $langs->load('members');
33 $langs->load('datapolicy@datapolicy');
34 
35 // Access control
36 if (!$user->admin) accessforbidden();
37 
38 // Parameters
39 $action = GETPOST('action', 'aZ09');
40 $backtopage = GETPOST('backtopage', 'alpha');
41 
42 $arrayofparameters = array();
43 $arrayofparameters['ThirdParty'] = array(
44  'DATAPOLICY_TIERS_CLIENT'=>array('css'=>'minwidth200'),
45  'DATAPOLICY_TIERS_PROSPECT'=>array('css'=>'minwidth200'),
46  'DATAPOLICY_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200'),
47  'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'),
48  'DATAPOLICY_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200'),
49 );
50 if (!empty($conf->global->DATAPOLICY_USE_SPECIFIC_DELAY_FOR_CONTACT)) {
51  $arrayofparameters['Contact'] = array(
52  'DATAPOLICY_CONTACT_CLIENT'=>array('css'=>'minwidth200'),
53  'DATAPOLICY_CONTACT_PROSPECT'=>array('css'=>'minwidth200'),
54  'DATAPOLICY_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200'),
55  'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200'),
56  'DATAPOLICY_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200'),
57  );
58 }
59 if (!empty($conf->adherent->enabled)) {
60  $arrayofparameters['Member'] = array(
61  'DATAPOLICY_ADHERENT'=>array('css'=>'minwidth200'),
62  );
63 }
64 
65 
66 
67 /*
68  * Actions
69  */
70 
71 include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
72 
73 $valTab = array(
74  '' => $langs->trans('Never'),
75  '6' => $langs->trans('NB_MONTHS', 6),
76  '12' => $langs->trans('ONE_YEAR'),
77  '24' => $langs->trans('NB_YEARS', 2),
78  '36' => $langs->trans('NB_YEARS', 3),
79  '48' => $langs->trans('NB_YEARS', 4),
80  '60' => $langs->trans('NB_YEARS', 5),
81  '120' => $langs->trans('NB_YEARS', 10),
82  '180' => $langs->trans('NB_YEARS', 15),
83  '240' => $langs->trans('NB_YEARS', 20),
84 );
85 
86 
87 /*
88  * View
89  */
90 
91 $page_name = "datapolicySetup";
92 llxHeader('', $langs->trans($page_name));
93 
94 // Subheader
95 $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
96 
97 print load_fiche_titre($langs->trans($page_name), $linkback, 'object_generic');
98 
99 // Configuration header
101 print dol_get_fiche_head($head, 'settings', '', -1, "datapolicy@datapolicy");
102 
103 // Setup page goes here
104 echo '<span class="opacitymedium">'.$langs->trans("datapolicySetupPage").'</span><br><br>';
105 
106 
107 if ($action == 'edit')
108 {
109  print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
110  print '<input type="hidden" name="token" value="'.newToken().'">';
111  print '<input type="hidden" name="action" value="update">';
112 
113  print '<table class="noborder centpercent">';
114  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
115 
116  foreach ($arrayofparameters as $title => $tab)
117  {
118  print '<tr class="trforbreak"><td class="titlefield trforbreak" colspan="2">'.$langs->trans($title).'</td></tr>';
119  foreach ($tab as $key => $val)
120  {
121  print '<tr class="oddeven"><td>';
122  print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
123  print '</td><td>';
124  print '<select name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'">';
125  foreach ($valTab as $key1 => $val1) {
126  print '<option value="'.$key1.'" '.($conf->global->$key == $key1 ? 'selected="selected"' : '').'>';
127  print $val1;
128  print '</option>';
129  }
130  print '</select>';
131  print '</td></tr>';
132  }
133  }
134 
135  print '</table>';
136 
137  print '<br><div class="center">';
138  print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
139  print '</div>';
140 
141  print '</form>';
142  print '<br>';
143 } else {
144  print '<table class="noborder centpercent">';
145  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
146 
147  foreach ($arrayofparameters as $title => $tab)
148  {
149  print '<tr class="trforbreak"><td class="titlefield trforbreak" colspan="2">'.$langs->trans($title).'</td></tr>';
150  foreach ($tab as $key => $val)
151  {
152  print '<tr class="oddeven"><td>';
153  print $form->textwithpicto($langs->trans($key), $langs->trans('DATAPOLICY_Tooltip_SETUP'));
154  print '</td><td>'.($conf->global->$key == '' ? $langs->trans('None') : $valTab[$conf->global->$key]).'</td></tr>';
155  }
156  }
157 
158  print '</table>';
159 
160  print '<div class="tabsAction">';
161  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
162  print '</div>';
163 }
164 
165 
166 // Page end
168 
169 llxFooter();
170 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 ...
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_get_fiche_end($notab=0)
Return tab footer of a card.
llxFooter()
Empty footer.
Definition: wrapper.php:59