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