34 dol_include_once(
'/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(5, 5);
81 public $version =
'dolibarr';
101 public $marge_gauche;
106 public $marge_droite;
127 public $situationinvoice;
143 global $conf, $langs, $mysoc;
146 $langs->loadLangs(array(
"main",
"bills"));
149 $this->
name =
"standard";
150 $this->
description = $langs->trans(
'DocumentModelStandardPDF');
151 $this->update_main_doc_field = 1;
156 $this->page_largeur = $formatarray[
'width'];
157 $this->page_hauteur = $formatarray[
'height'];
158 $this->format = array($this->page_largeur, $this->page_hauteur);
159 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
160 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
161 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
162 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
164 $this->option_logo = 1;
165 $this->option_tva = 1;
166 $this->option_modereg = 1;
167 $this->option_condreg = 1;
168 $this->option_codeproduitservice = 1;
169 $this->option_multilang = 1;
170 $this->option_escompte = 1;
171 $this->option_credit_note = 1;
172 $this->option_freetext = 1;
173 $this->option_draft_watermark = 1;
176 $this->emetteur = $mysoc;
177 if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2);
180 $this->posxdesc = $this->marge_gauche + 1;
183 $this->tabTitleHeight = 5;
187 $this->tva = array();
188 $this->localtax1 = array();
189 $this->localtax2 = array();
190 $this->atleastoneratenotnull = 0;
191 $this->atleastonediscount = 0;
192 $this->situationinvoice =
false;
208 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
211 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
213 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
215 if (!is_object($outputlangs)) $outputlangs = $langs;
217 if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output =
'ISO-8859-1';
220 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies"));
222 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
223 global $outputlangsbis;
224 $outputlangsbis =
new Translate(
'', $conf);
225 $outputlangsbis->setDefaultLang($conf->global->PDF_USE_ALSO_LANGUAGE_CODE);
226 $outputlangsbis->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies"));
229 $nblines = (is_array($object->lines) ? count($object->lines) : 0);
232 if (!empty($conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE)) {
233 $hidetop = $conf->global->MAIN_PDF_DISABLE_COL_HEAD_TITLE;
237 $realpatharray = array();
238 $this->atleastonephoto =
false;
294 if ($conf->recruitment->dir_output.
'/recruitmentjobposition')
296 $object->fetch_thirdparty();
299 if ($object->specimen)
301 $dir = $conf->recruitment->dir_output.
'/recruitmentjobposition';
302 $file = $dir.
"/SPECIMEN.pdf";
305 $dir = $conf->recruitment->dir_output.
'/recruitmentjobposition/'.$objectref;
306 $file = $dir.
"/".$objectref.
".pdf";
308 if (!file_exists($dir))
312 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
317 if (file_exists($dir))
320 if (!is_object($hookmanager))
322 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
325 $hookmanager->initHooks(array(
'pdfgeneration'));
326 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
328 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
331 $nblines = (is_array($object->lines) ? count($object->lines) : 0);
336 $pdf->SetAutoPageBreak(1, 0);
338 $heightforinfotot = 50;
339 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
340 $heightforfooter = $this->marge_basse + (empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 12 : 22);
342 if (class_exists(
'TCPDF'))
344 $pdf->setPrintHeader(
false);
345 $pdf->setPrintFooter(
false);
350 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
352 $pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
353 $tplidx = $pdf->importPage(1);
358 $pdf->SetDrawColor(128, 128, 128);
360 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
361 $pdf->SetSubject($object->label);
362 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
363 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
364 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$object->label.
" ".$outputlangs->convToOutputCharset($object->thirdparty->name));
365 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(
false);
368 $cert = empty($user->conf->CERTIFICATE_CRT) ?
'' : $user->conf->CERTIFICATE_CRT;
371 $cert = empty($conf->global->CERTIFICATE_CRT) ?
'' : $conf->global->CERTIFICATE_CRT;
376 'Name' => $this->emetteur->name,
377 'Location' =>
getCountry($this->emetteur->country_code, 0),
378 'Reason' =>
'MYOBJECT',
379 'ContactInfo' => $this->emetteur->email
381 $pdf->setSignature($cert, $cert, $this->emetteur->name,
'', 2, $info);
384 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
388 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
391 $top_shift = $this->
_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis);
392 $pdf->SetFont(
'',
'', $default_font_size - 1);
393 $pdf->MultiCell(0, 3,
'');
394 $pdf->SetTextColor(0, 0, 0);
396 $tab_top = 90 + $top_shift;
397 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 + $top_shift : 10);
398 $tab_height = 130 - $top_shift;
399 $tab_height_newpage = 150;
400 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $tab_height_newpage -= $top_shift;
402 $nexY = $tab_top - 1;
405 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
407 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
408 if (!empty($extranote))
413 $pagenb = $pdf->getPage();
418 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
419 $pageposbeforenote = $pagenb;
426 $pdf->startTransaction();
428 $pdf->SetFont(
'',
'', $default_font_size - 1);
429 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
431 $pageposafternote = $pdf->getPage();
432 $posyafter = $pdf->GetY();
434 if ($pageposafternote > $pageposbeforenote)
436 $pdf->rollbackTransaction(
true);
439 while ($pagenb < $pageposafternote) {
442 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
443 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
445 $pdf->setTopMargin($tab_top_newpage);
447 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
451 $pdf->setPage($pageposbeforenote);
452 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
453 $pdf->SetFont(
'',
'', $default_font_size - 1);
454 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
455 $pageposafternote = $pdf->getPage();
457 $posyafter = $pdf->GetY();
459 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20)))
461 $pdf->AddPage(
'',
'',
true);
464 $pdf->setPage($pageposafternote);
465 $pdf->setTopMargin($tab_top_newpage);
467 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
473 $i = $pageposbeforenote;
474 while ($i < $pageposafternote) {
478 $pdf->SetDrawColor(128, 128, 128);
480 if ($i > $pageposbeforenote) {
481 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
482 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
484 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
485 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
489 $pdf->setPageOrientation(
'', 1, 0);
490 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
496 $pdf->setPage($pageposafternote);
497 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
498 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
499 $height_note = $posyafter - $tab_top_newpage;
500 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
503 $pdf->commitTransaction();
504 $posyafter = $pdf->GetY();
505 $height_note = $posyafter - $tab_top;
506 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
508 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20)))
511 $pdf->AddPage(
'',
'',
true);
514 $pdf->setPage($pageposafternote);
515 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
516 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
518 $posyafter = $tab_top_newpage;
522 $tab_height = $tab_height - $height_note;
523 $tab_top = $posyafter + 6;
532 $pdf->startTransaction();
533 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
534 $pdf->rollbackTransaction(
true);
536 $nexY = $tab_top + $this->tabTitleHeight;
539 $pageposbeforeprintlines = $pdf->getPage();
540 $pagenb = $pageposbeforeprintlines;
541 for ($i = 0; $i < $nblines; $i++)
544 $pdf->SetFont(
'',
'', $default_font_size - 1);
545 $pdf->SetTextColor(0, 0, 0);
548 $imglinesize = array();
551 $pdf->setTopMargin($tab_top_newpage);
552 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
553 $pageposbefore = $pdf->getPage();
555 $showpricebeforepagebreak = 1;
561 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
563 $pdf->AddPage(
'',
'',
true);
564 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
565 $pdf->setPage($pageposbefore + 1);
567 $curY = $tab_top_newpage;
570 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
571 $showpricebeforepagebreak = 1;
572 else $showpricebeforepagebreak = 0;
575 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height']))
577 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
579 $posYAfterImage = $curY + $imglinesize[
'height'];
586 $pdf->startTransaction();
588 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
589 $pageposafter = $pdf->getPage();
591 if ($pageposafter > $pageposbefore)
593 $pdf->rollbackTransaction(
true);
594 $pdf->setPageOrientation(
'', 1, $heightforfooter);
596 $this->
printColDescContent($pdf, $curY,
'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
598 $pageposafter = $pdf->getPage();
599 $posyafter = $pdf->GetY();
601 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
603 if ($i == ($nblines - 1))
605 $pdf->AddPage(
'',
'',
true);
606 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
607 $pdf->setPage($pageposafter + 1);
612 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
613 $showpricebeforepagebreak = 1;
614 else $showpricebeforepagebreak = 0;
618 $pdf->commitTransaction();
622 $nexY = $pdf->GetY();
623 $pageposafter = $pdf->getPage();
624 $pdf->setPage($pageposbefore);
625 $pdf->setTopMargin($this->marge_haute);
626 $pdf->setPageOrientation(
'', 1, 0);
629 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
630 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
633 $pdf->SetFont(
'',
'', $default_font_size - 1);
643 'outputlangs' => $outputlangs,
644 'hidedetails' => $hidedetails
646 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
651 while ($pagenb < $pageposafter) {
652 $pdf->setPage($pagenb);
653 if ($pagenb == $pageposbeforeprintlines) {
654 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
656 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
658 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
660 $pdf->setPage($pagenb);
661 $pdf->setPageOrientation(
'', 1, 0);
662 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
665 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
666 if ($pagenb == $pageposafter) {
667 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis);
669 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis);
671 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
674 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
676 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
681 if ($pagenb == $pageposbeforeprintlines)
683 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis);
684 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
686 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis);
687 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
705 $this->
_pagefoot($pdf, $object, $outputlangs);
706 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
710 $pdf->Output($file,
'F');
713 $hookmanager->initHooks(array(
'pdfgeneration'));
714 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
716 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
719 $this->error = $hookmanager->error;
720 $this->errors = $hookmanager->errors;
723 if (!empty($conf->global->MAIN_UMASK))
724 @chmod($file, octdec($conf->global->MAIN_UMASK));
726 $this->result = array(
'fullpath'=>$file);
730 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
734 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"FAC_OUTPUTDIR");
750 return parent::liste_modeles($db, $maxfilenamelength);
768 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency =
'', $outputlangsbis = null)
774 if ($hidetop) $hidetop = -1;
776 $currency = !empty($currency) ? $currency : $conf->currency;
780 $pdf->SetTextColor(0, 0, 0);
781 $pdf->SetFont(
'',
'', $default_font_size - 2);
786 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
787 $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));
791 $pdf->SetDrawColor(128, 128, 128);
792 $pdf->SetFont(
'',
'', $default_font_size - 1);
795 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
798 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
800 if (empty($hidetop)) {
801 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
816 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null)
818 global $conf, $langs;
821 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"companies"));
828 if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK)))
830 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
833 $pdf->SetTextColor(0, 0, 60);
834 $pdf->SetFont(
'',
'B', $default_font_size + 3);
838 $posy = $this->marge_haute;
839 $posx = $this->page_largeur - $this->marge_droite - $w;
841 $pdf->SetXY($this->marge_gauche, $posy);
844 if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO))
846 if ($this->emetteur->logo)
848 $logodir = $conf->mycompany->dir_output;
849 if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
850 if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
852 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
854 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
856 if (is_readable($logo))
859 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
861 $pdf->SetTextColor(200, 0, 0);
862 $pdf->SetFont(
'',
'B', $default_font_size - 2);
863 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
864 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
867 $text = $this->emetteur->name;
868 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
872 $pdf->SetFont(
'',
'B', $default_font_size + 3);
873 $pdf->SetXY($posx, $posy);
874 $pdf->SetTextColor(0, 0, 60);
875 $title = $object->label;
880 $pdf->MultiCell($w, 3, $title,
'',
'R');
882 $pdf->SetFont(
'',
'B', $default_font_size);
885 $pdf->SetXY($posx, $posy);
886 $pdf->SetTextColor(0, 0, 60);
887 $textref = $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset($object->ref);
888 if ($object->statut == $object::STATUS_DRAFT)
890 $pdf->SetTextColor(128, 0, 0);
891 $textref .=
' - '.$outputlangs->transnoentities(
"NotValidated");
893 $pdf->MultiCell($w, 4, $textref,
'',
'R');
896 $pdf->SetFont(
'',
'', $default_font_size - 2);
898 if ($object->ref_client)
901 $pdf->SetXY($posx, $posy);
902 $pdf->SetTextColor(0, 0, 60);
903 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".$outputlangs->convToOutputCharset($object->ref_client),
'',
'R');
906 if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE))
908 $object->fetch_projet();
909 if (!empty($object->project->ref))
912 $pdf->SetXY($posx, $posy);
913 $pdf->SetTextColor(0, 0, 60);
914 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty($object->project->title) ?
'' : $object->projet->title),
'',
'R');
918 if (!empty($conf->global->PDF_SHOW_PROJECT))
920 $object->fetch_projet();
921 if (!empty($object->project->ref))
924 $pdf->SetXY($posx, $posy);
925 $pdf->SetTextColor(0, 0, 60);
926 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty($object->project->ref) ?
'' : $object->projet->ref),
'',
'R');
931 $pdf->SetXY($posx, $posy);
932 $pdf->SetTextColor(0, 0, 60);
934 $title = $outputlangs->transnoentities(
"Date");
935 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
936 $title .=
' - '.$outputlangsbis->transnoentities(
"Date");
938 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date($object->date_creation,
"day",
false, $outputlangs),
'',
'R');
940 if ($object->thirdparty->code_client)
943 $pdf->SetXY($posx, $posy);
944 $pdf->SetTextColor(0, 0, 60);
945 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
952 $current_y = $pdf->getY();
953 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3,
'R', $default_font_size);
954 if ($current_y < $pdf->getY())
956 $top_shift = $pdf->getY() - $current_y;
962 $carac_emetteur =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
965 $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
967 $posx = $this->marge_gauche;
968 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
970 $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
971 $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
975 $pdf->SetTextColor(0, 0, 0);
976 $pdf->SetFont(
'',
'', $default_font_size - 2);
977 $pdf->SetXY($posx, $posy - 5);
978 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0,
'L');
979 $pdf->SetXY($posx, $posy);
980 $pdf->SetFillColor(230, 230, 230);
981 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
982 $pdf->SetTextColor(0, 0, 60);
985 $pdf->SetXY($posx + 2, $posy + 3);
986 $pdf->SetFont(
'',
'B', $default_font_size);
987 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
988 $posy = $pdf->getY();
991 $pdf->SetXY($posx + 2, $posy);
992 $pdf->SetFont(
'',
'', $default_font_size - 1);
993 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
997 $arrayidcontact = $object->getIdContact(
'external',
'BILLING');
998 if (count($arrayidcontact) > 0)
1001 $result = $object->fetch_contact($arrayidcontact[0]);
1046 $pdf->SetTextColor(0, 0, 0);
1060 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
1063 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1064 return pdf_pagefoot($pdf, $outputlangs,
'INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
1077 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
1079 global $conf, $hookmanager;
1082 $this->defaultContentsFieldsStyle = array(
1084 'padding' => array(1, 0.5, 1, 0.5),
1088 $this->defaultTitlesFieldsStyle = array(
1090 'padding' => array(0.5, 0, 0.5, 0),
1252 $parameters = array(
1253 'object' => $object,
1254 'outputlangs' => $outputlangs,
1255 'hidedetails' => $hidedetails,
1256 'hidedesc' => $hidedesc,
1257 'hideref' => $hideref
1260 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1264 } elseif (empty($reshook))
1266 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1268 $this->cols = $hookmanager->resArray;
pdf_getFormat(Translate $outputlangs=null, $mode= 'setup')
Return array with format properties of default PDF format.
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
__construct($db)
Constructor.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
printColDescContent($pdf, &$curY, $colKey, $object, $i, $outputlangs, $hideref=0, $hidedesc=0, $issupplierline=0)
print description column content
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency= '', $outputlangsbis=null)
Show table for lines.
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...
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
$conf db name
Only used if Module[ID]Name translation string is not found.
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...
$conf db
API class for accounts.
getColumnStatus($colKey)
get column status from column key
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
write_file($object, $outputlangs, $srctemplatepath= '', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
Class to manage PDF template standard_recruitmentjobposition.
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
convertBackOfficeMediasLinksToPublicLinks($notetoshow)
Convert links to local wrapper to medias files into a string into a public external URL readable on i...
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects 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_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany= '', $targetcontact= '', $usecontact=0, $mode= 'source', $object=null)
Return a string with full address formated for output on documents.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Parent class for documents models.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
_pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis=null)
Show top header of page.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
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...