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