dolibarr 19.0.3
pdf_other.php
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
7 * Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.com>
8 * Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
29// Load Dolibarr environment
30require '../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
37
38// Load translation files required by the page
39$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips'));
40
41if (!$user->admin) {
43}
44
45$action = GETPOST('action', 'aZ09');
46
47
48/*
49 * Actions
50 */
51
52if ($action == 'update') {
53 if (GETPOSTISSET('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) {
54 dolibarr_set_const($db, "MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", GETPOST("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING"), 'chaine', 0, '', $conf->entity);
55 }
56 if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) {
57 dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity);
58 }
59 if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) {
60 dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity);
61 }
62 if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
63 dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
64 }
65 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE')) {
66 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE", GETPOST("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), 'chaine', 0, '', $conf->entity);
67 }
68 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN')) {
69 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN", GETPOST("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN"), 'chaine', 0, '', $conf->entity);
70 }
71 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE')) {
72 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE", GETPOST("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), 'chaine', 0, '', $conf->entity);
73 }
74 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN')) {
75 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN", GETPOST("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN"), 'chaine', 0, '', $conf->entity);
76 }
77 if (GETPOSTISSET('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH')) {
78 dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity);
79 }
80 if (GETPOSTISSET('INVOICE_ADD_ZATCA_QR_CODE')) {
81 dolibarr_set_const($db, "INVOICE_ADD_ZATCA_QR_CODE", GETPOST("INVOICE_ADD_ZATCA_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
82 if (GETPOSTINT('INVOICE_ADD_ZATCA_QR_CODE') == 1) {
83 dolibarr_del_const($db, "INVOICE_ADD_SWISS_QR_CODE", $conf->entity);
84 }
85 }
86 if (GETPOSTISSET('INVOICE_ADD_SWISS_QR_CODE')) {
87 dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'alpha'), 'chaine', 0, '', $conf->entity);
88 if (GETPOST('INVOICE_ADD_SWISS_QR_CODE', 'alpha') != '0') {
89 dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
90 }
91 }
92 if (GETPOSTISSET('INVOICE_CATEGORY_OF_OPERATION')) {
93 dolibarr_set_const($db, "INVOICE_CATEGORY_OF_OPERATION", GETPOST("INVOICE_CATEGORY_OF_OPERATION", 'int'), 'chaine', 0, '', $conf->entity);
94 }
95 if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
96 dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
97 dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
98 }
99
100 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
101
102 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
103 exit;
104}
105
106
107
108/*
109 * View
110 */
111
112$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
113llxHeader('', $langs->trans("Setup"), $wikihelp);
114
115$form = new Form($db);
116$formother = new FormOther($db);
117$formadmin = new FormAdmin($db);
118
119print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
120
121$head = pdf_admin_prepare_head();
122
123print dol_get_fiche_head($head, 'other', '', -1, '');
124
125$tooltiptext = '';
126print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."</span><br>\n";
127print "<br>\n";
128
129print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
130print '<input type="hidden" name="token" value="'.newToken().'">';
131print '<input type="hidden" name="action" value="update">';
132
133if (isModEnabled('propal')) {
134 print load_fiche_titre($langs->trans("Proposal"), '', 'proposal');
135
136 print '<div class="div-table-responsive-no-min">';
137 print '<table summary="more" class="noborder centpercent">';
138 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
139
140
141 print '<tr class="oddeven"><td>';
142 print $form->textwithpicto($langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING"), '');
143 print '</td><td>';
144 if ($conf->use_javascript_ajax) {
145 print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
146 } else {
147 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
148 print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING);
149 }
150 print '</td></tr>';
151
152 print '<tr class="oddeven"><td>';
153 print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral"));
154 print '</td><td>';
155 if ($conf->use_javascript_ajax) {
156 print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
157 } else {
158 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
159 print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
160 }
161 print '</td></tr>';
162
163 print '</table>';
164 print '</div>';
165}
166
167
168if (isModEnabled('supplier_proposal')) {
169 $langs->load("supplier_proposal");
170 print load_fiche_titre($langs->trans("SupplierProposal"), '', 'supplier_proposal');
171
172 print '<div class="div-table-responsive-no-min">';
173 print '<table summary="more" class="noborder centpercent">';
174 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
175
176 print '<tr class="oddeven"><td>';
177 print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), '');
178 print '</td><td>';
179 if ($conf->use_javascript_ajax) {
180 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE');
181 } else {
182 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
183 print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE);
184 }
185 print '</td></tr>';
186
187 print '<tr class="oddeven"><td>';
188 print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN"), '');
189 print '</td><td>';
190 if ($conf->use_javascript_ajax) {
191 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN');
192 } else {
193 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
194 print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN);
195 }
196 print '</td></tr>';
197
198 print '</table>';
199 print '</div>';
200}
201
202
203if (isModEnabled('supplier_order')) {
204 $langs->load("supplier_order");
205 print load_fiche_titre($langs->trans("SupplierOrder"), '', 'supplier_proposal');
206
207 print '<div class="div-table-responsive-no-min">';
208 print '<table summary="more" class="noborder centpercent">';
209 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
210
211 print '<tr class="oddeven"><td>';
212 print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), '');
213 print '</td><td>';
214 if ($conf->use_javascript_ajax) {
215 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE');
216 } else {
217 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
218 print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE);
219 }
220 print '</td></tr>';
221
222 print '<tr class="oddeven"><td>';
223 print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN"), '');
224 print '</td><td>';
225 if ($conf->use_javascript_ajax) {
226 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN');
227 } else {
228 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
229 print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN);
230 }
231 print '</td></tr>';
232
233 print '</table>';
234 print '</div>';
235}
236
237if (isModEnabled('facture')) {
238 print load_fiche_titre($langs->trans("Invoices"), '', 'bill');
239
240 print '<div class="div-table-responsive-no-min">';
241 print '<table summary="more" class="noborder centpercent">';
242 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
243
244 print '<tr class="oddeven"><td>';
245 print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
246 print '</td><td>';
247 if ($conf->use_javascript_ajax) {
248 print ajax_constantonoff('INVOICE_ADD_ZATCA_QR_CODE');
249 } else {
250 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
251 print $form->selectarray("INVOICE_ADD_ZATCA_QR_CODE", $arrval, getDolGlobalString('INVOICE_ADD_ZATCA_QR_CODE'));
252 }
253 print '</td></tr>';
254
255 print '<tr class="oddeven"><td>';
256 if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
257 print $form->textwithpicto($langs->trans("INVOICE_ADD_SWISS_QR_CODE"), $langs->trans("INVOICE_ADD_SWISS_QR_CODEMore"));
258 } else {
259 print $langs->trans("INVOICE_ADD_SWISS_QR_CODE");
260 }
261 print '</td><td>';
262 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
263 if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 1) {
264 $arrval['bottom'] = $langs->trans("AtBottomOfPage").' ('.$langs->trans("Experimental").' - Need PHP 8.1+ and some PHP libs)';
265 }
266 print $form->selectarray("INVOICE_ADD_SWISS_QR_CODE", $arrval, getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE'));
267 print '</td></tr>';
268
269 // Mention category of operations
270 // French Decret n°2099-1299 2022-10-07
271 print '<tr class="oddeven"><td>';
272 print $form->textwithpicto($langs->trans("InvoiceOptionCategoryOfOperations"), $langs->trans('InvoiceOptionCategoryOfOperationsHelp'), 1);
273 print '</td><td>';
274 $arrval = array('0'=>$langs->trans("No"),
275 '1'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes1"),
276 '2'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes2")
277 );
278 print $form->selectarray("INVOICE_CATEGORY_OF_OPERATION", $arrval, getDolGlobalString('INVOICE_CATEGORY_OF_OPERATION'), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
279 print '</td></tr>';
280
281 print '<tr class="oddeven"><td>';
282 print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
283 print '</td><td>';
284 if ($conf->use_javascript_ajax) {
285 print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
286 } else {
287 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
288 print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
289 }
290 print '</td></tr>';
291
292 /* Keep this option hidden for the moment to avoid options inflation. We'll see later if it is used enough...
293 print '<tr class="oddeven"><td>';
294 print $form->textwithpicto($langs->trans("SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT"), $langs->trans("SUPPLIER_PROPOSAL_ADD_BILLING_CONTACTMore"));
295 print '</td><td>';
296 if ($conf->use_javascript_ajax) {
297 print ajax_constantonoff('SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT');
298 } else {
299 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
300 print $form->selectarray("SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT", $arrval, $conf->global->SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT);
301 }
302 print '</td></tr>';
303 */
304
305 print '</table>';
306 print '</div>';
307}
308
309
310
311if (isModEnabled('reception')) {
312 print load_fiche_titre($langs->trans("Receptions"), '', 'reception');
313
314 print '<div class="div-table-responsive-no-min">';
315 print '<table summary="more" class="noborder centpercent">';
316 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
317
318 print '<tr class="oddeven"><td>';
319 print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");
320 print '</td><td>';
321 if ($conf->use_javascript_ajax) {
322 print ajax_constantonoff('RECEPTION_PDF_HIDE_ORDERED');
323 } else {
324 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
325 print $form->selectarray("RECEPTION_PDF_HIDE_ORDERED", $arrval, $conf->global->RECEPTION_PDF_HIDE_ORDERED);
326 }
327 print '</td></tr>';
328
329 print '<tr class="oddeven"><td>';
330 print $langs->trans("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT");
331 print '</td><td>';
332 if ($conf->use_javascript_ajax) {
333 print ajax_constantonoff('MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT');
334 } else {
335 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
336 print $form->selectarray("MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT", $arrval, $conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT);
337 }
338 print '</td></tr>';
339
340 print '</table>';
341 print '</div>';
342}
343
344
345print '<br><div class="center">';
346print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
347print '</div>';
348
349print '</form>';
350
351
352// End of page
353llxFooter();
354$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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to generate html code for admin pages.
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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
pdf_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition pdf.lib.php:47
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.