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