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