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