dolibarr 21.0.3
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 "Also note that if an 'encrypted PDF' provides a protection against manual change done by mistake, it does NOT provide any protection against modification of your PDF in a security point of view: A protected PDF can still be modified by any advanced PDF editors. Don't forget this: If a software can read the PDF, this software can also rebuild it differently !\n";
298 print 'You should disable this option.';
299 print '</div>';
300}
301
302
303
304// Misc options
305print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
306
307
308print '<div class="div-table-responsive-no-min">';
309print '<table summary="more" class="noborder centpercent">';
310print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px"></td></tr>';
311
312$selected = getDolGlobalString('MAIN_PDF_FORMAT');
313if (empty($selected)) {
314 $selected = dol_getDefaultFormat();
315}
316
317// Show pdf format
318
319print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
320print $formadmin->select_paper_format($selected, 'MAIN_PDF_FORMAT');
321print '</td></tr>';
322
323print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
324print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_LEFT" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10).'">';
325print '</td></tr>';
326print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
327print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_RIGHT" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10).'">';
328print '</td></tr>';
329print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
330print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_TOP" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10).'">';
331print '</td></tr>';
332print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
333print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_BOTTOM" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10).'">';
334print '</td></tr>';
335
336print '</table>';
337print '</div>';
338
339print '<br>';
340
341
342// Addresses
343print load_fiche_titre($langs->trans("PDFAddressForging"), '', '');
344
345print '<div class="div-table-responsive-no-min">';
346print '<table summary="more" class="noborder centpercent">';
347print '<tr class="liste_titre"><td class="">'.$langs->trans("Parameter").'</td><td></td></tr>';
348
349// Show sender name
350
351/* Set option as hidden because no need of this for 99.99% of users. Having it as hidden feature is enough.
352print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
353if ($conf->use_javascript_ajax) {
354 print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
355} else {
356 print $form->selectyesno('MAIN_PDF_HIDE_SENDER_NAME', getDolGlobalInt('MAIN_PDF_HIDE_SENDER_NAME'), 1);
357}
358print '</td></tr>';
359*/
360
361// Hide VAT Intra on address
362
363print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
364if ($conf->use_javascript_ajax) {
365 print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS');
366} else {
367 print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', getDolGlobalInt('MAIN_TVAINTRA_NOT_IN_ADDRESS'), 1);
368}
369print '</td></tr>';
370
371// Show prof id in address into pdf
372for ($i = 1; $i <= 6; $i++) {
373 if (!$noCountryCode) {
374 $pid = $langs->transcountry("ProfId".$i, $mysoc->country_code);
375 if ($pid == '-') {
376 $pid = false;
377 }
378 } else {
379 $pid = img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
380 }
381 if ($pid) {
382 print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
383 $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
384 if ($conf->use_javascript_ajax) {
385 print ajax_constantonoff($keyforconstant);
386 } else {
387 print $form->selectyesno($keyforconstant, getDolGlobalString($keyforconstant, 0), 1, $noCountryCode);
388 }
389 print '</td></tr>';
390 }
391}
392
393print '<tr class="oddeven"><td>'.$langs->trans("ShowLegalFormInAddress").' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
394$keyforconstant = 'MAIN_LEGALFORM_IN_ADDRESS';
395if ($conf->use_javascript_ajax) {
396 print ajax_constantonoff($keyforconstant);
397} else {
398 print $form->selectyesno($keyforconstant, getDolGlobalString($keyforconstant, 0), 1, $noCountryCode);
399}
400print '</td></tr>';
401
402
403// Borders on address frame
404
405print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_NO_SENDER_FRAME").'</td><td>';
406if ($conf->use_javascript_ajax) {
407 print ajax_constantonoff('MAIN_PDF_NO_SENDER_FRAME');
408} else {
409 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
410 print $form->selectarray("MAIN_PDF_NO_SENDER_FRAME", $arrval, getDolGlobalString('MAIN_PDF_NO_SENDER_FRAME'));
411}
412print '</td></tr>';
413
414print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_NO_RECIPENT_FRAME").'</td><td>';
415if ($conf->use_javascript_ajax) {
416 print ajax_constantonoff('MAIN_PDF_NO_RECIPENT_FRAME');
417} else {
418 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
419 print $form->selectarray("MAIN_PDF_NO_RECIPENT_FRAME", $arrval, getDolGlobalString('MAIN_PDF_NO_RECIPENT_FRAME'));
420}
421print '</td></tr>';
422
423//Invert sender and recipient
424
425print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
426if ($conf->use_javascript_ajax) {
427 print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT');
428} else {
429 print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', getDolGlobalInt('MAIN_INVERT_SENDER_RECIPIENT'), 1);
430}
431print '</td></tr>';
432
433// Place customer address to the ISO location
434
435print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
436if ($conf->use_javascript_ajax) {
437 print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION');
438} else {
439 print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', getDolGlobalInt('MAIN_PDF_USE_ISO_LOCATION'), 1);
440}
441print '</td></tr>';
442
443// Show alias in thirdparty name
444print '<tr class="oddeven"><td>'.$langs->trans("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME").'</td><td>';
445if ($conf->use_javascript_ajax) {
446 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("THIRDPARTY_ALIAS"), '2' => $langs->trans("ALIAS_THIRDPARTY"));
447 print $form->selectarray("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", $arrval, getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME'));
448}
449
450print '</table>';
451print '</div>';
452
453
454print '<br>';
455
456
457// Localtaxes
458$locales = '';
459$text = '';
460if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
461 if ($mysoc->useLocalTax(1)) {
462 $locales = $langs->transcountry("LT1", $mysoc->country_code);
463 $text = '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).'</td><td>';
464 if ($conf->use_javascript_ajax) {
465 $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_SECOND_TAX');
466 } else {
467 $text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', getDolGlobalInt('MAIN_PDF_MAIN_HIDE_SECOND_TAX'), 1);
468 }
469 $text .= '</td></tr>';
470 }
471
472 if ($mysoc->useLocalTax(2)) {
473 $locales .= ($locales ? ' & ' : '').$langs->transcountry("LT2", $mysoc->country_code);
474
475 $text .= '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)).'</td><td>';
476 if ($conf->use_javascript_ajax) {
477 $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_THIRD_TAX');
478 } else {
479 $text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', getDolGlobalInt('MAIN_PDF_MAIN_HIDE_THIRD_TAX'), 1);
480 }
481 $text .= '</td></tr>';
482 }
483}
484
485$title = $langs->trans("PDFRulesForSalesTax");
486if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
487 $title .= ' - '.$langs->trans("PDFLocaltax", $locales);
488}
489
490
491print load_fiche_titre($title, '', '');
492
493print '<table summary="more" class="noborder centpercent">';
494print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td></td></tr>';
495
496// Hide any information on Sale tax / VAT
497
498print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
499if ($conf->use_javascript_ajax) {
500 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT');
501} else {
502 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT'), 1);
503}
504print '</td></tr>';
505
506// Locataxes
507print $text;
508
509print '</table>';
510print '<br>';
511
512
513// Other
514
515print load_fiche_titre($langs->trans("Other"), '', '');
516
517print '<div class="div-table-responsive-no-min">';
518print '<table summary="more" class="noborder centpercent">';
519print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td></td></tr>';
520
521// Use 2 languages into PDF
522
523print '<tr class="oddeven"><td>';
524print $form->textwithpicto($langs->trans("PDFIn2Languages"), $langs->trans("PDF_USE_ALSO_LANGUAGE_CODE"));
525print '</td><td>';
526$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE');
527print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, array(), 1);
528print '</td></tr>';
529
530// Height of logo
531print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'</td><td>';
532print '<input type="text" class="maxwidth50" name="MAIN_DOCUMENTS_LOGO_HEIGHT" value="'.getDolGlobalInt('MAIN_DOCUMENTS_LOGO_HEIGHT', 20).'">';
533print '</td></tr>';
534
535// Frame corner radius
536print '<tr class="oddeven"><td>';
537print $form->textwithpicto($langs->trans("PDFBoxFrameRoundedCorners"), $langs->trans("MAIN_PDF_FRAME_CORNER_RADIUS"));
538print '</td><td>';
539$arrval = array('0', '1', '2', '3');
540print $form->selectarray("MAIN_PDF_FRAME_CORNER_RADIUS", $arrval, getDolGlobalInt('MAIN_PDF_FRAME_CORNER_RADIUS', 0));
541print '</td></tr>';
542
543// Show project
544if (isModEnabled('project')) {
545 print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_PROJECT").'</td><td>';
546 $tmparray = array('no' => 'No', 'showprojectref' => 'RefProject', 'showprojectlabel' => 'ShowProjectLabel');
547 $showprojectref = !getDolGlobalString('PDF_SHOW_PROJECT') ? (!getDolGlobalString('PDF_SHOW_PROJECT_TITLE') ? 'no' : 'showprojectlabel') : 'showprojectref';
548 print $form->selectarray('PDF_SHOW_PROJECT_REF_OR_LABEL', $tmparray, $showprojectref, 0, 0, 0, '', 1);
549 print '</td></tr>';
550}
551
552// Hide customer code
553print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_CUSTOMER_CODE");
554print '</td><td>';
555if ($conf->use_javascript_ajax) {
556 print ajax_constantonoff('MAIN_PDF_HIDE_CUSTOMER_CODE');
557} else {
558 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
559 print $form->selectarray("MAIN_PDF_HIDE_CUSTOMER_CODE", $arrval, getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_CODE'));
560}
561print '</td></tr>';
562
563// Hide accounting customer code
564print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE");
565print '</td><td>';
566if ($conf->use_javascript_ajax) {
567 print ajax_constantonoff('MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE');
568} else {
569 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
570 print $form->selectarray("MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE", $arrval, getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE'));
571}
572print '</td></tr>';
573
574// Hide Ref
575print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
576if ($conf->use_javascript_ajax) {
577 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_REF');
578} else {
579 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_HIDE_REF'), 1);
580}
581print '</td></tr>';
582
583// Barcode
584
585if (isModEnabled('barcode')) {
586 print '<tr class="oddeven"><td>'.$langs->trans("ShowProductBarcodeOnPDF").'</td><td>';
587 if ($conf->use_javascript_ajax) {
588 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE');
589 } else {
590 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE', getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE'), 1);
591 }
592 print '</td></tr>';
593}
594
595// Desc
596
597print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
598if ($conf->use_javascript_ajax) {
599 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DESC');
600} else {
601 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_HIDE_DESC'), 1);
602}
603print '</td></tr>';
604
605// Details
606
607print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
608if ($conf->use_javascript_ajax) {
609 print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS');
610} else {
611 print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS'), 1);
612}
613print '</td></tr>';
614
615// Switch in Bold
616
617print '<tr class="oddeven"><td>'.$langs->trans("BoldLabelOnPDF").'</td><td>';
618if ($conf->use_javascript_ajax) {
619 print ajax_constantonoff('PDF_BOLD_PRODUCT_LABEL');
620} else {
621 print $form->selectyesno('PDF_BOLD_PRODUCT_LABEL', getDolGlobalInt('PDF_BOLD_PRODUCT_LABEL'), 1);
622}
623print '</td></tr>';
624
625// Switch in Bold
626
627print '<tr class="oddeven"><td>'.$langs->trans("BoldRefAndPeriodOnPDF").'</td><td>';
628if ($conf->use_javascript_ajax) {
629 print ajax_constantonoff('PDF_BOLD_PRODUCT_REF_AND_PERIOD');
630} else {
631 print $form->selectyesno('PDF_BOLD_PRODUCT_REF_AND_PERIOD', getDolGlobalInt('PDF_BOLD_PRODUCT_REF_AND_PERIOD'), 1);
632}
633print '</td></tr>';
634
635// SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits.
636
637print '<tr class="oddeven"><td>'.$langs->trans("SHOW_SUBPRODUCT_REF_IN_PDF", $langs->transnoentitiesnoconv("AssociatedProductsAbility"), $langs->transnoentitiesnoconv("Products")).'</td><td>';
638if ($conf->use_javascript_ajax) {
639 print ajax_constantonoff('SHOW_SUBPRODUCT_REF_IN_PDF');
640} else {
641 print $form->selectyesno('SHOW_SUBPRODUCT_REF_IN_PDF', getDolGlobalInt('SHOW_SUBPRODUCT_REF_IN_PDF'), 1);
642}
643print '</td></tr>';
644
645// Show more details in footer
646
647print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
648print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', '0'));
649print '</td></tr>';
650
651// Show the first sales representative
652
653print '<tr class="oddeven"><td>'.$langs->trans("DOC_SHOW_FIRST_SALES_REP");
654print ' <span class="opacitymedium">('.$langs->trans("SalesRepresentativeInfo").')</span>';
655print '</td><td>';
656if ($conf->use_javascript_ajax) {
657 print ajax_constantonoff('DOC_SHOW_FIRST_SALES_REP');
658} else {
659 $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
660 print $form->selectarray("DOC_SHOW_FIRST_SALES_REP", $arrval, getDolGlobalString('DOC_SHOW_FIRST_SALES_REP'));
661}
662
663// Show online payment link on invoices
664
665print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").'</td><td>';
666if ($conf->use_javascript_ajax) {
667 print ajax_constantonoff('PDF_SHOW_LINK_TO_ONLINE_PAYMENT');
668} else {
669 print $form->selectyesno('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', getDolGlobalInt('PDF_SHOW_LINK_TO_ONLINE_PAYMENT'), 1);
670}
671print '</td></tr>';
672
673print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_A").'</td><td>';
674
675//$pdfa = false; // PDF default version
676$pdfa = getDolGlobalInt('PDF_USE_A', 0); // PDF/A-1 ou PDF/A-3
677
678print $form->selectarray('PDF_USE_A', $arraylistofpdfformat, $pdfa);
679print '</td></tr>';
680
681print '</table>';
682print '</div>';
683
684print $form->buttonsSaveCancel("Save", '');
685
686print '</form>';
687
688
689// End of page
690llxFooter();
691$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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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.
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.