dolibarr 21.0.0-alpha
pdf_azur.modules.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
5 * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
7 * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
8 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
9 * Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
10 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
11 * Copyright (C) 2019 Pierre Ardoin <mapiolca@me.com>
12 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
13 * Copyright (C) 2024 Nick Fragoulis
14 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program. If not, see <https://www.gnu.org/licenses/>.
28 * or see https://www.gnu.org/
29 */
30
37require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
38require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
42
43
48{
52 public $db;
53
57 public $entity;
58
62 public $name;
63
67 public $description;
68
72 public $update_main_doc_field;
73
77 public $type;
78
83 public $version = 'dolibarr';
84
85
91 public function __construct($db)
92 {
93 global $langs, $mysoc;
94
95 // Translations
96 $langs->loadLangs(array("main", "bills"));
97
98 $this->db = $db;
99 $this->name = "azur";
100 $this->description = $langs->trans('DocModelAzurDescription');
101 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
102
103 // Dimension page
104 $this->type = 'pdf';
105 $formatarray = pdf_getFormat();
106 $this->page_largeur = $formatarray['width'];
107 $this->page_hauteur = $formatarray['height'];
108 $this->format = array($this->page_largeur, $this->page_hauteur);
109 $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
110 $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
111 $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
112 $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
113 $this->corner_radius = getDolGlobalInt('MAIN_PDF_FRAME_CORNER_RADIUS', 0);
114 $this->option_logo = 1; // Display logo
115 $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
116 $this->option_modereg = 1; // Display payment mode
117 $this->option_condreg = 1; // Display payment terms
118 $this->option_multilang = 1; // Available in several languages
119 $this->option_escompte = 0; // Displays if there has been a discount
120 $this->option_credit_note = 0; // Support credit notes
121 $this->option_freetext = 1; // Support add of a personalised text
122 $this->option_draft_watermark = 1; // Support add of a watermark on drafts
123 $this->watermark = '';
124
125 // Define position of columns
126 $this->posxdesc = $this->marge_gauche + 1;
127 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
128 $this->posxtva = 101;
129 $this->posxup = 118;
130 $this->posxqty = 135;
131 $this->posxunit = 151;
132 } else {
133 $this->posxtva = 106;
134 $this->posxup = 122;
135 $this->posxqty = 145;
136 $this->posxunit = 162;
137 }
138 $this->posxdiscount = 162;
139 $this->postotalht = 174;
140 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') || getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) {
141 $this->posxtva = $this->posxup;
142 }
143 $this->posxpicture = $this->posxtva - getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20); // width of images
144 if ($this->page_largeur < 210) { // To work with US executive format
145 $this->posxpicture -= 20;
146 $this->posxtva -= 20;
147 $this->posxup -= 20;
148 $this->posxqty -= 20;
149 $this->posxunit -= 20;
150 $this->posxdiscount -= 20;
151 $this->postotalht -= 20;
152 }
153
154 $this->tva = array();
155 $this->tva_array = array();
156 $this->localtax1 = array();
157 $this->localtax2 = array();
158 $this->atleastoneratenotnull = 0;
159 $this->atleastonediscount = 0;
160
161 if ($mysoc === null) {
162 dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
163 return;
164 }
165
166 // Get source company
167 $this->emetteur = $mysoc;
168 if (empty($this->emetteur->country_code)) {
169 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
170 }
171 }
172
173 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
185 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
186 {
187 // phpcs:enable
188 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
189
190 dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
191
192 if (!is_object($outputlangs)) {
193 $outputlangs = $langs;
194 }
195 // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
196 if (getDolGlobalString('MAIN_USE_FPDF')) {
197 $outputlangs->charset_output = 'ISO-8859-1';
198 }
199
200 // Load translation files required by page
201 $langfiles = array("main", "dict", "companies", "bills", "propal", "products", "compta");
202 $outputlangs->loadLangs($langfiles);
203
204 global $outputlangsbis;
205 $outputlangsbis = null;
206 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
207 $outputlangsbis = new Translate('', $conf);
208 $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'));
209 $outputlangsbis->loadLangs($langfiles);
210 }
211
212 // Show Draft Watermark
213 if ($object->statut == $object::STATUS_DRAFT && getDolGlobalString('PROPALE_DRAFT_WATERMARK')) {
214 $this->watermark = getDolGlobalString('PROPALE_DRAFT_WATERMARK');
215 }
216
217 $nblines = count($object->lines);
218
219 // Loop on each lines to detect if there is at least one image to show
220 $realpatharray = array();
221 $this->atleastonephoto = false;
222 if (getDolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
223 $objphoto = new Product($this->db);
224
225 for ($i = 0; $i < $nblines; $i++) {
226 if (empty($object->lines[$i]->fk_product)) {
227 continue;
228 }
229
230 $objphoto->fetch($object->lines[$i]->fk_product);
231 //var_dump($objphoto->ref);exit;
232 $pdir = array();
233 if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
234 $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/";
235 $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
236 } else {
237 $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default
238 $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative
239 }
240
241 $arephoto = false;
242 $realpath = '';
243 foreach ($pdir as $midir) {
244 if (!$arephoto) {
245 if ($conf->entity != $objphoto->entity) {
246 $dir = $conf->product->multidir_output[$objphoto->entity].'/'.$midir; //Check repertories of current entities
247 } else {
248 $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product
249 }
250 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
251 if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
252 if ($obj['photo_vignette']) {
253 $filename = $obj['photo_vignette'];
254 } else {
255 $filename = $obj['photo'];
256 }
257 } else {
258 $filename = $obj['photo'];
259 }
260
261 $realpath = $dir.$filename;
262 $arephoto = true;
263 $this->atleastonephoto = true;
264 }
265 }
266 }
267
268 if ($realpath && $arephoto) {
269 $realpatharray[$i] = $realpath;
270 }
271 }
272 }
273
274 if (count($realpatharray) == 0) {
275 $this->posxpicture = $this->posxtva;
276 }
277
278 if ($conf->propal->multidir_output[$conf->entity]) {
279 $object->fetch_thirdparty();
280
281 $deja_regle = 0;
282
283 // Definition of $dir and $file
284 if ($object->specimen) {
285 $dir = $conf->propal->multidir_output[$conf->entity];
286 $file = $dir."/SPECIMEN.pdf";
287 } else {
288 $objectref = dol_sanitizeFileName($object->ref);
289 $dir = $conf->propal->multidir_output[$object->entity]."/".$objectref;
290 $file = $dir."/".$objectref.".pdf";
291 }
292
293 if (!file_exists($dir)) {
294 if (dol_mkdir($dir) < 0) {
295 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
296 return 0;
297 }
298 }
299
300 if (file_exists($dir)) {
301 // Add pdfgeneration hook
302 if (!is_object($hookmanager)) {
303 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
304 $hookmanager = new HookManager($this->db);
305 }
306 $hookmanager->initHooks(array('pdfgeneration'));
307 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
308 global $action;
309 $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
310
311 // Set nblines with the new content of lines after hook
312 $nblines = count($object->lines);
313 //$nbpayments = count($object->getListOfPayments());
314
315 // Create pdf instance
316 $pdf = pdf_getInstance($this->format);
317 $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
318 $pdf->SetAutoPageBreak(1, 0);
319
320 if (class_exists('TCPDF')) {
321 $pdf->setPrintHeader(false);
322 $pdf->setPrintFooter(false);
323 }
324 $pdf->SetFont(pdf_getPDFFont($outputlangs));
325 // Set path to the background PDF File
326 if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) {
327 $logodir = $conf->mycompany->dir_output;
328 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
329 $logodir = $conf->mycompany->multidir_output[$object->entity];
330 }
331 $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
332 $tplidx = $pdf->importPage(1);
333 }
334
335 $pdf->Open();
336 $pagenb = 0;
337 $pdf->SetDrawColor(128, 128, 128);
338
339 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
340 $pdf->SetSubject($outputlangs->transnoentities("PdfCommercialProposalTitle"));
341 $pdf->SetCreator("Dolibarr ".DOL_VERSION);
342 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
343 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfCommercialProposalTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
344 if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
345 $pdf->SetCompression(false);
346 }
347
348 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
349 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
350
351 // Set $this->atleastonediscount if you have at least one discount
352 for ($i = 0; $i < $nblines; $i++) {
353 if ($object->lines[$i]->remise_percent) {
354 $this->atleastonediscount++;
355 }
356 }
357 if (empty($this->atleastonediscount)) {
358 $delta = ($this->postotalht - $this->posxdiscount);
359 $this->posxpicture += $delta;
360 $this->posxtva += $delta;
361 $this->posxup += $delta;
362 $this->posxqty += $delta;
363 $this->posxunit += $delta;
364 $this->posxdiscount += $delta;
365 // post of fields after are not modified, stay at same position
366 }
367
368 // New page
369 $pdf->AddPage();
370 if (!empty($tplidx)) {
371 $pdf->useTemplate($tplidx);
372 }
373 $pagenb++;
374
375 $heightforinfotot = 40; // Height reserved to output the info and total part
376 $heightforsignature = !getDolGlobalString('PROPAL_DISABLE_SIGNATURE') ? (pdfGetHeightForHtmlContent($pdf, $outputlangs->transnoentities("ProposalCustomerSignature")) + 10) : 0;
377 $heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page
378 $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
379 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
380 $heightforfooter += 6;
381 }
382 //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit;
383
384 $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
385 $pdf->SetFont('', '', $default_font_size - 1);
386 $pdf->MultiCell(0, 3, ''); // Set interline to 3
387 $pdf->SetTextColor(0, 0, 0);
388
389
390 $tab_top = 90 + $top_shift;
391 $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
392
393 // Incoterm
394 $height_incoterms = 0;
395 if (isModEnabled('incoterm')) {
396 $desc_incoterms = $object->getIncotermsForPDF();
397 if ($desc_incoterms) {
398 $tab_top -= 2;
399
400 $pdf->SetFont('', '', $default_font_size - 1);
401 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
402 $nexY = $pdf->GetY();
403 $height_incoterms = $nexY - $tab_top;
404
405 // Rect takes a length in 3rd parameter
406 $pdf->SetDrawColor(192, 192, 192);
407 $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');
408
409 $tab_top = $nexY + 6;
410 $height_incoterms += 4;
411 }
412 }
413
414 // Displays notes
415 $notetoshow = empty($object->note_public) ? '' : $object->note_public;
416 if (getDolGlobalString('MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE')) {
417 // Get first sale rep
418 if (is_object($object->thirdparty)) {
419 $salereparray = $object->thirdparty->getSalesRepresentatives($user);
420 $salerepobj = new User($this->db);
421 $salerepobj->fetch($salereparray[0]['id']);
422 if (!empty($salerepobj->signature)) {
423 $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
424 }
425 }
426 }
427 // Extrafields in note
428 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
429 if (!empty($extranote)) {
430 $notetoshow = dol_concatdesc($notetoshow, $extranote);
431 }
432 if (getDolGlobalString('MAIN_ADD_CREATOR_IN_NOTE') && $object->user_author_id > 0) {
433 $tmpuser = new User($this->db);
434 $tmpuser->fetch($object->user_author_id);
435
436
437 $creator_info = $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs);
438 if ($tmpuser->email) {
439 $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email;
440 }
441 if ($tmpuser->office_phone) {
442 $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone;
443 }
444
445 $notetoshow = dol_concatdesc($notetoshow, $creator_info);
446 }
447
448 if ($notetoshow) {
449 $tab_top -= 2;
450
451 $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
452 complete_substitutions_array($substitutionarray, $outputlangs, $object);
453 $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
454 $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
455
456 $pdf->SetFont('', '', $default_font_size - 1);
457 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1);
458 $nexY = $pdf->GetY();
459 $height_note = $nexY - $tab_top;
460
461 // Rect takes a length in 3rd parameter
462 $pdf->SetDrawColor(192, 192, 192);
463 $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');
464
465 $tab_top = $nexY + 6;
466 }
467
468 $iniY = $tab_top + 7;
469 $curY = $tab_top + 7;
470 $nexY = $tab_top + 7;
471
472 // Loop on each lines
473 for ($i = 0; $i < $nblines; $i++) {
474 $curY = $nexY;
475 $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
476 $pdf->SetTextColor(0, 0, 0);
477
478 // Define size of image if we need it
479 $imglinesize = array();
480 if (!empty($realpatharray[$i])) {
481 $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
482 }
483
484 $pdf->setTopMargin($tab_top_newpage);
485 $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
486 $pageposbefore = $pdf->getPage();
487
488 $showpricebeforepagebreak = 1;
489 $posYAfterImage = 0;
490 $posYAfterDescription = 0;
491
492 // We start with Photo of product line
493 if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page
494 $pdf->AddPage('', '', true);
495 if (!empty($tplidx)) {
496 $pdf->useTemplate($tplidx);
497 }
498 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
499 $this->_pagehead($pdf, $object, 0, $outputlangs);
500 }
501 $pdf->setPage($pageposbefore + 1);
502
503 $curY = $tab_top_newpage;
504
505 // Allows data in the first page if description is long enough to break in multiples pages
506 if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
507 $showpricebeforepagebreak = 1;
508 } else {
509 $showpricebeforepagebreak = 0;
510 }
511 }
512
513 if (isset($imglinesize['width']) && isset($imglinesize['height'])) {
514 $curX = $this->posxpicture - 1;
515 $pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
516 // $pdf->Image does not increase value return by getY, so we save it manually
517 $posYAfterImage = $curY + $imglinesize['height'];
518 }
519
520 // Description of product line
521 $curX = $this->posxdesc - 1;
522
523 $pdf->startTransaction();
524 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
525 $pageposafter = $pdf->getPage();
526 if ($pageposafter > $pageposbefore) { // There is a pagebreak
527 $pdf->rollbackTransaction(true);
528 $pageposafter = $pageposbefore;
529 //print $pageposafter.'-'.$pageposbefore;exit;
530 $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
531 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
532
533 $pageposafter = $pdf->getPage();
534 $posyafter = $pdf->GetY();
535 //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
536 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text
537 if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
538 $pdf->AddPage('', '', true);
539 if (!empty($tplidx)) {
540 $pdf->useTemplate($tplidx);
541 }
542 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
543 $this->_pagehead($pdf, $object, 0, $outputlangs);
544 }
545 $pdf->setPage($pageposafter + 1);
546 }
547 } else {
548 // We found a page break
549
550 // Allows data in the first page if description is long enough to break in multiples pages
551 if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
552 $showpricebeforepagebreak = 1;
553 } else {
554 $showpricebeforepagebreak = 0;
555 }
556 }
557 } else { // No pagebreak
558 $pdf->commitTransaction();
559 }
560 $posYAfterDescription = $pdf->GetY();
561
562 $nexY = $pdf->GetY();
563 $pageposafter = $pdf->getPage();
564
565 $pdf->setPage($pageposbefore);
566 $pdf->setTopMargin($this->marge_haute);
567 $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
568
569 // We suppose that a too long description or photo were moved completely on next page
570 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
571 $pdf->setPage($pageposafter);
572 $curY = $tab_top_newpage;
573 }
574
575 $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default
576
577 // VAT Rate
578 if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) {
579 $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
580 $pdf->SetXY($this->posxtva - 5, $curY);
581 $pdf->MultiCell($this->posxup - $this->posxtva + 4, 3, $vat_rate, 0, 'R');
582 }
583
584 // Unit price before discount
585 $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails);
586 $pdf->SetXY($this->posxup, $curY);
587 $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0);
588
589 // Quantity
590 $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
591 $pdf->SetXY($this->posxqty, $curY);
592 $pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
593
594 // Unit
595 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
596 $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails);
597 $pdf->SetXY($this->posxunit, $curY);
598 $pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L');
599 }
600
601 // Discount on line
602 $pdf->SetXY($this->posxdiscount, $curY);
603 if ($object->lines[$i]->remise_percent) {
604 $pdf->SetXY($this->posxdiscount - 2, $curY);
605 $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
606 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0, 'R');
607 }
608
609 // Total HT line
610 $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails);
611 $pdf->SetXY($this->postotalht, $curY);
612 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
613
614 // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
615 if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) {
616 $tvaligne = $object->lines[$i]->multicurrency_total_tva;
617 } else {
618 $tvaligne = $object->lines[$i]->total_tva;
619 }
620
621 $localtax1ligne = $object->lines[$i]->total_localtax1;
622 $localtax2ligne = $object->lines[$i]->total_localtax2;
623 $localtax1_rate = $object->lines[$i]->localtax1_tx;
624 $localtax2_rate = $object->lines[$i]->localtax2_tx;
625 $localtax1_type = $object->lines[$i]->localtax1_type;
626 $localtax2_type = $object->lines[$i]->localtax2_type;
627
628 // TODO remise_percent is an obsolete field for object parent
629 /*if ($object->remise_percent) {
630 $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
631 }
632 if ($object->remise_percent) {
633 $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
634 }
635 if ($object->remise_percent) {
636 $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
637 }*/
638
639 $vatrate = (string) $object->lines[$i]->tva_tx;
640
641 // Retrieve type from database for backward compatibility with old records
642 if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
643 && (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
644 $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
645 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
646 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
647 }
648
649 // retrieve global local tax
650 if ($localtax1_type && $localtax1ligne != 0) {
651 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
652 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
653 } else {
654 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
655 }
656 }
657 if ($localtax2_type && $localtax2ligne != 0) {
658 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
659 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
660 } else {
661 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
662 }
663 }
664
665 if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
666 $vatrate .= '*';
667 }
668
669 // Fill $this->tva and $this->tva_array
670 if (!isset($this->tva[$vatrate])) {
671 $this->tva[$vatrate] = 0;
672 }
673 $this->tva[$vatrate] += $tvaligne;
674 $vatcode = $object->lines[$i]->vat_src_code;
675 if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
676 $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
677 }
678 $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
679
680 if ($posYAfterImage > $posYAfterDescription) {
681 $nexY = $posYAfterImage;
682 }
683
684 // Add line
685 if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
686 $pdf->setPage($pageposafter);
687 $pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
688 //$pdf->SetDrawColor(190,190,200);
689 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
690 $pdf->SetLineStyle(array('dash' => 0));
691 }
692
693 $nexY += 2; // Add space between lines
694
695 // Detect if some page were added automatically and output _tableau for past pages
696 while ($pagenb < $pageposafter) {
697 $pdf->setPage($pagenb);
698 if ($pagenb == 1) {
699 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
700 } else {
701 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
702 }
703 $this->_pagefoot($pdf, $object, $outputlangs, 1);
704 $pagenb++;
705 $pdf->setPage($pagenb);
706 $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
707 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
708 $this->_pagehead($pdf, $object, 0, $outputlangs);
709 }
710 if (!empty($tplidx)) {
711 $pdf->useTemplate($tplidx);
712 }
713 }
714 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { // @phan-suppress-current-line PhanUndeclaredProperty
715 if ($pagenb == 1) {
716 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code);
717 } else {
718 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code);
719 }
720 $this->_pagefoot($pdf, $object, $outputlangs, 1);
721 // New page
722 $pdf->AddPage();
723 if (!empty($tplidx)) {
724 $pdf->useTemplate($tplidx);
725 }
726 $pagenb++;
727 if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
728 $this->_pagehead($pdf, $object, 0, $outputlangs);
729 }
730 }
731 }
732
733 // Show square
734 if ($pagenb == 1) {
735 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
736 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1;
737 } else {
738 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code);
739 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1;
740 }
741
742 // Affiche zone infos
743 $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
744
745 // Affiche zone totaux
746 $posy = $this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
747
748 // Affiche zone versements
749 /*
750 if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included)
751 {
752 $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
753 }
754 */
755
756 // Customer signature area
757 if (!getDolGlobalString('PROPAL_DISABLE_SIGNATURE')) {
758 $posy = $this->_signature_area($pdf, $object, $posy, $outputlangs);
759 }
760
761 // Pied de page
762 $this->_pagefoot($pdf, $object, $outputlangs);
763 if (method_exists($pdf, 'AliasNbPages')) {
764 $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
765 }
766
767 //If propal merge product PDF is active
768 if (getDolGlobalString('PRODUIT_PDF_MERGE_PROPAL')) {
769 require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php';
770
771 $already_merged = array();
772 foreach ($object->lines as $line) {
773 if (!empty($line->fk_product) && !(in_array($line->fk_product, $already_merged))) {
774 // Find the desired PDF
775 $filetomerge = new Propalmergepdfproduct($this->db);
776
777 if (getDolGlobalInt('MAIN_MULTILANGS')) {
778 $filetomerge->fetch_by_product($line->fk_product, $outputlangs->defaultlang);
779 } else {
780 $filetomerge->fetch_by_product($line->fk_product);
781 }
782
783 $already_merged[] = $line->fk_product;
784
785 $product = new Product($this->db);
786 $product->fetch($line->fk_product);
787
788 if ($product->entity != $conf->entity) {
789 $entity_product_file = $product->entity;
790 } else {
791 $entity_product_file = $conf->entity;
792 }
793
794 // If PDF is selected and file is not empty
795 if (count($filetomerge->lines) > 0) {
796 foreach ($filetomerge->lines as $linefile) {
797 if (!empty($linefile->id) && !empty($linefile->file_name)) {
798 if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) {
799 if (isModEnabled("product")) {
800 $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos";
801 } elseif (isModEnabled("service")) {
802 $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos";
803 }
804 } else {
805 if (isModEnabled("product")) {
806 $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product');
807 } elseif (isModEnabled("service")) {
808 $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product');
809 }
810 }
811
812 dol_syslog(get_class($this).':: upload_dir='.$filetomerge_dir, LOG_DEBUG);
813
814 $infile = $filetomerge_dir.'/'.$linefile->file_name;
815 if (file_exists($infile) && is_readable($infile)) {
816 $pagecount = $pdf->setSourceFile($infile);
817 for ($i = 1; $i <= $pagecount; $i++) {
818 $tplIdx = $pdf->importPage($i);
819 if ($tplIdx !== false) {
820 $s = $pdf->getTemplatesize($tplIdx);
821 $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
822 $pdf->useTemplate($tplIdx);
823 } else {
824 setEventMessages(null, array($infile.' cannot be added, probably protected PDF'), 'warnings');
825 }
826 }
827 }
828 }
829 }
830 }
831 }
832 }
833 }
834
835 $pdf->Close();
836
837 $pdf->Output($file, 'F');
838
839 //Add pdfgeneration hook
840 $hookmanager->initHooks(array('pdfgeneration'));
841 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
842 global $action;
843 $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
844 if ($reshook < 0) {
845 $this->error = $hookmanager->error;
846 $this->errors = $hookmanager->errors;
847 }
848
849 dolChmod($file);
850
851 $this->result = array('fullpath' => $file);
852
853 return 1; // No error
854 } else {
855 $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
856 return 0;
857 }
858 } else {
859 $this->error = $langs->trans("ErrorConstantNotDefined", "PROP_OUTPUTDIR");
860 return 0;
861 }
862 }
863
864 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
865 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
875 protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
876 {
877 // phpcs:enable
878 return 1;
879 }
880
881 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
882 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
892 protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
893 {
894 // phpcs:enable
895 global $conf, $mysoc;
896 $default_font_size = pdf_getPDFFontSize($outputlangs);
897
898 $pdf->SetFont('', '', $default_font_size - 1);
899
900 $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
901
902 // If France, show VAT mention if not applicable
903 if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
904 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
905 $pdf->SetXY($this->marge_gauche, $posy);
906 $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
907
908 $posy = $pdf->GetY() + 4;
909 }
910
911 $posxval = 52;
912 if (getDolGlobalString('MAIN_PDF_DELIVERY_DATE_TEXT')) {
913 $displaydate = "daytext";
914 } else {
915 $displaydate = "day";
916 }
917
918 // Show shipping date
919 if (!empty($object->delivery_date)) {
920 $outputlangs->load("sendings");
921 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
922 $pdf->SetXY($this->marge_gauche, $posy);
923 $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':';
924 $pdf->MultiCell(80, 4, $titre, 0, 'L');
925 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
926 $pdf->SetXY($posxval, $posy);
927 $dlp = dol_print_date($object->delivery_date, $displaydate, false, $outputlangs, true);
928 $pdf->MultiCell(80, 4, $dlp, 0, 'L');
929
930 $posy = $pdf->GetY() + 1;
931 } elseif ($object->availability_code || $object->availability) { // Show availability conditions
932 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
933 $pdf->SetXY($this->marge_gauche, $posy);
934 $titre = $outputlangs->transnoentities("AvailabilityPeriod").':';
935 $pdf->MultiCell(80, 4, $titre, 0, 'L');
936 $pdf->SetTextColor(0, 0, 0);
937 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
938 $pdf->SetXY($posxval, $posy);
939 $lib_availability = ($outputlangs->transnoentities("AvailabilityType".$object->availability_code) != 'AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset($object->availability);
940 $lib_availability = str_replace('\n', "\n", $lib_availability);
941 $pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
942
943 $posy = $pdf->GetY() + 1;
944 }
945
946 // Show delivery mode
947 if (!getDolGlobalString('PROPOSAL_PDF_HIDE_DELIVERYMODE') && $object->shipping_method_id > 0) {
948 $outputlangs->load("sendings");
949
950 $shipping_method_id = $object->shipping_method_id;
951 if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD') && !empty($this->emetteur->shipping_method_id)) {
952 $shipping_method_id = $this->emetteur->shipping_method_id;
953 }
954 $shipping_method_code = dol_getIdFromCode($this->db, (string) $shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
955 $shipping_method_label = dol_getIdFromCode($this->db, (string) $shipping_method_id, 'c_shipment_mode', 'rowid', 'libelle');
956
957 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
958 $pdf->SetXY($this->marge_gauche, $posy);
959 $titre = $outputlangs->transnoentities("SendingMethod").':';
960 $pdf->MultiCell(43, 4, $titre, 0, 'L');
961
962 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
963 $pdf->SetXY($posxval, $posy);
964 $lib_condition_paiement = ($outputlangs->transnoentities("SendingMethod".strtoupper($shipping_method_code)) != "SendingMethod".strtoupper($shipping_method_code)) ? $outputlangs->trans("SendingMethod".strtoupper($shipping_method_code)) : $shipping_method_label;
965 $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
966 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');
967
968 $posy = $pdf->GetY() + 1;
969 }
970
971 // Show payments conditions
972 if (!getDolGlobalString('PROPOSAL_PDF_HIDE_PAYMENTTERM') && $object->cond_reglement_code) {
973 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
974 $pdf->SetXY($this->marge_gauche, $posy);
975 $titre = $outputlangs->transnoentities("PaymentConditions").':';
976 $pdf->MultiCell(43, 4, $titre, 0, 'L');
977
978 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
979 $pdf->SetXY($posxval, $posy);
980 $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);
981 $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement);
982 if ($object->deposit_percent > 0) {
983 $lib_condition_paiement = str_replace('__DEPOSIT_PERCENT__', $object->deposit_percent, $lib_condition_paiement);
984 }
985 $pdf->MultiCell(67, 4, $lib_condition_paiement, 0, 'L');
986
987 $posy = $pdf->GetY() + 3;
988 }
989
990 if (!getDolGlobalString('PROPOSAL_PDF_HIDE_PAYMENTMODE')) {
991 // Show payment mode
992 if ($object->mode_reglement_code
993 && $object->mode_reglement_code != 'CHQ'
994 && $object->mode_reglement_code != 'VIR') {
995 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
996 $pdf->SetXY($this->marge_gauche, $posy);
997 $titre = $outputlangs->transnoentities("PaymentMode").':';
998 $pdf->MultiCell(80, 5, $titre, 0, 'L');
999 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
1000 $pdf->SetXY($posxval, $posy);
1001 $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);
1002 $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
1003
1004 $posy = $pdf->GetY() + 2;
1005 }
1006
1007 // Show payment mode CHQ
1008 if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
1009 // Si mode reglement non force ou si force a CHQ
1010 if (getDolGlobalInt('FACTURE_CHQ_NUMBER')) {
1011 if (getDolGlobalInt('FACTURE_CHQ_NUMBER') > 0) {
1012 $account = new Account($this->db);
1013 $account->fetch(getDolGlobalInt('FACTURE_CHQ_NUMBER'));
1014
1015 $pdf->SetXY($this->marge_gauche, $posy);
1016 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
1017 $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->owner_name), 0, 'L', 0);
1018 $posy = $pdf->GetY() + 1;
1019
1020 if (!getDolGlobalString('MAIN_PDF_HIDE_CHQ_ADDRESS')) {
1021 $pdf->SetXY($this->marge_gauche, $posy);
1022 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
1023 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
1024 $posy = $pdf->GetY() + 2;
1025 }
1026 }
1027 if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) {
1028 $pdf->SetXY($this->marge_gauche, $posy);
1029 $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
1030 $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
1031 $posy = $pdf->GetY() + 1;
1032
1033 if (!getDolGlobalString('MAIN_PDF_HIDE_CHQ_ADDRESS')) {
1034 $pdf->SetXY($this->marge_gauche, $posy);
1035 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
1036 $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
1037 $posy = $pdf->GetY() + 2;
1038 }
1039 }
1040 }
1041 }
1042
1043 // If payment mode not forced or forced to VIR, show payment with BAN
1044 if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') {
1045 if (!empty($object->fk_account) || !empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) {
1046 $bankid = (empty($object->fk_account) ? getDolGlobalInt('FACTURE_RIB_NUMBER') : $object->fk_account);
1047 if (!empty($object->fk_bank) && $object->fk_bank > 0) {
1048 $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
1049 }
1050 $account = new Account($this->db);
1051 $account->fetch($bankid);
1052
1053 $curx = $this->marge_gauche;
1054 $cury = $posy;
1055
1056 $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size);
1057
1058 $posy += 2;
1059 }
1060 }
1061 }
1062
1063 return $posy;
1064 }
1065
1066 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1067 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
1079 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis = null)
1080 {
1081 // phpcs:enable
1082 global $conf, $mysoc;
1083 $default_font_size = pdf_getPDFFontSize($outputlangs);
1084
1085 $tab2_top = $posy;
1086 $tab2_hl = 4;
1087 $pdf->SetFont('', '', $default_font_size - 1);
1088
1089 // Total table
1090 $col1x = 120;
1091 $col2x = 170;
1092 if ($this->page_largeur < 210) { // To work with US executive format
1093 $col2x -= 20;
1094 }
1095 $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
1096
1097 $useborder = 0;
1098 $index = 0;
1099
1100 // Get Total HT
1101 $total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
1102
1103 // Total remise
1104 $total_line_remise = 0;
1105 foreach ($object->lines as $i => $line) {
1106 $resdiscount = pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2);
1107 $total_line_remise += (is_numeric($resdiscount) ? $resdiscount : 0);
1108 // Gestion remise sous forme de ligne négative
1109 if ($line->total_ht < 0) {
1110 $total_line_remise += -$line->total_ht;
1111 }
1112 }
1113 if ($total_line_remise > 0) {
1114 $pdf->SetFillColor(255, 255, 255);
1115 $pdf->SetXY($col1x, $tab2_top + $tab2_hl);
1116 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1);
1117 $pdf->SetXY($col2x, $tab2_top + $tab2_hl);
1118 $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
1119
1120 $index++;
1121
1122 // Show total NET before discount
1123 $pdf->SetFillColor(255, 255, 255);
1124 $pdf->SetXY($col1x, $tab2_top);
1125 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1);
1126 $pdf->SetXY($col2x, $tab2_top);
1127 $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
1128
1129 $index++;
1130 }
1131
1132 // Total HT
1133 $pdf->SetFillColor(255, 255, 255);
1134 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1135 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
1136
1137 $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht);
1138 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1139 $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);
1140
1141 // Show VAT by rates and total
1142 $pdf->SetFillColor(248, 248, 248);
1143
1144 $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc;
1145
1146 $this->atleastoneratenotnull = 0;
1147 if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) {
1148 $tvaisnull = (!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000']));
1149 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL') && $tvaisnull) {
1150 // Nothing to do
1151 } else {
1152 //Local tax 1 before VAT
1153 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1154 if (in_array((string) $localtax_type, array('1', '3', '5'))) {
1155 continue;
1156 }
1157
1158 foreach ($localtax_rate as $tvakey => $tvaval) {
1159 if ($tvakey != 0) { // On affiche pas taux 0
1160 //$this->atleastoneratenotnull++;
1161
1162 $index++;
1163 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1164
1165 $tvacompl = '';
1166 if (preg_match('/\*/', $tvakey)) {
1167 $tvakey = str_replace('*', '', $tvakey);
1168 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1169 }
1170 $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1171
1172 if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
1173 $totalvat .= $tvacompl;
1174 } else {
1175 $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl;
1176 }
1177
1178 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1179
1180 $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);
1181
1182 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1183 $pdf->MultiCell($largcol2, $tab2_hl, price($total_localtax, 0, $outputlangs), 0, 'R', 1);
1184 }
1185 }
1186 }
1187
1188 //Local tax 2 before VAT
1189 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1190 if (in_array((string) $localtax_type, array('1', '3', '5'))) {
1191 continue;
1192 }
1193
1194 foreach ($localtax_rate as $tvakey => $tvaval) {
1195 if ($tvakey != 0) { // On affiche pas taux 0
1196 //$this->atleastoneratenotnull++;
1197
1198 $index++;
1199 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1200
1201 $tvacompl = '';
1202 if (preg_match('/\*/', $tvakey)) {
1203 $tvakey = str_replace('*', '', $tvakey);
1204 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1205 }
1206 $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1207
1208 if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
1209 $totalvat .= $tvacompl;
1210 } else {
1211 $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl;
1212 }
1213
1214 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1215
1216 $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);
1217
1218 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1219 $pdf->MultiCell($largcol2, $tab2_hl, price($total_localtax, 0, $outputlangs), 0, 'R', 1);
1220 }
1221 }
1222 }
1223
1224 // VAT
1225 foreach ($this->tva_array as $tvakey => $tvaval) {
1226 if ($tvakey != 0) { // On affiche pas taux 0
1227 $this->atleastoneratenotnull++;
1228
1229 $index++;
1230 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1231
1232 $tvacompl = '';
1233 if (preg_match('/\*/', $tvakey)) {
1234 $tvakey = str_replace('*', '', $tvakey);
1235 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1236 }
1237 $totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
1238 $totalvat .= ' ';
1239 if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
1240 $totalvat .= vatrate($tvaval['vatrate'], 1).$tvacompl;
1241 } elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
1242 $totalvat .= $tvaval['vatcode'].$tvacompl;
1243 } elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
1244 $totalvat .= $tvacompl;
1245 } else {
1246 $totalvat .= vatrate($tvaval['vatrate'], 1).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$tvacompl;
1247 }
1248 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1249
1250 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1251 $pdf->MultiCell($largcol2, $tab2_hl, price(price2num($tvaval['amount'], 'MT'), 0, $outputlangs), 0, 'R', 1);
1252 }
1253 }
1254
1255 //Local tax 1 after VAT
1256 foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
1257 if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1258 continue;
1259 }
1260
1261 foreach ($localtax_rate as $tvakey => $tvaval) {
1262 if ($tvakey != 0) { // On affiche pas taux 0
1263 //$this->atleastoneratenotnull++;
1264
1265 $index++;
1266 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1267
1268 $tvacompl = '';
1269 if (preg_match('/\*/', $tvakey)) {
1270 $tvakey = str_replace('*', '', $tvakey);
1271 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1272 }
1273 $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' ';
1274
1275 if (getDolGlobalString('PDF_LOCALTAX1_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
1276 $totalvat .= $tvacompl;
1277 } else {
1278 $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl;
1279 }
1280
1281 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1282
1283 $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);
1284
1285 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1286 $pdf->MultiCell($largcol2, $tab2_hl, price($total_localtax, 0, $outputlangs), 0, 'R', 1);
1287 }
1288 }
1289 }
1290
1291 //Local tax 2 after VAT
1292 foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
1293 if (in_array((string) $localtax_type, array('2', '4', '6'))) {
1294 continue;
1295 }
1296
1297 foreach ($localtax_rate as $tvakey => $tvaval) {
1298 // retrieve global local tax
1299 if ($tvakey != 0) { // On affiche pas taux 0
1300 //$this->atleastoneratenotnull++;
1301
1302 $index++;
1303 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1304
1305 $tvacompl = '';
1306 if (preg_match('/\*/', $tvakey)) {
1307 $tvakey = str_replace('*', '', $tvakey);
1308 $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1309 }
1310 $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' ';
1311
1312 if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
1313 $totalvat .= $tvacompl;
1314 } else {
1315 $totalvat .= vatrate((string) abs((float) $tvakey), 1).$tvacompl;
1316 }
1317
1318 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1319
1320 $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval);
1321
1322 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1323 $pdf->MultiCell($largcol2, $tab2_hl, price($total_localtax, 0, $outputlangs), 0, 'R', 1);
1324 }
1325 }
1326 }
1327 //}
1328
1329 // Total TTC
1330 $index++;
1331 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1332 $pdf->SetTextColor(0, 0, 60);
1333 $pdf->SetFillColor(224, 224, 224);
1334 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1335
1336 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1337 $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
1338 }
1339 }
1340
1341 $pdf->SetTextColor(0, 0, 0);
1342
1343 $resteapayer = 0;
1344 /*
1345 $resteapayer = $object->total_ttc - $deja_regle;
1346 if (!empty($object->paye)) $resteapayer=0;
1347 */
1348
1349 if ($deja_regle > 0) {
1350 $index++;
1351
1352 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1353 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0);
1354
1355 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1356 $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0);
1357
1358 /*
1359 if ($object->close_code == 'discount_vat') {
1360 $index++;
1361 $pdf->SetFillColor(255,255,255);
1362
1363 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1364 $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
1365
1366 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1367 $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc - $deja_regle, 0, $outputlangs), $useborder, 'R', 1);
1368
1369 $resteapayer=0;
1370 }
1371 */
1372
1373 $index++;
1374 $pdf->SetTextColor(0, 0, 60);
1375 $pdf->SetFillColor(224, 224, 224);
1376 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1377 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
1378
1379 $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1380 $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
1381
1382 $pdf->SetFont('', '', $default_font_size - 1);
1383 $pdf->SetTextColor(0, 0, 0);
1384 }
1385
1386 $index++;
1387 return ($tab2_top + ($tab2_hl * $index));
1388 }
1389
1390 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1404 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
1405 {
1406 global $conf;
1407
1408 // Force to disable hidetop and hidebottom
1409 $hidebottom = 0;
1410 if ($hidetop) {
1411 $hidetop = -1;
1412 }
1413
1414 $currency = !empty($currency) ? $currency : $conf->currency;
1415 $default_font_size = pdf_getPDFFontSize($outputlangs);
1416
1417 // Amount in (at tab_top - 1)
1418 $pdf->SetTextColor(0, 0, 0);
1419 $pdf->SetFont('', '', $default_font_size - 2);
1420
1421 if (empty($hidetop)) {
1422 $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
1423 $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
1424 $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1425
1426 //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1427 if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
1428 $pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1429 }
1430 }
1431
1432 $pdf->SetDrawColor(128, 128, 128);
1433 $pdf->SetFont('', '', $default_font_size - 1);
1434
1435 // Output Rect
1436 $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
1437
1438 if (empty($hidetop)) {
1439 $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
1440
1441 $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
1442 $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1443 }
1444
1445 if (getDolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
1446 $pdf->line($this->posxpicture - 1, $tab_top, $this->posxpicture - 1, $tab_top + $tab_height);
1447 if (empty($hidetop)) {
1448 //$pdf->SetXY($this->posxpicture-1, $tab_top+1);
1449 //$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
1450 }
1451 }
1452
1453 if (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) {
1454 $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
1455 if (empty($hidetop)) {
1456 // Not do -3 and +3 instead of -1 -1 to have more space for text 'Sales tax'
1457 $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
1458 $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
1459 }
1460 }
1461
1462 $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
1463 if (empty($hidetop)) {
1464 $pdf->SetXY($this->posxup - 1, $tab_top + 1);
1465 $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
1466 }
1467
1468 $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
1469 if (empty($hidetop)) {
1470 $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
1471 $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
1472 }
1473
1474 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
1475 $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
1476 if (empty($hidetop)) {
1477 $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
1478 $pdf->MultiCell(
1479 $this->posxdiscount - $this->posxunit - 1,
1480 2,
1481 $outputlangs->transnoentities("Unit"),
1482 '',
1483 'C'
1484 );
1485 }
1486 }
1487
1488 $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
1489 if (empty($hidetop)) {
1490 if ($this->atleastonediscount) {
1491 $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
1492 $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
1493 }
1494 }
1495 if ($this->atleastonediscount) {
1496 $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
1497 }
1498 if (empty($hidetop)) {
1499 $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
1500 $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHTShort"), '', 'C');
1501 }
1502 }
1503
1504 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1515 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null)
1516 {
1517 global $conf, $langs;
1518
1519 $ltrdirection = 'L';
1520 if ($outputlangs->trans("DIRECTION") == 'rtl') {
1521 $ltrdirection = 'R';
1522 }
1523
1524 // Load traductions files required by page
1525 $outputlangs->loadLangs(array("main", "propal", "companies", "bills"));
1526
1527 $default_font_size = pdf_getPDFFontSize($outputlangs);
1528
1529 pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
1530
1531 $pdf->SetTextColor(0, 0, 60);
1532 $pdf->SetFont('', 'B', $default_font_size + 3);
1533
1534 $w = 100;
1535
1536 $posy = $this->marge_haute;
1537 $posx = $this->page_largeur - $this->marge_droite - $w;
1538
1539 $pdf->SetXY($this->marge_gauche, $posy);
1540
1541 // Logo
1542 if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
1543 if ($this->emetteur->logo) {
1544 $logodir = $conf->mycompany->dir_output;
1545 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
1546 $logodir = $conf->mycompany->multidir_output[$object->entity];
1547 }
1548 if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
1549 $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
1550 } else {
1551 $logo = $logodir.'/logos/'.$this->emetteur->logo;
1552 }
1553 if (is_readable($logo)) {
1554 $height = pdf_getHeightForLogo($logo);
1555 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
1556 } else {
1557 $pdf->SetTextColor(200, 0, 0);
1558 $pdf->SetFont('', 'B', $default_font_size - 2);
1559 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
1560 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1561 }
1562 } else {
1563 $text = $this->emetteur->name;
1564 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1565 }
1566 }
1567
1568 $pdf->SetFont('', 'B', $default_font_size + 3);
1569 $pdf->SetXY($posx, $posy);
1570 $pdf->SetTextColor(0, 0, 60);
1571 $title = $outputlangs->transnoentities("PdfCommercialProposalTitle");
1572 $title .= ' '.$outputlangs->convToOutputCharset($object->ref);
1573 if ($object->statut == $object::STATUS_DRAFT) {
1574 $pdf->SetTextColor(128, 0, 0);
1575 $title .= ' - '.$outputlangs->transnoentities("NotValidated");
1576 }
1577 $pdf->MultiCell($w, 4, $title, '', 'R');
1578
1579 $pdf->SetFont('', 'B', $default_font_size);
1580
1581 /*
1582 $posy += 5;
1583 $pdf->SetXY($posx, $posy);
1584 $pdf->SetTextColor(0, 0, 60);
1585 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
1586 */
1587
1588 $posy += 3;
1589 $pdf->SetFont('', '', $default_font_size - 2);
1590
1591 if ($object->ref_client) {
1592 $posy += 4;
1593 $pdf->SetXY($posx, $posy);
1594 $pdf->SetTextColor(0, 0, 60);
1595 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R');
1596 }
1597
1598 if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
1599 $object->fetchProject();
1600 if (!empty($object->project->ref)) {
1601 $posy += 3;
1602 $pdf->SetXY($posx, $posy);
1603 $pdf->SetTextColor(0, 0, 60);
1604 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
1605 }
1606 }
1607
1608 if (getDolGlobalString('PDF_SHOW_PROJECT')) {
1609 $object->fetchProject();
1610 if (!empty($object->project->ref)) {
1611 $outputlangs->load("projects");
1612 $posy += 3;
1613 $pdf->SetXY($posx, $posy);
1614 $pdf->SetTextColor(0, 0, 60);
1615 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
1616 }
1617 }
1618
1619 if (getDolGlobalString('MAIN_PDF_DATE_TEXT')) {
1620 $displaydate = "daytext";
1621 } else {
1622 $displaydate = "day";
1623 }
1624
1625 //$posy += 4;
1626 $posy = $pdf->getY();
1627 $pdf->SetXY($posx, $posy);
1628 $pdf->SetTextColor(0, 0, 60);
1629 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R');
1630
1631 $posy += 4;
1632 $pdf->SetXY($posx, $posy);
1633 $pdf->SetTextColor(0, 0, 60);
1634 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R');
1635
1636 if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_CODE') && $object->thirdparty->code_client) {
1637 $posy += 4;
1638 $pdf->SetXY($posx, $posy);
1639 $pdf->SetTextColor(0, 0, 60);
1640 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
1641 }
1642
1643 if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_ACCOUNTING_CODE') && $object->thirdparty->code_compta_client) {
1644 $posy += 4;
1645 $pdf->SetXY($posx, $posy);
1646 $pdf->SetTextColor(0, 0, 60);
1647 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerAccountancyCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_compta_client), '', 'R');
1648 }
1649
1650 // Get contact
1651 if (getDolGlobalString('DOC_SHOW_FIRST_SALES_REP')) {
1652 $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1653 if (count($arrayidcontact) > 0) {
1654 $usertmp = new User($this->db);
1655 $usertmp->fetch($arrayidcontact[0]);
1656 $posy += 4;
1657 $pdf->SetXY($posx, $posy);
1658 $pdf->SetTextColor(0, 0, 60);
1659 $pdf->MultiCell($w, 3, $outputlangs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
1660 }
1661 }
1662
1663 $posy += 2;
1664
1665 $top_shift = 0;
1666 // Show list of linked objects
1667 $current_y = $pdf->getY();
1668 $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size);
1669 if ($current_y < $pdf->getY()) {
1670 $top_shift = $pdf->getY() - $current_y;
1671 }
1672
1673 if ($showaddress) {
1674 // Sender properties
1675 $carac_emetteur = '';
1676 // Add internal contact of object if defined
1677 $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
1678 if (count($arrayidcontact) > 0) {
1679 $object->fetch_user($arrayidcontact[0]);
1680 $labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
1681 $carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname." ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
1682 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ' (' : '';
1683 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone : '';
1684 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') && getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ', ' : '';
1685 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email : '';
1686 $carac_emetteur .= (getDolGlobalInt('PDF_SHOW_PHONE_AFTER_USER_CONTACT') || getDolGlobalInt('PDF_SHOW_EMAIL_AFTER_USER_CONTACT')) ? ')' : '';
1687 $carac_emetteur .= "\n";
1688 }
1689
1690 $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1691
1692 // Show sender
1693 $posy = 42 + $top_shift;
1694 $posx = $this->marge_gauche;
1695 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
1696 $posx = $this->page_largeur - $this->marge_droite - 80;
1697 }
1698 $hautcadre = 40;
1699
1700 // Show sender frame
1701 if (!getDolGlobalString('MAIN_PDF_NO_SENDER_FRAME')) {
1702 $pdf->SetTextColor(0, 0, 0);
1703 $pdf->SetFont('', '', $default_font_size - 2);
1704 $pdf->SetXY($posx, $posy - 5);
1705 $pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
1706 $pdf->SetXY($posx, $posy);
1707 $pdf->SetFillColor(230, 230, 230);
1708 $pdf->RoundedRect($posx, $posy, 82, $hautcadre, $this->corner_radius, '1234', 'F');
1709 $pdf->SetTextColor(0, 0, 60);
1710 }
1711
1712 // Show company name
1713 if (!getDolGlobalString('MAIN_PDF_HIDE_SENDER_NAME')) {
1714 $pdf->SetXY($posx + 2, $posy + 3);
1715 $pdf->SetFont('', 'B', $default_font_size);
1716 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1717 $posy = $pdf->getY();
1718 }
1719
1720 // Show sender information
1721 $pdf->SetXY($posx + 2, $posy);
1722 $pdf->SetFont('', '', $default_font_size - 1);
1723 $pdf->MultiCell(80, 4, $carac_emetteur, 0, $ltrdirection);
1724
1725
1726 // If CUSTOMER contact defined, we use it
1727 $usecontact = false;
1728 $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
1729 if (count($arrayidcontact) > 0) {
1730 $usecontact = true;
1731 $result = $object->fetch_contact($arrayidcontact[0]);
1732 }
1733
1734 // Recipient name
1735 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1736 $thirdparty = $object->contact;
1737 } else {
1738 $thirdparty = $object->thirdparty;
1739 }
1740
1741 $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
1742
1743 $mode = 'target';
1744 $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), ($usecontact ? 1 : 0), $mode, $object);
1745
1746 // Show recipient
1747 $widthrecbox = 100;
1748 if ($this->page_largeur < 210) {
1749 $widthrecbox = 84; // To work with US executive format
1750 }
1751 $posy = 42 + $top_shift;
1752 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1753 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
1754 $posx = $this->marge_gauche;
1755 }
1756
1757 // Show recipient frame
1758 if (!getDolGlobalString('MAIN_PDF_NO_RECIPENT_FRAME')) {
1759 $pdf->SetTextColor(0, 0, 0);
1760 $pdf->SetFont('', '', $default_font_size - 2);
1761 $pdf->SetXY($posx + 2, $posy - 5);
1762 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
1763 $pdf->RoundedRect($posx, $posy, $widthrecbox, $hautcadre, $this->corner_radius, '1234', 'D');
1764 }
1765
1766 // Show recipient name
1767 $pdf->SetXY($posx + 2, $posy + 3);
1768 $pdf->SetFont('', 'B', $default_font_size);
1769 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1770 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, $ltrdirection);
1771
1772 $posy = $pdf->getY();
1773
1774 // Show recipient information
1775 $pdf->SetFont('', '', $default_font_size - 1);
1776 $pdf->SetXY($posx + 2, $posy);
1777 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1778 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1779 }
1780
1781 $pdf->SetTextColor(0, 0, 0);
1782
1783 return $top_shift;
1784 }
1785
1786 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1796 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1797 {
1798 $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
1799 return pdf_pagefoot($pdf, $outputlangs, 'PROPOSAL_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
1800 }
1801
1802 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
1803 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
1813 protected function _signature_area(&$pdf, $object, $posy, $outputlangs)
1814 {
1815 // phpcs:enable
1816 $default_font_size = pdf_getPDFFontSize($outputlangs);
1817 $tab_top = $posy + 4;
1818 $tab_hl = 4;
1819
1820 $posx = 120;
1821 $largcol = ($this->page_largeur - $this->marge_droite - $posx);
1822
1823 // Total HT
1824 $pdf->SetFillColor(255, 255, 255);
1825 $pdf->SetXY($posx, $tab_top);
1826 $pdf->SetFont('', '', $default_font_size - 2);
1827 $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1);
1828
1829 $pdf->SetXY($posx, $tab_top + $tab_hl + 3);
1830 $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R');
1831 if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) {
1832 // Can be retrieve with getSignatureAppearanceArray()
1833 // Can be also detected by putting the mouse over the area when using evince pdf reader
1834 $pdf->addEmptySignatureAppearance($posx, $tab_top + $tab_hl, $largcol, $tab_hl * 3);
1835 }
1836
1837 return ($tab_hl * 7);
1838 }
1839}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Class to manage bank accounts.
printRoundedRect($pdf, $x, $y, $w, $h, $r, $hidetop=0, $hidebottom=0, $style='D')
Print a rounded rectangle on the PDF.
Class to manage hooks.
Class mere des modeles de propale.
Class to manage products or services.
Put here description of your class.
Class to manage translations.
Class to manage Dolibarr users.
Class to generate PDF proposal Azur.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
__construct($db)
Constructor.
_pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis=null)
Show top header of page.
_signature_area(&$pdf, $object, $posy, $outputlangs)
Show area for the customer to sign.
_tableau_versements(&$pdf, $object, $posy, $outputlangs)
Show payments table.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
Show table for lines.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis=null)
Show total to pay.
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(!function_exists( 'dolEscapeXML')) convertBackOfficeMediasLinksToPublicLinks($notetoshow)
Convert links to local wrapper to medias files into a string into a public external URL readable on i...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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 '.
getCallerInfoString()
Get caller info as a string that can be appended to a log message.
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_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_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.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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:2648
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:1442
pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line total excluding tax.
Definition pdf.lib.php:2382
pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails=0)
Return line total amount discount.
Definition pdf.lib.php:2679
pdf_getFormat($outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition pdf.lib.php:86
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition pdf.lib.php:288
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:1027
pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails=0)
Return line unit price excluding tax.
Definition pdf.lib.php:2000
pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
Return line vat rate.
Definition pdf.lib.php:1938
pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
Function to try to calculate height of a HTML Content.
Definition pdf.lib.php:338
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition pdf.lib.php:729
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
Definition pdf.lib.php:1405
pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber=0, $default_font_size=10)
Show bank information for PDF generation.
Definition pdf.lib.php:850
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 formatted for output on PDF documents.
Definition pdf.lib.php:434
pdf_getlineunit($object, $i, $outputlangs, $hidedetails=0)
Return line unit.
Definition pdf.lib.php:2245
pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails=0)
Return line remise percent.
Definition pdf.lib.php:2288
pdf_getlineqty($object, $i, $outputlangs, $hidedetails=0)
Return line quantity.
Definition pdf.lib.php:2085
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:765
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition pdf.lib.php:128
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:137
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140