dolibarr 24.0.2
pdf_canelle.modules.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
4 * Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
6 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
8 * Copyright (C) 2024 Nick Fragoulis
9 * Copyright (C) 2025 Joachim Küter <git-jk@bloxera.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 * or see https://www.gnu.org/
24 */
25
32require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
33require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
34require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
38
39
44{
48 public $db;
49
53 public $name;
54
58 public $description;
59
63 public $update_main_doc_field;
64
68 public $type;
69
74 public $version = 'dolibarr';
75
76
82 public function __construct($db)
83 {
84 global $conf, $langs, $mysoc;
85
86 // Translations
87 $langs->loadLangs(array("main", "bills"));
88
89 $this->db = $db;
90 $this->name = "canelle";
91 $this->description = $langs->trans('SuppliersInvoiceModel');
92 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
93
94 // Page dimensions
95 $this->type = 'pdf';
96 $formatarray = pdf_getFormat();
97 $this->page_largeur = $formatarray['width'];
98 $this->page_hauteur = $formatarray['height'];
99 $this->format = array($this->page_largeur, $this->page_hauteur);
100 $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
101 $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
102 $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
103 $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
104 $this->corner_radius = getDolGlobalInt('MAIN_PDF_FRAME_CORNER_RADIUS', 0);
105 $this->option_logo = 1; // Display logo
106 $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
107 $this->option_modereg = 1; // Display payment mode
108 $this->option_condreg = 1; // Display payment terms
109 $this->option_multilang = 1; // Available in several languages
110
111 // Define column position
112 $this->posxdesc = $this->marge_gauche + 1;
113
114 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
115 $this->posxtva = 99;
116 $this->posxup = 114;
117 $this->posxqty = 130;
118 $this->posxunit = 147;
119 } else {
120 $this->posxtva = 106;
121 $this->posxup = 122;
122 $this->posxqty = 145;
123 $this->posxunit = 162;
124 }
125 $this->posxdiscount = 162;
126 $this->postotalht = 174;
127
128 /* if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') || getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) {
129 $this->posxtva = $this->posxup;
130 } */
131 $this->posxpicture = $this->posxtva - (getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20)); // width of images
132 if ($this->page_largeur < 210) { // To work with US executive format
133 $this->posxpicture -= 20;
134 $this->posxtva -= 20;
135 $this->posxup -= 20;
136 $this->posxqty -= 20;
137 $this->posxunit -= 20;
138 $this->posxdiscount -= 20;
139 $this->postotalht -= 20;
140 }
141
142 $this->tva = array();
143 $this->tva_array = array();
144 $this->localtax1 = array();
145 $this->localtax2 = array();
146 $this->atleastoneratenotnull = 0;
147 $this->atleastonediscount = 0;
148 }
149
150
151 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
163 public function write_file($object, $outputlangs = null, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
164 {
165 // phpcs:enable
166 global $user, $langs, $conf, $mysoc, $hookmanager, $nblines;
167
168 // Get source company
169 if (!is_object($object->thirdparty)) {
170 $object->fetch_thirdparty();
171 }
172 if (!is_object($object->thirdparty)) {
173 $object->thirdparty = $mysoc; // If fetch_thirdparty fails, object has no socid (specimen)
174 }
175
176 $this->emetteur = $object->thirdparty;
177 if (!$this->emetteur->country_code) {
178 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
179 }
180
181 if (!is_object($outputlangs)) {
182 $outputlangs = $langs;
183 }
184 // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
185 if (getDolGlobalString('MAIN_USE_FPDF')) {
186 $outputlangs->charset_output = 'ISO-8859-1';
187 }
188
189 // Load translation files required by the page
190 $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products"));
191
192 $nblines = count($object->lines);
193
194 if ($conf->fournisseur->facture->dir_output) {
195 $deja_regle = $object->getSommePaiement((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
196 $amount_credit_notes_included = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
197 $amount_deposits_included = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
198
199 // Definition of $dir and $file
200 if ($object->specimen) {
201 $dir = $conf->fournisseur->facture->dir_output;
202 $file = $dir."/SPECIMEN.pdf";
203 } else {
204 $objectref = dol_sanitizeFileName($object->ref);
205 $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier);
206 $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$objectref;
207 $file = $dir."/".$objectref.".pdf";
208 if (getDolGlobalString('SUPPLIER_REF_IN_NAME')) {
209 $file = $dir."/".$objectref.($objectrefsupplier ? "_".$objectrefsupplier : "").".pdf";
210 }
211 }
212
213 if (!file_exists($dir)) {
214 if (dol_mkdir($dir) < 0) {
215 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
216 return 0;
217 }
218 }
219
220 if (file_exists($dir)) {
221 // Add pdfgeneration hook
222 if (!is_object($hookmanager)) {
223 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
224 $hookmanager = new HookManager($this->db);
225 }
226 $hookmanager->initHooks(array('pdfgeneration'));
227 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
228 global $action;
229 $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
230
231 // Set nblines with the new facture lines content after hook
232 $nblines = count($object->lines);
233 $nbpayments = count($object->getListOfPayments());
234
235 // Create pdf instance
236 $pdf = pdf_getInstance($this->format);
237 $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
238 $pdf->setAutoPageBreak(true, 0);
239
240 $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
241 if ($heightforinfotot > 220) {
242 $heightforinfotot = 220;
243 }
244 $heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page
245 $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
246 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
247 $heightforfooter += 6;
248 }
249
250 if (class_exists('TCPDF')) {
251 $pdf->setPrintHeader(false);
252 $pdf->setPrintFooter(false);
253 }
254 $pdf->SetFont(pdf_getPDFFont($outputlangs));
255 // Set path to the background PDF File
256 if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) {
257 $logodir = $conf->mycompany->dir_output;
258 if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
259 $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity];
260 }
261 $pagecount = $pdf->setSourceFile($logodir .'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
262 $tplidx = $pdf->importPage(1);
263 }
264
265 $pdf->Open();
266 $pagenb = 0;
267 $pdf->SetDrawColor(128, 128, 128);
268
269 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
270 $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle"));
271 $pdf->SetCreator("Dolibarr ".DOL_VERSION);
272 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
273 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
274 if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
275 $pdf->SetCompression(false);
276 }
277
278 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
279 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
280
281 // Set $this->atleastonediscount if you have at least one discount
282 for ($i = 0; $i < $nblines; $i++) {
283 if ($object->lines[$i]->remise_percent) {
284 $this->atleastonediscount++;
285 }
286 }
287 if (empty($this->atleastonediscount)) {
288 $delta = ($this->postotalht - $this->posxdiscount);
289 $this->posxpicture += $delta;
290 $this->posxtva += $delta;
291 $this->posxup += $delta;
292 $this->posxqty += $delta;
293 $this->posxunit += $delta;
294 $this->posxdiscount += $delta;
295 // post of fields after are not modified, stay at same position
296 }
297
298 // New page
299 $pdf->AddPage();
300 if (!empty($tplidx)) {
301 $pdf->useTemplate($tplidx);
302 }
303 $pagenb++;
304 $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
305 $pdf->SetFont('', '', $default_font_size - 1);
306 $pdf->MultiCell(0, 3, ''); // Set interline to 3
307 $pdf->SetTextColor(0, 0, 0);
308
309 $tab_top = 90 + $top_shift;
310 $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
311
312 // Incoterm
313 if (isModEnabled('incoterm')) {
314 $desc_incoterms = $object->getIncotermsForPDF();
315 if ($desc_incoterms) {
316 $tab_top -= 2;
317
318 $pdf->SetFont('', '', $default_font_size - 1);
319 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
320 $nexY = $pdf->GetY();
321 $height_incoterms = $nexY - $tab_top;
322
323 // Rect takes a length in 3rd parameter
324 $pdf->SetDrawColor(192, 192, 192);
325 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 3, $this->corner_radius, '1234', 'D');
326
327 $tab_top = $nexY + 6;
328 }
329 }
330
331 // Displays notes
332 $notetoshow = empty($object->note_public) ? '' : $object->note_public;
333
334 // Extrafields in note
335 if (getDolGlobalString('INVOICE_ADD_EXTRAFIELD_IN_NOTE')) {
336 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
337 if (!empty($extranote)) {
338 $notetoshow = dol_concatdesc($notetoshow, $extranote);
339 }
340 }
341
342 if ($notetoshow) {
343 $tab_top -= 2;
344
345 $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
346 complete_substitutions_array($substitutionarray, $outputlangs, $object);
347 $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
348 $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
349
350 $pdf->SetFont('', '', $default_font_size - 1);
351 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1);
352 $nexY = $pdf->GetY();
353 $height_note = $nexY - $tab_top;
354
355 // Rect takes a length in 3rd parameter
356 $pdf->SetDrawColor(192, 192, 192);
357 $pdf->RoundedRect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 2, $this->corner_radius, '1234', 'D');
358
359 $tab_top = $nexY + 6;
360 }
361
362 $iniY = $tab_top + 7;
363 $curY = $tab_top + 7;
364 $nexY = $tab_top + 7;
365 $pdf_sub_options = [
366 'titleshowuponpdf' => 1,
367 'titleshowtotalexludingvatonpdf' => 1,
368 ];
369
370 // Loop on each lines
371 for ($i = 0; $i < $nblines; $i++) {
372 $sub_options = $object->lines[$i]->extraparams["subtotal"] ?? array();
373
374 if ($object->lines[$i]->special_code == SUBTOTALS_SPECIAL_CODE) {
375 $level = $object->lines[$i]->qty;
376 if ($sub_options) {
377 if (isset($sub_options['titleshowuponpdf'])) {
378 $pdf_sub_options['titleshowuponpdf'] = isset($pdf_sub_options['titleshowuponpdf']) && $pdf_sub_options['titleshowuponpdf'] < $level ? $pdf_sub_options['titleshowuponpdf'] : $level;
379 } elseif (isset($pdf_sub_options['titleshowuponpdf']) && abs($level) <= $pdf_sub_options['titleshowuponpdf']) {
380 unset($pdf_sub_options['titleshowuponpdf']);
381 }
382 if (isset($sub_options['titleshowtotalexludingvatonpdf'])) {
383 $pdf_sub_options['titleshowtotalexludingvatonpdf'] = isset($pdf_sub_options['titleshowtotalexludingvatonpdf']) && $pdf_sub_options['titleshowtotalexludingvatonpdf'] < $level ? $pdf_sub_options['titleshowtotalexludingvatonpdf'] : $level;
384 } elseif (isset($pdf_sub_options['titleshowtotalexludingvatonpdf']) && abs($level) <= $pdf_sub_options['titleshowtotalexludingvatonpdf']) {
385 unset($pdf_sub_options['titleshowtotalexludingvatonpdf']);
386 }
387 } else {
388 if (isset($pdf_sub_options['titleshowuponpdf']) && abs($level) <= $pdf_sub_options['titleshowuponpdf']) {
389 unset($pdf_sub_options['titleshowuponpdf']);
390 }
391 if (isset($pdf_sub_options['titleshowtotalexludingvatonpdf']) && abs($level) <= $pdf_sub_options['titleshowtotalexludingvatonpdf']) {
392 unset($pdf_sub_options['titleshowtotalexludingvatonpdf']);
393 }
394 }
395 }
396 $curY = $nexY;
397 $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
398 $pdf->SetTextColor(0, 0, 0);
399
400 // Define size of image if we need it
401 //$imglinesize = array();
402 //if (!empty($realpatharray[$i])) {
403 // $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
404 //}
405
406 $pdf->setTopMargin($tab_top_newpage);
407 $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
408 $pageposbefore = $pdf->getPage();
409
410 $showpricebeforepagebreak = 1;
411 $posYAfterImage = 0;
412
413 // Description of product line
414 $curX = $this->posxdesc - 1;
415
416 $pdf->startTransaction();
417 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc, 1);
418 $pageposafter = $pdf->getPage();
419 if ($pageposafter > $pageposbefore) { // There is a pagebreak
420 $pdf->rollbackTransaction(true);
421 $pageposafter = $pageposbefore;
422 //print $pageposafter.'-'.$pageposbefore;exit;
423 $pdf->setPageOrientation('', true, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
424 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc, 1);
425 $posyafter = $pdf->GetY();
426 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
427 if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
428 $pdf->AddPage('', '', true);
429 if (!empty($tplidx)) {
430 $pdf->useTemplate($tplidx);
431 }
432 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
433 $this->_pagehead($pdf, $object, 0, $outputlangs);
434 }
435 $pdf->setPage($pageposafter + 1);
436 }
437 } else {
438 // We found a page break
439 // Allows data in the first page if description is long enough to break in multiples pages
440 if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
441 $showpricebeforepagebreak = 1;
442 } else {
443 $showpricebeforepagebreak = 0;
444 }
445 }
446 } else { // No pagebreak
447 $pdf->commitTransaction();
448 }
449 $posYAfterDescription = $pdf->GetY();
450
451 $nexY = $pdf->GetY();
452 $pageposafter = $pdf->getPage();
453 $pdf->setPage($pageposbefore);
454 $pdf->setTopMargin($this->marge_haute);
455 $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
456
457 // We suppose that a too long description or photo were moved completely on next page
458 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
459 $pdf->setPage($pageposafter);
460 $curY = $tab_top_newpage;
461 }
462
463 $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font
464
465 // VAT Rate
466 if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && $object->lines[$i]->special_code != SUBTOTALS_SPECIAL_CODE) {
467 $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
468 $pdf->SetXY($this->posxtva, $curY);
469 $pdf->MultiCell($this->posxup - $this->posxtva - 1, 3, $vat_rate, 0, 'R');
470 }
471
472 // Unit price before discount
473 if ($object->lines[$i]->special_code != SUBTOTALS_SPECIAL_CODE && isset($pdf_sub_options['titleshowuponpdf'])) {
474 $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
475 $pdf->SetXY($this->posxup, $curY);
476 $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', false);
477 }
478
479 // Quantity
480 if ($object->lines[$i]->special_code != SUBTOTALS_SPECIAL_CODE) {
481 $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
482 $pdf->SetXY($this->posxqty, $curY);
483 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
484 }
485
486 // Unit
487 if (getDolGlobalInt('PRODUCT_USE_UNITS') && $object->lines[$i]->special_code != SUBTOTALS_SPECIAL_CODE) {
488 $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails);
489 $pdf->SetXY($this->posxunit, $curY);
490 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L');
491 }
492
493 // Discount on line
494 if ($object->lines[$i]->remise_percent && $object->lines[$i]->special_code != SUBTOTALS_SPECIAL_CODE) {
495 $pdf->SetXY($this->posxdiscount - 2, $curY);
496 $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
497 $pdf->MultiCell($this->postotalht - $this->posxdiscount - 1, 3, $remise_percent, 0, 'R');
498 }
499
500 // Total HT line
501 if ($object->lines[$i]->special_code != SUBTOTALS_SPECIAL_CODE && isset($pdf_sub_options['titleshowtotalexludingvatonpdf'])) {
502 $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
503 $pdf->SetXY($this->postotalht, $curY);
504 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', false);
505 } elseif ($object->lines[$i]->qty < 0 && isset($sub_options['subtotalshowtotalexludingvatonpdf'])) {
506 if (isModEnabled('multicurrency') && $object->multicurrency_code != $conf->currency) {
507 $total_excl_tax = $object->getSubtotalLineMulticurrencyAmount($object->lines[$i]);
508 } else {
509 $total_excl_tax = $object->getSubtotalLineAmount($object->lines[$i]);
510 }
511 $pdf->SetXY($this->postotalht, $curY);
512 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', false);
513 }
514
515 // Collection of totals by VAT value in $this->tva["taux"]=total_tva
516 if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
517 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
518 } else {
519 $tvaligne = $object->lines[$i]->total_tva;
520 }
521
522 $localtax1ligne = $object->lines[$i]->total_localtax1;
523 $localtax2ligne = $object->lines[$i]->total_localtax2;
524
525 // TODO remise_percent is an obsolete field for object parent
526 /*if (!empty($object->remise_percent)) {
527 $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
528 }*/
529
530 $vatrate = (string) $object->lines[$i]->tva_tx;
531 $localtax1rate = (string) $object->lines[$i]->localtax1_tx;
532 $localtax2rate = (string) $object->lines[$i]->localtax2_tx;
533
534 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
535 $vatrate .= '*';
536 }
537 if (empty($this->tva[$vatrate])) {
538 $this->tva[$vatrate] = 0;
539 }
540 if (empty($this->localtax1[$localtax1rate])) {
541 $this->localtax1[$localtax1rate] = 0;
542 }
543 if (empty($this->localtax2[$localtax2rate])) {
544 $this->localtax2[$localtax2rate] = 0;
545 }
546 $this->tva[$vatrate] += $tvaligne;
547 $this->localtax1[$localtax1rate] += $localtax1ligne;
548 $this->localtax2[$localtax2rate] += $localtax2ligne;
549
550 if ($posYAfterImage > $posYAfterDescription) {
551 $nexY = $posYAfterImage;
552 }
553
554 // Add line
555 if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
556 $pdf->setPage($pageposafter);
557 $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
558 //$pdf->SetDrawColor(190,190,200);
559 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
560 $pdf->SetLineStyle(array('dash' => 0));
561 }
562
563 $nexY += 2; // Add space between lines
564
565 // Detect if some page were added automatically and output _tableau for past pages
566 while ($pagenb < $pageposafter) {
567 $pdf->setPage($pagenb);
568 if ($pagenb == 1) {
569 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
570 } else {
571 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
572 }
573 $this->_pagefoot($pdf, $object, $outputlangs, 1);
574 $pagenb++;
575 $pdf->setPage($pagenb);
576 $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
577 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
578 $this->_pagehead($pdf, $object, 0, $outputlangs);
579 }
580 }
581 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { // @phan-suppress-current-line PhanUndeclaredProperty // @phan-suppress-current-line PhanUndeclaredProperty
582 if ($pagenb == 1) {
583 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
584 } else {
585 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
586 }
587 $this->_pagefoot($pdf, $object, $outputlangs, 1);
588 // New page
589 $pdf->AddPage();
590 if (!empty($tplidx)) {
591 $pdf->useTemplate($tplidx);
592 }
593 $pagenb++;
594 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
595 $this->_pagehead($pdf, $object, 0, $outputlangs);
596 }
597 }
598 }
599
600 // Show square
601 if ($pagenb == 1) {
602 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
603 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
604 } else {
605 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
606 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
607 }
608
609 // Display total area
610 $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
611
612 $amount_credit_notes_included = 0;
613 $amount_deposits_included = 0;
614
615 // Display Payments area
616 if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && !getDolGlobalString('SUPPLIER_INVOICE_NO_PAYMENT_DETAILS')) {
617 $posy = $this->_tableau_versements($pdf, $object, $posy, $outputlangs, $heightforfooter);
618 }
619
620 // Pagefoot
621 $this->_pagefoot($pdf, $object, $outputlangs);
622 if (method_exists($pdf, 'AliasNbPages')) {
623 $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
624 }
625
626 $pdf->Close();
627
628 $pdf->Output($file, 'F');
629
630 // Add pdfgeneration hook
631 $hookmanager->initHooks(array('pdfgeneration'));
632 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
633 global $action;
634 $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
635 $this->warnings = $hookmanager->warnings;
636 if ($reshook < 0) {
637 $this->error = $hookmanager->error;
638 $this->errors = $hookmanager->errors;
639 dolChmod($file);
640 return -1;
641 }
642
643 dolChmod($file);
644
645 $this->result = array('fullpath' => $file);
646
647 return 1; // No error
648 } else {
649 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
650 return 0;
651 }
652 } else {
653 $this->error = $langs->transnoentities("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR");
654 return 0;
655 }
656 }
657
658 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
659 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
670 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
671 {
672 // phpcs:enable
673 global $conf, $mysoc, $hookmanager;
674
675 $sign = 1;
676 if ($object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) {
677 $sign = -1;
678 }
679
680 $default_font_size = pdf_getPDFFontSize($outputlangs);
681
682 $tab2_top = $posy;
683 $tab2_hl = 4;
684 $pdf->SetFont('', '', $default_font_size - 1);
685
686 // Total table
687 $col1x = 120;
688 $col2x = 170;
689 if ($this->page_largeur < 210) { // To work with US executive format
690 $col2x -= 20;
691 }
692 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
693
694 $useborder = 0;
695 $index = 0;
696
697 // Total HT
698 $pdf->SetFillColor(255, 255, 255);
699 $pdf->SetXY($col1x, $tab2_top);
700 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', true);
701
702 $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
703 $pdf->SetXY($col2x, $tab2_top);
704 $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0, 'R', true);
705
706 // Show VAT by rates and total
707 $pdf->SetFillColor(248, 248, 248);
708
709 $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
710
711 $this->atleastoneratenotnull = 0;
712 foreach ($this->tva as $tvakey => $tvaval) {
713 if ($tvakey > 0) { // We do not display rate 0
714 $this->atleastoneratenotnull++;
715
716 $index++;
717 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
718
719 $tvacompl = '';
720
721 if (preg_match('/\*/', $tvakey)) {
722 $tvakey = str_replace('*', '', $tvakey);
723 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
724 }
725
726 $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
727 $totalvat .= vatrate($tvakey, true).$tvacompl;
728 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
729
730 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
731 $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', true);
732 }
733 }
734 if (!$this->atleastoneratenotnull) { // If no vat at all
735 $index++;
736 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
737 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code), 0, 'L', true);
738 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
739 $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_tva, 0, $outputlangs), 0, 'R', true);
740
741 // Total LocalTax1
742 if (getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == 'localtax1on' && $object->total_localtax1 > 0) {
743 $index++;
744 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
745 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code), 0, 'L', true);
746 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
747 $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1, 0, $outputlangs), 0, 'R', true);
748 }
749
750 // Total LocalTax2
751 if (getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == 'localtax2on' && $object->total_localtax2 > 0) {
752 $index++;
753 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
754 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code), 0, 'L', true);
755 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
756 $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2, 0, $outputlangs), 0, 'R', true);
757 }
758 } else {
759 //if (getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') && getDolGlobalString('FACTURE_LOCAL_TAX1_OPTION') == 'localtax1on')
760 //{
761 //Local tax 1
762 foreach ($this->localtax1 as $tvakey => $tvaval) {
763 if ($tvakey != 0) { // On affiche pas taux 0
764 //$this->atleastoneratenotnull++;
765
766 $index++;
767 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
768
769 $tvacompl = '';
770 if (preg_match('/\*/', (string) $tvakey)) {
771 $tvakey = str_replace('*', '', (string) $tvakey);
772 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
773 }
774 $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
775 $totalvat .= vatrate((string) abs((float) $tvakey), true).$tvacompl;
776 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
777
778 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
779 $pdf->MultiCell($largcol2, $tab2_hl, price((string) $tvaval, 0, $outputlangs), 0, 'R', true);
780 }
781 }
782 //}
783
784 //if (getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') && getDolGlobalString('FACTURE_LOCAL_TAX2_OPTION') == 'localtax2on')
785 //{
786 //Local tax 2
787 foreach ($this->localtax2 as $tvakey => $tvaval) {
788 if ($tvakey != 0) { // On affiche pas taux 0
789 //$this->atleastoneratenotnull++;
790
791 $index++;
792 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
793
794 $tvacompl = '';
795 if (preg_match('/\*/', (string) $tvakey)) {
796 $tvakey = str_replace('*', '', (string) $tvakey);
797 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
798 }
799 $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
800 $totalvat .= vatrate((string) abs((float) $tvakey), true).$tvacompl;
801 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
802
803 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
804 $pdf->MultiCell($largcol2, $tab2_hl, price((string) $tvaval, 0, $outputlangs), 0, 'R', true);
805 }
806 }
807 //}
808 }
809
810 // Total TTC
811 $index++;
812 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
813 $pdf->SetTextColor(0, 0, 60);
814 $pdf->SetFillColor(224, 224, 224);
815 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', true);
816
817 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
818 $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', true);
819
820 $pdf->SetTextColor(0, 0, 0);
821 $creditnoteamount = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
822 $depositsamount = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0);
823 //print "x".$creditnoteamount."-".$depositsamount;exit;
824 $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
825 if (!empty($object->paid)) {
826 $resteapayer = 0;
827 }
828
829 if (($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) && !getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS')) {
830 // Already paid + Deposits
831 $index++;
832 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
833 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("Paid"), 0, 'L', false);
834 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
835 $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', false);
836
837 // Credit note
838 if ($creditnoteamount) {
839 $labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes");
840 $index++;
841 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
842 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $labeltouse, 0, 'L', false);
843 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
844 $pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', false);
845 }
846
847 // Escompte
848 if ($object->close_code == FactureFournisseur::CLOSECODE_DISCOUNTVAT) {
849 $index++;
850 $pdf->SetFillColor(255, 255, 255);
851
852 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
853 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', true);
854 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
855 $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', true);
856
857 $resteapayer = 0;
858 }
859
860 $index++;
861 $pdf->SetTextColor(0, 0, 60);
862 $pdf->SetFillColor(224, 224, 224);
863 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
864 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', true);
865
866 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
867 $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', true);
868 $pdf->SetFont('', '', $default_font_size - 1);
869 $pdf->SetTextColor(0, 0, 0);
870 }
871
872 $parameters = array('pdf' => &$pdf, 'object' => &$object, 'outputlangs' => $outputlangs, 'index' => &$index, 'posy' => $posy);
873
874 $reshook = $hookmanager->executeHooks('afterPDFTotalTable', $parameters, $this); // Note that $action and $object may have been modified by some hooks
875 if ($reshook < 0) {
876 $this->error = $hookmanager->error;
877 $this->errors = $hookmanager->errors;
878 }
879
880 $index++;
881 return ($tab2_top + ($tab2_hl * $index));
882 }
883
884 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
898 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
899 {
900 global $conf;
901
902 // Force to disable hidetop and hidebottom
903 $hidebottom = 0;
904 if ($hidetop) {
905 $hidetop = -1;
906 }
907
908 $currency = !empty($currency) ? $currency : $conf->currency;
909 $default_font_size = pdf_getPDFFontSize($outputlangs);
910
911 // Amount in (at tab_top - 1)
912 $pdf->SetTextColor(0, 0, 0);
913 $pdf->SetFont('', '', $default_font_size - 2);
914
915 if (empty($hidetop)) {
916 $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
917 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
918 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
919
920 //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
921 if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
922 $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
923 }
924 }
925
926 $pdf->SetDrawColor(128, 128, 128);
927 $pdf->SetFont('', '', $default_font_size - 1);
928
929 // Output Rect
930 $this->printRoundedRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $this->corner_radius, $hidetop, $hidebottom, 'D'); // Rect takes a length in 3rd parameter and 4th parameter
931
932 if (empty($hidetop)) {
933 $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
934
935 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
936 $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
937 }
938
939 if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) {
940 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
941 if (empty($hidetop)) {
942 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
943 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
944 }
945 }
946
947 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
948 if (empty($hidetop)) {
949 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
950 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
951 }
952
953 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
954 if (empty($hidetop)) {
955 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
956 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
957 }
958
959 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
960 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
961 if (empty($hidetop)) {
962 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
963 $pdf->MultiCell(
964 $this->posxdiscount - $this->posxunit - 1,
965 2,
966 $outputlangs->transnoentities("Unit"),
967 '',
968 'C'
969 );
970 }
971 }
972
973 if ($this->atleastonediscount) {
974 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
975 if (empty($hidetop)) {
976 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
977 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
978 }
979 }
980
981 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
982 if (empty($hidetop)) {
983 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
984 $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C');
985 }
986 }
987
988 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
989 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
1000 protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0)
1001 {
1002 // phpcs:enable
1003 global $conf;
1004
1005 $sign = 1;
1006 if ($object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) {
1007 $sign = -1;
1008 }
1009
1010 $tab3_posx = 120;
1011 $tab3_top = $posy + 8;
1012 $tab3_width = 80;
1013 $tab3_height = 4;
1014 if ($this->page_largeur < 210) { // To work with US executive format
1015 $tab3_posx -= 20;
1016 }
1017
1018 $default_font_size = pdf_getPDFFontSize($outputlangs);
1019
1020 $pdf->SetFont('', '', $default_font_size - 3);
1021 $pdf->SetXY($tab3_posx, $tab3_top - 4);
1022 $pdf->MultiCell(60, 3, $outputlangs->transnoentities("PaymentsAlreadyDone"), 0, 'L', false);
1023
1024 $pdf->line($tab3_posx, $tab3_top, $tab3_posx + $tab3_width, $tab3_top);
1025
1026 $pdf->SetFont('', '', $default_font_size - 4);
1027 $pdf->SetXY($tab3_posx, $tab3_top);
1028 $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Payment"), 0, 'L', false);
1029 $pdf->SetXY($tab3_posx + 21, $tab3_top);
1030 $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Amount"), 0, 'L', false);
1031 $pdf->SetXY($tab3_posx + 40, $tab3_top);
1032 $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Type"), 0, 'L', false);
1033 $pdf->SetXY($tab3_posx + 58, $tab3_top);
1034 $pdf->MultiCell(20, 3, $outputlangs->transnoentities("Num"), 0, 'L', false);
1035
1036 $pdf->line($tab3_posx, $tab3_top - 1 + $tab3_height, $tab3_posx + $tab3_width, $tab3_top - 1 + $tab3_height);
1037
1038 $y = 0;
1039
1040 $pdf->SetFont('', '', $default_font_size - 4);
1041
1042 // Loop on each deposits and credit notes included
1043 //
1044
1045 // Loop on each payment
1046 $sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num_payment, pf.amount as amount, pf.multicurrency_amount,";
1047 $sql .= " cp.code";
1048 $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p";
1049 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
1050 $sql .= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".((int) $object->id);
1051 $sql .= " ORDER BY p.datep";
1052 $resql = $this->db->query($sql);
1053 if ($resql) {
1054 $num = $this->db->num_rows($resql);
1055 $i = 0;
1056 while ($i < $num) {
1057 $y += 3;
1058 $row = $this->db->fetch_object($resql);
1059
1060 $pdf->SetXY($tab3_posx, $tab3_top + $y);
1061 $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date), 'day', false, $outputlangs, true), 0, 'L', false);
1062 $pdf->SetXY($tab3_posx + 21, $tab3_top + $y);
1063 $pdf->MultiCell(20, 3, price($sign * ((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0, 'L', false);
1064 $pdf->SetXY($tab3_posx + 40, $tab3_top + $y);
1065 $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$row->code);
1066
1067 $pdf->MultiCell(20, 3, $oper, 0, 'L', false);
1068 $pdf->SetXY($tab3_posx + 58, $tab3_top + $y);
1069 $pdf->MultiCell(30, 3, $row->num_payment, 0, 'L', false);
1070
1071 $pdf->line($tab3_posx, $tab3_top + $y + 3, $tab3_posx + $tab3_width, $tab3_top + $y + 3);
1072
1073 $i++;
1074 }
1075 } else {
1076 $this->error = $this->db->lasterror();
1077 return -1;
1078 }
1079 return -1;
1080 }
1081
1082 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1092 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
1093 {
1094 global $langs, $conf, $mysoc;
1095
1096 // Load translation files required by the page
1097 $outputlangs->loadLangs(array("main", "orders", "companies", "bills"));
1098
1099 $default_font_size = pdf_getPDFFontSize($outputlangs);
1100
1101 // Do not add the BACKGROUND as this is for suppliers
1102 //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
1103
1104 $pdf->SetTextColor(0, 0, 60);
1105 $pdf->SetFont('', 'B', $default_font_size + 3);
1106
1107 $w = 100;
1108
1109 $posy = $this->marge_haute;
1110 $posx = $this->page_largeur - $this->marge_droite - 100;
1111
1112 $pdf->SetXY($this->marge_gauche, $posy);
1113
1114 // Logo
1115 /*
1116 $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
1117 if ($mysoc->logo)
1118 {
1119 if (is_readable($logo))
1120 {
1121 $height=pdf_getHeightForLogo($logo);
1122 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
1123 }
1124 else
1125 {
1126 $pdf->SetTextColor(200,0,0);
1127 $pdf->SetFont('','B', $default_font_size - 2);
1128 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
1129 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
1130 }
1131 }
1132 else
1133 {*/
1134 $text = $this->emetteur->name;
1135 $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
1136 //}
1137
1138 $pdf->SetFont('', 'B', $default_font_size + 3);
1139 $pdf->SetXY($posx, $posy);
1140 $pdf->SetTextColor(0, 0, 60);
1141 $title = $outputlangs->transnoentities("PdfInvoiceTitle");
1142 if ($object->type == 1) {
1143 $title = $outputlangs->transnoentities("InvoiceReplacement");
1144 }
1145 if ($object->type == 2) {
1146 $title = $outputlangs->transnoentities("InvoiceAvoir");
1147 }
1148 if ($object->type == 3) {
1149 $title = $outputlangs->transnoentities("InvoiceDeposit");
1150 }
1151 $pdf->MultiCell($w, 3, $title." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
1152 $posy += 1;
1153
1154 if ($object->ref_supplier) {
1155 $posy += 4;
1156 $pdf->SetFont('', 'B', $default_font_size);
1157 $pdf->SetXY($posx, $posy);
1158 $pdf->SetTextColor(0, 0, 60);
1159 $pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSupplier")." : ".$object->ref_supplier, '', 'R');
1160 $posy += 1;
1161 }
1162
1163 $pdf->SetFont('', '', $default_font_size - 1);
1164
1165 if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
1166 $object->fetchProject();
1167 if (!empty($object->project->ref)) {
1168 $posy += 3;
1169 $pdf->SetXY($posx, $posy);
1170 $pdf->SetTextColor(0, 0, 60);
1171 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : dol_trunc($object->project->title, 50)), '', 'R');
1172 }
1173 }
1174
1175 if (getDolGlobalString('PDF_SHOW_PROJECT')) {
1176 $object->fetchProject();
1177 if (!empty($object->project->ref)) {
1178 $outputlangs->load("projects");
1179 $posy += 4;
1180 $pdf->SetXY($posx, $posy);
1181 $langs->load("projects");
1182 $pdf->SetTextColor(0, 0, 60);
1183 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
1184 }
1185 }
1186
1187 if ($object->date) {
1188 $posy += 4;
1189 $pdf->SetXY($posx, $posy);
1190 $pdf->SetTextColor(0, 0, 60);
1191 $pdf->MultiCell($w, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
1192 } else {
1193 $posy += 4;
1194 $pdf->SetXY($posx, $posy);
1195 $pdf->SetTextColor(255, 0, 0);
1196 $pdf->MultiCell($w, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R');
1197 }
1198
1199 if ($object->thirdparty->code_fournisseur) {
1200 $posy += 4;
1201 $pdf->SetXY($posx, $posy);
1202 $pdf->SetTextColor(0, 0, 60);
1203 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("SupplierCode")." : ".$outputlangs->transnoentities((string) $object->thirdparty->code_fournisseur), '', 'R');
1204 }
1205
1206 $posy += 1;
1207 $pdf->SetTextColor(0, 0, 60);
1208
1209 $top_shift = 0;
1210 // Show list of linked objects
1211 $current_y = $pdf->getY();
1212 $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
1213 if ($current_y < $pdf->getY()) {
1214 $top_shift = $pdf->getY() - $current_y;
1215 }
1216
1217 if ($showaddress) {
1218 // Sender properties
1219 $carac_emetteur = '';
1220 // Add internal contact of object if defined
1221 $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1222 if (count($arrayidcontact) > 0) {
1223 $object->fetch_user($arrayidcontact[0]);
1224 $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
1225 $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
1226 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
1227 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
1228 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
1229 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
1230 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
1231 $carac_emetteur .= "\n";
1232 }
1233
1234 $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1235
1236 // Show sender
1237 $posy = 42 + $top_shift;
1238 $posx = $this->marge_gauche;
1239 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
1240 $posx = $this->page_largeur - $this->marge_droite - 80;
1241 }
1242 $hautcadre = 40;
1243
1244 // Show sender frame
1245 $pdf->SetTextColor(0, 0, 0);
1246 $pdf->SetFont('', '', $default_font_size - 2);
1247 $pdf->SetXY($posx, $posy - 5);
1248 $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, 'L');
1249 $pdf->SetXY($posx, $posy);
1250 $pdf->SetFillColor(230, 230, 230);
1251 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius, '1234', 'F');
1252 $pdf->SetTextColor(0, 0, 60);
1253
1254 // Show sender name
1255 $pdf->SetXY($posx + 2, $posy + 3);
1256 $pdf->SetFont('', 'B', $default_font_size);
1257 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
1258 $posy = $pdf->getY();
1259
1260 // Show sender information
1261 $pdf->SetXY($posx + 2, $posy);
1262 $pdf->SetFont('', '', $default_font_size - 1);
1263 $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
1264
1265
1266
1267 // If BILLING contact defined on invoice, we use it
1268 $usecontact = false;
1269 $arrayidcontact = $object->getIdContact('internal', 'BILLING');
1270 if (count($arrayidcontact) > 0) {
1271 $usecontact = true;
1272 $result = $object->fetch_contact($arrayidcontact[0]);
1273 }
1274
1275 // Recipient name
1276 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1277 $thirdparty = $object->contact;
1278 } else {
1279 $thirdparty = $mysoc;
1280 }
1281
1282 $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1283
1284 $carac_client = pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact)) ? $object->contact : null), ($usecontact ? 1 : 0), 'target', $object);
1285
1286 // Show recipient
1287 $widthrecbox = 100;
1288 if ($this->page_largeur < 210) {
1289 $widthrecbox = 84; // To work with US executive format
1290 }
1291 $posy = 42 + $top_shift;
1292 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1293 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
1294 $posx = $this->marge_gauche;
1295 }
1296
1297 // Show recipient frame
1298 $pdf->SetTextColor(0, 0, 0);
1299 $pdf->SetFont('', '', $default_font_size - 2);
1300 $pdf->SetXY($posx + 2, $posy - 5);
1301 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, 'L');
1302 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius, '1234', 'D');
1303
1304 // Show recipient name
1305 $pdf->SetXY($posx + 2, $posy + 3);
1306 $pdf->SetFont('', 'B', $default_font_size);
1307 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
1308
1309 $posy = $pdf->getY();
1310
1311 // Show recipient information
1312 $pdf->SetFont('', '', $default_font_size - 1);
1313 $pdf->SetXY($posx + 2, $posy);
1314 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
1315 }
1316
1317 return $top_shift;
1318 }
1319
1320 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1330 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1331 {
1332 $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1333 return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1334 }
1335}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
printRoundedRect($pdf, $x, $y, $w, $h, $r, $hidetop=0, $hidebottom=0, $style='D')
Print a rounded rectangle on the PDF.
Class to manage hooks.
Parent class for supplier invoices models.
Class to generate the supplier invoices PDF with the template canelle.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
write_file($object, $outputlangs=null, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build a document on disk using the generic odt module.
_tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter=0)
Show payments table.
_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.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
__construct($db)
Constructor.
global $mysoc
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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 formatted for view output Used into pdf and HTML pages.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line total excluding tax.
Definition pdf.lib.php:2893
pdf_getFormat($outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition pdf.lib.php:87
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
Definition pdf.lib.php:1810
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition pdf.lib.php:294
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0, $align='J')
Output line description into PDF.
Definition pdf.lib.php:1848
pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price excluding tax.
Definition pdf.lib.php:2482
pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
Return line vat rate.
Definition pdf.lib.php:2420
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:1423
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition pdf.lib.php:273
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formatted for output on PDF documents.
Definition pdf.lib.php:438
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0)
Return line unit.
Definition pdf.lib.php:2727
pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails=0)
Return line remise percent.
Definition pdf.lib.php:2770
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
Definition pdf.lib.php:2567
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:1137
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition pdf.lib.php:129
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
Definition pdf.lib.php:393
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Definition repair.php:137
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140