dolibarr  18.0.0-alpha
pdf_vinci.modules.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
5  * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
7  * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
8  * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  * or see https://www.gnu.org/
23  */
24 
31 require_once DOL_DOCUMENT_ROOT.'/core/modules/mrp/modules_mo.php';
32 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
38 
39 
43 class pdf_vinci extends ModelePDFMo
44 {
48  public $db;
49 
53  public $name;
54 
58  public $description;
59 
63  public $update_main_doc_field;
64 
68  public $type;
69 
74  public $phpmin = array(7, 0);
75 
80  public $version = 'dolibarr';
81 
85  public $page_largeur;
86 
90  public $page_hauteur;
91 
95  public $format;
96 
100  public $marge_gauche;
101 
105  public $marge_droite;
106 
110  public $marge_haute;
111 
115  public $marge_basse;
116 
121  public $emetteur;
122 
123 
129  public function __construct($db)
130  {
131  global $conf, $langs, $mysoc;
132 
133  // Load translation files required by the page
134  $langs->loadLangs(array("main", "bills"));
135 
136  $this->db = $db;
137  $this->name = "vinci";
138  $this->description = $langs->trans('DocumentModelStandardPDF');
139  $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
140 
141  // Page size for A4 format
142  $this->type = 'pdf';
143  $formatarray = pdf_getFormat();
144  $this->page_largeur = $formatarray['width'];
145  $this->page_hauteur = $formatarray['height'];
146  $this->format = array($this->page_largeur, $this->page_hauteur);
147  $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
148  $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
149  $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
150  $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
151 
152  $this->option_logo = 1; // Display logo
153  $this->option_multilang = 1; //Available in several languages
154  $this->option_escompte = 0; // Displays if there has been a discount
155  $this->option_credit_note = 0; // Support credit notes
156  $this->option_freetext = 1; // Support add of a personalised text
157  $this->option_draft_watermark = 1; // Support add of a watermark on drafts
158 
159  // Get source company
160  $this->emetteur = $mysoc;
161  if (empty($this->emetteur->country_code)) {
162  $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
163  }
164 
165  // Define position of columns
166  $this->posxdesc = $this->marge_gauche + 1; // For module retrocompatibility support durring PDF transition: TODO remove this at the end
167  }
168 
169 
170  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
182  public function write_file($object, $outputlangs = '', $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
183  {
184  // phpcs:enable
185  global $user, $langs, $conf, $hookmanager, $mysoc;
186 
187  if (!is_object($outputlangs)) {
188  $outputlangs = $langs;
189  }
190  // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
191  if (!empty($conf->global->MAIN_USE_FPDF)) {
192  $outputlangs->charset_output = 'ISO-8859-1';
193  }
194 
195  // Load translation files required by the page
196  $outputlangs->loadLangs(array("main", "orders", "companies", "bills", "dict", "products"));
197 
198  global $outputlangsbis;
199  $outputlangsbis = null;
200  if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
201  $outputlangsbis = new Translate('', $conf);
202  $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
203  $outputlangsbis->loadLangs(array("main", "orders", "companies", "bills", "dict", "products"));
204  }
205 
206  if (!isset($object->lines) || !is_array($object->lines)) {
207  $object->lines = array();
208  }
209 
210  $nblines = count($object->lines);
211 
212  $hidetop = 0;
213  if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
214  $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
215  }
216 
217  // Loop on each lines to detect if there is at least one image to show
218  $realpatharray = array();
219 
220  if ($conf->mrp->dir_output) {
221  $object->fetch_thirdparty();
222 
223  $deja_regle = 0;
224  $amount_credit_notes_included = 0;
225  $amount_deposits_included = 0;
226  //$amount_credit_notes_included = $object->getSumCreditNotesUsed();
227  //$amount_deposits_included = $object->getSumDepositsUsed();
228 
229  // Definition of $dir and $file
230  if ($object->specimen) {
231  $dir = $conf->mrp->dir_output;
232  $file = $dir."/SPECIMEN.pdf";
233  } else {
234  $objectref = dol_sanitizeFileName($object->ref);
235  $dir = $conf->mrp->dir_output.'/'.$objectref;
236  $file = $dir."/".$objectref.".pdf";
237  }
238 
239  if (!file_exists($dir)) {
240  if (dol_mkdir($dir) < 0) {
241  $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
242  return 0;
243  }
244  }
245 
246  if (file_exists($dir)) {
247  // Add pdfgeneration hook
248  if (!is_object($hookmanager)) {
249  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
250  $hookmanager = new HookManager($this->db);
251  }
252  $hookmanager->initHooks(array('pdfgeneration'));
253  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
254  global $action;
255  $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
256 
257  $nblines = count($object->lines);
258 
259  $pdf = pdf_getInstance($this->format);
260  $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
261  $heightforinfotot = 50; // Height reserved to output the info and total part
262  $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
263  $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
264  if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
265  $heightforfooter += 6;
266  }
267  $pdf->SetAutoPageBreak(1, 0);
268 
269  if (class_exists('TCPDF')) {
270  $pdf->setPrintHeader(false);
271  $pdf->setPrintFooter(false);
272  }
273  $pdf->SetFont(pdf_getPDFFont($outputlangs));
274  // Set path to the background PDF File
275  if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
276  $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
277  $tplidx = $pdf->importPage(1);
278  }
279 
280  $pdf->Open();
281  $pagenb = 0;
282  $pdf->SetDrawColor(128, 128, 128);
283 
284  $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
285  $pdf->SetSubject($outputlangs->transnoentities("Mo"));
286  $pdf->SetCreator("Dolibarr ".DOL_VERSION);
287  $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
288  $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Mo")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
289  if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
290  $pdf->SetCompression(false);
291  }
292 
293  $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
294 
295  // Does we have at least one line with discount $this->atleastonediscount
296 
297  // New page
298  $pdf->AddPage();
299  if (!empty($tplidx)) {
300  $pdf->useTemplate($tplidx);
301  }
302  $pagenb++;
303  $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
304  $pdf->SetFont('', '', $default_font_size - 1);
305  $pdf->MultiCell(0, 3, ''); // Set interline to 3
306  $pdf->SetTextColor(0, 0, 0);
307 
308  $tab_top = 90 + $top_shift;
309  $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
310 
311  $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
312 
313 
314  // Affiche notes
315  $notetoshow = empty($object->note_public) ? '' : $object->note_public;
316 
317  // Extrafields in note
318  $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
319  if (!empty($extranote)) {
320  $notetoshow = dol_concatdesc($notetoshow, $extranote);
321  }
322 
323  $pagenb = $pdf->getPage();
324  if ($notetoshow) {
325  $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
326  $pageposbeforenote = $pagenb;
327 
328  $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
329  complete_substitutions_array($substitutionarray, $outputlangs, $object);
330  $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
331  $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
332 
333  $tab_top -= 2;
334 
335  $pdf->startTransaction();
336 
337  $pdf->SetFont('', '', $default_font_size - 1);
338  $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
339  // Description
340  $pageposafternote = $pdf->getPage();
341  $posyafter = $pdf->GetY();
342 
343  if ($pageposafternote > $pageposbeforenote) {
344  $pdf->rollbackTransaction(true);
345 
346  // prepar pages to receive notes
347  while ($pagenb < $pageposafternote) {
348  $pdf->AddPage();
349  $pagenb++;
350  if (!empty($tplidx)) {
351  $pdf->useTemplate($tplidx);
352  }
353  if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
354  $this->_pagehead($pdf, $object, 0, $outputlangs);
355  }
356  // $this->_pagefoot($pdf,$object,$outputlangs,1);
357  $pdf->setTopMargin($tab_top_newpage);
358  // The only function to edit the bottom margin of current page to set it.
359  $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
360  }
361 
362  // back to start
363  $pdf->setPage($pageposbeforenote);
364  $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
365  $pdf->SetFont('', '', $default_font_size - 1);
366  $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
367  $pageposafternote = $pdf->getPage();
368 
369  $posyafter = $pdf->GetY();
370 
371  if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) { // There is no space left for total+free text
372  $pdf->AddPage('', '', true);
373  $pagenb++;
374  $pageposafternote++;
375  $pdf->setPage($pageposafternote);
376  $pdf->setTopMargin($tab_top_newpage);
377  // The only function to edit the bottom margin of current page to set it.
378  $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext);
379  //$posyafter = $tab_top_newpage;
380  }
381 
382 
383  // apply note frame to previus pages
384  $i = $pageposbeforenote;
385  while ($i < $pageposafternote) {
386  $pdf->setPage($i);
387 
388 
389  $pdf->SetDrawColor(128, 128, 128);
390  // Draw note frame
391  if ($i > $pageposbeforenote) {
392  $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
393  $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
394  } else {
395  $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
396  $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
397  }
398 
399  // Add footer
400  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
401  $this->_pagefoot($pdf, $object, $outputlangs, 1);
402 
403  $i++;
404  }
405 
406  // apply note frame to last page
407  $pdf->setPage($pageposafternote);
408  if (!empty($tplidx)) {
409  $pdf->useTemplate($tplidx);
410  }
411  if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
412  $this->_pagehead($pdf, $object, 0, $outputlangs);
413  }
414  $height_note = $posyafter - $tab_top_newpage;
415  $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
416  } else {
417  // No pagebreak
418  $pdf->commitTransaction();
419  $posyafter = $pdf->GetY();
420  $height_note = $posyafter - $tab_top;
421  $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
422 
423 
424  if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
425  // not enough space, need to add page
426  $pdf->AddPage('', '', true);
427  $pagenb++;
428  $pageposafternote++;
429  $pdf->setPage($pageposafternote);
430  if (!empty($tplidx)) {
431  $pdf->useTemplate($tplidx);
432  }
433  if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
434  $this->_pagehead($pdf, $object, 0, $outputlangs);
435  }
436 
437  $posyafter = $tab_top_newpage;
438  }
439  }
440 
441  $tab_height = $tab_height - $height_note;
442  $tab_top = $posyafter + 6;
443  } else {
444  $height_note = 0;
445  }
446 
447  $nexY = $tab_top + 5;
448 
449  // Use new auto collum system
450  $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
451 
452  // Loop on each lines
453  $pageposbeforeprintlines = $pdf->getPage();
454  $pagenb = $pageposbeforeprintlines;
455 
456  $bom = new BOM($this->db);
457  $bom -> fetch($object->fk_bom);
458 
459  $nblines = count($bom->lines);
460 
461  for ($i = 0; $i < $nblines; $i++) {
462  $curY = $nexY;
463  $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
464  $pdf->SetTextColor(0, 0, 0);
465 
466  $prod = new Product($this->db);
467  $prod->fetch($bom->lines[$i]->fk_product);
468 
469  // Define size of image if we need it
470  $imglinesize = array();
471  if (!empty($realpatharray[$i])) {
472  $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
473  }
474 
475  $pdf->setTopMargin($tab_top_newpage);
476  $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
477  $pageposbefore = $pdf->getPage();
478 
479  $showpricebeforepagebreak = 1;
480  $posYAfterImage = 0;
481  $posYAfterDescription = 0;
482 
483  // We start with Photo of product line
484  if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
485  $pdf->AddPage('', '', true);
486  if (!empty($tplidx)) {
487  $pdf->useTemplate($tplidx);
488  }
489  if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
490  $this->_pagehead($pdf, $object, 0, $outputlangs);
491  }
492  $pdf->setPage($pageposbefore + 1);
493 
494  $curY = $tab_top_newpage;
495 
496  // Allows data in the first page if description is long enough to break in multiples pages
497  if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
498  $showpricebeforepagebreak = 1;
499  } else {
500  $showpricebeforepagebreak = 0;
501  }
502  }
503 
504  if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) {
505  $curX = $this->posxpicture - 1;
506  $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
507  // $pdf->Image does not increase value return by getY, so we save it manually
508  $posYAfterImage = $curY + $imglinesize['height'];
509  }
510  // Description of product line
511  $curX = $this->posxdesc - 1;
512  $showpricebeforepagebreak = 1;
513 
514  if ($this->getColumnStatus('code')) {
515  $pdf->startTransaction(); //description
516  //$this->printColDescContent($pdf, $curY, 'code', $object, $i, $outputlangs, $hideref, $hidedesc, $showsupplierSKU);
517  $this->printStdColumnContent($pdf, $curY, 'code', $prod->ref);
518 
519  $pageposafter = $pdf->getPage();
520  $posyafter = $pdf->GetY();
521  if ($pageposafter > $pageposbefore) { // There is a pagebreak
522  $pdf->rollbackTransaction(true);
523 
524  //$this->printColDescContent($pdf, $curY, 'code', $object, $i, $outputlangs, $hideref, $hidedesc, $showsupplierSKU);
525  $this->printStdColumnContent($pdf, $curY, 'code', $prod->ref);
526 
527  $pageposafter = $pdf->getPage();
528  $posyafter = $pdf->GetY();
529  } elseif ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
530  if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
531  $pdf->AddPage('', '', true);
532  if (!empty($tplidx)) {
533  $pdf->useTemplate($tplidx);
534  }
535  //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
536  $pdf->setPage($pageposafter + 1);
537  } else {
538  // We found a page break
539  // Allows data in the first page if description is long enough to break in multiples pages
540  if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
541  $showpricebeforepagebreak = 1;
542  } else {
543  $showpricebeforepagebreak = 0;
544  }
545  }
546  } else // No pagebreak
547  {
548  $pdf->commitTransaction();
549  }
550  $posYAfterDescription = $pdf->GetY();
551  }
552 
553  $nexY = $pdf->GetY();
554  $pageposafter = $pdf->getPage();
555  $pdf->setPage($pageposbefore);
556  $pdf->setTopMargin($this->marge_haute);
557  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
558 
559  // We suppose that a too long description is moved completely on next page
560  if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
561  $pdf->setPage($pageposafter);
562  $curY = $tab_top_newpage;
563  }
564 
565  if ($this->getColumnStatus('desc')) {
566  $pdf->startTransaction(); //description
567  $des = $prod -> description;
568  $descr = $des;//implode("<br>", $des);
569 
570  $this->printStdColumnContent($pdf, $curY, 'desc', $descr);
571 
572  $pageposafter = $pdf->getPage();
573  $posyafter = $pdf->GetY();
574  if ($pageposafter > $pageposbefore) { // There is a pagebreak
575  $pdf->rollbackTransaction(true);
576 
577  $this->printStdColumnContent($pdf, $curY, 'desc', $descr);
578 
579  $pageposafter = $pdf->getPage();
580  $posyafter = $pdf->GetY();
581  } elseif ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
582  if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
583  $pdf->AddPage('', '', true);
584  if (!empty($tplidx)) {
585  $pdf->useTemplate($tplidx);
586  }
587  //if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
588  $pdf->setPage($pageposafter + 1);
589  } else {
590  // We found a page break
591  // Allows data in the first page if description is long enough to break in multiples pages
592  if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
593  $showpricebeforepagebreak = 1;
594  } else {
595  $showpricebeforepagebreak = 0;
596  }
597  }
598  } else // No pagebreak
599  {
600  $pdf->commitTransaction();
601  }
602  $posYAfterDescription = max($posYAfterDescription, $pdf->GetY());
603  }
604 
605  $nexY = max($nexY, $pdf->GetY());
606  $pageposafter = $pdf->getPage();
607  $pdf->setPage($pageposbefore);
608  $pdf->setTopMargin($this->marge_haute);
609  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
610 
611  // We suppose that a too long description is moved completely on next page
612  if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
613  $pdf->setPage($pageposafter);
614  $curY = $tab_top_newpage;
615  }
616 
617  $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
618 
619  // Quantity
620  // Enough for 6 chars
621  if ($this->getColumnStatus('qty')) {
622  $qty = $bom->lines[$i]->qty;
623  $this->printStdColumnContent($pdf, $curY, 'qty', $qty);
624  $nexY = max($pdf->GetY(), $nexY);
625  }
626 
627  // Quantity
628  // Enough for 6 chars
629  if ($this->getColumnStatus('qtytot')) {
630  $qtytot = $object->qty * $bom->lines[$i]->qty;
631  $this->printStdColumnContent($pdf, $curY, 'qtytot', $qtytot);
632  $nexY = max($pdf->GetY(), $nexY);
633  }
634 
635  // Dimensions
636  if ($this->getColumnStatus('dim')) {
637  $array = array_filter(array($prod->length, $prod->width, $prod->height));
638  $dim = implode("x", $array);
639  $this->printStdColumnContent($pdf, $curY, 'dim', $dim);
640  $nexY = max($pdf->GetY(), $nexY);
641  }
642  }
643 
644 
645 
646 
647  // Show square
648  if ($pagenb == $pageposbeforeprintlines) {
649  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
650  $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
651  } else {
652  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
653  $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
654  }
655 
656  // Affiche zone infos
657  $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
658 
659  // Affiche zone totaux
660  //$posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
661 
662  // Affiche zone versements
663  if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) {
664  $posy = $this->_tableau_versements($pdf, $object, $posy, $outputlangs);
665  }
666 
667  // Pied de page
668  $this->_pagefoot($pdf, $object, $outputlangs);
669  if (method_exists($pdf, 'AliasNbPages')) {
670  $pdf->AliasNbPages();
671  }
672 
673  $pdf->Close();
674 
675  $pdf->Output($file, 'F');
676 
677  // Add pdfgeneration hook
678  $hookmanager->initHooks(array('pdfgeneration'));
679  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
680  global $action;
681  $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
682  if ($reshook < 0) {
683  $this->error = $hookmanager->error;
684  $this->errors = $hookmanager->errors;
685  }
686 
687  dolChmod($file);
688 
689  $this->result = array('fullpath'=>$file);
690 
691  return 1; // No error
692  } else {
693  $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
694  return 0;
695  }
696  } else {
697  $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR");
698  return 0;
699  }
700  }
701 
702  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
703  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
713  protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
714  {
715  // phpcs:enable
716  }
717 
718  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
719  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
729  protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
730  {
731  // phpcs:enable
732  global $conf, $mysoc;
733  $default_font_size = pdf_getPDFFontSize($outputlangs);
734 
735  // If France, show VAT mention if not applicable
736  if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
737  $pdf->SetFont('', 'B', $default_font_size - 2);
738  $pdf->SetXY($this->marge_gauche, $posy);
739  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
740 
741  $posy = $pdf->GetY() + 4;
742  }
743 
744  $posxval = 52;
745 
746  // Show payments conditions
747  if (!empty($object->cond_reglement_code) || $object->cond_reglement) {
748  $pdf->SetFont('', 'B', $default_font_size - 2);
749  $pdf->SetXY($this->marge_gauche, $posy);
750  $titre = $outputlangs->transnoentities("PaymentConditions").':';
751  $pdf->MultiCell(80, 4, $titre, 0, 'L');
752 
753  $pdf->SetFont('', '', $default_font_size - 2);
754  $pdf->SetXY($posxval, $posy);
755  $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement_label);
756  $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
757  $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
758 
759  $posy = $pdf->GetY() + 3;
760  }
761 
762  // Show payment mode
763  if (!empty($object->mode_reglement_code)) {
764  $pdf->SetFont('', 'B', $default_font_size - 2);
765  $pdf->SetXY($this->marge_gauche, $posy);
766  $titre = $outputlangs->transnoentities("PaymentMode").':';
767  $pdf->MultiCell(80, 5, $titre, 0, 'L');
768 
769  $pdf->SetFont('', '', $default_font_size - 2);
770  $pdf->SetXY($posxval, $posy);
771  $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
772  $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
773 
774  $posy = $pdf->GetY() + 2;
775  }
776 
777 
778  return $posy;
779  }
780 
781  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
782  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
793  protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
794  {
795  // phpcs:enable
796  global $conf, $mysoc;
797 
798  $default_font_size = pdf_getPDFFontSize($outputlangs);
799 
800  $tab2_top = $posy;
801  $tab2_hl = 4;
802  $pdf->SetFont('', '', $default_font_size - 1);
803 
804  // Tableau total
805  $col1x = 120;
806  $col2x = 170;
807  if ($this->page_largeur < 210) { // To work with US executive format
808  $col2x -= 20;
809  }
810  $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
811 
812  $useborder = 0;
813  $index = 0;
814 
815  // Total HT
816  $pdf->SetFillColor(255, 255, 255);
817  $pdf->SetXY($col1x, $tab2_top);
818  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
819 
820  $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
821  $pdf->SetXY($col2x, $tab2_top);
822  $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, 'R', 1);
823 
824  // Show VAT by rates and total
825  $pdf->SetFillColor(248, 248, 248);
826 
827  $this->atleastoneratenotnull = 0;
828  foreach ($this->tva as $tvakey => $tvaval) {
829  if ($tvakey > 0) { // On affiche pas taux 0
830  $this->atleastoneratenotnull++;
831 
832  $index++;
833  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
834 
835  $tvacompl = '';
836 
837  if (preg_match('/\*/', $tvakey)) {
838  $tvakey = str_replace('*', '', $tvakey);
839  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
840  }
841 
842  $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
843  $totalvat .= vatrate($tvakey, 1).$tvacompl;
844  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
845 
846  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
847  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
848  }
849  }
850  if (!$this->atleastoneratenotnull) { // If no vat at all
851  $index++;
852  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
853  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code), 0, 'L', 1);
854 
855  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
856  $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva), 0, 'R', 1);
857 
858  // Total LocalTax1
859  if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION == 'localtax1on' && $object->total_localtax1 > 0) {
860  $index++;
861  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
862  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code), 0, 'L', 1);
863  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
864  $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1);
865  }
866 
867  // Total LocalTax2
868  if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION == 'localtax2on' && $object->total_localtax2 > 0) {
869  $index++;
870  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
871  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code), 0, 'L', 1);
872  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
873  $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1);
874  }
875  } else {
876  //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
877  //{
878  //Local tax 1
879  foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
880  if (in_array((string) $localtax_type, array('2', '4', '6'))) {
881  continue;
882  }
883 
884  foreach ($localtax_rate as $tvakey => $tvaval) {
885  if ($tvakey != 0) { // On affiche pas taux 0
886  //$this->atleastoneratenotnull++;
887 
888  $index++;
889  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
890 
891  $tvacompl = '';
892  if (preg_match('/\*/', $tvakey)) {
893  $tvakey = str_replace('*', '', $tvakey);
894  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
895  }
896  $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
897  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
898  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
899 
900  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
901  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
902  }
903  }
904  }
905 
906  //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
907  //{
908  //Local tax 2
909  foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
910  if (in_array((string) $localtax_type, array('2', '4', '6'))) {
911  continue;
912  }
913 
914  foreach ($localtax_rate as $tvakey => $tvaval) {
915  if ($tvakey != 0) { // On affiche pas taux 0
916  //$this->atleastoneratenotnull++;
917 
918  $index++;
919  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
920 
921  $tvacompl = '';
922  if (preg_match('/\*/', $tvakey)) {
923  $tvakey = str_replace('*', '', $tvakey);
924  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
925  }
926  $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
927  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
928  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
929 
930  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
931  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1);
932  }
933  }
934  }
935  }
936 
937  // Total TTC
938  $index++;
939  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
940  $pdf->SetTextColor(0, 0, 60);
941  $pdf->SetFillColor(224, 224, 224);
942  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
943 
944  $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
945  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
946  $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1);
947  $pdf->SetFont('', '', $default_font_size - 1);
948  $pdf->SetTextColor(0, 0, 0);
949 
950  $creditnoteamount = 0;
951  $depositsamount = 0;
952  //$creditnoteamount=$object->getSumCreditNotesUsed();
953  //$depositsamount=$object->getSumDepositsUsed();
954  //print "x".$creditnoteamount."-".$depositsamount;exit;
955  $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
956  if (!empty($object->paye)) {
957  $resteapayer = 0;
958  }
959 
960  if ($deja_regle > 0) {
961  // Already paid + Deposits
962  $index++;
963 
964  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
965  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
966  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
967  $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle), 0, 'R', 0);
968 
969  $index++;
970  $pdf->SetTextColor(0, 0, 60);
971  $pdf->SetFillColor(224, 224, 224);
972  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
973  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
974 
975  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
976  $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer), $useborder, 'R', 1);
977 
978  $pdf->SetFont('', '', $default_font_size - 1);
979  $pdf->SetTextColor(0, 0, 0);
980  }
981 
982  $index++;
983  return ($tab2_top + ($tab2_hl * $index));
984  }
985 
986  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1000  protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
1001  {
1002  global $conf;
1003 
1004  // Force to disable hidetop and hidebottom
1005  $hidebottom = 0;
1006  if ($hidetop) {
1007  $hidetop = -1;
1008  }
1009 
1010  $currency = !empty($currency) ? $currency : $conf->currency;
1011  $default_font_size = pdf_getPDFFontSize($outputlangs);
1012 
1013  // Amount in (at tab_top - 1)
1014  $pdf->SetTextColor(0, 0, 0);
1015  $pdf->SetFont('', '', $default_font_size - 2);
1016 
1017  if (empty($hidetop)) {
1018  //$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
1019  $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1020  $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1021 
1022  //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1023  if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1024  $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1025  }
1026  }
1027 
1028  $pdf->SetDrawColor(128, 128, 128);
1029  $pdf->SetFont('', '', $default_font_size - 1);
1030 
1031  // Output Rect
1032  $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
1033 
1034  foreach ($this->cols as $colKey => $colDef) {
1035  if (!$this->getColumnStatus($colKey)) {
1036  continue;
1037  }
1038 
1039  // get title label
1040  $colDef['title']['label'] = !empty($colDef['title']['label']) ? $colDef['title']['label'] : $outputlangs->transnoentities($colDef['title']['textkey']);
1041 
1042  // Add column separator
1043  if (!empty($colDef['border-left'])) {
1044  $pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height);
1045  }
1046 
1047  if (empty($hidetop)) {
1048  $pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
1049 
1050  $textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
1051  $pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
1052  }
1053  }
1054 
1055  if (empty($hidetop)) {
1056  $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line takes a position y in 2nd parameter and 4th parameter
1057  }
1058  }
1059 
1060  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1070  protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1071  {
1072  global $langs, $conf, $mysoc;
1073 
1074  $ltrdirection = 'L';
1075  if ($outputlangs->trans("DIRECTION") == 'rtl') $ltrdirection = 'R';
1076 
1077  // Load translation files required by the page
1078  $outputlangs->loadLangs(array("main", "orders", "companies", "bills", "sendings"));
1079 
1080  $default_font_size = pdf_getPDFFontSize($outputlangs);
1081 
1082  // Do not add the BACKGROUND as this is for suppliers
1083  //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
1084 
1085  //Affiche le filigrane brouillon - Print Draft Watermark
1086  /*if($object->statut==0 && getDolGlobalString('COMMANDE_DRAFT_WATERMARK'))
1087  {
1088  pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',getDolGlobalString('COMMANDE_DRAFT_WATERMARK'));
1089  }*/
1090  //Print content
1091 
1092  $pdf->SetTextColor(0, 0, 60);
1093  $pdf->SetFont('', 'B', $default_font_size + 3);
1094 
1095  $posx = $this->page_largeur - $this->marge_droite - 100;
1096  $posy = $this->marge_haute;
1097 
1098  $pdf->SetXY($this->marge_gauche, $posy);
1099 
1100  // Logo
1101  $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
1102  if ($this->emetteur->logo) {
1103  if (is_readable($logo)) {
1104  $height = pdf_getHeightForLogo($logo);
1105  $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
1106  } else {
1107  $pdf->SetTextColor(200, 0, 0);
1108  $pdf->SetFont('', 'B', $default_font_size - 2);
1109  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
1110  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
1111  }
1112  } else {
1113  $text = $this->emetteur->name;
1114  $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1115  }
1116 
1117  $pdf->SetFont('', 'B', $default_font_size + 3);
1118  $pdf->SetXY($posx, $posy);
1119  $pdf->SetTextColor(0, 0, 60);
1120  $title = $outputlangs->transnoentities("Mo")." ".$outputlangs->convToOutputCharset($object->ref);
1121  $pdf->MultiCell(100, 3, $title, '', 'R');
1122  $posy += 1;
1123 
1124  if ($object->ref_supplier) {
1125  $posy += 4;
1126  $pdf->SetFont('', 'B', $default_font_size);
1127  $pdf->SetXY($posx, $posy);
1128  $pdf->SetTextColor(0, 0, 60);
1129  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".$outputlangs->convToOutputCharset($object->ref_supplier), '', 'R');
1130  $posy += 1;
1131  }
1132 
1133  $pdf->SetFont('', '', $default_font_size - 1);
1134  if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
1135  $object->fetch_projet();
1136  if (!empty($object->project->ref)) {
1137  $posy += 3;
1138  $pdf->SetXY($posx, $posy);
1139  $pdf->SetTextColor(0, 0, 60);
1140  $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
1141  }
1142  }
1143 
1144  if (!empty($conf->global->PDF_SHOW_PROJECT)) {
1145  $object->fetch_projet();
1146  if (!empty($object->project->ref)) {
1147  $outputlangs->load("projects");
1148  $posy += 4;
1149  $pdf->SetXY($posx, $posy);
1150  $langs->load("projects");
1151  $pdf->SetTextColor(0, 0, 60);
1152  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
1153  }
1154  }
1155 
1156  if (!empty($object->date_approve)) {
1157  $posy += 5;
1158  $pdf->SetXY($posx, $posy);
1159  $pdf->SetTextColor(0, 0, 60);
1160  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("MoDate")." : ".dol_print_date($object->date_approve, "day", false, $outputlangs, true), '', 'R');
1161  } else {
1162  $posy += 5;
1163  $pdf->SetXY($posx, $posy);
1164  $pdf->SetTextColor(255, 0, 0);
1165  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ToApprove"), '', 'R');
1166  }
1167 
1168  // product info
1169  $posy += 7;
1170  $prodToMake = new Product($this->db);
1171  $prodToMake->fetch($object->fk_product);
1172  $pdf->SetFont('', 'B', $default_font_size + 1);
1173  $pdf->SetXY($posx, $posy);
1174  $pdf->SetTextColor(0, 0, 60);
1175  $pdf->MultiCell($w, 3, $prodToMake->ref, '', 'R');
1176 
1177  $posy += 5;
1178  $prodToMake = new Product($this->db);
1179  $prodToMake->fetch($object->fk_product);
1180  $pdf->SetFont('', 'B', $default_font_size + 3);
1181  $pdf->SetXY($posx, $posy);
1182  $pdf->SetTextColor(0, 0, 60);
1183  $pdf->MultiCell($w, 3, $prodToMake->description, '', 'R');
1184 
1185  $array = array_filter(array($prodToMake->length, $prodToMake->width, $prodToMake->height));
1186  $dim = implode("x", $array);
1187  if (!empty($dim)) {
1188  $posy += 5;
1189  $pdf->SetFont('', 'B', $default_font_size + 3);
1190  $pdf->SetXY($posx, $posy);
1191  $pdf->SetTextColor(0, 0, 60);
1192  $pdf->MultiCell($w, 3, $dim, '', 'R');
1193  }
1194 
1195  $posy += 5;
1196  $prodToMake = new Product($this->db);
1197  $prodToMake->fetch($object->fk_product);
1198  $pdf->SetFont('', 'B', $default_font_size + 3);
1199  $pdf->SetXY($posx, $posy);
1200  $pdf->SetTextColor(0, 0, 60);
1201  $pdf->MultiCell($w, 3, $outputlangs->transnoentities("QtyToProduce").": " .$object->qty, '', 'R');
1202 
1203 
1204  $pdf->SetTextColor(0, 0, 60);
1205  $usehourmin = 'day';
1206  if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) {
1207  $usehourmin = 'dayhour';
1208  }
1209  if (!empty($object->delivery_date)) {
1210  $posy += 4;
1211  $pdf->SetXY($posx - 90, $posy);
1212  $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R');
1213  }
1214 
1215  if ($object->thirdparty->code_fournisseur) {
1216  $posy += 4;
1217  $pdf->SetXY($posx, $posy);
1218  $pdf->SetTextColor(0, 0, 60);
1219  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R');
1220  }
1221 
1222  // Get contact
1223  if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1224  $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1225  if (count($arrayidcontact) > 0) {
1226  $usertmp = new User($this->db);
1227  $usertmp->fetch($arrayidcontact[0]);
1228  $posy += 4;
1229  $pdf->SetXY($posx, $posy);
1230  $pdf->SetTextColor(0, 0, 60);
1231  $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
1232  }
1233  }
1234 
1235  $posy += 1;
1236  $pdf->SetTextColor(0, 0, 60);
1237 
1238  $top_shift = 0;
1239  // Show list of linked objects
1240  $current_y = $pdf->getY();
1241  $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
1242  if ($current_y < $pdf->getY()) {
1243  $top_shift = $pdf->getY() - $current_y;
1244  }
1245 
1246  if ($showaddress) {
1247  // Sender properties
1248  $carac_emetteur = '';
1249  // Add internal contact of proposal if defined
1250  $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1251  if (count($arrayidcontact) > 0) {
1252  $object->fetch_user($arrayidcontact[0]);
1253  $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
1254  }
1255 
1256  $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1257 
1258  // Show sender
1259  $posy = 42 + $top_shift;
1260  $posx = $this->marge_gauche;
1261  if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1262  $posx = $this->page_largeur - $this->marge_droite - 80;
1263  }
1264  $hautcadre = 40;
1265 
1266  // Show sender frame
1267  $pdf->SetTextColor(0, 0, 0);
1268  $pdf->SetFont('', '', $default_font_size - 2);
1269  $pdf->SetXY($posx, $posy - 5);
1270  $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
1271  $pdf->SetXY($posx, $posy);
1272  $pdf->SetFillColor(230, 230, 230);
1273  $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
1274  $pdf->SetTextColor(0, 0, 60);
1275 
1276  // Show sender name
1277  $pdf->SetXY($posx + 2, $posy + 3);
1278  $pdf->SetFont('', 'B', $default_font_size);
1279  $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1280  $posy = $pdf->getY();
1281 
1282  // Show sender information
1283  $pdf->SetXY($posx + 2, $posy);
1284  $pdf->SetFont('', '', $default_font_size - 1);
1285  $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
1286 
1287 
1288 
1289  // If CUSTOMER contact defined on order, we use it. Note: Even if this is a supplier object, the code for external contat that follow order is 'CUSTOMER'
1290  $usecontact = false;
1291  $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
1292  if (count($arrayidcontact) > 0) {
1293  $usecontact = true;
1294  $result = $object->fetch_contact($arrayidcontact[0]);
1295  }
1296 
1297  // Recipient name
1298  if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
1299  $thirdparty = $object->contact;
1300  } else {
1301  $thirdparty = $object->thirdparty;
1302  }
1303 
1304  //$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1305 
1306  //$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
1307 
1308  // Show recipient
1309  //$widthrecbox = 100;
1310  //if ($this->page_largeur < 210) {
1311  // $widthrecbox = 84; // To work with US executive format
1312  //}
1313  //$posy = 42 + $top_shift;
1314  //$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1315  //if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1316  // $posx = $this->marge_gauche;
1317  //}
1318  //
1320  //$pdf->SetTextColor(0, 0, 0);
1321  //$pdf->SetFont('', '', $default_font_size - 2);
1322  //$pdf->SetXY($posx + 2, $posy - 5);
1323  //$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
1324  //$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1325  //
1327  //$pdf->SetXY($posx + 2, $posy + 3);
1328  //$pdf->SetFont('', 'B', $default_font_size);
1329  //$pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection);
1330  //
1331  //$posy = $pdf->getY();
1332  //
1334  //$pdf->SetFont('', '', $default_font_size - 1);
1335  //$pdf->SetXY($posx + 2, $posy);
1336  //$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1337  }
1338 
1339  return $top_shift;
1340  }
1341 
1342  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1352  protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1353  {
1354  $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1355  return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1356  }
1357 
1358 
1359 
1370  public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1371  {
1372  global $conf, $hookmanager;
1373 
1374  // Default field style for content
1375  $this->defaultContentsFieldsStyle = array(
1376  'align' => 'R', // R,C,L
1377  'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1378  );
1379 
1380  // Default field style for content
1381  $this->defaultTitlesFieldsStyle = array(
1382  'align' => 'C', // R,C,L
1383  'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1384  );
1385 
1386  /*
1387  * For exemple
1388  $this->cols['theColKey'] = array(
1389  'rank' => $rank, // int : use for ordering columns
1390  'width' => 20, // the column width in mm
1391  'title' => array(
1392  'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
1393  'label' => ' ', // the final label : used fore final generated text
1394  'align' => 'L', // text alignement : R,C,L
1395  'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1396  ),
1397  'content' => array(
1398  'align' => 'L', // text alignement : R,C,L
1399  'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1400  ),
1401  );
1402  */
1403  $rank = 0;
1404  $this->cols['code'] = array(
1405  'rank' => $rank,
1406  'status' => true,
1407  'width' => 35, // in mm
1408  'title' => array(
1409  'textkey' => 'Ref'
1410  ),
1411  'border-left' => true, // add left line separator
1412  );
1413 
1414  $rank = 1; // do not use negative rank
1415  $this->cols['desc'] = array(
1416  'rank' => $rank,
1417  'width' => false, // only for desc
1418  'status' => true,
1419  'title' => array(
1420  'textkey' => 'Designation', // use lang key is usefull in somme case with module
1421  'align' => 'L',
1422  // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
1423  // 'label' => ' ', // the final label
1424  'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1425  ),
1426  'border-left' => true,
1427  'content' => array(
1428  'align' => 'L',
1429  'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1430  ),
1431  );
1432 
1433  $rank = $rank + 10;
1434  $this->cols['photo'] = array(
1435  'rank' => $rank,
1436  'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm
1437  'status' => false,
1438  'title' => array(
1439  'textkey' => 'Photo',
1440  'label' => ' '
1441  ),
1442  'content' => array(
1443  'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1444  ),
1445  'border-left' => false, // remove left line separator
1446  );
1447 
1448  if (!empty($conf->global->MAIN_GENERATE_ORDERS_WITH_PICTURE)) {
1449  $this->cols['photo']['status'] = true;
1450  }
1451 
1452  $rank = $rank + 10;
1453  $this->cols['dim'] = array(
1454  'rank' => $rank,
1455  'status' => true,
1456  'width' => 25, // in mm
1457  'title' => array(
1458  'textkey' => 'Size'
1459  ),
1460  'border-left' => true, // add left line separator
1461  );
1462 
1463  $rank = $rank + 10;
1464  $this->cols['qty'] = array(
1465  'rank' => $rank,
1466  'width' => 16, // in mm
1467  'status' => true,
1468  'title' => array(
1469  'textkey' => 'Qty'
1470  ),
1471  'border-left' => true, // add left line separator
1472  );
1473 
1474  $rank = $rank + 10;
1475  $this->cols['qtytot'] = array(
1476  'rank' => $rank,
1477  'width' => 25, // in mm
1478  'status' => true,
1479  'title' => array(
1480  'textkey' => 'QtyTot'
1481  ),
1482  'border-left' => true, // add left line separator
1483  );
1484 
1485  // Add extrafields cols
1486  if (!empty($object->lines)) {
1487  $line = reset($object->lines);
1488  $this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
1489  }
1490 
1491  $parameters = array(
1492  'object' => $object,
1493  'outputlangs' => $outputlangs,
1494  'hidedetails' => $hidedetails,
1495  'hidedesc' => $hidedesc,
1496  'hideref' => $hideref
1497  );
1498 
1499  $reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
1500  if ($reshook < 0) {
1501  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1502  } elseif (empty($reshook)) {
1503  $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
1504  } else {
1505  $this->cols = $hookmanager->resArray;
1506  }
1507  }
1508 }
pdf_vinci\_pagehead
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
Definition: pdf_vinci.modules.php:1070
make_substitutions
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Definition: functions.lib.php:8210
pdf_vinci
Class to generate the manufacturing orders with the vinci model.
Definition: pdf_vinci.modules.php:43
db
$conf db
API class for accounts.
Definition: inc.php:41
pdf_getSizeForImage
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
Definition: pdf.lib.php:2505
dol_sanitizeFileName
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Definition: functions.lib.php:1236
description
print *****$script_file(".$version.") pid cd cd cd description as description
Definition: email_expire_services_to_customers.php:83
pdf_getFormat
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition: pdf.lib.php:84
pdf_vinci\_pagefoot
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
Definition: pdf_vinci.modules.php:1352
pdf_getInstance
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition: pdf.lib.php:126
CommonDocGenerator\printStdColumnContent
printStdColumnContent($pdf, &$curY, $colKey, $columnText='')
print standard column content
Definition: commondocgenerator.class.php:1211
pdf_getPDFFont
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition: pdf.lib.php:265
Translate
Class to manage translations.
Definition: translate.class.php:30
name
$conf db name
Definition: repair.php:122
pdf_vinci\_tableau
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
Show table for lines.
Definition: pdf_vinci.modules.php:1000
BOM
Class for BOM.
Definition: bom.class.php:36
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5834
CommonDocGenerator\prepareArrayColumnField
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
Definition: commondocgenerator.class.php:1054
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2566
dol_concatdesc
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
Definition: functions.lib.php:7590
dolChmod
dolChmod($filepath, $newmask='')
Change mod of a file.
Definition: functions.lib.php:6882
pdf_vinci\__construct
__construct($db)
Constructor.
Definition: pdf_vinci.modules.php:129
pdf_getHeightForLogo
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition: pdf.lib.php:313
CommonDocGenerator\printRect
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
Definition: commondocgenerator.class.php:1010
pdf_writeLinkedObjects
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
Definition: pdf.lib.php:1318
pdf_build_address
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formated for output on documents.
Definition: pdf.lib.php:434
convertBackOfficeMediasLinksToPublicLinks
if(!function_exists('dolEscapeXML')) convertBackOfficeMediasLinksToPublicLinks($notetoshow)
Convert links to local wrapper to medias files into a string into a public external URL readable on i...
Definition: functions2.lib.php:2723
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:82
pdf_vinci\defineColumnField
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field.
Definition: pdf_vinci.modules.php:1370
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:147
pdf_vinci\_tableau_info
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
Definition: pdf_vinci.modules.php:729
ModelePDFMo
Parent class for mos models.
Definition: modules_mo.php:39
User
Class to manage Dolibarr users.
Definition: user.class.php:44
Product
Class to manage products or services.
Definition: product.class.php:46
dol_htmlentitiesbr
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
Definition: functions.lib.php:7325
pdf_getPDFFontSize
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition: pdf.lib.php:288
pdf_getSubstitutionArray
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
Definition: pdf.lib.php:744
price
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
Definition: functions.lib.php:5708
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8509
pdf_vinci\_tableau_tot
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
Definition: pdf_vinci.modules.php:793
pdf_vinci\_tableau_versements
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
Definition: pdf_vinci.modules.php:713
dol_mkdir
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Definition: functions.lib.php:6811
pdf_vinci\write_file
write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
Definition: pdf_vinci.modules.php:182
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:96
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119
CommonDocGenerator\defineColumnExtrafield
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
Definition: commondocgenerator.class.php:1631
CommonDocGenerator\getColumnStatus
getColumnStatus($colKey)
get column status from column key
Definition: commondocgenerator.class.php:1535
HookManager
Class to manage hooks.
Definition: hookmanager.class.php:30
complete_substitutions_array
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
Definition: functions.lib.php:8333
vatrate
vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0, $html=0)
Return a string with VAT rate label formated for view output Used into pdf and HTML pages.
Definition: functions.lib.php:5659
pdf_pagefoot
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0, $page_largeur=0, $watermark='')
Show footer of page for PDF generation.
Definition: pdf.lib.php:996