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