34 require_once DOL_DOCUMENT_ROOT.
'/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php';
35 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
64 public $update_main_doc_field;
75 public $phpmin = array(7, 0);
81 public $version =
'dolibarr';
92 public $situationinvoice;
98 public $cols = array();
108 global $conf, $langs, $mysoc;
111 $langs->loadLangs(array(
"main",
"bills"));
114 $this->
name =
"standard";
115 $this->
description = $langs->trans(
'DocumentModelStandardPDF');
116 $this->update_main_doc_field = 1;
121 $this->page_largeur = $formatarray[
'width'];
122 $this->page_hauteur = $formatarray[
'height'];
123 $this->format = array($this->page_largeur, $this->page_hauteur);
129 $this->option_logo = 1;
130 $this->option_tva = 1;
131 $this->option_modereg = 1;
132 $this->option_condreg = 1;
133 $this->option_multilang = 1;
134 $this->option_escompte = 1;
135 $this->option_credit_note = 1;
136 $this->option_freetext = 1;
137 $this->option_draft_watermark = 1;
140 $this->emetteur = $mysoc;
141 if (empty($this->emetteur->country_code)) {
142 $this->emetteur->country_code = substr($langs->defaultlang, -2);
146 $this->posxdesc = $this->marge_gauche + 1;
149 $this->tabTitleHeight = 5;
153 $this->tva = array();
154 $this->localtax1 = array();
155 $this->localtax2 = array();
156 $this->atleastoneratenotnull = 0;
157 $this->atleastonediscount = 0;
158 $this->situationinvoice =
false;
174 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
177 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
179 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
181 if (!is_object($outputlangs)) {
182 $outputlangs = $langs;
185 if (!empty($conf->global->MAIN_USE_FPDF)) {
186 $outputlangs->charset_output =
'ISO-8859-1';
190 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies"));
192 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
193 global $outputlangsbis;
194 $outputlangsbis =
new Translate(
'', $conf);
195 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
196 $outputlangsbis->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies"));
199 $nblines = (is_array($object->lines) ? count($object->lines) : 0);
202 if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
203 $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
207 $realpatharray = array();
208 $this->atleastonephoto =
false;
263 if ($conf->recruitment->dir_output.
'/recruitmentjobposition') {
264 $object->fetch_thirdparty();
267 if ($object->specimen) {
268 $dir = $conf->recruitment->dir_output.
'/recruitmentjobposition';
269 $file = $dir.
"/SPECIMEN.pdf";
272 $dir = $conf->recruitment->dir_output.
'/recruitmentjobposition/'.$objectref;
273 $file = $dir.
"/".$objectref.
".pdf";
275 if (!file_exists($dir)) {
277 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
282 if (file_exists($dir)) {
284 if (!is_object($hookmanager)) {
285 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
288 $hookmanager->initHooks(array(
'pdfgeneration'));
289 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
291 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
294 $nblines = (is_array($object->lines) ? count($object->lines) : 0);
299 $pdf->SetAutoPageBreak(1, 0);
301 $heightforinfotot = 50;
302 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
303 $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22);
305 if (class_exists(
'TCPDF')) {
306 $pdf->setPrintHeader(
false);
307 $pdf->setPrintFooter(
false);
312 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
313 $logodir = $conf->mycompany->dir_output;
314 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
315 $logodir = $conf->mycompany->multidir_output[$object->entity];
317 $pagecount = $pdf->setSourceFile($logodir.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
318 $tplidx = $pdf->importPage(1);
323 $pdf->SetDrawColor(128, 128, 128);
325 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
326 $pdf->SetSubject($object->label);
327 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
328 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
329 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$object->label.
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
331 $pdf->SetCompression(
false);
335 $cert = empty($user->conf->CERTIFICATE_CRT) ?
'' : $user->conf->CERTIFICATE_CRT;
338 $cert = empty($conf->global->CERTIFICATE_CRT) ?
'' : $conf->global->CERTIFICATE_CRT;
343 'Name' => $this->emetteur->name,
344 'Location' =>
getCountry($this->emetteur->country_code, 0),
345 'Reason' =>
'MYOBJECT',
346 'ContactInfo' => $this->emetteur->email
348 $pdf->setSignature($cert, $cert, $this->emetteur->name,
'', 2, $info);
351 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
355 if (!empty($tplidx)) {
356 $pdf->useTemplate($tplidx);
360 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
361 $pdf->SetFont(
'',
'', $default_font_size - 1);
362 $pdf->MultiCell(0, 3,
'');
363 $pdf->SetTextColor(0, 0, 0);
365 $tab_top = 90 + $top_shift;
366 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
367 $tab_height = 130 - $top_shift;
368 $tab_height_newpage = 150;
369 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
370 $tab_height_newpage -= $top_shift;
373 $nexY = $tab_top - 1;
376 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
378 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
379 if (!empty($extranote)) {
383 $pagenb = $pdf->getPage();
387 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
388 $pageposbeforenote = $pagenb;
395 $pdf->startTransaction();
397 $pdf->SetFont(
'',
'', $default_font_size - 1);
398 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
400 $pageposafternote = $pdf->getPage();
401 $posyafter = $pdf->GetY();
403 if ($pageposafternote > $pageposbeforenote) {
404 $pdf->rollbackTransaction(
true);
407 while ($pagenb < $pageposafternote) {
410 if (!empty($tplidx)) {
411 $pdf->useTemplate($tplidx);
413 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
414 $this->
_pagehead($pdf, $object, 0, $outputlangs);
417 $pdf->setTopMargin($tab_top_newpage);
419 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
423 $pdf->setPage($pageposbeforenote);
424 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
425 $pdf->SetFont(
'',
'', $default_font_size - 1);
426 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
427 $pageposafternote = $pdf->getPage();
429 $posyafter = $pdf->GetY();
431 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
432 $pdf->AddPage(
'',
'',
true);
435 $pdf->setPage($pageposafternote);
436 $pdf->setTopMargin($tab_top_newpage);
438 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
444 $i = $pageposbeforenote;
445 while ($i < $pageposafternote) {
449 $pdf->SetDrawColor(128, 128, 128);
451 if ($i > $pageposbeforenote) {
452 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
453 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
455 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
456 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
460 $pdf->setPageOrientation(
'', 1, 0);
461 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
467 $pdf->setPage($pageposafternote);
468 if (!empty($tplidx)) {
469 $pdf->useTemplate($tplidx);
471 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
472 $this->
_pagehead($pdf, $object, 0, $outputlangs);
474 $height_note = $posyafter - $tab_top_newpage;
475 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
478 $pdf->commitTransaction();
479 $posyafter = $pdf->GetY();
480 $height_note = $posyafter - $tab_top;
481 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
483 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
485 $pdf->AddPage(
'',
'',
true);
488 $pdf->setPage($pageposafternote);
489 if (!empty($tplidx)) {
490 $pdf->useTemplate($tplidx);
492 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
493 $this->
_pagehead($pdf, $object, 0, $outputlangs);
496 $posyafter = $tab_top_newpage;
500 $tab_height = $tab_height - $height_note;
501 $tab_top = $posyafter + 6;
510 $pdf->startTransaction();
511 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
512 $pdf->rollbackTransaction(
true);
514 $nexY = $tab_top + $this->tabTitleHeight;
517 $pageposbeforeprintlines = $pdf->getPage();
518 $pagenb = $pageposbeforeprintlines;
519 for ($i = 0; $i < $nblines; $i++) {
521 $pdf->SetFont(
'',
'', $default_font_size - 1);
522 $pdf->SetTextColor(0, 0, 0);
525 $imglinesize = array();
526 if (!empty($realpatharray[$i])) {
530 $pdf->setTopMargin($tab_top_newpage);
531 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
532 $pageposbefore = $pdf->getPage();
534 $showpricebeforepagebreak = 1;
539 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
540 $pdf->AddPage(
'',
'',
true);
541 if (!empty($tplidx)) {
542 $pdf->useTemplate($tplidx);
544 $pdf->setPage($pageposbefore + 1);
546 $curY = $tab_top_newpage;
549 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
550 $showpricebeforepagebreak = 1;
552 $showpricebeforepagebreak = 0;
556 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
557 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
559 $posYAfterImage = $curY + $imglinesize[
'height'];
565 $pdf->startTransaction();
567 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
568 $pageposafter = $pdf->getPage();
570 if ($pageposafter > $pageposbefore) {
571 $pdf->rollbackTransaction(
true);
572 $pdf->setPageOrientation(
'', 1, $heightforfooter);
574 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
576 $pageposafter = $pdf->getPage();
577 $posyafter = $pdf->GetY();
580 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
581 if ($i == ($nblines - 1)) {
582 $pdf->AddPage(
'',
'',
true);
583 if (!empty($tplidx)) {
584 $pdf->useTemplate($tplidx);
586 $pdf->setPage($pageposafter + 1);
591 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
592 $showpricebeforepagebreak = 1;
594 $showpricebeforepagebreak = 0;
599 $pdf->commitTransaction();
603 $nexY = $pdf->GetY();
604 $pageposafter = $pdf->getPage();
605 $pdf->setPage($pageposbefore);
606 $pdf->setTopMargin($this->marge_haute);
607 $pdf->setPageOrientation(
'', 1, 0);
610 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
611 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
614 $pdf->SetFont(
'',
'', $default_font_size - 1);
624 'outputlangs' => $outputlangs,
625 'hidedetails' => $hidedetails
627 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
632 while ($pagenb < $pageposafter) {
633 $pdf->setPage($pagenb);
634 if ($pagenb == $pageposbeforeprintlines) {
635 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
637 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
639 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
641 $pdf->setPage($pagenb);
642 $pdf->setPageOrientation(
'', 1, 0);
643 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
644 $this->
_pagehead($pdf, $object, 0, $outputlangs);
646 if (!empty($tplidx)) {
647 $pdf->useTemplate($tplidx);
651 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
652 if ($pagenb == $pageposafter) {
653 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
655 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
657 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
660 if (!empty($tplidx)) {
661 $pdf->useTemplate($tplidx);
664 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
665 $this->
_pagehead($pdf, $object, 0, $outputlangs);
671 if ($pagenb == $pageposbeforeprintlines) {
672 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
673 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
675 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
676 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
694 $this->
_pagefoot($pdf, $object, $outputlangs);
695 if (method_exists($pdf,
'AliasNbPages')) {
696 $pdf->AliasNbPages();
701 $pdf->Output($file,
'F');
704 $hookmanager->initHooks(array(
'pdfgeneration'));
705 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
707 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
709 $this->error = $hookmanager->error;
710 $this->errors = $hookmanager->errors;
713 if (!empty($conf->global->MAIN_UMASK)) {
714 @chmod($file, octdec($conf->global->MAIN_UMASK));
717 $this->result = array(
'fullpath'=>$file);
721 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
725 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"FAC_OUTPUTDIR");
741 return parent::liste_modeles($db, $maxfilenamelength);
759 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'', $outputlangsbis =
null)
769 $currency = !empty($currency) ? $currency : $conf->currency;
773 $pdf->SetTextColor(0, 0, 0);
774 $pdf->SetFont(
'',
'', $default_font_size - 2);
776 if (empty($hidetop)) {
778 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
779 $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight,
'F',
null, explode(
',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
783 $pdf->SetDrawColor(128, 128, 128);
784 $pdf->SetFont(
'',
'', $default_font_size - 1);
787 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
790 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
792 if (empty($hidetop)) {
793 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
808 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis =
null)
810 global $conf, $langs;
813 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"companies"));
820 if ($object->statut == $object::STATUS_DRAFT &&
getDolGlobalString(
'RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK')) {
821 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm',
getDolGlobalString(
'RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK'));
824 $pdf->SetTextColor(0, 0, 60);
825 $pdf->SetFont(
'',
'B', $default_font_size + 3);
829 $posy = $this->marge_haute;
830 $posx = $this->page_largeur - $this->marge_droite - $w;
832 $pdf->SetXY($this->marge_gauche, $posy);
836 if ($this->emetteur->logo) {
837 $logodir = $conf->mycompany->dir_output;
838 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
839 $logodir = $conf->mycompany->multidir_output[$object->entity];
842 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
844 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
846 if (is_readable($logo)) {
848 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
850 $pdf->SetTextColor(200, 0, 0);
851 $pdf->SetFont(
'',
'B', $default_font_size - 2);
852 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
853 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
856 $text = $this->emetteur->name;
857 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
861 $pdf->SetFont(
'',
'B', $default_font_size + 3);
862 $pdf->SetXY($posx, $posy);
863 $pdf->SetTextColor(0, 0, 60);
864 $title = $object->label;
869 $pdf->MultiCell($w, 3, $title,
'',
'R');
871 $pdf->SetFont(
'',
'B', $default_font_size);
874 $pdf->SetXY($posx, $posy);
875 $pdf->SetTextColor(0, 0, 60);
876 $textref = $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset($object->ref);
877 if ($object->statut == $object::STATUS_DRAFT) {
878 $pdf->SetTextColor(128, 0, 0);
879 $textref .=
' - '.$outputlangs->transnoentities(
"NotValidated");
881 $pdf->MultiCell($w, 4, $textref,
'',
'R');
884 $pdf->SetFont(
'',
'', $default_font_size - 2);
886 if ($object->ref_client) {
888 $pdf->SetXY($posx, $posy);
889 $pdf->SetTextColor(0, 0, 60);
890 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".
dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65),
'',
'R');
893 if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
894 $object->fetch_projet();
895 if (!empty($object->project->ref)) {
897 $pdf->SetXY($posx, $posy);
898 $pdf->SetTextColor(0, 0, 60);
899 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->projet->title),
'',
'R');
903 if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) {
904 $object->fetch_projet();
905 if (!empty($object->project->ref)) {
907 $pdf->SetXY($posx, $posy);
908 $pdf->SetTextColor(0, 0, 60);
909 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->project->title),
'',
'R');
913 if (!empty($conf->global->PDF_SHOW_PROJECT)) {
914 $object->fetch_projet();
915 if (!empty($object->project->ref)) {
916 $outputlangs->load(
"projects");
918 $pdf->SetXY($posx, $posy);
919 $pdf->SetTextColor(0, 0, 60);
920 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty($object->project->ref) ?
'' : $object->project->ref),
'',
'R');
925 $pdf->SetXY($posx, $posy);
926 $pdf->SetTextColor(0, 0, 60);
928 $title = $outputlangs->transnoentities(
"Date");
929 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
930 $title .=
' - '.$outputlangsbis->transnoentities(
"Date");
932 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date($object->date_creation,
"day",
false, $outputlangs),
'',
'R');
934 if ($object->thirdparty->code_client) {
936 $pdf->SetXY($posx, $posy);
937 $pdf->SetTextColor(0, 0, 60);
938 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
945 $current_y = $pdf->getY();
946 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3,
'R', $default_font_size);
947 if ($current_y < $pdf->getY()) {
948 $top_shift = $pdf->getY() - $current_y;
953 $carac_emetteur =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
956 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
958 $posx = $this->marge_gauche;
959 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
960 $posx = $this->page_largeur - $this->marge_droite - 80;
963 $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
964 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
968 $pdf->SetTextColor(0, 0, 0);
969 $pdf->SetFont(
'',
'', $default_font_size - 2);
970 $pdf->SetXY($posx, $posy - 5);
971 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0,
'L');
972 $pdf->SetXY($posx, $posy);
973 $pdf->SetFillColor(230, 230, 230);
974 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
975 $pdf->SetTextColor(0, 0, 60);
978 $pdf->SetXY($posx + 2, $posy + 3);
979 $pdf->SetFont(
'',
'B', $default_font_size);
980 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
981 $posy = $pdf->getY();
984 $pdf->SetXY($posx + 2, $posy);
985 $pdf->SetFont(
'',
'', $default_font_size - 1);
986 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
990 $arrayidcontact = $object->getIdContact(
'external',
'BILLING');
991 if (count($arrayidcontact) > 0) {
993 $result = $object->fetch_contact($arrayidcontact[0]);
1038 $pdf->SetTextColor(0, 0, 0);
1052 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1055 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1056 return pdf_pagefoot($pdf, $outputlangs,
'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1069 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1071 global $conf, $hookmanager;
1074 $this->defaultContentsFieldsStyle = array(
1076 'padding' => array(1, 0.5, 1, 0.5),
1080 $this->defaultTitlesFieldsStyle = array(
1082 'padding' => array(0.5, 0, 0.5, 0),
1244 $parameters = array(
1245 'object' => $object,
1246 'outputlangs' => $outputlangs,
1247 'hidedetails' => $hidedetails,
1248 'hidedesc' => $hidedesc,
1249 'hideref' => $hideref
1252 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1255 } elseif (empty($reshook)) {
1256 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1258 $this->cols = $hookmanager->resArray;
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
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
Parent class for documents models.
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.
__construct($db)
Constructor.
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=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
print *****$script_file(".$version.") pid 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='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return 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...
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')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
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_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
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.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formated for output on documents.
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.