dolibarr 18.0.6
pdf.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2022 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 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
36
37// Load translation files required by the page
38$langs->loadLangs(array('admin', 'companies', 'languages', 'members', 'other', 'products', 'stocks', 'trips'));
39
40if (!$user->admin) {
42}
43
44$action = GETPOST('action', 'aZ09');
45$cancel = GETPOST('cancel', 'alpha');
46
47
48/*
49 * Actions
50 */
51
52if ($cancel) {
53 $action = '';
54}
55
56if ($action == 'update') {
57 if (GETPOSTISSET('MAIN_PDF_FORMAT')) {
58 dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity);
59 }
60
61 if (GETPOSTISSET('MAIN_PDF_MARGIN_LEFT')) {
62 dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity);
63 }
64 if (GETPOSTISSET('MAIN_PDF_MARGIN_RIGHT')) {
65 dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_RIGHT"), 'chaine', 0, '', $conf->entity);
66 }
67 if (GETPOSTISSET('MAIN_PDF_MARGIN_TOP')) {
68 dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity);
69 }
70 if (GETPOSTISSET('MAIN_PDF_MARGIN_BOTTOM')) {
71 dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity);
72 }
73
74 if (GETPOSTISSET('MAIN_PROFID1_IN_ADDRESS')) {
75 dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
76 }
77 if (GETPOSTISSET('MAIN_PROFID2_IN_ADDRESS')) {
78 dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
79 }
80 if (GETPOSTISSET('MAIN_PROFID3_IN_ADDRESS')) {
81 dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
82 }
83 if (GETPOSTISSET('MAIN_PROFID4_IN_ADDRESS')) {
84 dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
85 }
86 if (GETPOSTISSET('MAIN_PROFID5_IN_ADDRESS')) {
87 dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
88 }
89 if (GETPOSTISSET('MAIN_PROFID6_IN_ADDRESS')) {
90 dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
91 }
92
93 if (GETPOSTISSET('MAIN_PDF_NO_SENDER_FRAME')) {
94 dolibarr_set_const($db, "MAIN_PDF_NO_SENDER_FRAME", GETPOST("MAIN_PDF_NO_SENDER_FRAME"), 'chaine', 0, '', $conf->entity);
95 }
96 if (GETPOSTISSET('MAIN_PDF_NO_RECIPENT_FRAME')) {
97 dolibarr_set_const($db, "MAIN_PDF_NO_RECIPENT_FRAME", GETPOST("MAIN_PDF_NO_RECIPENT_FRAME"), 'chaine', 0, '', $conf->entity);
98 }
99
100 /*if (GETPOSTISSET('MAIN_PDF_HIDE_SENDER_NAME')) {
101 dolibarr_set_const($db, "MAIN_PDF_HIDE_SENDER_NAME", GETPOST("MAIN_PDF_HIDE_SENDER_NAME"), 'chaine', 0, '', $conf->entity);
102 }*/
103
104 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) {
105 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity);
106 }
107
108 if (GETPOSTISSET('MAIN_TVAINTRA_NOT_IN_ADDRESS')) {
109 dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
110 }
111
112 if (isModEnabled('project')) {
113 if (GETPOST('PDF_SHOW_PROJECT_REF_OR_LABEL') == 'no') {
114 dolibarr_del_const($db, "PDF_SHOW_PROJECT", $conf->entity);
115 dolibarr_del_const($db, "PDF_SHOW_PROJECT_TITLE", $conf->entity);
116 } elseif (GETPOST('PDF_SHOW_PROJECT_REF_OR_LABEL') == 'showprojectref') {
117 dolibarr_set_const($db, "PDF_SHOW_PROJECT", GETPOST("PDF_SHOW_PROJECT_REF_OR_LABEL"), 'chaine', 0, '', $conf->entity);
118 dolibarr_del_const($db, "PDF_SHOW_PROJECT_TITLE", $conf->entity);
119 } elseif (GETPOST('PDF_SHOW_PROJECT_REF_OR_LABEL') == 'showprojectlabel') {
120 dolibarr_del_const($db, "PDF_SHOW_PROJECT", $conf->entity);
121 dolibarr_set_const($db, "PDF_SHOW_PROJECT_TITLE", GETPOST("PDF_SHOW_PROJECT_REF_OR_LABEL"), 'chaine', 0, '', $conf->entity);
122 }
123 }
124
125 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS')) {
126 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"), 'chaine', 0, '', $conf->entity);
127 }
128 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_DESC')) {
129 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity);
130 }
131 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_HIDE_REF')) {
132 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity);
133 }
134
135 if (GETPOSTISSET('MAIN_DOCUMENTS_LOGO_HEIGHT')) {
136 dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
137 }
138 if (GETPOSTISSET('MAIN_INVERT_SENDER_RECIPIENT')) {
139 dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity);
140 }
141 if (GETPOSTISSET('MAIN_PDF_USE_ISO_LOCATION')) {
142 dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity);
143 }
144 if (GETPOSTISSET('MAIN_PDF_NO_CUSTOMER_CODE')) {
145 dolibarr_set_const($db, "MAIN_PDF_NO_CUSTOMER_CODE", GETPOST("MAIN_PDF_NO_CUSTOMER_CODE"), 'chaine', 0, '', $conf->entity);
146 }
147
148 if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
149 dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity);
150 }
151
152 if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_SECOND_TAX')) {
153 dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity);
154 }
155 if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_THIRD_TAX')) {
156 dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity);
157 }
158
159 if (GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE')) {
160 dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
161 }
162 if (GETPOSTISSET('SHOW_SUBPRODUCT_REF_IN_PDF')) {
163 dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity);
164 }
165
166 if (GETPOSTISSET('PDF_SHOW_LINK_TO_ONLINE_PAYMENT')) {
167 dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity);
168 }
169
170 if (GETPOSTISSET('DOC_SHOW_FIRST_SALES_REP')) {
171 dolibarr_set_const($db, "DOC_SHOW_FIRST_SALES_REP", GETPOST('DOC_SHOW_FIRST_SALES_REP', 'alpha'), 'chaine', 0, '', $conf->entity);
172 }
173
174 if (GETPOSTISSET('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) {
175 dolibarr_set_const($db, "PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", GETPOST('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME', 'alpha'), 'chaine', 0, '', $conf->entity);
176 }
177 if (GETPOSTISSET('PDF_USE_A')) {
178 dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity);
179 }
180
181 if (GETPOSTISSET('PDF_BOLD_PRODUCT_LABEL')) {
182 dolibarr_set_const($db, "PDF_BOLD_PRODUCT_LABEL", GETPOST('PDF_BOLD_PRODUCT_LABEL', 'alpha'), 'chaine', 0, '', $conf->entity);
183 }
184 if (GETPOSTISSET('PDF_BOLD_PRODUCT_REF_AND_PERIOD')) {
185 dolibarr_set_const($db, "PDF_BOLD_PRODUCT_REF_AND_PERIOD", GETPOST('PDF_BOLD_PRODUCT_REF_AND_PERIOD', 'alpha'), 'chaine', 0, '', $conf->entity);
186 }
187
188 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
189
190 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
191 exit;
192}
193
194
195
196/*
197 * View
198 */
199
200$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
201llxHeader('', $langs->trans("Setup"), $wikihelp);
202
203$form = new Form($db);
204$formother = new FormOther($db);
205$formadmin = new FormAdmin($db);
206
207$arraydetailsforpdffoot = array(
208 0 => $langs->transnoentitiesnoconv('NoDetails'),
209 1 => $langs->transnoentitiesnoconv('DisplayCompanyInfo'),
210 2 => $langs->transnoentitiesnoconv('DisplayCompanyManagers'),
211 3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
212);
213
214$arraylistofpdfformat = array(
215 0 => $langs->transnoentitiesnoconv('PDF 1.7'),
216 1 => $langs->transnoentitiesnoconv('PDF/A-1b'),
217 3 => $langs->transnoentitiesnoconv('PDF/A-3b'),
218);
219
220$s = $langs->trans("LibraryToBuildPDF")."<br>";
221$i = 0;
222$pdf = pdf_getInstance('A4');
223if (class_exists('FPDF') && !class_exists('TCPDF')) {
224 if ($i) {
225 $s .= ' + ';
226 }
227 $s .= 'FPDF';
228 $s .= ' ('.@constant('FPDF_PATH').')';
229 $i++;
230}
231if (class_exists('TCPDF')) {
232 if ($i) {
233 $s .= ' + ';
234 }
235 $s .= 'TCPDF';
236 $s .= ' ('.@constant('TCPDF_PATH').')';
237 $i++;
238}
239if (class_exists('FPDI')) {
240 if ($i) {
241 $s .= ' + ';
242 }
243 $s .= 'FPDI';
244 $s .= ' ('.@constant('FPDI_PATH').')';
245 $i++;
246}
247if (class_exists('TCPDI')) {
248 if ($i) {
249 $s .= ' + ';
250 }
251 $s .= 'TCPDI';
252 $s .= ' ('.@constant('TCPDI_PATH').')';
253 $i++;
254}
255
256print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
257
258$head = pdf_admin_prepare_head();
259
260print dol_get_fiche_head($head, 'general', '', -1, '');
261
262print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFDesc"), $s)."</span><br>\n";
263print "<br>\n";
264
265$noCountryCode = (empty($mysoc->country_code) ? true : false);
266
267print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
268print '<input type="hidden" name="token" value="'.newToken().'">';
269print '<input type="hidden" name="action" value="update">';
270
271clearstatcache();
272
273
274if (getDolGlobalString('PDF_SECURITY_ENCRYPTION')) {
275 print '<div class="warning">';
276 print 'The not supported and hidden option PDF_SECURITY_ENCRYPTION has been enabled. This means a lof of feature related to PDF will be broken, like mass PDF generation or online signature of PDF.'."\n";
277 print 'You should disable this option.';
278 print '</div>';
279}
280
281
282
283// Misc options
284print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
285
286
287print '<div class="div-table-responsive-no-min">';
288print '<table summary="more" class="noborder centpercent">';
289print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
290
291$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
292if (empty($selected)) {
293 $selected = dol_getDefaultFormat();
294}
295
296// Show pdf format
297
298print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
299print $formadmin->select_paper_format($selected, 'MAIN_PDF_FORMAT');
300print '</td></tr>';
301
302print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
303print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_LEFT" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10).'">';
304print '</td></tr>';
305print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
306print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_RIGHT" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10).'">';
307print '</td></tr>';
308print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
309print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_TOP" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10).'">';
310print '</td></tr>';
311print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
312print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_BOTTOM" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10).'">';
313print '</td></tr>';
314
315print '</table>';
316print '</div>';
317
318print '<br>';
319
320
321// Addresses
322print load_fiche_titre($langs->trans("PDFAddressForging"), '', '');
323
324print '<div class="div-table-responsive-no-min">';
325print '<table summary="more" class="noborder centpercent">';
326print '<tr class="liste_titre"><td class="">'.$langs->trans("Parameter").'</td><td></td></tr>';
327
328// Show sender name
329
330/* Set option as hidden because no need of this for 99.99% of users. Having it as hidden feature is enough.
331print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
332if ($conf->use_javascript_ajax) {
333 print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
334} else {
335 print $form->selectyesno('MAIN_PDF_HIDE_SENDER_NAME', (!empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) ? $conf->global->MAIN_PDF_HIDE_SENDER_NAME : 0, 1);
336}
337print '</td></tr>';
338*/
339
340// Hide VAT Intra on address
341
342print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
343if ($conf->use_javascript_ajax) {
344 print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS');
345} else {
346 print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (!empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) ? $conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS : 0, 1);
347}
348print '</td></tr>';
349
350// Show prof id in address into pdf
351for ($i = 1; $i <= 6; $i++) {
352 if (!$noCountryCode) {
353 $pid = $langs->transcountry("ProfId".$i, $mysoc->country_code);
354 if ($pid == '-') {
355 $pid = false;
356 }
357 } else {
358 $pid = img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
359 }
360 if ($pid) {
361 print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
362 $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
363 if ($conf->use_javascript_ajax) {
364 print ajax_constantonoff($keyforconstant);
365 } else {
366 print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant) ? $conf->global->$keyforconstant : 0, 1, $noCountryCode);
367 }
368 print '</td></tr>';
369 }
370}
371
372// Borders on address frame
373
374print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_NO_SENDER_FRAME").'</td><td>';
375if ($conf->use_javascript_ajax) {
376 print ajax_constantonoff('MAIN_PDF_NO_SENDER_FRAME');
377} else {
378 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
379 print $form->selectarray("MAIN_PDF_NO_SENDER_FRAME", $arrval, $conf->global->MAIN_PDF_NO_SENDER_FRAME);
380}
381print '</td></tr>';
382
383print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_NO_RECIPENT_FRAME").'</td><td>';
384if ($conf->use_javascript_ajax) {
385 print ajax_constantonoff('MAIN_PDF_NO_RECIPENT_FRAME');
386} else {
387 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
388 print $form->selectarray("MAIN_PDF_NO_RECIPENT_FRAME", $arrval, $conf->global->MAIN_PDF_NO_RECIPENT_FRAME);
389}
390print '</td></tr>';
391
392//Invert sender and recipient
393
394print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
395if ($conf->use_javascript_ajax) {
396 print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT');
397} else {
398 print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1);
399}
400print '</td></tr>';
401
402// Place customer adress to the ISO location
403
404print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
405if ($conf->use_javascript_ajax) {
406 print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION');
407} else {
408 print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1);
409}
410print '</td></tr>';
411
412// Show alias in thirdparty name
413print '<tr class="oddeven"><td>'.$langs->trans("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME").'</td><td>';
414if ($conf->use_javascript_ajax) {
415 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("THIRDPARTY_ALIAS"), '2' => $langs->trans("ALIAS_THIRDPARTY"));
416 print $form->selectarray("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", $arrval, getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME'));
417}
418
419print '</table>';
420print '</div>';
421
422
423print '<br>';
424
425
426// Localtaxes
427$locales = '';
428$text = '';
429if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
430 if ($mysoc->useLocalTax(1)) {
431 $locales = $langs->transcountry("LT1", $mysoc->country_code);
432 $text = '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).'</td><td>';
433 if ($conf->use_javascript_ajax) {
434 $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_SECOND_TAX');
435 } else {
436 $text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
437 }
438 $text .= '</td></tr>';
439 }
440
441 if ($mysoc->useLocalTax(2)) {
442 $locales .= ($locales ? ' & ' : '').$langs->transcountry("LT2", $mysoc->country_code);
443
444 $text .= '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)).'</td><td>';
445 if ($conf->use_javascript_ajax) {
446 $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_THIRD_TAX');
447 } else {
448 $text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
449 }
450 $text .= '</td></tr>';
451 }
452}
453
454$title = $langs->trans("PDFRulesForSalesTax");
455if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
456 $title .= ' - '.$langs->trans("PDFLocaltax", $locales);
457}
458
459
460print load_fiche_titre($title, '', '');
461
462print '<table summary="more" class="noborder centpercent">';
463print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td></td></tr>';
464
465// Hide any information on Sale tax / VAT
466
467print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
468if ($conf->use_javascript_ajax) {
469 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT');
470} else {
471 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT : 0, 1);
472}
473print '</td></tr>';
474
475// Locataxes
476print $text;
477
478print '</table>';
479print '<br>';
480
481
482// Other
483
484print load_fiche_titre($langs->trans("Other"), '', '');
485
486print '<div class="div-table-responsive-no-min">';
487print '<table summary="more" class="noborder centpercent">';
488print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
489
490// Use 2 languages into PDF
491
492print '<tr class="oddeven"><td>';
493print $form->textwithpicto($langs->trans("PDFIn2Languages"), $langs->trans("PDF_USE_ALSO_LANGUAGE_CODE"));
494print '</td><td>';
495$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0);
496print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
497print '</td></tr>';
498
499// Height of logo
500print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'</td><td>';
501print '<input type="text" class="maxwidth50" name="MAIN_DOCUMENTS_LOGO_HEIGHT" value="'.(!empty($conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT) ? $conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT : 20).'">';
502print '</td></tr>';
503
504// Show project
505if (isModEnabled('project')) {
506 print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_PROJECT").'</td><td>';
507 $tmparray = array('no' => 'No', 'showprojectref' => 'RefProject', 'showprojectlabel' => 'ShowProjectLabel');
508 $showprojectref = empty($conf->global->PDF_SHOW_PROJECT) ? (empty($conf->global->PDF_SHOW_PROJECT_TITLE) ? 'no' : 'showprojectlabel') : 'showprojectref';
509 print $form->selectarray('PDF_SHOW_PROJECT_REF_OR_LABEL', $tmparray, $showprojectref, 0, 0, 0, '', 1);
510 print '</td></tr>';
511}
512
513//
514
515print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_CUSTOMER_CODE");
516print '</td><td>';
517if ($conf->use_javascript_ajax) {
518 print ajax_constantonoff('MAIN_PDF_HIDE_CUSTOMER_CODE');
519} else {
520 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
521 print $form->selectarray("MAIN_PDF_HIDE_CUSTOMER_CODE", $arrval, $conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE);
522}
523print '</td></tr>';
524
525// Ref
526
527print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
528if ($conf->use_javascript_ajax) {
529 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_REF');
530} else {
531 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF : 0, 1);
532}
533print '</td></tr>';
534
535// Desc
536
537print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
538if ($conf->use_javascript_ajax) {
539 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DESC');
540} else {
541 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC : 0, 1);
542}
543print '</td></tr>';
544
545// Details
546
547print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
548if ($conf->use_javascript_ajax) {
549 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS');
550} else {
551 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS : 0, 1);
552}
553print '</td></tr>';
554
555// Swicth in Bold
556
557print '<tr class="oddeven"><td>'.$langs->trans("BoldLabelOnPDF").'</td><td>';
558if ($conf->use_javascript_ajax) {
559 print ajax_constantonoff('PDF_BOLD_PRODUCT_LABEL');
560} else {
561 print $form->selectyesno('PDF_BOLD_PRODUCT_LABEL', (!empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) ? $conf->global->PDF_BOLD_PRODUCT_LABEL : 0, 1);
562}
563print '</td></tr>';
564
565// Swicth in Bold
566
567print '<tr class="oddeven"><td>'.$langs->trans("BoldRefAndPeriodOnPDF").'</td><td>';
568if ($conf->use_javascript_ajax) {
569 print ajax_constantonoff('PDF_BOLD_PRODUCT_REF_AND_PERIOD');
570} else {
571 print $form->selectyesno('PDF_BOLD_PRODUCT_REF_AND_PERIOD', (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) ? $conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD : 0, 1);
572}
573print '</td></tr>';
574
575// SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits.
576
577print '<tr class="oddeven"><td>'.$langs->trans("SHOW_SUBPRODUCT_REF_IN_PDF", $langs->transnoentitiesnoconv("AssociatedProductsAbility"), $langs->transnoentitiesnoconv("Products")).'</td><td>';
578if ($conf->use_javascript_ajax) {
579 print ajax_constantonoff('SHOW_SUBPRODUCT_REF_IN_PDF');
580} else {
581 print $form->selectyesno('SHOW_SUBPRODUCT_REF_IN_PDF', (!empty($conf->global->SHOW_SUBPRODUCT_REF_IN_PDF)) ? $conf->global->SHOW_SUBPRODUCT_REF_IN_PDF : 0, 1);
582}
583print '</td></tr>';
584
585// Show more details in footer
586
587print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
588print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0));
589print '</td></tr>';
590
591// Show the first sales representative
592
593print '<tr class="oddeven"><td>'.$langs->trans("DOC_SHOW_FIRST_SALES_REP");
594print ' <span class="opacitymedium">('.$langs->trans("SalesRepresentativeInfo").')</span>';
595print '</td><td>';
596if ($conf->use_javascript_ajax) {
597 print ajax_constantonoff('DOC_SHOW_FIRST_SALES_REP');
598} else {
599 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
600 print $form->selectarray("DOC_SHOW_FIRST_SALES_REP", $arrval, $conf->global->DOC_SHOW_FIRST_SALES_REP);
601}
602
603// Show online payment link on invoices
604
605print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").'</td><td>';
606if ($conf->use_javascript_ajax) {
607 print ajax_constantonoff('PDF_SHOW_LINK_TO_ONLINE_PAYMENT');
608} else {
609 print $form->selectyesno('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', (!empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)) ? $conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT : 0, 1);
610}
611print '</td></tr>';
612
613print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_A").'</td><td>';
614print $form->selectarray('PDF_USE_A', $arraylistofpdfformat, (empty($conf->global->PDF_USE_A) ? 0 : $conf->global->PDF_USE_A));
615print '</td></tr>';
616
617print '</table>';
618print '</div>';
619
620print $form->buttonsSaveCancel("Save", '');
621
622print '</form>';
623
624
625// End of page
626llxFooter();
627$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:56
llxFooter()
Empty footer.
Definition wrapper.php:70
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.
dol_getDefaultFormat(Translate $outputlangs=null)
Try to guess default paper format according to language into $langs.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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.
getDolGlobalInt($key, $default=0)
Return 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.
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
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition pdf.lib.php:127
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.