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