dolibarr  18.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  *
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
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
35 require_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 
40 if (!$user->admin) {
42 }
43 
44 $action = GETPOST('action', 'aZ09');
45 $cancel = GETPOST('cancel', 'alpha');
46 
47 
48 /*
49  * Actions
50  */
51 
52 if ($cancel) {
53  $action = '';
54 }
55 
56 if ($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_DOCUMENTS_LOGO_HEIGHT')) {
136  dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
137  }
138  if (GETPOSTISSET('MAIN_INVERT_SENDER_RECIPIENT')) {
139  dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity);
140  }
141  if (GETPOSTISSET('MAIN_PDF_USE_ISO_LOCATION')) {
142  dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity);
143  }
144  if (GETPOSTISSET('MAIN_PDF_NO_CUSTOMER_CODE')) {
145  dolibarr_set_const($db, "MAIN_PDF_NO_CUSTOMER_CODE", GETPOST("MAIN_PDF_NO_CUSTOMER_CODE"), 'chaine', 0, '', $conf->entity);
146  }
147 
148  if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
149  dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity);
150  }
151 
152  if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_SECOND_TAX')) {
153  dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity);
154  }
155  if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_THIRD_TAX')) {
156  dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_THIRD_TAX"), 'chaine', 0, '', $conf->entity);
157  }
158 
159  if (GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE')) {
160  dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
161  }
162  if (GETPOSTISSET('SHOW_SUBPRODUCT_REF_IN_PDF')) {
163  dolibarr_set_const($db, "SHOW_SUBPRODUCT_REF_IN_PDF", GETPOST('SHOW_SUBPRODUCT_REF_IN_PDF', 'alpha'), 'chaine', 0, '', $conf->entity);
164  }
165 
166  if (GETPOSTISSET('PDF_SHOW_LINK_TO_ONLINE_PAYMENT')) {
167  dolibarr_set_const($db, "PDF_SHOW_LINK_TO_ONLINE_PAYMENT", GETPOST('PDF_SHOW_LINK_TO_ONLINE_PAYMENT', 'alpha'), 'chaine', 0, '', $conf->entity);
168  }
169 
170  if (GETPOSTISSET('DOC_SHOW_FIRST_SALES_REP')) {
171  dolibarr_set_const($db, "DOC_SHOW_FIRST_SALES_REP", GETPOST('DOC_SHOW_FIRST_SALES_REP', 'alpha'), 'chaine', 0, '', $conf->entity);
172  }
173 
174  if (GETPOSTISSET('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME')) {
175  dolibarr_set_const($db, "PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", GETPOST('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME', 'alpha'), 'chaine', 0, '', $conf->entity);
176  }
177  if (GETPOSTISSET('PDF_USE_A')) {
178  dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity);
179  }
180 
181  if (GETPOSTISSET('PDF_BOLD_PRODUCT_LABEL')) {
182  dolibarr_set_const($db, "PDF_BOLD_PRODUCT_LABEL", GETPOST('PDF_BOLD_PRODUCT_LABEL', 'alpha'), 'chaine', 0, '', $conf->entity);
183  }
184  if (GETPOSTISSET('PDF_BOLD_PRODUCT_REF_AND_PERIOD')) {
185  dolibarr_set_const($db, "PDF_BOLD_PRODUCT_REF_AND_PERIOD", GETPOST('PDF_BOLD_PRODUCT_REF_AND_PERIOD', 'alpha'), 'chaine', 0, '', $conf->entity);
186  }
187 
188  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
189 
190  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
191  exit;
192 }
193 
194 
195 
196 /*
197  * View
198  */
199 
200 $wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
201 llxHeader('', $langs->trans("Setup"), $wikihelp);
202 
203 $form = new Form($db);
204 $formother = new FormOther($db);
205 $formadmin = new FormAdmin($db);
206 
207 $arraydetailsforpdffoot = array(
208  0 => $langs->transnoentitiesnoconv('NoDetails'),
209  1 => $langs->transnoentitiesnoconv('DisplayCompanyInfo'),
210  2 => $langs->transnoentitiesnoconv('DisplayCompanyManagers'),
211  3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
212 );
213 
214 $arraylistofpdfformat = array(
215  0 => $langs->transnoentitiesnoconv('PDF 1.7'),
216  1 => $langs->transnoentitiesnoconv('PDF/A-1b'),
217  3 => $langs->transnoentitiesnoconv('PDF/A-3b'),
218 );
219 
220 $s = $langs->trans("LibraryToBuildPDF")."<br>";
221 $i = 0;
222 $pdf = pdf_getInstance('A4');
223 if (class_exists('FPDF') && !class_exists('TCPDF')) {
224  if ($i) {
225  $s .= ' + ';
226  }
227  $s .= 'FPDF';
228  $s .= ' ('.@constant('FPDF_PATH').')';
229  $i++;
230 }
231 if (class_exists('TCPDF')) {
232  if ($i) {
233  $s .= ' + ';
234  }
235  $s .= 'TCPDF';
236  $s .= ' ('.@constant('TCPDF_PATH').')';
237  $i++;
238 }
239 if (class_exists('FPDI')) {
240  if ($i) {
241  $s .= ' + ';
242  }
243  $s .= 'FPDI';
244  $s .= ' ('.@constant('FPDI_PATH').')';
245  $i++;
246 }
247 if (class_exists('TCPDI')) {
248  if ($i) {
249  $s .= ' + ';
250  }
251  $s .= 'TCPDI';
252  $s .= ' ('.@constant('TCPDI_PATH').')';
253  $i++;
254 }
255 
256 print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
257 
258 $head = pdf_admin_prepare_head();
259 
260 print dol_get_fiche_head($head, 'general', '', -1, '');
261 
262 print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFDesc"), $s)."</span><br>\n";
263 print "<br>\n";
264 
265 $noCountryCode = (empty($mysoc->country_code) ? true : false);
266 
267 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
268 print '<input type="hidden" name="token" value="'.newToken().'">';
269 print '<input type="hidden" name="action" value="update">';
270 
271 clearstatcache();
272 
273 
274 // Misc options
275 print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
276 
277 print '<div class="div-table-responsive-no-min">';
278 print '<table summary="more" class="noborder centpercent">';
279 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
280 
281 $selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
282 if (empty($selected)) {
283  $selected = dol_getDefaultFormat();
284 }
285 
286 // Show pdf format
287 
288 print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
289 print $formadmin->select_paper_format($selected, 'MAIN_PDF_FORMAT');
290 print '</td></tr>';
291 
292 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
293 print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_LEFT" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10).'">';
294 print '</td></tr>';
295 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
296 print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_RIGHT" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10).'">';
297 print '</td></tr>';
298 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
299 print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_TOP" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10).'">';
300 print '</td></tr>';
301 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
302 print '<input type="text" class="maxwidth50" name="MAIN_PDF_MARGIN_BOTTOM" value="'.getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10).'">';
303 print '</td></tr>';
304 
305 print '</table>';
306 print '</div>';
307 
308 print '<br>';
309 
310 
311 // Addresses
312 print load_fiche_titre($langs->trans("PDFAddressForging"), '', '');
313 
314 print '<div class="div-table-responsive-no-min">';
315 print '<table summary="more" class="noborder centpercent">';
316 print '<tr class="liste_titre"><td class="">'.$langs->trans("Parameter").'</td><td></td></tr>';
317 
318 // Show sender name
319 
320 /* Set option as hidden because no need of this for 99.99% of users. Having it as hidden feature is enough.
321 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
322 if ($conf->use_javascript_ajax) {
323  print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
324 } else {
325  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);
326 }
327 print '</td></tr>';
328 */
329 
330 // Hide VAT Intra on address
331 
332 print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
333 if ($conf->use_javascript_ajax) {
334  print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS');
335 } else {
336  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);
337 }
338 print '</td></tr>';
339 
340 // Show prof id in address into pdf
341 for ($i = 1; $i <= 6; $i++) {
342  if (!$noCountryCode) {
343  $pid = $langs->transcountry("ProfId".$i, $mysoc->country_code);
344  if ($pid == '-') {
345  $pid = false;
346  }
347  } else {
348  $pid = img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
349  }
350  if ($pid) {
351  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
352  $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
353  if ($conf->use_javascript_ajax) {
354  print ajax_constantonoff($keyforconstant);
355  } else {
356  print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant) ? $conf->global->$keyforconstant : 0, 1, $noCountryCode);
357  }
358  print '</td></tr>';
359  }
360 }
361 
362 // Borders on address frame
363 
364 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_NO_SENDER_FRAME").'</td><td>';
365 if ($conf->use_javascript_ajax) {
366  print ajax_constantonoff('MAIN_PDF_NO_SENDER_FRAME');
367 } else {
368  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
369  print $form->selectarray("MAIN_PDF_NO_SENDER_FRAME", $arrval, $conf->global->MAIN_PDF_NO_SENDER_FRAME);
370 }
371 print '</td></tr>';
372 
373 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_NO_RECIPENT_FRAME").'</td><td>';
374 if ($conf->use_javascript_ajax) {
375  print ajax_constantonoff('MAIN_PDF_NO_RECIPENT_FRAME');
376 } else {
377  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
378  print $form->selectarray("MAIN_PDF_NO_RECIPENT_FRAME", $arrval, $conf->global->MAIN_PDF_NO_RECIPENT_FRAME);
379 }
380 print '</td></tr>';
381 
382 //Invert sender and recipient
383 
384 print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
385 if ($conf->use_javascript_ajax) {
386  print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT');
387 } else {
388  print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1);
389 }
390 print '</td></tr>';
391 
392 // Place customer adress to the ISO location
393 
394 print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
395 if ($conf->use_javascript_ajax) {
396  print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION');
397 } else {
398  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);
399 }
400 print '</td></tr>';
401 
402 // Show alias in thirdparty name
403 print '<tr class="oddeven"><td>'.$langs->trans("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME").'</td><td>';
404 if ($conf->use_javascript_ajax) {
405  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("THIRDPARTY_ALIAS"), '2' => $langs->trans("ALIAS_THIRDPARTY"));
406  print $form->selectarray("PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME", $arrval, getDolGlobalInt('PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME'));
407 }
408 
409 print '</table>';
410 print '</div>';
411 
412 
413 print '<br>';
414 
415 
416 // Localtaxes
417 $locales = '';
418 $text = '';
419 if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
420  if ($mysoc->useLocalTax(1)) {
421  $locales = $langs->transcountry("LT1", $mysoc->country_code);
422  $text = '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).'</td><td>';
423  if ($conf->use_javascript_ajax) {
424  $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_SECOND_TAX');
425  } else {
426  $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);
427  }
428  $text .= '</td></tr>';
429  }
430 
431  if ($mysoc->useLocalTax(2)) {
432  $locales .= ($locales ? ' & ' : '').$langs->transcountry("LT2", $mysoc->country_code);
433 
434  $text .= '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)).'</td><td>';
435  if ($conf->use_javascript_ajax) {
436  $text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_THIRD_TAX');
437  } else {
438  $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);
439  }
440  $text .= '</td></tr>';
441  }
442 }
443 
444 $title = $langs->trans("PDFRulesForSalesTax");
445 if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
446  $title .= ' - '.$langs->trans("PDFLocaltax", $locales);
447 }
448 
449 
450 print load_fiche_titre($title, '', '');
451 
452 print '<table summary="more" class="noborder centpercent">';
453 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td></td></tr>';
454 
455 // Hide any information on Sale tax / VAT
456 
457 print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
458 if ($conf->use_javascript_ajax) {
459  print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT');
460 } else {
461  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);
462 }
463 print '</td></tr>';
464 
465 // Locataxes
466 print $text;
467 
468 print '</table>';
469 print '<br>';
470 
471 
472 // Other
473 
474 print load_fiche_titre($langs->trans("Other"), '', '');
475 
476 print '<div class="div-table-responsive-no-min">';
477 print '<table summary="more" class="noborder centpercent">';
478 print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
479 
480 // Use 2 languages into PDF
481 
482 print '<tr class="oddeven"><td>';
483 print $form->textwithpicto($langs->trans("PDFIn2Languages"), $langs->trans("PDF_USE_ALSO_LANGUAGE_CODE"));
484 print '</td><td>';
485 $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);
486 print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
487 print '</td></tr>';
488 
489 // Height of logo
490 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'</td><td>';
491 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).'">';
492 print '</td></tr>';
493 
494 // Show project
495 if (isModEnabled('project')) {
496  print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_PROJECT").'</td><td>';
497  $tmparray = array('no' => 'No', 'showprojectref' => 'RefProject', 'showprojectlabel' => 'ShowProjectLabel');
498  $showprojectref = empty($conf->global->PDF_SHOW_PROJECT) ? (empty($conf->global->PDF_SHOW_PROJECT_TITLE) ? 'no' : 'showprojectlabel') : 'showprojectref';
499  print $form->selectarray('PDF_SHOW_PROJECT_REF_OR_LABEL', $tmparray, $showprojectref, 0, 0, 0, '', 1);
500  print '</td></tr>';
501 }
502 
503 //
504 
505 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_CUSTOMER_CODE");
506 print '</td><td>';
507 if ($conf->use_javascript_ajax) {
508  print ajax_constantonoff('MAIN_PDF_HIDE_CUSTOMER_CODE');
509 } else {
510  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
511  print $form->selectarray("MAIN_PDF_HIDE_CUSTOMER_CODE", $arrval, $conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE);
512 }
513 print '</td></tr>';
514 
515 // Ref
516 
517 print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
518 if ($conf->use_javascript_ajax) {
519  print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_REF');
520 } else {
521  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);
522 }
523 print '</td></tr>';
524 
525 // Desc
526 
527 print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
528 if ($conf->use_javascript_ajax) {
529  print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DESC');
530 } else {
531  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);
532 }
533 print '</td></tr>';
534 
535 // Details
536 
537 print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
538 if ($conf->use_javascript_ajax) {
539  print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS');
540 } else {
541  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);
542 }
543 print '</td></tr>';
544 
545 // Swicth in Bold
546 
547 print '<tr class="oddeven"><td>'.$langs->trans("BoldLabelOnPDF").'</td><td>';
548 if ($conf->use_javascript_ajax) {
549  print ajax_constantonoff('PDF_BOLD_PRODUCT_LABEL');
550 } else {
551  print $form->selectyesno('PDF_BOLD_PRODUCT_LABEL', (!empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) ? $conf->global->PDF_BOLD_PRODUCT_LABEL : 0, 1);
552 }
553 print '</td></tr>';
554 
555 // Swicth in Bold
556 
557 print '<tr class="oddeven"><td>'.$langs->trans("BoldRefAndPeriodOnPDF").'</td><td>';
558 if ($conf->use_javascript_ajax) {
559  print ajax_constantonoff('PDF_BOLD_PRODUCT_REF_AND_PERIOD');
560 } else {
561  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);
562 }
563 print '</td></tr>';
564 
565 // SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits.
566 
567 print '<tr class="oddeven"><td>'.$langs->trans("SHOW_SUBPRODUCT_REF_IN_PDF", $langs->transnoentitiesnoconv("AssociatedProductsAbility"), $langs->transnoentitiesnoconv("Products")).'</td><td>';
568 if ($conf->use_javascript_ajax) {
569  print ajax_constantonoff('SHOW_SUBPRODUCT_REF_IN_PDF');
570 } else {
571  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);
572 }
573 print '</td></tr>';
574 
575 // Show more details in footer
576 
577 print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
578 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));
579 print '</td></tr>';
580 
581 // Show the first sales representative
582 
583 print '<tr class="oddeven"><td>'.$langs->trans("DOC_SHOW_FIRST_SALES_REP");
584 print ' <span class="opacitymedium">('.$langs->trans("SalesRepresentativeInfo").')</span>';
585 print '</td><td>';
586 if ($conf->use_javascript_ajax) {
587  print ajax_constantonoff('DOC_SHOW_FIRST_SALES_REP');
588 } else {
589  $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
590  print $form->selectarray("DOC_SHOW_FIRST_SALES_REP", $arrval, $conf->global->DOC_SHOW_FIRST_SALES_REP);
591 }
592 
593 // Show online payment link on invoices
594 
595 print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_LINK_TO_ONLINE_PAYMENT").'</td><td>';
596 if ($conf->use_javascript_ajax) {
597  print ajax_constantonoff('PDF_SHOW_LINK_TO_ONLINE_PAYMENT');
598 } else {
599  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);
600 }
601 print '</td></tr>';
602 
603 print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_A").'</td><td>';
604 print $form->selectarray('PDF_USE_A', $arraylistofpdfformat, (empty($conf->global->PDF_USE_A) ? 0 : $conf->global->PDF_USE_A));
605 print '</td></tr>';
606 
607 print '</table>';
608 print '</div>';
609 
610 print $form->buttonsSaveCancel("Save", '');
611 
612 print '</form>';
613 
614 
615 // End of page
616 llxFooter();
617 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
dolibarr_del_const
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
Definition: admin.lib.php:557
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5363
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:530
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:4671
$wikihelp
if(GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) if(GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
Definition: agenda_xcal.php:90
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
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
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
ajax_constantonoff
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='', $morecss='')
On/off button for constant.
Definition: ajax.lib.php:604
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:1873
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:147
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:633
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:431
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:8509
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1106
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:96