dolibarr 23.0.3
pdf_standard_recruitmentjobposition.modules.php
1<?php
2
3/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
6 * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
7 * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
8 * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
9 * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
10 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
11 * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
12 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
13 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <https://www.gnu.org/licenses/>.
27 * or see https://www.gnu.org/
28 */
29
36require_once DOL_DOCUMENT_ROOT.'/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php';
37require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
41
42
47{
51 public $db;
52
56 public $name;
57
61 public $description;
62
66 public $update_main_doc_field;
67
71 public $type;
72
77 public $phpmin = array(7, 0);
78
83 public $version = 'dolibarr';
84
89 public $emetteur;
90
94 public $situationinvoice;
95
99 public $tabTitleHeight;
100
104 public $defaultContentsFieldsStyle = array();
105
109 public $defaultTitlesFieldsStyle = array();
110
114 public $cols = array();
115
116
122 public function __construct($db)
123 {
124 global $conf, $langs, $mysoc;
125
126 // Translations
127 $langs->loadLangs(array("main", "bills"));
128
129 $this->db = $db;
130 $this->name = "standard";
131 $this->description = $langs->trans('DocumentModelStandardPDF');
132 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
133
134 // Dimension page
135 $this->type = 'pdf';
136 $formatarray = pdf_getFormat();
137 $this->page_largeur = $formatarray['width'];
138 $this->page_hauteur = $formatarray['height'];
139 $this->format = array($this->page_largeur, $this->page_hauteur);
140 $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
141 $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
142 $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
143 $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
144
145 $this->option_logo = 1; // Display logo
146 $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
147 $this->option_modereg = 1; // Display payment mode
148 $this->option_condreg = 1; // Display payment terms
149 $this->option_multilang = 1; // Available in several languages
150 $this->option_escompte = 1; // Displays if there has been a discount
151 $this->option_credit_note = 1; // Support credit notes
152 $this->option_freetext = 1; // Support add of a personalised text
153 $this->option_draft_watermark = 1; // Support add of a watermark on drafts
154
155 // Define position of columns
156 $this->posxdesc = $this->marge_gauche + 1; // used for notes and other stuff
157
158
159 $this->tabTitleHeight = 5; // default height
160
161 // Use new system for position of columns, view $this->defineColumnField()
162
163 // $this->tva = array();
164 // $this->localtax1 = array();
165 // $this->localtax2 = array();
166 // $this->atleastoneratenotnull = 0;
167 // $this->atleastonediscount = 0;
168 $this->situationinvoice = false;
169
170 if ($mysoc === null) {
171 dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
172 return;
173 }
174
175 // Get source company
176 $this->emetteur = $mysoc;
177 if (empty($this->emetteur->country_code)) {
178 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
179 }
180 }
181
182
183 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
195 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
196 {
197 // phpcs:enable
198 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
199 global $action;
200
201 dol_syslog("write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
202
203 if (!is_object($outputlangs)) {
204 $outputlangs = $langs;
205 }
206 // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
207 if (getDolGlobalString('MAIN_USE_FPDF')) {
208 $outputlangs->charset_output = 'ISO-8859-1';
209 }
210
211 // Load translation files required by the page
212 $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies"));
213
214 global $outputlangsbis;
215 $outputlangsbis = null;
216 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && $outputlangs->defaultlang != getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
217 $outputlangsbis = new Translate('', $conf);
218 $outputlangsbis->setDefaultLang(getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'));
219 $outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
220 }
221
222 $nblines = (is_array($object->lines) ? count($object->lines) : 0);
223
224 $hidetop = 0;
225 if (getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE')) {
226 $hidetop = getDolGlobalString('MAIN_PDF_DISABLE_COL_HEAD_TITLE');
227 }
228
230 if ($dir) {
231 $object->fetch_thirdparty();
232
233 // Definition of $dir and $file
234 if ($object->specimen) {
235 $file = $dir."/SPECIMEN.pdf";
236 } else {
237 $objectref = dol_sanitizeFileName($object->ref);
238 $dir .= '/'.$objectref;
239 $file = $dir."/".$objectref.".pdf";
240 }
241 if (!file_exists($dir)) {
242 if (dol_mkdir($dir) < 0) {
243 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
244 return 0;
245 }
246 }
247
248 if (file_exists($dir)) {
249 // Add pdfgeneration hook
250 $hookmanager->initHooks(array('pdfgeneration'));
251 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
252 $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
253
254 // Set nblines with the new facture lines content after hook
255 $nblines = (is_array($object->lines) ? count($object->lines) : 0);
256
257 // Create pdf instance
258 $pdf = pdf_getInstance($this->format);
259 $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
260 $pdf->setAutoPageBreak(true, 0);
261
262 $heightforinfotot = 50; // Height reserved to output the info and total part and payment part
263 $heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page
264 $heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
265
266 if (class_exists('TCPDF')) {
267 $pdf->setPrintHeader(false);
268 $pdf->setPrintFooter(false);
269 }
270 $pdf->SetFont(pdf_getPDFFont($outputlangs));
271
272 // Set path to the background PDF File
273 if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) {
274 $logodir = $conf->mycompany->dir_output;
275 if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
276 $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity];
277 }
278 $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
279 $tplidx = $pdf->importPage(1);
280 }
281
282 $pdf->Open();
283 $pagenb = 0;
284 $pdf->SetDrawColor(128, 128, 128);
285
286 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
287 $pdf->SetSubject($object->label);
288 $pdf->SetCreator("Dolibarr ".DOL_VERSION);
289 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
290 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$object->label." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
291 if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
292 $pdf->SetCompression(false);
293 }
294
295 // Set certificate
296 $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT;
297 // If user has no certificate, we try to take the company one
298 if (!$cert) {
299 $cert = !getDolGlobalString('CERTIFICATE_CRT') ? '' : $conf->global->CERTIFICATE_CRT;
300 }
301 // If a certificate is found
302 if ($cert) {
303 $info = array(
304 'Name' => $this->emetteur->name,
305 'Location' => getCountry($this->emetteur->country_code, ''),
306 'Reason' => 'MYOBJECT',
307 'ContactInfo' => $this->emetteur->email
308 );
309 $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info);
310 }
311
312 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
313 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
314
315 // New page
316 $pdf->AddPage();
317 if (!empty($tplidx)) {
318 $pdf->useTemplate($tplidx);
319 }
320 $pagenb++;
321
322 $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
323 $pdf->SetFont('', '', $default_font_size - 1);
324 $pdf->MultiCell(0, 3, ''); // Set interline to 3
325 $pdf->SetTextColor(0, 0, 0);
326
327 $tab_top = 90 + $top_shift;
328 $tab_top_newpage = (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
329 $tab_height = 130 - $top_shift;
330 $tab_height_newpage = 150;
331 if (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD')) {
332 $tab_height_newpage -= $top_shift;
333 }
334
335 $nexY = $tab_top - 1;
336
337 // Display notes
338 $notetoshow = empty($object->note_public) ? '' : $object->note_public;
339 // Extrafields in note
340 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
341 if (!empty($extranote)) {
342 $notetoshow = dol_concatdesc($notetoshow, $extranote);
343 }
344
345 $pagenb = $pdf->getPage();
346 if ($notetoshow) {
347 $tab_top -= 2;
348
349 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
350 $pageposbeforenote = $pagenb;
351
352 $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
353 complete_substitutions_array($substitutionarray, $outputlangs, $object);
354 $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);
355 $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow);
356
357 $pdf->startTransaction();
358
359 $pdf->SetFont('', '', $default_font_size - 1);
360 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
361 // Description
362 $pageposafternote = $pdf->getPage();
363 $posyafter = $pdf->GetY();
364
365 if ($pageposafternote > $pageposbeforenote) {
366 $pdf->rollbackTransaction(true);
367
368 // prepare pages to receive notes
369 while ($pagenb < $pageposafternote) {
370 $pdf->AddPage();
371 $pagenb++;
372 if (!empty($tplidx)) {
373 $pdf->useTemplate($tplidx);
374 }
375 if (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD')) {
376 $this->_pagehead($pdf, $object, 0, $outputlangs);
377 }
378 // $this->_pagefoot($pdf,$object,$outputlangs,1);
379 $pdf->setTopMargin($tab_top_newpage);
380 // The only function to edit the bottom margin of current page to set it.
381 $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext);
382 }
383
384 // back to start
385 $pdf->setPage($pageposbeforenote);
386 $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext);
387 $pdf->SetFont('', '', $default_font_size - 1);
388 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
389 $pageposafternote = $pdf->getPage();
390
391 $posyafter = $pdf->GetY();
392
393 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) { // There is no space left for total+free text
394 $pdf->AddPage('', '', true);
395 $pagenb++;
396 $pageposafternote++;
397 $pdf->setPage($pageposafternote);
398 $pdf->setTopMargin($tab_top_newpage);
399 // The only function to edit the bottom margin of current page to set it.
400 $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext);
401 //$posyafter = $tab_top_newpage;
402 }
403
404
405 // apply note frame to previous pages
406 $i = $pageposbeforenote;
407 while ($i < $pageposafternote) {
408 $pdf->setPage($i);
409
410
411 $pdf->SetDrawColor(128, 128, 128);
412 // Draw note frame
413 if ($i > $pageposbeforenote) {
414 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
415 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
416 } else {
417 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
418 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
419 }
420
421 // Add footer
422 $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
423 $this->_pagefoot($pdf, $object, $outputlangs, 1);
424
425 $i++;
426 }
427
428 // apply note frame to last page
429 $pdf->setPage($pageposafternote);
430 if (!empty($tplidx)) {
431 $pdf->useTemplate($tplidx);
432 }
433 if (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD')) {
434 $this->_pagehead($pdf, $object, 0, $outputlangs);
435 }
436 $height_note = $posyafter - $tab_top_newpage;
437 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
438 } else { // No pagebreak
439 $pdf->commitTransaction();
440 $posyafter = $pdf->GetY();
441 $height_note = $posyafter - $tab_top;
442 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
443
444 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
445 // not enough space, need to add page
446 $pdf->AddPage('', '', true);
447 $pagenb++;
448 $pageposafternote++;
449 $pdf->setPage($pageposafternote);
450 if (!empty($tplidx)) {
451 $pdf->useTemplate($tplidx);
452 }
453 if (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD')) {
454 $this->_pagehead($pdf, $object, 0, $outputlangs);
455 }
456
457 $posyafter = $tab_top_newpage;
458 }
459 }
460
461 $tab_height -= $height_note;
462 $tab_top = $posyafter + 6;
463 } else {
464 $height_note = 0;
465 }
466
467 // Use new auto column system
468 $this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
469
470 // Table simulation to know the height of the title line
471 $pdf->startTransaction();
472 $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
473 $pdf->rollbackTransaction(true);
474
475 $nexY = $tab_top + $this->tabTitleHeight;
476
477 // Loop on each lines
478 $pageposbeforeprintlines = $pdf->getPage();
479 $pagenb = $pageposbeforeprintlines;
480 for ($i = 0; $i < $nblines; $i++) {
481 $curY = $nexY;
482 $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
483 $pdf->SetTextColor(0, 0, 0);
484
485 $pdf->setTopMargin($tab_top_newpage);
486 $pdf->setPageOrientation('', true, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
487 $pageposbefore = $pdf->getPage();
488
489 $showpricebeforepagebreak = 1;
490
491 // Description of product line
492 if ($this->getColumnStatus('desc')) {
493 $pdf->startTransaction();
494
495 $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
496 $pageposafter = $pdf->getPage();
497
498 if ($pageposafter > $pageposbefore) { // There is a pagebreak
499 $pdf->rollbackTransaction(true);
500 $pdf->setPageOrientation('', true, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
501
502 $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
503
504 $pageposafter = $pdf->getPage();
505 $posyafter = $pdf->GetY();
506
507 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
508 if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
509 $pdf->AddPage('', '', true);
510 if (!empty($tplidx)) {
511 $pdf->useTemplate($tplidx);
512 }
513 $pdf->setPage($pageposafter + 1);
514 }
515 } else {
516 // We found a page break
517 // Allows data in the first page if description is long enough to break in multiples pages
518 if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) {
519 $showpricebeforepagebreak = 1;
520 } else {
521 $showpricebeforepagebreak = 0;
522 }
523 }
524 } else { // No pagebreak
525 $pdf->commitTransaction();
526 }
527 }
528
529 $nexY = $pdf->GetY();
530 $pageposafter = $pdf->getPage();
531 $pdf->setPage($pageposbefore);
532 $pdf->setTopMargin($this->marge_haute);
533 $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
534
535 // We suppose that a too long description were moved completely on next page
536 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
537 $pdf->setPage($pageposafter);
538 $curY = $tab_top_newpage;
539 }
540
541 $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default
542
543 $parameters = array(
544 'object' => $object,
545 'i' => $i,
546 'pdf' => & $pdf,
547 'curY' => & $curY,
548 'nexY' => & $nexY,
549 'outputlangs' => $outputlangs,
550 'hidedetails' => $hidedetails
551 );
552 $reshook = $hookmanager->executeHooks('printPDFline', $parameters, $this); // Note that $object may have been modified by hook
553
554 // Detect if some page were added automatically and output _tableau for past pages
555 while ($pagenb < $pageposafter) {
556 $pdf->setPage($pagenb);
557 if ($pagenb == $pageposbeforeprintlines) {
558 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
559 } else {
560 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
561 }
562 $this->_pagefoot($pdf, $object, $outputlangs, 1);
563 $pagenb++;
564 $pdf->setPage($pagenb);
565 $pdf->setPageOrientation('', true, 0); // The only function to edit the bottom margin of current page to set it.
566 if (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD')) {
567 $this->_pagehead($pdf, $object, 0, $outputlangs);
568 }
569 if (!empty($tplidx)) {
570 $pdf->useTemplate($tplidx);
571 }
572 }
573
574 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
575 if ($pagenb == $pageposafter) {
576 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
577 } else {
578 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
579 }
580 $this->_pagefoot($pdf, $object, $outputlangs, 1);
581 // New page
582 $pdf->AddPage();
583 if (!empty($tplidx)) {
584 $pdf->useTemplate($tplidx);
585 }
586 $pagenb++;
587 if (!getDolGlobalString('MAIN_PDF_DONOTREPEAT_HEAD')) {
588 $this->_pagehead($pdf, $object, 0, $outputlangs);
589 }
590 }
591 }
592
593 // Show square
594 if ($pagenb == $pageposbeforeprintlines) {
595 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
596 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
597 } else {
598 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
599 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
600 }
601
602 // Display infos area
603 //$posy = $this->drawInfoTable($pdf, $object, $bottomlasttab, $outputlangs);
604
605 // Display total zone
606 //$posy = $this->drawTotalTable($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs);
607
608 // Display payment area
609 /*
610 if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS))
611 {
612 $posy = $this->drawPaymentsTable($pdf, $object, $posy, $outputlangs);
613 }
614 */
615
616 // Pagefoot
617 $this->_pagefoot($pdf, $object, $outputlangs);
618 if (method_exists($pdf, 'AliasNbPages')) {
619 $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod
620 }
621
622 $pdf->Close();
623
624 $pdf->Output($file, 'F');
625
626 // Add pdfgeneration hook
627 $hookmanager->initHooks(array('pdfgeneration'));
628 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
629 global $action;
630 $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
631 $this->warnings = $hookmanager->warnings;
632 if ($reshook < 0) {
633 $this->error = $hookmanager->error;
634 $this->errors = $hookmanager->errors;
635 dolChmod($file);
636 return -1;
637 }
638
639 dolChmod($file);
640
641 $this->result = array('fullpath' => $file);
642
643 return 1; // No error
644 } else {
645 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
646 return 0;
647 }
648 } else {
649 $this->error = $langs->transnoentities("ErrorConstantNotDefined", "FAC_OUTPUTDIR");
650 return 0;
651 }
652 }
653
654 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
662 public static function liste_modeles($db, $maxfilenamelength = 0)
663 {
664 // phpcs:enable
665 return parent::liste_modeles($db, $maxfilenamelength); // TODO: Change the autogenerated stub
666 }
667
668 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
683 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null)
684 {
685 // Force to disable hidetop and hidebottom
686 $hidebottom = 0;
687 if ($hidetop) {
688 $hidetop = -1;
689 }
690
691 $currency = !empty($currency) ? $currency : getDolCurrency();
692 $default_font_size = pdf_getPDFFontSize($outputlangs);
693
694 // Amount in (at tab_top - 1)
695 $pdf->SetTextColor(0, 0, 0);
696 $pdf->SetFont('', '', $default_font_size - 2);
697
698 if (empty($hidetop)) {
699 //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
700 if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
701 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
702 }
703 }
704
705 $pdf->SetDrawColor(128, 128, 128);
706 $pdf->SetFont('', '', $default_font_size - 1);
707
708 // Output Rect
709 $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
710
711 $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
712
713 if (empty($hidetop)) {
714 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter
715 }
716 }
717
718 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
729 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null)
730 {
731 global $conf;
732
733 // Load traductions files required by page
734 $outputlangs->loadLangs(array("main", "bills", "propal", "companies"));
735
736 $default_font_size = pdf_getPDFFontSize($outputlangs);
737
738 pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
739
740 // Show Draft Watermark
741 if ($object->status == $object::STATUS_DRAFT && getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK')) {
742 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK'));
743 }
744
745 $pdf->SetTextColor(0, 0, 60);
746 $pdf->SetFont('', 'B', $default_font_size + 3);
747
748 $w = 110;
749
750 $posy = $this->marge_haute;
751 $posx = $this->page_largeur - $this->marge_droite - $w;
752
753 $pdf->SetXY($this->marge_gauche, $posy);
754
755 // Logo
756 if (!getDolGlobalInt('PDF_DISABLE_MYCOMPANY_LOGO')) {
757 if ($this->emetteur->logo) {
758 $logodir = $conf->mycompany->dir_output;
759 if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) {
760 $logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity];
761 }
762 if (!getDolGlobalInt('MAIN_PDF_USE_LARGE_LOGO')) {
763 $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
764 } else {
765 $logo = $logodir.'/logos/'.$this->emetteur->logo;
766 }
767 if (is_readable($logo)) {
768 $height = pdf_getHeightForLogo($logo);
769 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
770 } else {
771 $pdf->SetTextColor(200, 0, 0);
772 $pdf->SetFont('', 'B', $default_font_size - 2);
773 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
774 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
775 }
776 } else {
777 $text = $this->emetteur->name;
778 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
779 }
780 }
781
782 $pdf->SetFont('', 'B', $default_font_size + 3);
783 $pdf->SetXY($posx, $posy);
784 $pdf->SetTextColor(0, 0, 60);
785 $title = $object->label;
786 $pdf->MultiCell($w, 3, $title, '', 'R');
787
788 $pdf->SetFont('', 'B', $default_font_size);
789
790 $posy += 5;
791 $pdf->SetXY($posx, $posy);
792 $pdf->SetTextColor(0, 0, 60);
793 $textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref);
794 if ($object->status == $object::STATUS_DRAFT) {
795 $pdf->SetTextColor(128, 0, 0);
796 $textref .= ' - '.$outputlangs->transnoentities("NotValidated");
797 }
798 $pdf->MultiCell($w, 4, $textref, '', 'R');
799
800 $posy += 1;
801 $pdf->SetFont('', '', $default_font_size - 2);
802
803 if ($object->ref_client) {
804 $posy += 4;
805 $pdf->SetXY($posx, $posy);
806 $pdf->SetTextColor(0, 0, 60);
807 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
808 }
809
810 if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
811 $object->fetchProject();
812 if (!empty($object->project->ref)) {
813 $posy += 3;
814 $pdf->SetXY($posx, $posy);
815 $pdf->SetTextColor(0, 0, 60);
816 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
817 }
818 }
819
820 if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) {
821 $object->fetchProject();
822 if (!empty($object->project->ref)) {
823 $posy += 3;
824 $pdf->SetXY($posx, $posy);
825 $pdf->SetTextColor(0, 0, 60);
826 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->project->title), '', 'R');
827 }
828 }
829
830 if (getDolGlobalString('PDF_SHOW_PROJECT')) {
831 $object->fetchProject();
832 if (!empty($object->project->ref)) {
833 $outputlangs->load("projects");
834 $posy += 3;
835 $pdf->SetXY($posx, $posy);
836 $pdf->SetTextColor(0, 0, 60);
837 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->project->ref), '', 'R');
838 }
839 }
840
841 $posy += 4;
842 $pdf->SetXY($posx, $posy);
843 $pdf->SetTextColor(0, 0, 60);
844
845 $title = $outputlangs->transnoentities("Date");
846 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
847 $title .= ' - '.$outputlangsbis->transnoentities("Date");
848 }
849 $pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date_creation, "day", false, $outputlangs), '', 'R');
850
851 if ($object->thirdparty->code_client) {
852 $posy += 3;
853 $pdf->SetXY($posx, $posy);
854 $pdf->SetTextColor(0, 0, 60);
855 $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
856 }
857
858 $posy += 1;
859
860 $top_shift = 0;
861 // Show list of linked objects
862 $current_y = $pdf->getY();
863 $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size);
864 if ($current_y < $pdf->getY()) {
865 $top_shift = $pdf->getY() - $current_y;
866 }
867
868 if ($showaddress) {
869 // Sender properties
870 $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
871
872 // Show sender
873 $posy = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 40 : 42;
874 $posy += $top_shift;
875 $posx = $this->marge_gauche;
876 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) {
877 $posx = $this->page_largeur - $this->marge_droite - 80;
878 }
879
880 $hautcadre = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 38 : 40;
881 $widthrecbox = getDolGlobalString('MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82;
882
883
884 // Show sender frame
885 $pdf->SetTextColor(0, 0, 0);
886 $pdf->SetFont('', '', $default_font_size - 2);
887 $pdf->SetXY($posx, $posy - 5);
888 $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
889 $pdf->SetXY($posx, $posy);
890 $pdf->SetFillColor(230, 230, 230);
891 $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', true);
892 $pdf->SetTextColor(0, 0, 60);
893
894 // Show sender name
895 $pdf->SetXY($posx + 2, $posy + 3);
896 $pdf->SetFont('', 'B', $default_font_size);
897 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
898 $posy = $pdf->getY();
899
900 // Show sender information
901 $pdf->SetXY($posx + 2, $posy);
902 $pdf->SetFont('', '', $default_font_size - 1);
903 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, 'L');
904
905 // If BILLING contact defined on invoice, we use it
906 $usecontact = false;
907 $arrayidcontact = $object->getIdContact('external', 'BILLING');
908 if (count($arrayidcontact) > 0) {
909 $usecontact = true;
910 $result = $object->fetch_contact($arrayidcontact[0]);
911 }
912
913 // Recipient name
914 /*if ($usecontact && $object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
915 $thirdparty = $object->contact;
916 } else {
917 $thirdparty = $object->thirdparty;
918 }
919
920 if (is_object($thirdparty)) {
921 $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
922 }
923
924 $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target', $object);
925
926 // Show recipient
927 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
928 if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
929 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
930 $posy += $top_shift;
931 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
932 if (getDolGlobalString('MAIN_INVERT_SENDER_RECIPIENT')) $posx = $this->marge_gauche;
933
934 // Show recipient frame
935 $pdf->SetTextColor(0, 0, 0);
936 $pdf->SetFont('', '', $default_font_size - 2);
937 $pdf->SetXY($posx + 2, $posy - 5);
938 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L');
939 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
940
941 // Show recipient name
942 $pdf->SetXY($posx + 2, $posy + 3);
943 $pdf->SetFont('', 'B', $default_font_size);
944 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L');
945
946 $posy = $pdf->getY();
947
948 // Show recipient information
949 $pdf->SetFont('', '', $default_font_size - 1);
950 $pdf->SetXY($posx + 2, $posy);
951 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
952 */
953 }
954
955 $pdf->SetTextColor(0, 0, 0);
956
957 return $top_shift;
958 }
959
960 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
970 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
971 {
972 global $conf;
973 $showdetails = !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
974 return pdf_pagefoot($pdf, $outputlangs, 'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
975 }
976
987 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
988 {
989 global $hookmanager;
990
991 // Default field style for content
992 $this->defaultContentsFieldsStyle = array(
993 'align' => 'R', // R,C,L
994 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
995 );
996
997 // Default field style for content
998 $this->defaultTitlesFieldsStyle = array(
999 'align' => 'C', // R,C,L
1000 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1001 );
1002
1003 /*
1004 * For example
1005 $this->cols['theColKey'] = array(
1006 'rank' => $rank, // int : use for ordering columns
1007 'width' => 20, // the column width in mm
1008 'title' => array(
1009 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
1010 'label' => ' ', // the final label : used fore final generated text
1011 'align' => 'L', // text alignment : R,C,L
1012 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1013 ),
1014 'content' => array(
1015 'align' => 'L', // text alignment : R,C,L
1016 'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1017 ),
1018 );
1019 */
1020
1021 $rank = 0; // do not use negative rank
1022 /*
1023 $this->cols['desc'] = array(
1024 'rank' => $rank,
1025 'width' => false, // only for desc
1026 'status' => true,
1027 'title' => array(
1028 'textkey' => 'Designation', // use lang key is useful in some case with module
1029 'align' => 'L',
1030 // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
1031 // 'label' => ' ', // the final label
1032 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1033 ),
1034 'content' => array(
1035 'align' => 'L',
1036 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
1037 ),
1038 );
1039
1040 $rank += 10;
1041 $this->cols['vat'] = array(
1042 'rank' => $rank,
1043 'status' => false,
1044 'width' => 16, // in mm
1045 'title' => array(
1046 'textkey' => 'VAT'
1047 ),
1048 'border-left' => true, // add left line separator
1049 );
1050
1051 if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN))
1052 {
1053 $this->cols['vat']['status'] = true;
1054 }
1055
1056 $rank += 10;
1057 $this->cols['subprice'] = array(
1058 'rank' => $rank,
1059 'width' => 19, // in mm
1060 'status' => true,
1061 'title' => array(
1062 'textkey' => 'PriceUHT'
1063 ),
1064 'border-left' => true, // add left line separator
1065 );
1066
1067 $rank += 10;
1068 $this->cols['qty'] = array(
1069 'rank' => $rank,
1070 'width' => 16, // in mm
1071 'status' => true,
1072 'title' => array(
1073 'textkey' => 'Qty'
1074 ),
1075 'border-left' => true, // add left line separator
1076 );
1077
1078 $rank += 10;
1079 $this->cols['progress'] = array(
1080 'rank' => $rank,
1081 'width' => 19, // in mm
1082 'status' => false,
1083 'title' => array(
1084 'textkey' => 'Progress'
1085 ),
1086 'border-left' => true, // add left line separator
1087 );
1088
1089 if ($this->situationinvoice)
1090 {
1091 $this->cols['progress']['status'] = true;
1092 }
1093
1094 $rank += 10;
1095 $this->cols['unit'] = array(
1096 'rank' => $rank,
1097 'width' => 11, // in mm
1098 'status' => false,
1099 'title' => array(
1100 'textkey' => 'Unit'
1101 ),
1102 'border-left' => true, // add left line separator
1103 );
1104 if (getDolGlobalString('PRODUCT_USE_UNITS')) {
1105 $this->cols['unit']['status'] = true;
1106 }
1107
1108 $rank += 10;
1109 $this->cols['discount'] = array(
1110 'rank' => $rank,
1111 'width' => 13, // in mm
1112 'status' => false,
1113 'title' => array(
1114 'textkey' => 'ReductionShort'
1115 ),
1116 'border-left' => true, // add left line separator
1117 );
1118 if ($this->atleastonediscount) {
1119 $this->cols['discount']['status'] = true;
1120 }
1121
1122 $rank += 1000; // add a big offset to be sure is the last col because default extrafield rank is 100
1123 $this->cols['totalexcltax'] = array(
1124 'rank' => $rank,
1125 'width' => 26, // in mm
1126 'status' => true,
1127 'title' => array(
1128 'textkey' => 'TotalHT'
1129 ),
1130 'border-left' => true, // add left line separator
1131 );
1132
1133 // Add extrafields cols
1134 if (!empty($object->lines)) {
1135 $line = reset($object->lines);
1136 $this->defineColumnExtrafield($line, $outputlangs, $hidedetails);
1137 }
1138 */
1139
1140 $parameters = array(
1141 'object' => $object,
1142 'outputlangs' => $outputlangs,
1143 'hidedetails' => $hidedetails,
1144 'hidedesc' => $hidedesc,
1145 'hideref' => $hideref
1146 );
1147
1148 $reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook
1149 if ($reshook < 0) {
1150 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1151 } elseif (empty($reshook)) {
1152 // @phan-suppress-next-line PhanPluginSuspiciousParamOrderInternal
1153 $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys
1154 } else {
1155 $this->cols = $hookmanager->resArray;
1156 }
1157 }
1158}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
getColumnStatus($colKey)
get column status from column key
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
print description column content
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
Class to manage translations.
Class to manage PDF template standard_recruitmentjobposition.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
_pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis=null)
Show top header of page.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='', $outputlangsbis=null)
Show table for lines.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
if(!function_exists( 'utf8_encode')) if(!function_exists('utf8_decode')) if(!function_exists( 'str_starts_with')) if(!function_exists('str_ends_with')) if(!function_exists( 'str_contains')) getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
pdf_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_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_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
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
Definition pdf.lib.php:844
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