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