dolibarr  16.0.5
intracommreport.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
3  * Copyright (C) 2019-2020 Open-DSI <support@open-dsi.fr>
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 <http://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 DOL_DOCUMENT_ROOT.'/core/lib/intracommreport.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
29 
30 // Load translation files required by the page
31 $langs->loadLangs(array("admin", "intracommreport"));
32 
33 if (!$user->admin) {
35 }
36 
37 $action = GETPOST('action', 'aZ09');
38 
39 // Parameters INTRACOMMREPORT_* and others
40 $list_DEB = array(
41  'INTRACOMMREPORT_NUM_AGREMENT',
42 );
43 
44 $list_DES = array(
45  'INTRACOMMREPORT_NUM_DECLARATION',
46 );
47 
48 if ($action == 'update') {
49  $error = 0;
50 
51  if (!$error) {
52  foreach ($list_DEB as $constname) {
53  $constvalue = GETPOST($constname, 'alpha');
54 
55  if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
56  $error++;
57  }
58  }
59 
60  foreach ($list_DES as $constname) {
61  $constvalue = GETPOST($constname, 'alpha');
62 
63  if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
64  $error++;
65  }
66  }
67 
68  dolibarr_set_const($db, "INTRACOMMREPORT_TYPE_ACTEUR", GETPOST("INTRACOMMREPORT_TYPE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
69  dolibarr_set_const($db, "INTRACOMMREPORT_ROLE_ACTEUR", GETPOST("INTRACOMMREPORT_ROLE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
70  dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", 'alpha'), 'chaine', 0, '', $conf->entity);
71  dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", 'alpha'), 'chaine', 0, '', $conf->entity);
72  dolibarr_set_const($db, "INTRACOMMREPORT_CATEG_FRAISDEPORT", GETPOST("INTRACOMMREPORT_CATEG_FRAISDEPORT", 'alpha'), 'chaine', 0, '', $conf->entity);
73 
74  if ($error) {
75  setEventMessages($langs->trans("Error"), null, 'errors');
76  }
77  }
78 
79  if (!$error) {
80  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
81  }
82 }
83 
84 /*
85  * View
86  */
87 
88 $form = new Form($db);
89 $formother = new FormOther($db);
90 
91 llxHeader('', $langs->trans("IntracommReportSetup"));
92 
93 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
94 print load_fiche_titre($langs->trans("IntracommReportSetup"), $linkback, 'title_setup');
95 
97 
98 print dol_get_fiche_head($head, 'general', $langs->trans("IntracommReport"), -1, "intracommreport");
99 
100 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
101 print '<input type="hidden" name="token" value="'.newToken().'">';
102 print '<input type="hidden" name="action" value="update">';
103 
104 print load_fiche_titre($langs->trans("Parameters").' (DEB)');
105 
106 print '<table class="noborder" width="100%">';
107 print '<tr class="liste_titre">';
108 print '<td>'.$langs->trans("Description").'</td>';
109 print '<td>'.$langs->trans("Value").'</td>';
110 print '</tr>';
111 
112 foreach ($list_DEB as $key) {
113  print '<tr class="oddeven value">';
114 
115  // Param
116  $label = $langs->trans($key);
117  print '<td>'.$label.'</td>';
118  // Value
119  print '<td class="left">';
120  print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
121  print '</td>';
122 
123  print '</tr>';
124 }
125 
126 print '<tr class="oddeven">';
127 print '<td>'.$langs->trans("INTRACOMMREPORT_TYPE_ACTEUR").'</td>';
128 $arraychoices = array(''=>$langs->trans("None"), 'PSI'=>'Déclarant pour son compte', 'TDP'=>'Tiers déclarant');
129 print '<td>';
130 print $form->selectarray('INTRACOMMREPORT_TYPE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_TYPE_ACTEUR, 0);
131 print '</td>';
132 print "</tr>\n";
133 
134 print '<tr class="oddeven">';
135 print '<td>'.$langs->trans("INTRACOMMREPORT_ROLE_ACTEUR").'</td>';
136 $arraychoices = array(''=>$langs->trans("None"), 'sender'=>'Emetteur', 'PSI'=>'Déclarant');
137 print '<td>';
138 print $form->selectarray('INTRACOMMREPORT_ROLE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_ROLE_ACTEUR, 0);
139 print '</td>';
140 print "</tr>\n";
141 
142 print '<tr class="oddeven">';
143 print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION").'</td>';
144 $arraychoices = array(1=>'Seuil de 460 000 €', 2=>'En dessous de 460 000 €');
145 print '<td>';
146 print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION, 0);
147 print '</td>';
148 print "</tr>\n";
149 
150 print '<tr class="oddeven">';
151 print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION").'</td>';
152 $arraychoices = array(3=>'Seuil de 460 000 €', 4=>'En dessous de 460 000 €');
153 print '<td>';
154 print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION, 0);
155 print '</td>';
156 print "</tr>\n";
157 
158 print '<tr class="oddeven">';
159 print '<td>'.$langs->trans("INTRACOMMREPORT_CATEG_FRAISDEPORT").'</td>';
160 print '<td>';
161 print $formother->select_categories('product', $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
162 print '</td>';
163 print "</tr>\n";
164 
165 print '</table>';
166 
167 
168 print load_fiche_titre($langs->trans("Parameters").' (DES)');
169 
170 print '<table class="noborder" width="100%">';
171 print '<tr class="liste_titre">';
172 print '<td>'.$langs->trans("Description").'</td>';
173 print '<td>'.$langs->trans("Value").'</td>';
174 print '</tr>';
175 
176 foreach ($list_DES as $key) {
177  print '<tr class="oddeven value">';
178 
179  // Param
180  $label = $langs->trans($key);
181  print '<td>'.$label.'</td>';
182  // Value
183  print '<td class="left">';
184  print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
185  print '</td>';
186 
187  print '</tr>';
188 }
189 
190 print '</table>';
191 
192 print '<div class="center">';
193 print '<input type="submit" name="bt_save" class="butAction button-save" value="'.$langs->trans("Update").'" />';
194 print '</div>';
195 
196 print '</form>';
197 
198 print dol_get_fiche_end();
199 
200 // End of page
201 llxFooter();
202 $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
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39
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
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:80
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
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
intracommReportAdminPrepareHead
intracommReportAdminPrepareHead()
Prepare array with list of admin tabs.
Definition: intracommreport.lib.php:30
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
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