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