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