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