dolibarr  7.0.0-beta
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@capnetworks.com>
5  * Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
26 require '../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
33 
34 $langs->load("admin");
35 $langs->load("languages");
36 $langs->load("other");
37 
38 $langs->load("companies");
39 $langs->load("products");
40 $langs->load("members");
41 
42 if (! $user->admin) accessforbidden();
43 
44 $action = GETPOST('action','alpha');
45 $cancel = GETPOST('cancel','alpha');
46 
47 
48 /*
49  * Actions
50  */
51 
52 if ($cancel) {
53  $action='';
54 }
55 
56 if ($action == 'update')
57 {
58  dolibarr_set_const($db, "MAIN_PDF_FORMAT", $_POST["MAIN_PDF_FORMAT"],'chaine',0,'',$conf->entity);
59 
60  dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", $_POST["MAIN_PDF_MARGIN_LEFT"],'chaine',0,'',$conf->entity);
61  dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", $_POST["MAIN_PDF_MARGIN_RIGHT"],'chaine',0,'',$conf->entity);
62  dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"],'chaine',0,'',$conf->entity);
63  dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"],'chaine',0,'',$conf->entity);
64 
65  dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"],'chaine',0,'',$conf->entity);
66  dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'',$conf->entity);
67  dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'',$conf->entity);
68  dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'',$conf->entity);
69  dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'',$conf->entity);
70 
71  dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"],'chaine',0,'',$conf->entity);
72  dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'',$conf->entity);
73  dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
74  dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
75  dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
76  dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
77 
78 
79  dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity);
80  dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity);
81 
82  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
83  exit;
84 }
85 
86 if ($action == 'activate_pdfsecurity')
87 {
88  dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1",'chaine',0,'',$conf->entity);
89  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
90  exit;
91 }
92 else if ($action == 'disable_pdfsecurity')
93 {
94  dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity);
95  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
96  exit;
97 }
98 
99 
100 
101 /*
102  * View
103  */
104 
105 $wikihelp='EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
106 llxHeader('',$langs->trans("Setup"),$wikihelp);
107 
108 $form=new Form($db);
109 $formother=new FormOther($db);
110 $formadmin=new FormAdmin($db);
111 
112 $arraydetailsforpdffoot = array(
113  0 => $langs->transnoentitiesnoconv('NoDetails'),
114  1 => $langs->transnoentitiesnoconv('DisplayCompanyInfo'),
115  2 => $langs->transnoentitiesnoconv('DisplayCompanyManagers'),
116  3 => $langs->transnoentitiesnoconv('DisplayCompanyInfoAndManagers')
117 );
118 
119 print load_fiche_titre($langs->trans("PDF"),'','title_setup');
120 
121 print $langs->trans("PDFDesc")."<br>\n";
122 print "<br>\n";
123 
124 $noCountryCode = (empty($mysoc->country_code) ? true : false);
125 
126 if ($action == 'edit') // Edit
127 {
128  print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
129  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
130  print '<input type="hidden" name="action" value="update">';
131 
132  clearstatcache();
133 
134 
135  // Misc options
136  print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>';
137 
138  print '<div class="div-table-responsive-no-min">';
139  print '<table summary="more" class="noborder" width="100%">';
140  print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
141 
142  $selected=$conf->global->MAIN_PDF_FORMAT;
143  if (empty($selected)) $selected=dol_getDefaultFormat();
144 
145  // Show pdf format
146 
147  print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
148  print $formadmin->select_paper_format($selected,'MAIN_PDF_FORMAT');
149  print '</td></tr>';
150 
151  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
152  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).'">';
153  print '</td></tr>';
154  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
155  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).'">';
156  print '</td></tr>';
157  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
158  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).'">';
159  print '</td></tr>';
160  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
161  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).'">';
162  print '</td></tr>';
163 
164  print '</table>';
165  print '</div>';
166 
167  print '<br>';
168 
169 
170  // Addresses
171  print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>';
172 
173  print '<div class="div-table-responsive-no-min">';
174  print '<table summary="more" class="noborder" width="100%">';
175  print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
176 
177  // Hide VAT Intra on address
178 
179  print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
180  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);
181  print '</td></tr>';
182 
183  // Show prof id 1 in address into pdf
184 
185  if (! $noCountryCode)
186  {
187  $pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
188  if ($pid1 == '-') $pid1=false;
189  }
190  else
191  {
192  $pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
193  }
194  if ($pid1)
195  {
196  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
197  print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS',isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0,1,$noCountryCode);
198  print '</td></tr>';
199  }
200 
201  // Show prof id 2 in address into pdf
202 
203  if (! $noCountryCode)
204  {
205  $pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
206  if ($pid2 == '-') $pid2=false;
207  }
208  else
209  {
210  $pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
211  }
212  if ($pid2)
213  {
214  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
215  print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS',isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0,1,$noCountryCode);
216  print '</td></tr>';
217  }
218 
219  // Show prof id 3 in address into pdf
220 
221  if (! $noCountryCode)
222  {
223  $pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
224  if ($pid3 == '-') $pid3=false;
225  }
226  else
227  {
228  $pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
229  }
230  if ($pid3)
231  {
232  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
233  print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS',isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0,1,$noCountryCode);
234  print '</td></tr>';
235  }
236 
237  // Show prof id 4 in address into pdf
238 
239  if (! $noCountryCode)
240  {
241  $pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
242  if ($pid4 == '-') $pid4=false;
243  }
244  else
245  {
246  $pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
247  }
248  if ($pid4)
249  {
250  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
251  print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS',isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0,1,$noCountryCode);
252  print '</td></tr>';
253  }
254 
255  print '</table>';
256  print '</div>';
257 
258  print '<br>';
259 
260  // Localtaxes
261  if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
262  {
263  $locales ='';
264  $text='';
265 
266  if ($mysoc->useLocalTax(1))
267  {
268  $locales = $langs->transcountry("LT1",$mysoc->country_code);
269  $text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
270  $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);
271  $text .= '</td></tr>';
272  }
273 
274  if ($mysoc->useLocalTax(2))
275  {
276  $locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
277 
278  $text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
279  $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);
280  $text.= '</td></tr>';
281  }
282 
283  print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
284 
285  print '<table summary="more" class="noborder" width="100%">';
286  print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
287  print $text;
288 
289  print '</table>';
290  print '<br>';
291 
292  }
293 
294  // Other
295  print load_fiche_titre($langs->trans("Other"),'','').'<br>';
296 
297  print '<div class="div-table-responsive-no-min">';
298  print '<table summary="more" class="noborder" width="100%">';
299  print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
300 
301  // Hide any PDF informations
302 
303  print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
304  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);
305  print '</td></tr>';
306 
307  //Desc
308 
309  print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
310  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);
311  print '</td></tr>';
312 
313  //Ref
314 
315  print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
316  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);
317  print '</td></tr>';
318 
319  //Details
320 
321  print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
322  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);
323  print '</td></tr>';
324 
325  // Place customer adress to the ISO location
326 
327  print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
328  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);
329  print '</td></tr>';
330 
331 
332  print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
333  print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
334  print '</td></tr>';
335 
336  print '</table>';
337  print '</div>';
338 
339  print '<br><div class="center">';
340  print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
341  print ' &nbsp; ';
342  print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
343  print '</div>';
344 
345  print '</form>';
346  print '<br>';
347 }
348 else // Show
349 {
350  // Misc options
351  print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
352 
353 
354  print '<div class="div-table-responsive-no-min">';
355  print '<table summary="more" class="noborder" width="100%">';
356  print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
357 
358  // Show pdf format
359 
360  print '<tr class="oddeven"><td>'.$langs->trans("DictionaryPaperFormat").'</td><td>';
361 
362  $pdfformatlabel='';
363  if (empty($conf->global->MAIN_PDF_FORMAT))
364  {
365  include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
366  $pdfformatlabel=dol_getDefaultFormat();
367  }
368  else $pdfformatlabel=$conf->global->MAIN_PDF_FORMAT;
369  if (! empty($pdfformatlabel))
370  {
371  $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format";
372  $sql.=" WHERE code LIKE '%".$db->escape($pdfformatlabel)."%'";
373 
374  $resql=$db->query($sql);
375  if ($resql)
376  {
377  $obj=$db->fetch_object($resql);
378  $paperKey = $langs->trans('PaperFormat'.$obj->code);
379  $unitKey = $langs->trans('SizeUnit'.$obj->unit);
380  $pdfformatlabel = ($paperKey == 'PaperFormat'.$obj->code ? $obj->label : $paperKey).' - '.round($obj->width).'x'.round($obj->height).' '.($unitKey == 'SizeUnit'.$obj->unit ? $obj->unit : $unitKey);
381  }
382  }
383  print $pdfformatlabel;
384  print '</td></tr>';
385 
386  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_LEFT").'</td><td>';
387  print empty($conf->global->MAIN_PDF_MARGIN_LEFT)?10:$conf->global->MAIN_PDF_MARGIN_LEFT;
388  print '</td></tr>';
389  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_RIGHT").'</td><td>';
390  print empty($conf->global->MAIN_PDF_MARGIN_RIGHT)?10:$conf->global->MAIN_PDF_MARGIN_RIGHT;
391  print '</td></tr>';
392  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_TOP").'</td><td>';
393  print empty($conf->global->MAIN_PDF_MARGIN_TOP)?10:$conf->global->MAIN_PDF_MARGIN_TOP;
394  print '</td></tr>';
395  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_MARGIN_BOTTOM").'</td><td>';
396  print empty($conf->global->MAIN_PDF_MARGIN_BOTTOM)?10:$conf->global->MAIN_PDF_MARGIN_BOTTOM;
397  print '</td></tr>';
398 
399  print '</table>';
400  print '</div>';
401 
402  print '<br>';
403 
404  print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
405 
406  print '<div class="div-table-responsive-no-min">';
407  print '<table class="noborder" width="100%">';
408  print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
409 
410  // Hide Intra VAT on address
411 
412  print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td colspan="2">';
413  print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1);
414  print '</td></tr>';
415 
416  // Show prof id 1 in address into pdf
417 
418  if (! $noCountryCode)
419  {
420  $pid1=$langs->transcountry("ProfId1",$mysoc->country_code);
421  if ($pid1 == '-') $pid1=false;
422  }
423  else
424  {
425  $pid1 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
426  }
427  if ($pid1)
428  {
429  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.'</td><td>';
430  print yn($conf->global->MAIN_PROFID1_IN_ADDRESS,1);
431  print '</td></tr>';
432  }
433 
434  // Show prof id 2 in address into pdf
435 
436  if (! $noCountryCode)
437  {
438  $pid2=$langs->transcountry("ProfId2",$mysoc->country_code);
439  if ($pid2 == '-') $pid2=false;
440  }
441  else
442  {
443  $pid2 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
444  }
445  if ($pid2)
446  {
447  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.'</td><td>';
448  print yn($conf->global->MAIN_PROFID2_IN_ADDRESS,1);
449  print '</td></tr>';
450  }
451 
452  // Show prof id 3 in address into pdf
453 
454  if (! $noCountryCode)
455  {
456  $pid3=$langs->transcountry("ProfId3",$mysoc->country_code);
457  if ($pid3 == '-') $pid3=false;
458  }
459  else
460  {
461  $pid3 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
462  }
463  if ($pid3)
464  {
465  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.'</td><td>';
466  print yn($conf->global->MAIN_PROFID3_IN_ADDRESS,1);
467  print '</td></tr>';
468  }
469 
470  // Show prof id 4 in address into pdf
471 
472  if (! $noCountryCode)
473  {
474  $pid4=$langs->transcountry("ProfId4",$mysoc->country_code);
475  if ($pid4 == '-') $pid4=false;
476  }
477  else
478  {
479  $pid4 = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
480  }
481  if ($pid4)
482  {
483  print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.'</td><td>';
484  print yn($conf->global->MAIN_PROFID4_IN_ADDRESS,1);
485  print '</td></tr>';
486  }
487 
488  print '</table>'."\n";
489  print '</div>';
490 
491  print '<br>';
492 
493  // Localtaxes
494  if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
495  {
496  $locales ='';
497  $text='';
498 
499  if ($mysoc->useLocalTax(1))
500  {
501  $locales = $langs->transcountry("LT1",$mysoc->country_code);
502  $text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
503  $text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX,1);
504  $text .= '</td></tr>';
505  }
506 
507  if ($mysoc->useLocalTax(2))
508  {
509  $locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
510 
511  $text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
512  $text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX,1);
513  $text.= '</td></tr>';
514  }
515 
516  print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
517 
518  print '<table summary="more" class="noborder" width="100%">';
519  print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
520  print $text;
521  print '</table>';
522  print '<br>';
523 
524  }
525 
526  // Other
527  print load_fiche_titre($langs->trans("Other"),'','');
528 
529  print '<div class="div-table-responsive-no-min">';
530  print '<table summary="more" class="noborder" width="100%">';
531  print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';
532 
533  // Encrypt and protect PDF
534 
535  print '<tr class="oddeven">';
536  print '<td>';
537  $text = $langs->trans("ProtectAndEncryptPdfFiles");
538  $desc = $form->textwithpicto($text,$langs->transnoentities("ProtectAndEncryptPdfFilesDesc"),1);
539  print $desc;
540  print '</td>';
541  print '<td width="60">';
542  if($conf->global->PDF_SECURITY_ENCRYPTION == 1)
543  {
544  print img_picto($langs->trans("Active"),'tick');
545  }
546  print '</td>';
547  print '<td align="center" width="140">';
548  if (empty($conf->global->PDF_SECURITY_ENCRYPTION))
549  {
550  print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_pdfsecurity">'.$langs->trans("Activate").'</a>';
551  }
552  else
553  {
554  print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_pdfsecurity">'.$langs->trans("Disable").'</a>';
555  }
556  print "</td>";
557 
558  print "</td>";
559  print '</tr>';
560 
561  // Hide any PDF informations
562 
563  print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
564  print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
565  print '</td></tr>';
566 
567  //Desc
568 
569  print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
570  print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1);
571  print '</td></tr>';
572 
573  //Ref
574 
575  print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td colspan="2">';
576  print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1);
577  print '</td></tr>';
578 
579  //Details
580 
581  print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td colspan="2">';
582  print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1);
583  print '</td></tr>';
584 
585 
586  print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
587  print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
588  print '</td></tr>';
589 
590 
591  print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
592  print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)];
593  print '</td></tr>';
594 
595  print '</table>';
596  print '</div>';
597 
598 
599  /*
600  * Library
601  */
602 
603  print '<br>';
604  print load_fiche_titre($langs->trans("Library"));
605 
606  print '<div class="div-table-responsive-no-min">';
607  print '<table class="noborder" width="100%">'."\n";
608 
609  print '<tr class="liste_titre">'."\n";
610  print '<td>'.$langs->trans("Name").'</td>'."\n";
611  print '<td>'.$langs->trans("Value").'</td>'."\n";
612  print "</tr>\n";
613 
614  if (! empty($dolibarr_pdf_force_fpdf))
615  {
616 
617  print '<tr class="oddeven">'."\n";
618  print '<td>dolibarr_pdf_force_fpdf</td>'."\n";
619  print '<td>';
620  print $dolibarr_pdf_force_fpdf;
621  print '</td>';
622  print '</tr>';
623  }
624 
625 
626  print '<tr class="oddeven">'."\n";
627  print '<td>'.$langs->trans("LibraryToBuildPDF").'</td>'."\n";
628  print '<td>';
629  $i=0;
630  $pdf=pdf_getInstance('A4');
631  if (class_exists('FPDF') && ! class_exists('TCPDF'))
632  {
633  if ($i) print ' + ';
634  print 'FPDF';
635  print ' ('.@constant('FPDF_PATH').')';
636  $i++;
637  }
638  if (class_exists('TCPDF'))
639  {
640  if ($i) print ' + ';
641  print 'TCPDF';
642  print ' ('.@constant('TCPDF_PATH').')';
643  $i++;
644  }
645  if (class_exists('FPDI'))
646  {
647  if ($i) print ' + ';
648  print 'FPDI';
649  print ' ('.@constant('FPDI_PATH').')';
650  $i++;
651  }
652  if (class_exists('TCPDI'))
653  {
654  if ($i) print ' + ';
655  print 'TCPDI';
656  print ' ('.@constant('TCPDI_PATH').')';
657  $i++;
658  }
659  print '<!-- $conf->global->MAIN_USE_FPDF = '.$conf->global->MAIN_USE_FPDF.' -->';
660  print '</td>'."\n";
661  print '</tr>'."\n";
662 
663  print "</table>\n";
664  print '</div>';
665 
666  if (! empty($dolibarr_pdf_force_fpdf))
667  {
668  print info_admin($langs->trans("WarningUsingFPDF")).'<br>';
669  }
670 
671  print '<div class="tabsAction">';
672  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
673  print '</div>';
674  print '<br>';
675 }
676 
677 
678 llxFooter();
679 
680 $db->close();
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition: pdf.lib.php:82
llxFooter()
Empty footer.
Definition: wrapper.php:58
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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:485
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to generate html code for admin pages.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage generation of HTML components Only common components must be here.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1')
Show information for admin users or standard users.
img_warning($titlealt= 'default', $moreatt= '')
Show warning logo.
if(GETPOST('button_removefilter_x','alpha')||GETPOST('button_removefilter.x','alpha')||GETPOST('button_removefilter','alpha')) if($action=="save"&&empty($cancel)) if(preg_match('/set_(.*)/', $action, $reg)) if(preg_match('/del_(.*)/', $action, $reg) $wikihelp)
View.
Definition: agenda.php:143
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
Definition: admin.lib.php:410
Classe permettant la generation de composants html autre Only common components are here...
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
dol_getDefaultFormat(Translate $outputlangs=null)
Try to guess default paper format according to language into $langs.
print
Draft customers invoices.
Definition: index.php:91
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013