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