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