dolibarr 21.0.0-alpha
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 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/intracommreport/lib/intracommreport.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
31
32// Load translation files required by the page
33$langs->loadLangs(array("admin", "intracommreport"));
34
35// Access Control
36if (!$user->admin) {
38}
39
40// Get Parameters
41$action = GETPOST('action', 'aZ09');
42
43// Parameters INTRACOMMREPORT_* and others
44$list_DEB = array(
45 'INTRACOMMREPORT_NUM_AGREMENT',
46);
47
48$list_DES = array(
49 'INTRACOMMREPORT_NUM_DECLARATION',
50);
51
52if ($action == 'update') {
53 $error = 0;
54
55 if (!$error) {
56 foreach ($list_DEB as $constname) {
57 $constvalue = GETPOST($constname, 'alpha');
58
59 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
60 $error++;
61 }
62 }
63
64 foreach ($list_DES as $constname) {
65 $constvalue = GETPOST($constname, 'alpha');
66
67 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
68 $error++;
69 }
70 }
71
72 dolibarr_set_const($db, "INTRACOMMREPORT_TYPE_ACTEUR", GETPOST("INTRACOMMREPORT_TYPE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
73 dolibarr_set_const($db, "INTRACOMMREPORT_ROLE_ACTEUR", GETPOST("INTRACOMMREPORT_ROLE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
74 dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", 'alpha'), 'chaine', 0, '', $conf->entity);
75 dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", 'alpha'), 'chaine', 0, '', $conf->entity);
76 dolibarr_set_const($db, "INTRACOMMREPORT_CATEG_FRAISDEPORT", GETPOST("INTRACOMMREPORT_CATEG_FRAISDEPORT", 'alpha'), 'chaine', 0, '', $conf->entity);
77
78 if ($error) {
79 setEventMessages($langs->trans("Error"), null, 'errors');
80 }
81 }
82
83 if (!$error) {
84 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
85 }
86}
87
88
89/*
90 * View
91 */
92
93$form = new Form($db);
94$formother = new FormOther($db);
95
96llxHeader('', $langs->trans("IntracommReportSetup"), '', '', 0, 0, '', '', '', 'mod-intracommreport page-admin_intracommreport');
97
98$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
99print load_fiche_titre($langs->trans("IntracommReportSetup"), $linkback, 'title_setup');
100
102
103print dol_get_fiche_head($head, 'general', $langs->trans("IntracommReport"), -1, "intracommreport");
104
105print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
106print '<input type="hidden" name="token" value="'.newToken().'">';
107print '<input type="hidden" name="action" value="update">';
108
109print load_fiche_titre($langs->trans("Parameters").' (DEB)');
110
111print '<table class="noborder" width="100%">';
112print '<tr class="liste_titre">';
113print '<td>'.$langs->trans("Description").'</td>';
114print '<td>'.$langs->trans("Value").'</td>';
115print '</tr>';
116
117foreach ($list_DEB as $key) {
118 print '<tr class="oddeven value">';
119
120 // Param
121 $label = $langs->trans($key);
122 print '<td>'.$label.'</td>';
123 // Value
124 print '<td class="left">';
125 print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
126 print '</td>';
127
128 print '</tr>';
129}
130
131print '<tr class="oddeven">';
132print '<td>'.$langs->trans("INTRACOMMREPORT_TYPE_ACTEUR").'</td>';
133$arraychoices = array('' => $langs->trans("None"), 'PSI' => 'Déclarant pour son compte', 'TDP' => 'Tiers déclarant');
134print '<td>';
135print $form->selectarray('INTRACOMMREPORT_TYPE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_TYPE_ACTEUR, 0);
136print '</td>';
137print "</tr>\n";
138
139print '<tr class="oddeven">';
140print '<td>'.$langs->trans("INTRACOMMREPORT_ROLE_ACTEUR").'</td>';
141$arraychoices = array('' => $langs->trans("None"), 'sender' => 'Emetteur', 'PSI' => 'Déclarant');
142print '<td>';
143print $form->selectarray('INTRACOMMREPORT_ROLE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_ROLE_ACTEUR, 0);
144print '</td>';
145print "</tr>\n";
146
147print '<tr class="oddeven">';
148print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION").'</td>';
149$arraychoices = array(1 => 'Seuil de 460 000 €', 2 => 'En dessous de 460 000 €');
150print '<td>';
151print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION, 0);
152print '</td>';
153print "</tr>\n";
154
155print '<tr class="oddeven">';
156print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION").'</td>';
157$arraychoices = array(3 => 'Seuil de 460 000 €', 4 => 'En dessous de 460 000 €');
158print '<td>';
159print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION, 0);
160print '</td>';
161print "</tr>\n";
162
163print '<tr class="oddeven">';
164print '<td>'.$langs->trans("INTRACOMMREPORT_CATEG_FRAISDEPORT").'</td>';
165print '<td>';
166print $formother->select_categories('product', $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
167print '</td>';
168print "</tr>\n";
169
170print '</table>';
171
172
173print load_fiche_titre($langs->trans("Parameters").' (DES)');
174
175print '<table class="noborder" width="100%">';
176print '<tr class="liste_titre">';
177print '<td>'.$langs->trans("Description").'</td>';
178print '<td>'.$langs->trans("Value").'</td>';
179print '</tr>';
180
181foreach ($list_DES as $key) {
182 print '<tr class="oddeven value">';
183
184 // Param
185 $label = $langs->trans($key);
186 print '<td>'.$label.'</td>';
187 // Value
188 print '<td class="left">';
189 print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
190 print '</td>';
191
192 print '</tr>';
193}
194
195print '</table>';
196
197print '<div class="center">';
198print '<input type="submit" name="bt_save" class="butAction button-save" value="'.$langs->trans("Update").'" />';
199print '</div>';
200
201print '</form>';
202
203print dol_get_fiche_end();
204
205// End of page
206llxFooter();
207$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).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation de composants html autre Only common components are here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
intracommreportAdminPrepareHead()
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.