dolibarr  19.0.0-dev
pdf_aurore.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-2012 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
5  * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
6  * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
7  * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  * or see https://www.gnu.org/
22  */
23 
29 require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_proposal/modules_supplier_proposal.php';
30 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
34 
35 
40 {
44  public $db;
45 
49  public $name;
50 
54  public $description;
55 
59  public $update_main_doc_field;
60 
64  public $type;
65 
70  public $version = 'dolibarr';
71 
75  public $page_largeur;
76 
80  public $page_hauteur;
81 
85  public $format;
86 
90  public $marge_gauche;
91 
95  public $marge_droite;
96 
100  public $marge_haute;
101 
105  public $marge_basse;
106 
111  public $emetteur;
112 
113 
119  public function __construct($db)
120  {
121  global $conf, $langs, $mysoc;
122 
123  // Translations
124  $langs->loadLangs(array("main", "bills"));
125 
126  $this->db = $db;
127  $this->name = "aurore";
128  $this->description = $langs->trans('DocModelAuroreDescription');
129  $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
130 
131  // Page size for A4 format
132  $this->type = 'pdf';
133  $formatarray = pdf_getFormat();
134  $this->page_largeur = $formatarray['width'];
135  $this->page_hauteur = $formatarray['height'];
136  $this->format = array($this->page_largeur, $this->page_hauteur);
137  $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
138  $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
139  $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
140  $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
141 
142  $this->option_logo = 1; // Display logo
143  $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
144  $this->option_modereg = 1; // Display payment mode
145  $this->option_condreg = 1; // Display payment terms
146  $this->option_multilang = 1; // Available in several languages
147  $this->option_escompte = 1; // Displays if there has been a discount
148  $this->option_credit_note = 1; // Support credit notes
149  $this->option_freetext = 1; // Support add of a personalised text
150  $this->option_draft_watermark = 1; //Support add of a watermark on drafts
151  $this->watermark = '';
152 
153  // Get source company
154  $this->emetteur = $mysoc;
155  if (empty($this->emetteur->country_code)) {
156  $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
157  }
158 
159  // Define position of columns
160  $this->posxdesc = $this->marge_gauche + 1;
161 
162  if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
163  //$this->posxtva = 101;
164  $this->posxup = 112;
165  $this->posxqty = 135;
166  $this->posxunit = 151;
167  } else {
168  //$this->posxtva = 106;
169  $this->posxup = 122;
170  $this->posxqty = 145;
171  $this->posxunit = 162;
172  }
173  $this->posxdiscount = 162;
174  $this->postotalht = 174;
175 
176  $this->posxpicture = $this->posxup - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
177  if ($this->page_largeur < 210) { // To work with US executive format
178  $this->posxpicture -= 20;
179  $this->posxup -= 20;
180  $this->posxqty -= 20;
181  $this->posxunit -= 20;
182  $this->posxdiscount -= 20;
183  $this->postotalht -= 20;
184  }
185 
186  $this->tva = array();
187  $this->tva_array = array();
188  $this->localtax1 = array();
189  $this->localtax2 = array();
190  $this->atleastoneratenotnull = 0;
191  $this->atleastonediscount = 0;
192  }
193 
194  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
206  public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
207  {
208  // phpcs:enable
209  global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
210 
211  if (!is_object($outputlangs)) {
212  $outputlangs = $langs;
213  }
214  // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
215  if (!empty($conf->global->MAIN_USE_FPDF)) {
216  $outputlangs->charset_output = 'ISO-8859-1';
217  }
218 
219  // Load traductions files required by page
220  $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal"));
221 
222  // Show Draft Watermark
223  if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) {
224  $this->watermark = $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK;
225  }
226 
227  $nblines = count($object->lines);
228 
229  // Loop on each lines to detect if there is at least one image to show
230  $realpatharray = array();
231  if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) {
232  for ($i = 0; $i < $nblines; $i++) {
233  if (empty($object->lines[$i]->fk_product)) {
234  continue;
235  }
236 
237  $objphoto = new Product($this->db);
238  $objphoto->fetch($object->lines[$i]->fk_product);
239 
240  if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
241  $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
242  $dir = $conf->product->dir_output.'/'.$pdir;
243  } else {
244  $pdir = get_exdir(0, 0, 0, 0, $objphoto, 'product');
245  $dir = $conf->product->dir_output.'/'.$pdir;
246  }
247 
248  $realpath = '';
249  foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
250  if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
251  if ($obj['photo_vignette']) {
252  $filename = $obj['photo_vignette'];
253  } else {
254  $filename = $obj['photo'];
255  }
256  } else {
257  $filename = $obj['photo'];
258  }
259  $realpath = $dir.$filename;
260  break;
261  }
262 
263  if ($realpath) {
264  $realpatharray[$i] = $realpath;
265  }
266  }
267  }
268  if (count($realpatharray) == 0) {
269  $this->posxpicture = $this->posxup;
270  }
271 
272  if ($conf->supplier_proposal->dir_output) {
273  $object->fetch_thirdparty();
274 
275  // $deja_regle = 0;
276 
277  // Definition of $dir and $file
278  if ($object->specimen) {
279  $dir = $conf->supplier_proposal->dir_output;
280  $file = $dir."/SPECIMEN.pdf";
281  } else {
282  $objectref = dol_sanitizeFileName($object->ref);
283  $dir = $conf->supplier_proposal->dir_output."/".$objectref;
284  $file = $dir."/".$objectref.".pdf";
285  }
286 
287  if (!file_exists($dir)) {
288  if (dol_mkdir($dir) < 0) {
289  $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
290  return 0;
291  }
292  }
293 
294  if (file_exists($dir)) {
295  // Add pdfgeneration hook
296  if (!is_object($hookmanager)) {
297  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
298  $hookmanager = new HookManager($this->db);
299  }
300  $hookmanager->initHooks(array('pdfgeneration'));
301  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
302  global $action;
303  $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
304 
305  // Create pdf instance
306  $pdf = pdf_getInstance($this->format);
307  $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
308  $heightforinfotot = 50; // Height reserved to output the info and total part
309  $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
310  $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
311  if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
312  $heightforfooter += 6;
313  }
314  $pdf->SetAutoPageBreak(1, 0);
315 
316  if (class_exists('TCPDF')) {
317  $pdf->setPrintHeader(false);
318  $pdf->setPrintFooter(false);
319  }
320  $pdf->SetFont(pdf_getPDFFont($outputlangs));
321  // Set path to the background PDF File
322  if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
323  $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
324  $tplidx = $pdf->importPage(1);
325  }
326 
327  $pdf->Open();
328  $pagenb = 0;
329  $pdf->SetDrawColor(128, 128, 128);
330 
331  $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
332  $pdf->SetSubject($outputlangs->transnoentities("CommercialAsk"));
333  $pdf->SetCreator("Dolibarr ".DOL_VERSION);
334  $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
335  $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
336  if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
337  $pdf->SetCompression(false);
338  }
339 
340  $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
341 
342  // Positionne $this->atleastonediscount si on a au moins une remise
343  for ($i = 0; $i < $nblines; $i++) {
344  if ($object->lines[$i]->remise_percent) {
345  $this->atleastonediscount++;
346  }
347  }
348  if (empty($this->atleastonediscount)) {
349  $delta = ($this->postotalht - $this->posxdiscount);
350  $this->posxpicture += $delta;
351  $this->posxup += $delta;
352  $this->posxqty += $delta;
353  $this->posxunit += $delta;
354  $this->posxdiscount += $delta;
355  // post of fields after are not modified, stay at same position
356  }
357 
358  // New page
359  $pdf->AddPage();
360  if (!empty($tplidx)) {
361  $pdf->useTemplate($tplidx);
362  }
363  $pagenb++;
364  $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
365  $pdf->SetFont('', '', $default_font_size - 1);
366  $pdf->MultiCell(0, 3, ''); // Set interline to 3
367  $pdf->SetTextColor(0, 0, 0);
368 
369  $tab_top = 90 + $top_shift;
370  $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
371 
372  // Affiche notes
373  $notetoshow = empty($object->note_public) ? '' : $object->note_public;
374  if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
375  // Get first sale rep
376  if (is_object($object->thirdparty)) {
377  $salereparray = $object->thirdparty->getSalesRepresentatives($user);
378  $salerepobj = new User($this->db);
379  $salerepobj->fetch($salereparray[0]['id']);
380  if (!empty($salerepobj->signature)) {
381  $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
382  }
383  }
384  }
385 
386  // Extrafields in note
387  $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
388  if (!empty($extranote)) {
389  $notetoshow = dol_concatdesc($notetoshow, $extranote);
390  }
391 
392  if ($notetoshow) {
393  $tab_top -= 2;
394 
395  $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
396  complete_substitutions_array($substitutionarray, $outputlangs, $object);
397  $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
398  $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
399 
400  $pdf->SetFont('', '', $default_font_size - 1);
401  $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1);
402  $nexY = $pdf->GetY();
403  $height_note = $nexY - $tab_top;
404 
405  // Rect takes a length in 3rd parameter
406  $pdf->SetDrawColor(192, 192, 192);
407  $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
408 
409  $tab_top = $nexY + 6;
410  }
411 
412  $iniY = $tab_top + 7;
413  $curY = $tab_top + 7;
414  $nexY = $tab_top + 7;
415 
416  // Loop on each lines
417  for ($i = 0; $i < $nblines; $i++) {
418  $curY = $nexY;
419  $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
420  $pdf->SetTextColor(0, 0, 0);
421 
422  // Define size of image if we need it
423  $imglinesize = array();
424  if (!empty($realpatharray[$i])) {
425  $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
426  }
427 
428  $pdf->setTopMargin($tab_top_newpage);
429  $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
430  $pageposbefore = $pdf->getPage();
431 
432  $showpricebeforepagebreak = 1;
433  $posYAfterImage = 0;
434  $posYAfterDescription = 0;
435 
436  // We start with Photo of product line
437  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
438  $pdf->AddPage('', '', true);
439  if (!empty($tplidx)) {
440  $pdf->useTemplate($tplidx);
441  }
442  if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
443  $this->_pagehead($pdf, $object, 0, $outputlangs);
444  }
445  $pdf->setPage($pageposbefore + 1);
446 
447  $curY = $tab_top_newpage;
448 
449  // Allows data in the first page if description is long enough to break in multiples pages
450  if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
451  $showpricebeforepagebreak = 1;
452  } else {
453  $showpricebeforepagebreak = 0;
454  }
455  }
456 
457  if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) {
458  $curX = $this->posxpicture - 1;
459  $pdf->Image($realpatharray[$i], $curX + (($this->posxup - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
460  // $pdf->Image does not increase value return by getY, so we save it manually
461  $posYAfterImage = $curY + $imglinesize['height'];
462  }
463 
464  // Description of product line
465  $curX = $this->posxdesc - 1;
466 
467  $pdf->startTransaction();
468  if ($posYAfterImage > 0) {
469  $descWidth = $this->posxpicture - $curX;
470  } else {
471  $descWidth = $this->posxup - $curX;
472  }
473  pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
474 
475  $pageposafter = $pdf->getPage();
476  if ($pageposafter > $pageposbefore) { // There is a pagebreak
477  $pdf->rollbackTransaction(true);
478  $pageposafter = $pageposbefore;
479  //print $pageposafter.'-'.$pageposbefore;exit;
480  $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
481  pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
482 
483  $pageposafter = $pdf->getPage();
484  $posyafter = $pdf->GetY();
485  //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
486  if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
487  if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
488  $pdf->AddPage('', '', true);
489  if (!empty($tplidx)) {
490  $pdf->useTemplate($tplidx);
491  }
492  if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
493  $this->_pagehead($pdf, $object, 0, $outputlangs);
494  }
495  $pdf->setPage($pageposafter + 1);
496  }
497  } else {
498  // We found a page break
499  // Allows data in the first page if description is long enough to break in multiples pages
500  if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
501  $showpricebeforepagebreak = 1;
502  } else {
503  $showpricebeforepagebreak = 0;
504  }
505  }
506  } else // No pagebreak
507  {
508  $pdf->commitTransaction();
509  }
510  $posYAfterDescription = $pdf->GetY();
511 
512  $nexY = $pdf->GetY();
513  $pageposafter = $pdf->getPage();
514 
515  $pdf->setPage($pageposbefore);
516  $pdf->setTopMargin($this->marge_haute);
517  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
518 
519  // We suppose that a too long description or photo were moved completely on next page
520  if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
521  $pdf->setPage($pageposafter);
522  $curY = $tab_top_newpage;
523  }
524 
525  $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut
526 
527  // Quantity
528  $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
529  $pdf->SetXY($this->posxqty, $curY);
530  $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
531 
532  // Unit
533  if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
534  $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
535  $pdf->SetXY($this->posxunit, $curY);
536  $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L');
537  }
538 
539  // Discount on line
540  /*
541  if ($object->lines[$i]->remise_percent)
542  {
543  $pdf->SetXY($this->posxdiscount-2, $curY);
544  $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
545  $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
546  }
547 
548  // Total HT line
549  $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
550  $pdf->SetXY($this->postotalht, $curY);
551  if ($total_excl_tax > 0)
552  $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
553  */
554 
555  // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
556  if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
557  $tvaligne = $object->lines[$i]->multicurrency_total_tva;
558  } else {
559  $tvaligne = $object->lines[$i]->total_tva;
560  }
561 
562  $localtax1ligne = $object->lines[$i]->total_localtax1;
563  $localtax2ligne = $object->lines[$i]->total_localtax2;
564  $localtax1_rate = $object->lines[$i]->localtax1_tx;
565  $localtax2_rate = $object->lines[$i]->localtax2_tx;
566  $localtax1_type = $object->lines[$i]->localtax1_type;
567  $localtax2_type = $object->lines[$i]->localtax2_type;
568 
569  // TODO remise_percent is an obsolete field for object parent
570  /*if ($object->remise_percent) {
571  $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
572  }
573  if ($object->remise_percent) {
574  $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
575  }
576  if ($object->remise_percent) {
577  $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
578  }*/
579 
580  $vatrate = (string) $object->lines[$i]->tva_tx;
581 
582  // Retrieve type from database for backward compatibility with old records
583  if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
584  && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
585  $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
586  $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
587  $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
588  }
589 
590  // retrieve global local tax
591  if ($localtax1_type && $localtax1ligne != 0) {
592  if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
593  $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
594  } else {
595  $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
596  }
597  }
598  if ($localtax2_type && $localtax2ligne != 0) {
599  if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
600  $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
601  } else {
602  $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
603  }
604  }
605 
606  if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
607  $vatrate .= '*';
608  }
609 
610  // Fill $this->tva and $this->tva_array
611  if (!isset($this->tva[$vatrate])) {
612  $this->tva[$vatrate] = 0;
613  }
614  $this->tva[$vatrate] += $tvaligne;
615  $vatcode = $object->lines[$i]->vat_src_code;
616  if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
617  $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
618  }
619  $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
620 
621  if ($posYAfterImage > $posYAfterDescription) {
622  $nexY = $posYAfterImage;
623  }
624 
625  // Add line
626  if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
627  $pdf->setPage($pageposafter);
628  $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
629  //$pdf->SetDrawColor(190,190,200);
630  $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
631  $pdf->SetLineStyle(array('dash'=>0));
632  }
633 
634  $nexY += 2; // Add space between lines
635 
636  // Detect if some page were added automatically and output _tableau for past pages
637  while ($pagenb < $pageposafter) {
638  $pdf->setPage($pagenb);
639  if ($pagenb == 1) {
640  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
641  } else {
642  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
643  }
644  $this->_pagefoot($pdf, $object, $outputlangs, 1);
645  $pagenb++;
646  $pdf->setPage($pagenb);
647  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
648  if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
649  $this->_pagehead($pdf, $object, 0, $outputlangs);
650  }
651  if (!empty($tplidx)) {
652  $pdf->useTemplate($tplidx);
653  }
654  }
655  if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
656  if ($pagenb == 1) {
657  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
658  } else {
659  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
660  }
661  $this->_pagefoot($pdf, $object, $outputlangs, 1);
662  // New page
663  $pdf->AddPage();
664  if (!empty($tplidx)) {
665  $pdf->useTemplate($tplidx);
666  }
667  $pagenb++;
668  if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
669  $this->_pagehead($pdf, $object, 0, $outputlangs);
670  }
671  }
672  }
673 
674  // Show square
675  if ($pagenb == 1) {
676  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
677  $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
678  } else {
679  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
680  $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
681  }
682 
683  // Affiche zone infos
684  $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
685 
686  // Affiche zone totaux
687  //$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
688 
689  // Affiche zone versements
690  /*
691  if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
692  {
693  $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
694  }
695  */
696 
697  // Pied de page
698  $this->_pagefoot($pdf, $object, $outputlangs);
699  if (method_exists($pdf, 'AliasNbPages')) {
700  $pdf->AliasNbPages();
701  }
702 
703  $pdf->Close();
704 
705  $pdf->Output($file, 'F');
706 
707  //Add pdfgeneration hook
708  $hookmanager->initHooks(array('pdfgeneration'));
709  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
710  global $action;
711  $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
712  if ($reshook < 0) {
713  $this->error = $hookmanager->error;
714  $this->errors = $hookmanager->errors;
715  }
716 
717  dolChmod($file);
718 
719  $this->result = array('fullpath'=>$file);
720 
721  return 1; // No error
722  } else {
723  $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
724  return 0;
725  }
726  } else {
727  $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_PROPOSAL_OUTPUTDIR");
728  return 0;
729  }
730  }
731 
732  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
733  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
743  protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
744  {
745  // phpcs:enable
746  return 1;
747  }
748 
749  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
750  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
760  protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
761  {
762  // phpcs:enable
763  global $conf;
764  $default_font_size = pdf_getPDFFontSize($outputlangs);
765 
766  $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
767 
768  $pdf->SetFont('', '', $default_font_size - 1);
769 
770  $posxval = 52;
771 
772  // Show shipping date
773  if (!empty($object->delivery_date)) {
774  $outputlangs->load("sendings");
775  $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
776  $pdf->SetXY($this->marge_gauche, $posy);
777  $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
778  $pdf->MultiCell(80, 4, $titre, 0, 'L');
779  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
780  $pdf->SetXY($posxval, $posy);
781  $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true);
782  $pdf->MultiCell(80, 4, $dlp, 0, 'L');
783 
784  $posy = $pdf->GetY() + 1;
785  } else {
786  $outputlangs->load("sendings");
787  $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
788  $pdf->SetXY($this->marge_gauche, $posy);
789  $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
790  $pdf->MultiCell(80, 4, $titre, 0, 'L');
791  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
792  $pdf->SetXY($posxval, $posy);
793  //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true);
794  $pdf->MultiCell(80, 4, '', 0, 'L');
795 
796  $posy = $pdf->GetY() + 1;
797  }
798  /*
799  elseif ($object->availability_code || $object->availability) // Show availability conditions
800  {
801  $pdf->SetFont('','B', $default_font_size - 2);
802  $pdf->SetXY($this->marge_gauche, $posy);
803  $titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
804  $pdf->MultiCell(80, 4, $titre, 0, 'L');
805  $pdf->SetTextColor(0,0,0);
806  $pdf->SetFont('','', $default_font_size - 2);
807  $pdf->SetXY($posxval, $posy);
808  $lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset($object->availability);
809  $lib_availability=str_replace('\n',"\n",$lib_availability);
810  $pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
811 
812  $posy=$pdf->GetY()+1;
813  }*/
814 
815  // Show payments conditions
816  if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) {
817  $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
818  $pdf->SetXY($this->marge_gauche, $posy);
819  $titre = $outputlangs->transnoentities("PaymentConditions").':';
820  $pdf->MultiCell(80, 4, $titre, 0, 'L');
821 
822  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
823  $pdf->SetXY($posxval, $posy);
824  $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);
825  $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
826  $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
827 
828  $posy = $pdf->GetY() + 3;
829  }
830 
831  if (!empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE)) {
832  // Show payment mode
833  if ($object->mode_reglement_code
834  && $object->mode_reglement_code != 'CHQ'
835  && $object->mode_reglement_code != 'VIR') {
836  $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
837  $pdf->SetXY($this->marge_gauche, $posy - 2);
838  $titre = $outputlangs->transnoentities("PaymentMode").':';
839  $pdf->MultiCell(80, 5, $titre, 0, 'L');
840  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
841  $pdf->SetXY($posxval, $posy - 2);
842  $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);
843  $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
844 
845  $posy = $pdf->GetY() + 2;
846  }
847 
848  // Show payment mode CHQ
849  if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
850  // Si mode reglement non force ou si force a CHQ
851  if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) {
852  if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
853  $account = new Account($this->db);
854  $account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER'));
855 
856  $pdf->SetXY($this->marge_gauche, $posy);
857  $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
858  $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
859  $posy = $pdf->GetY() + 1;
860 
861  if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
862  $pdf->SetXY($this->marge_gauche, $posy);
863  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
864  $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
865  $posy = $pdf->GetY() + 2;
866  }
867  }
868  if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) {
869  $pdf->SetXY($this->marge_gauche, $posy);
870  $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
871  $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
872  $posy = $pdf->GetY() + 1;
873 
874  if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
875  $pdf->SetXY($this->marge_gauche, $posy);
876  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
877  $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
878  $posy = $pdf->GetY() + 2;
879  }
880  }
881  }
882  }
883 
884  // If payment mode not forced or forced to VIR, show payment with BAN
885  if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') {
886  if (!empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) {
887  $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
888  $account = new Account($this->db);
889  $account->fetch($bankid);
890 
891  $curx = $this->marge_gauche;
892  $cury = $posy;
893 
894  $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
895 
896  $posy += 2;
897  }
898  }
899  }
900 
901  return $posy;
902  }
903 
904  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
905  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
916  protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
917  {
918  // phpcs:enable
919  global $conf, $mysoc;
920  $default_font_size = pdf_getPDFFontSize($outputlangs);
921 
922  $tab2_top = $posy;
923  $tab2_hl = 4;
924  $pdf->SetFont('', '', $default_font_size - 1);
925 
926  // Tableau total
927  $col1x = 120;
928  $col2x = 170;
929  if ($this->page_largeur < 210) { // To work with US executive format
930  $col2x -= 20;
931  }
932  $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
933 
934  $useborder = 0;
935  $index = 0;
936 
937  // Total HT
938  $pdf->SetFillColor(255, 255, 255);
939  $pdf->SetXY($col1x, $tab2_top);
940  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
941 
942  $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
943  $pdf->SetXY($col2x, $tab2_top);
944  $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
945 
946  // Show VAT by rates and total
947  $pdf->SetFillColor(248, 248, 248);
948 
949  $this->atleastoneratenotnull = 0;
950  if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
951  $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
952  if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) {
953  // Nothing to do
954  } else {
955  //Local tax 1 before VAT
956  //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
957  //{
958  foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
959  if (in_array((string) $localtax_type, array('1', '3', '5'))) {
960  continue;
961  }
962 
963  foreach ($localtax_rate as $tvakey => $tvaval) {
964  if ($tvakey != 0) { // On affiche pas taux 0
965  //$this->atleastoneratenotnull++;
966 
967  $index++;
968  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
969 
970  $tvacompl = '';
971  if (preg_match('/\*/', $tvakey)) {
972  $tvakey = str_replace('*', '', $tvakey);
973  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
974  }
975  $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
976  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
977  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
978 
979  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
980  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
981  }
982  }
983  }
984  //}
985  //Local tax 2 before VAT
986  //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
987  //{
988  foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
989  if (in_array((string) $localtax_type, array('1', '3', '5'))) {
990  continue;
991  }
992 
993  foreach ($localtax_rate as $tvakey => $tvaval) {
994  if ($tvakey != 0) { // On affiche pas taux 0
995  //$this->atleastoneratenotnull++;
996 
997 
998 
999  $index++;
1000  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1001 
1002  $tvacompl = '';
1003  if (preg_match('/\*/', $tvakey)) {
1004  $tvakey = str_replace('*', '', $tvakey);
1005  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1006  }
1007  $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1008  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1009  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1010 
1011  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1012  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1013  }
1014  }
1015  }
1016  //}
1017  // VAT
1018  foreach ($this->tva as $tvakey => $tvaval) {
1019  if ($tvakey > 0) { // On affiche pas taux 0
1020  $this->atleastoneratenotnull++;
1021 
1022  $index++;
1023  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1024 
1025  $tvacompl = '';
1026  if (preg_match('/\*/', $tvakey)) {
1027  $tvakey = str_replace('*', '', $tvakey);
1028  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1029  }
1030  $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
1031  $totalvat .= vatrate($tvakey, 1).$tvacompl;
1032  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1033 
1034  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1035  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1036  }
1037  }
1038 
1039  //Local tax 1 after VAT
1040  //if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
1041  //{
1042  foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1043  if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1044  continue;
1045  }
1046 
1047  foreach ($localtax_rate as $tvakey => $tvaval) {
1048  if ($tvakey != 0) { // On affiche pas taux 0
1049  //$this->atleastoneratenotnull++;
1050 
1051  $index++;
1052  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1053 
1054  $tvacompl = '';
1055  if (preg_match('/\*/', $tvakey)) {
1056  $tvakey = str_replace('*', '', $tvakey);
1057  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1058  }
1059  $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1060 
1061  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1062  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1063  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1064  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1065  }
1066  }
1067  }
1068  //}
1069  //Local tax 2 after VAT
1070  //if (!empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
1071  //{
1072  foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1073  if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1074  continue;
1075  }
1076 
1077  foreach ($localtax_rate as $tvakey => $tvaval) {
1078  // retrieve global local tax
1079  if ($tvakey != 0) { // On affiche pas taux 0
1080  //$this->atleastoneratenotnull++;
1081 
1082  $index++;
1083  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1084 
1085  $tvacompl = '';
1086  if (preg_match('/\*/', $tvakey)) {
1087  $tvakey = str_replace('*', '', $tvakey);
1088  $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1089  }
1090  $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1091 
1092  $totalvat .= vatrate(abs($tvakey), 1).$tvacompl;
1093  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1094 
1095  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1096  $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
1097  }
1098  }
1099  }
1100  //}
1101 
1102  // Total TTC
1103  $index++;
1104  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1105  $pdf->SetTextColor(0, 0, 60);
1106  $pdf->SetFillColor(224, 224, 224);
1107  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1108 
1109  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1110  $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1);
1111  }
1112  }
1113 
1114  $pdf->SetTextColor(0, 0, 0);
1115 
1116  $resteapayer = $object->total_ttc - $deja_regle;
1117  if (!empty($object->paye)) {
1118  $resteapayer = 0;
1119  }
1120 
1121  if ($deja_regle > 0) {
1122  $index++;
1123 
1124  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1125  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
1126 
1127  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1128  $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
1129 
1130  $index++;
1131  $pdf->SetTextColor(0, 0, 60);
1132  $pdf->SetFillColor(224, 224, 224);
1133  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1134  $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
1135 
1136  $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1137  $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
1138 
1139  $pdf->SetFont('', '', $default_font_size - 1);
1140  $pdf->SetTextColor(0, 0, 0);
1141  }
1142 
1143  $index++;
1144  return ($tab2_top + ($tab2_hl * $index));
1145  }
1146 
1147  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1161  protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
1162  {
1163  global $conf;
1164 
1165  // Force to disable hidetop and hidebottom
1166  $hidebottom = 0;
1167  if ($hidetop) {
1168  $hidetop = -1;
1169  }
1170 
1171  $currency = !empty($currency) ? $currency : $conf->currency;
1172  $default_font_size = pdf_getPDFFontSize($outputlangs);
1173 
1174  // Amount in (at tab_top - 1)
1175  $pdf->SetTextColor(0, 0, 0);
1176  $pdf->SetFont('', '', $default_font_size - 2);
1177 
1178  if (empty($hidetop)) {
1179  $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
1180  $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1181  $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1182 
1183  //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1184  if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
1185  $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1186  }
1187  }
1188 
1189  $pdf->SetDrawColor(128, 128, 128);
1190  $pdf->SetFont('', '', $default_font_size - 1);
1191 
1192  // Output Rect
1193  $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
1194 
1195  if (empty($hidetop)) {
1196  $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
1197 
1198  $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1199  $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1200  }
1201 
1202  $pdf->line($this->posxup + 1, $tab_top, $this->posxup + 1, $tab_top + $tab_height);
1203  if (empty($hidetop)) {
1204  $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1205  $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
1206  }
1207 
1208  $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1209  if (empty($hidetop)) {
1210  $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1211  $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
1212  }
1213 
1214  if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
1215  $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1216  if (empty($hidetop)) {
1217  $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1218  $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C');
1219  }
1220  }
1221 
1222  $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1223  if (empty($hidetop)) {
1224  if ($this->atleastonediscount) {
1225  $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1226  $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
1227  }
1228  }
1229  if ($this->atleastonediscount) {
1230  $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1231  }
1232  if (empty($hidetop)) {
1233  $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1234  $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C');
1235  }
1236  }
1237 
1238  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1248  protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1249  {
1250  global $conf, $langs;
1251 
1252  // Load traductions files required by page
1253  $outputlangs->loadLangs(array("main", "bills", "supplier_proposal", "companies"));
1254 
1255  $default_font_size = pdf_getPDFFontSize($outputlangs);
1256 
1257  pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
1258 
1259  $pdf->SetTextColor(0, 0, 60);
1260  $pdf->SetFont('', 'B', $default_font_size + 3);
1261 
1262  $posy = $this->marge_haute;
1263  $posx = $this->page_largeur - $this->marge_droite - 100;
1264 
1265  $pdf->SetXY($this->marge_gauche, $posy);
1266 
1267  // Logo
1268  if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
1269  if ($this->emetteur->logo) {
1270  $logodir = $conf->mycompany->dir_output;
1271  if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1272  $logodir = $conf->mycompany->multidir_output[$object->entity];
1273  }
1274  if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
1275  $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
1276  } else {
1277  $logo = $logodir.'/logos/'.$this->emetteur->logo;
1278  }
1279  if (is_readable($logo)) {
1280  $height = pdf_getHeightForLogo($logo);
1281  $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
1282  } else {
1283  $pdf->SetTextColor(200, 0, 0);
1284  $pdf->SetFont('', 'B', $default_font_size - 2);
1285  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
1286  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1287  }
1288  } else {
1289  $text = $this->emetteur->name;
1290  $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0);
1291  }
1292  }
1293 
1294  $pdf->SetFont('', 'B', $default_font_size + 3);
1295  $pdf->SetXY($posx, $posy);
1296  $pdf->SetTextColor(0, 0, 60);
1297  $title = $outputlangs->transnoentities("CommercialAsk");
1298  $pdf->MultiCell(100, 4, $title, '', 'R');
1299 
1300  $pdf->SetFont('', 'B', $default_font_size);
1301 
1302  $posy += 5;
1303  $pdf->SetXY($posx, $posy);
1304  $pdf->SetTextColor(0, 0, 60);
1305  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
1306 
1307  $posy += 1;
1308  $pdf->SetFont('', '', $default_font_size - 2);
1309 
1310  if ($object->ref_fourn) {
1311  $posy += 4;
1312  $pdf->SetXY($posx, $posy);
1313  $pdf->SetTextColor(0, 0, 60);
1314  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_fourn), 65), '', 'R');
1315  }
1316 
1317  if ($object->thirdparty->code_fournisseur) {
1318  $posy += 4;
1319  $pdf->SetXY($posx, $posy);
1320  $pdf->SetTextColor(0, 0, 60);
1321  $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R');
1322  }
1323 
1324  // Get contact
1325  if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
1326  $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1327  if (count($arrayidcontact) > 0) {
1328  $usertmp = new User($this->db);
1329  $usertmp->fetch($arrayidcontact[0]);
1330  $posy += 4;
1331  $pdf->SetXY($posx, $posy);
1332  $pdf->SetTextColor(0, 0, 60);
1333  $pdf->MultiCell(100, 3, $langs->trans("BuyerName")." : ".$usertmp->getFullName($langs), '', 'R');
1334  }
1335  }
1336 
1337  $posy += 2;
1338 
1339  $top_shift = 0;
1340  // Show list of linked objects
1341  $current_y = $pdf->getY();
1342  $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
1343  if ($current_y < $pdf->getY()) {
1344  $top_shift = $pdf->getY() - $current_y;
1345  }
1346 
1347  if ($showaddress) {
1348  // Sender properties
1349  $carac_emetteur = '';
1350  // Add internal contact of object if defined
1351  $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1352  if (count($arrayidcontact) > 0) {
1353  $object->fetch_user($arrayidcontact[0]);
1354  $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
1355  $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
1356  $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
1357  $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
1358  $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
1359  $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
1360  $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
1361  $carac_emetteur .= "\n";
1362  }
1363 
1364  $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1365 
1366  // Show sender
1367  $posy = 42 + $top_shift;
1368  $posx = $this->marge_gauche;
1369  if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1370  $posx = $this->page_largeur - $this->marge_droite - 80;
1371  }
1372  $hautcadre = 40;
1373 
1374  // Show sender frame
1375  $pdf->SetTextColor(0, 0, 0);
1376  $pdf->SetFont('', '', $default_font_size - 2);
1377  $pdf->SetXY($posx, $posy - 5);
1378  $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
1379  $pdf->SetXY($posx, $posy);
1380  $pdf->SetFillColor(230, 230, 230);
1381  $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
1382  $pdf->SetTextColor(0, 0, 60);
1383 
1384  // Show sender name
1385  $pdf->SetXY($posx + 2, $posy + 3);
1386  $pdf->SetFont('', 'B', $default_font_size);
1387  $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
1388  $posy = $pdf->getY();
1389 
1390  // Show sender information
1391  $pdf->SetXY($posx + 2, $posy);
1392  $pdf->SetFont('', '', $default_font_size - 1);
1393  $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
1394 
1395 
1396  // If CUSTOMER contact defined, we use it
1397  $usecontact = false;
1398  $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
1399  if (count($arrayidcontact) > 0) {
1400  $usecontact = true;
1401  $result = $object->fetch_contact($arrayidcontact[0]);
1402  }
1403 
1404  // Recipient name
1405  if (!empty($usecontact)) {
1406  if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
1407  $socname = $object->contact;
1408  } else {
1409  $socname = $object->thirdparty;
1410  }
1411  } else {
1412  $socname = $object->thirdparty;
1413  }
1414 
1415  $carac_client_name = pdfBuildThirdpartyName($socname, $outputlangs);
1416 
1417  $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
1418 
1419  // Show recipient
1420  $widthrecbox = 100;
1421  if ($this->page_largeur < 210) {
1422  $widthrecbox = 84; // To work with US executive format
1423  }
1424  $posy = 42 + $top_shift;
1425  $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1426  if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
1427  $posx = $this->marge_gauche;
1428  }
1429 
1430  // Show recipient frame
1431  $pdf->SetTextColor(0, 0, 0);
1432  $pdf->SetFont('', '', $default_font_size - 2);
1433  $pdf->SetXY($posx + 2, $posy - 5);
1434  $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L');
1435  $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1436 
1437  // Show recipient name
1438  $pdf->SetXY($posx + 2, $posy + 3);
1439  $pdf->SetFont('', 'B', $default_font_size);
1440  $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
1441 
1442  // Show recipient information
1443  $pdf->SetFont('', '', $default_font_size - 1);
1444  $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4));
1445  $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
1446  }
1447 
1448  $pdf->SetTextColor(0, 0, 0);
1449  return $top_shift;
1450  }
1451 
1452  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1462  protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1463  {
1464  $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1465  return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
1466  }
1467 }
Class to manage bank accounts.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
Class to manage hooks.
Classe mere des modeles de propale.
Class to manage products or services.
Class to manage Dolibarr users.
Definition: user.class.php:48
Class to generate PDF supplier proposal Aurore.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
__construct($db)
Constructor.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
Show table for lines.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
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...
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.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
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...
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...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_nboflines_bis($text, $maxlinesize=0, $charset='UTF-8')
Return nb of lines of a formated text with and (WARNING: string must not have mixed and br sepa...
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
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:2520
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition: pdf.lib.php:289
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition: pdf.lib.php:85
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
Definition: pdf.lib.php:1369
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition: pdf.lib.php:314
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:1005
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0, $hookmanager=false)
Return line unit.
Definition: pdf.lib.php:2138
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition: pdf.lib.php:721
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
Definition: pdf.lib.php:1333
pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank informations for PDF generation.
Definition: pdf.lib.php:828
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition: pdf.lib.php:266
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:435
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
Definition: pdf.lib.php:1977
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
Definition: pdf.lib.php:753
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition: pdf.lib.php:127
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
Definition: pdf.lib.php:387
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:120
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:123