dolibarr 21.0.0-beta
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.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
27// Load Dolibarr environment
28require '../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/intracommreport/lib/intracommreport.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
32
41// Load translation files required by the page
42$langs->loadLangs(array("admin", "intracommreport"));
43
44// Access Control
45if (!$user->admin) {
47}
48
49// Get Parameters
50$action = GETPOST('action', 'aZ09');
51
52// Parameters INTRACOMMREPORT_* and others
53$list_DEB = array(
54 'INTRACOMMREPORT_NUM_AGREMENT',
55);
56
57$list_DES = array(
58 'INTRACOMMREPORT_NUM_DECLARATION',
59);
60
61if ($action == 'update') {
62 $error = 0;
63
64 if (!$error) {
65 foreach ($list_DEB as $constname) {
66 $constvalue = GETPOST($constname, 'alpha');
67
68 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
69 $error++;
70 }
71 }
72
73 foreach ($list_DES as $constname) {
74 $constvalue = GETPOST($constname, 'alpha');
75
76 if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
77 $error++;
78 }
79 }
80
81 dolibarr_set_const($db, "INTRACOMMREPORT_TYPE_ACTEUR", GETPOST("INTRACOMMREPORT_TYPE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
82 dolibarr_set_const($db, "INTRACOMMREPORT_ROLE_ACTEUR", GETPOST("INTRACOMMREPORT_ROLE_ACTEUR", 'alpha'), 'chaine', 0, '', $conf->entity);
83 dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION", 'alpha'), 'chaine', 0, '', $conf->entity);
84 dolibarr_set_const($db, "INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", GETPOST("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION", 'alpha'), 'chaine', 0, '', $conf->entity);
85 dolibarr_set_const($db, "INTRACOMMREPORT_CATEG_FRAISDEPORT", GETPOST("INTRACOMMREPORT_CATEG_FRAISDEPORT", 'alpha'), 'chaine', 0, '', $conf->entity);
86
87 if ($error) {
88 setEventMessages($langs->trans("Error"), null, 'errors');
89 }
90 }
91
92 if (!$error) {
93 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
94 }
95}
96
97
98/*
99 * View
100 */
101
102$form = new Form($db);
103$formother = new FormOther($db);
104
105llxHeader('', $langs->trans("IntracommReportSetup"), '', '', 0, 0, '', '', '', 'mod-intracommreport page-admin_intracommreport');
106
107$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
108print load_fiche_titre($langs->trans("IntracommReportSetup"), $linkback, 'title_setup');
109
111
112print dol_get_fiche_head($head, 'general', $langs->trans("IntracommReport"), -1, "intracommreport");
113
114print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
115print '<input type="hidden" name="token" value="'.newToken().'">';
116print '<input type="hidden" name="action" value="update">';
117
118print load_fiche_titre($langs->trans("Parameters").' (DEB)');
119
120print '<table class="noborder" width="100%">';
121print '<tr class="liste_titre">';
122print '<td>'.$langs->trans("Description").'</td>';
123print '<td>'.$langs->trans("Value").'</td>';
124print '</tr>';
125
126foreach ($list_DEB as $key) {
127 print '<tr class="oddeven value">';
128
129 // Param
130 $label = $langs->trans($key);
131 print '<td>'.$label.'</td>';
132 // Value
133 print '<td class="left">';
134 print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
135 print '</td>';
136
137 print '</tr>';
138}
139
140print '<tr class="oddeven">';
141print '<td>'.$langs->trans("INTRACOMMREPORT_TYPE_ACTEUR").'</td>';
142$arraychoices = array('' => $langs->trans("None"), 'PSI' => 'Déclarant pour son compte', 'TDP' => 'Tiers déclarant');
143print '<td>';
144print $form->selectarray('INTRACOMMREPORT_TYPE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_TYPE_ACTEUR, 0);
145print '</td>';
146print "</tr>\n";
147
148print '<tr class="oddeven">';
149print '<td>'.$langs->trans("INTRACOMMREPORT_ROLE_ACTEUR").'</td>';
150$arraychoices = array('' => $langs->trans("None"), 'sender' => 'Emetteur', 'PSI' => 'Déclarant');
151print '<td>';
152print $form->selectarray('INTRACOMMREPORT_ROLE_ACTEUR', $arraychoices, $conf->global->INTRACOMMREPORT_ROLE_ACTEUR, 0);
153print '</td>';
154print "</tr>\n";
155
156print '<tr class="oddeven">';
157print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION").'</td>';
158$arraychoices = array(1 => 'Seuil de 460 000 €', 2 => 'En dessous de 460 000 €');
159print '<td>';
160print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_INTRODUCTION, 0);
161print '</td>';
162print "</tr>\n";
163
164print '<tr class="oddeven">';
165print '<td>'.$langs->trans("INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION").'</td>';
166$arraychoices = array(3 => 'Seuil de 460 000 €', 4 => 'En dessous de 460 000 €');
167print '<td>';
168print $form->selectarray('INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION', $arraychoices, $conf->global->INTRACOMMREPORT_NIV_OBLIGATION_EXPEDITION, 0);
169print '</td>';
170print "</tr>\n";
171
172print '<tr class="oddeven">';
173print '<td>'.$langs->trans("INTRACOMMREPORT_CATEG_FRAISDEPORT").'</td>';
174print '<td>';
175print $formother->select_categories('product', $conf->global->INTRACOMMREPORT_CATEG_FRAISDEPORT, 'INTRACOMMREPORT_CATEG_FRAISDEPORT');
176print '</td>';
177print "</tr>\n";
178
179print '</table>';
180
181
182print load_fiche_titre($langs->trans("Parameters").' (DES)');
183
184print '<table class="noborder" width="100%">';
185print '<tr class="liste_titre">';
186print '<td>'.$langs->trans("Description").'</td>';
187print '<td>'.$langs->trans("Value").'</td>';
188print '</tr>';
189
190foreach ($list_DES as $key) {
191 print '<tr class="oddeven value">';
192
193 // Param
194 $label = $langs->trans($key);
195 print '<td>'.$label.'</td>';
196 // Value
197 print '<td class="left">';
198 print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
199 print '</td>';
200
201 print '</tr>';
202}
203
204print '</table>';
205
206print '<div class="center">';
207print '<input type="submit" name="bt_save" class="butAction button-save" value="'.$langs->trans("Update").'" />';
208print '</div>';
209
210print '</form>';
211
212print dol_get_fiche_end();
213
214// End of page
215llxFooter();
216$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:71
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.