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