dolibarr  17.0.4
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 <https://www.gnu.org/licenses/>.
17  */
18 
25 // Load Dolibarr environment
26 require '../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/intracommreport.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array("admin", "intracommreport"));
33 
34 // Access Control
35 if (!$user->admin) {
37 }
38 
39 // Get Parameters
40 $action = GETPOST('action', 'aZ09');
41 
42 // Parameters INTRACOMMREPORT_* and others
43 $list_DEB = array(
44  'INTRACOMMREPORT_NUM_AGREMENT',
45 );
46 
47 $list_DES = array(
48  'INTRACOMMREPORT_NUM_DECLARATION',
49 );
50 
51 if ($action == 'update') {
52  $error = 0;
53 
54  if (!$error) {
55  foreach ($list_DEB as $constname) {
56  $constvalue = GETPOST($constname, 'alpha');
57 
58  if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
59  $error++;
60  }
61  }
62 
63  foreach ($list_DES as $constname) {
64  $constvalue = GETPOST($constname, 'alpha');
65 
66  if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
67  $error++;
68  }
69  }
70 
71  dolibarr_set_const($db, "INTRACOMMREPORT_TYPE_ACTEUR", GETPOST("INTRACOMMREPORT_TYPE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
72  dolibarr_set_const($db, "INTRACOMMREPORT_ROLE_ACTEUR", GETPOST("INTRACOMMREPORT_ROLE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
73  dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", 'alpha'), 'chaine', 0, '', $conf->entity);
74  dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", 'alpha'), 'chaine', 0, '', $conf->entity);
75  dolibarr_set_const($db, "INTRACOMMREPORT_CATEG_FRAISDEPORT", GETPOST("INTRACOMMREPORT_CATEG_FRAISDEPORT", 'alpha'), 'chaine', 0, '', $conf->entity);
76 
77  if ($error) {
78  setEventMessages($langs->trans("Error"), null, 'errors');
79  }
80  }
81 
82  if (!$error) {
83  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
84  }
85 }
86 
87 
88 /*
89  * View
90  */
91 
92 $form = new Form($db);
93 $formother = new FormOther($db);
94 
95 llxHeader('', $langs->trans("IntracommReportSetup"));
96 
97 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
98 print load_fiche_titre($langs->trans("IntracommReportSetup"), $linkback, 'title_setup');
99 
101 
102 print dol_get_fiche_head($head, 'general', $langs->trans("IntracommReport"), -1, "intracommreport");
103 
104 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
105 print '<input type="hidden" name="token" value="'.newToken().'">';
106 print '<input type="hidden" name="action" value="update">';
107 
108 print load_fiche_titre($langs->trans("Parameters").' (DEB)');
109 
110 print '<table class="noborder" width="100%">';
111 print '<tr class="liste_titre">';
112 print '<td>'.$langs->trans("Description").'</td>';
113 print '<td>'.$langs->trans("Value").'</td>';
114 print '</tr>';
115 
116 foreach ($list_DEB as $key) {
117  print '<tr class="oddeven value">';
118 
119  // Param
120  $label = $langs->trans($key);
121  print '<td>'.$label.'</td>';
122  // Value
123  print '<td class="left">';
124  print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
125  print '</td>';
126 
127  print '</tr>';
128 }
129 
130 print '<tr class="oddeven">';
131 print '<td>'.$langs->trans("INTRACOMMREPORT_TYPE_ACTEUR").'</td>';
132 $arraychoices = array(''=>$langs->trans("None"), 'PSI'=>'Déclarant pour son compte', 'TDP'=>'Tiers déclarant');
133 print '<td>';
134 print $form->selectarray('INTRACOMMREPORT_TYPE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_TYPE_ACTEUR, 0);
135 print '</td>';
136 print "</tr>\n";
137 
138 print '<tr class="oddeven">';
139 print '<td>'.$langs->trans("INTRACOMMREPORT_ROLE_ACTEUR").'</td>';
140 $arraychoices = array(''=>$langs->trans("None"), 'sender'=>'Emetteur', 'PSI'=>'Déclarant');
141 print '<td>';
142 print $form->selectarray('INTRACOMMREPORT_ROLE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_ROLE_ACTEUR, 0);
143 print '</td>';
144 print "</tr>\n";
145 
146 print '<tr class="oddeven">';
147 print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION").'</td>';
148 $arraychoices = array(1=>'Seuil de 460 000 €', 2=>'En dessous de 460 000 €');
149 print '<td>';
150 print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION, 0);
151 print '</td>';
152 print "</tr>\n";
153 
154 print '<tr class="oddeven">';
155 print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION").'</td>';
156 $arraychoices = array(3=>'Seuil de 460 000 €', 4=>'En dessous de 460 000 €');
157 print '<td>';
158 print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION, 0);
159 print '</td>';
160 print "</tr>\n";
161 
162 print '<tr class="oddeven">';
163 print '<td>'.$langs->trans("INTRACOMMREPORT_CATEG_FRAISDEPORT").'</td>';
164 print '<td>';
165 print $formother->select_categories('product', $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
166 print '</td>';
167 print "</tr>\n";
168 
169 print '</table>';
170 
171 
172 print load_fiche_titre($langs->trans("Parameters").' (DES)');
173 
174 print '<table class="noborder" width="100%">';
175 print '<tr class="liste_titre">';
176 print '<td>'.$langs->trans("Description").'</td>';
177 print '<td>'.$langs->trans("Value").'</td>';
178 print '</tr>';
179 
180 foreach ($list_DES as $key) {
181  print '<tr class="oddeven value">';
182 
183  // Param
184  $label = $langs->trans($key);
185  print '<td>'.$label.'</td>';
186  // Value
187  print '<td class="left">';
188  print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
189  print '</td>';
190 
191  print '</tr>';
192 }
193 
194 print '</table>';
195 
196 print '<div class="center">';
197 print '<input type="submit" name="bt_save" class="butAction button-save" value="'.$langs->trans("Update").'" />';
198 print '</div>';
199 
200 print '</form>';
201 
202 print dol_get_fiche_end();
203 
204 // End of page
205 llxFooter();
206 $db->close();
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:632
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
intracommReportAdminPrepareHead()
Prepare array with list of admin tabs.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.