172 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
175 global $user, $langs,
$conf,
$mysoc, $hookmanager, $nblines;
177 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
179 if (!is_object($outputlangs)) {
180 $outputlangs = $langs;
184 $outputlangs->charset_output =
'ISO-8859-1';
188 $langfiles = array(
"main",
"bills",
"products",
"dict",
"companies",
"compta");
189 $outputlangs->loadLangs($langfiles);
196 global $outputlangsbis;
197 $outputlangsbis =
null;
201 $outputlangsbis->loadLangs($langfiles);
204 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
212 $realpatharray = array();
213 $this->atleastonephoto =
false;
269 if (!empty($dir_output)) {
270 $dir_output .=
'/' .
$object->element;
278 $file = $dir.
"/SPECIMEN.pdf";
281 $dir = $dir_output.
"/".$objectref;
282 $file = $dir.
"/".$objectref.
".pdf";
287 if (!file_exists($dir)) {
289 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
294 if (file_exists($dir)) {
296 if (!is_object($hookmanager)) {
297 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
300 $hookmanager->initHooks(array(
'pdfgeneration'));
301 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
303 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
306 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
310 '@phan-var-force TCPDI|TCPDF $pdf';
312 $pdf->setAutoPageBreak(
true, 0);
314 $heightforinfotot = 50;
316 $heightforfooter = $this->marge_basse + (
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);
318 if (class_exists(
'TCPDF')) {
319 $pdf->setPrintHeader(
false);
320 $pdf->setPrintFooter(
false);
326 $logodir =
$conf->mycompany->dir_output;
327 if (!empty(
$conf->mycompany->multidir_output[
$object->entity ??
$conf->entity])) {
330 $pagecount = $pdf->setSourceFile($logodir.
'/'.
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
331 $tplidx = $pdf->importPage(1);
336 $pdf->SetDrawColor(128, 128, 128);
338 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
339 $pdf->SetSubject($outputlangs->transnoentities(
"PdfTitle"));
340 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
341 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
342 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"PdfTitle").
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name));
344 $pdf->SetCompression(
false);
348 $cert = empty($user->conf->CERTIFICATE_CRT) ?
'' : $user->conf->CERTIFICATE_CRT;
356 'Name' => $this->emetteur->name,
357 'Location' =>
getCountry($this->emetteur->country_code,
''),
358 'Reason' =>
'MYOBJECT',
359 'ContactInfo' => $this->emetteur->email
361 $pdf->setSignature($cert, $cert, $this->emetteur->name,
'', 2, $info);
365 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
370 if (!empty($tplidx)) {
371 $pdf->useTemplate($tplidx);
375 $top_shift = $this->
_pagehead($pdf,
$object, 1, $outputlangs, $outputlangsbis);
376 $pdf->SetFont(
'',
'', $default_font_size - 1);
377 $pdf->MultiCell(0, 3,
'');
378 $pdf->SetTextColor(0, 0, 0);
380 $tab_top = 90 + $top_shift;
381 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
383 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
385 $tab_height_newpage = 150;
387 $tab_height_newpage -= $top_shift;
390 $nexY = $tab_top - 1;
393 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
395 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
396 if (!empty($extranote)) {
400 $pagenb = $pdf->getPage();
404 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
405 $pageposbeforenote = $pagenb;
412 $pdf->startTransaction();
414 $pdf->SetFont(
'',
'', $default_font_size - 1);
415 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
417 $pageposafternote = $pdf->getPage();
418 $posyafter = $pdf->GetY();
420 if ($pageposafternote > $pageposbeforenote) {
421 $pdf->rollbackTransaction(
true);
424 while ($pagenb < $pageposafternote) {
427 if (!empty($tplidx)) {
428 $pdf->useTemplate($tplidx);
434 $pdf->setTopMargin($tab_top_newpage);
436 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
440 $pdf->setPage($pageposbeforenote);
441 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
442 $pdf->SetFont(
'',
'', $default_font_size - 1);
443 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
444 $pageposafternote = $pdf->getPage();
446 $posyafter = $pdf->GetY();
448 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
449 $pdf->AddPage(
'',
'',
true);
452 $pdf->setPage($pageposafternote);
453 $pdf->setTopMargin($tab_top_newpage);
455 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
461 $i = $pageposbeforenote;
462 while ($i < $pageposafternote) {
466 $pdf->SetDrawColor(128, 128, 128);
468 if ($i > $pageposbeforenote) {
469 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
470 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
472 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
473 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
477 $pdf->setPageOrientation(
'',
true, 0);
484 $pdf->setPage($pageposafternote);
485 if (!empty($tplidx)) {
486 $pdf->useTemplate($tplidx);
491 $height_note = $posyafter - $tab_top_newpage;
492 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
495 $pdf->commitTransaction();
496 $posyafter = $pdf->GetY();
497 $height_note = $posyafter - $tab_top;
498 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
501 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
503 $pdf->AddPage(
'',
'',
true);
506 $pdf->setPage($pageposafternote);
507 if (!empty($tplidx)) {
508 $pdf->useTemplate($tplidx);
514 $posyafter = $tab_top_newpage;
518 $tab_height -= $height_note;
519 $tab_top = $posyafter + 6;
528 $pdf->startTransaction();
529 $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
530 $pdf->rollbackTransaction(
true);
532 $nexY = $tab_top + $this->tabTitleHeight;
535 $pageposbeforeprintlines = $pdf->getPage();
536 $pagenb = $pageposbeforeprintlines;
537 for ($i = 0; $i < $nblines; $i++) {
539 $pdf->SetFont(
'',
'', $default_font_size - 1);
540 $pdf->SetTextColor(0, 0, 0);
548 $pdf->setTopMargin($tab_top_newpage);
549 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext + $heightforinfotot);
550 $pageposbefore = $pdf->getPage();
552 $showpricebeforepagebreak = 1;
554 $posYAfterDescription = 0;
584 $pdf->startTransaction();
587 $pageposafter = $pdf->getPage();
589 if ($pageposafter > $pageposbefore) {
590 $pdf->rollbackTransaction(
true);
591 $pageposafter = $pageposbefore;
592 $pdf->setPageOrientation(
'',
true, $heightforfooter);
596 $pageposafter = $pdf->getPage();
597 $posyafter = $pdf->GetY();
599 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
600 if ($i == ($nblines - 1)) {
601 $pdf->AddPage(
'',
'',
true);
602 if (!empty($tplidx)) {
603 $pdf->useTemplate($tplidx);
605 $pdf->setPage($pageposafter + 1);
611 $showpricebeforepagebreak = 1;
613 $showpricebeforepagebreak = 0;
617 $pdf->commitTransaction();
619 $posYAfterDescription = $pdf->GetY();
622 $nexY = max($pdf->GetY(), $posYAfterImage);
625 $pageposafter = $pdf->getPage();
626 $pdf->setPage($pageposbefore);
627 $pdf->setTopMargin($this->marge_haute);
628 $pdf->setPageOrientation(
'',
true, 0);
631 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
632 $pdf->setPage($pageposafter);
633 $curY = $tab_top_newpage;
636 $pdf->SetFont(
'',
'', $default_font_size - 1);
643 $nexY = max($pdf->GetY(), $nexY);
647 if (!empty(
$object->lines[$i]->array_options)) {
648 foreach (
$object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
652 $nexY = max($pdf->GetY(), $nexY);
664 'outputlangs' => $outputlangs,
665 'hidedetails' => $hidedetails
667 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
672 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
675 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
677 $tvaligne = $sign *
$object->lines[$i]->total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
681 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva;
683 $tvaligne = $sign *
$object->lines[$i]->total_tva;
687 $localtax1ligne =
$object->lines[$i]->total_localtax1;
688 $localtax2ligne =
$object->lines[$i]->total_localtax2;
690 $localtax1_rate =
$object->lines[$i]->localtax1_tx;
691 $localtax2_rate =
$object->lines[$i]->localtax2_tx;
692 $localtax1_type =
$object->lines[$i]->localtax1_type;
693 $localtax2_type =
$object->lines[$i]->localtax2_type;
695 $vatrate = (string)
$object->lines[$i]->tva_tx;
698 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
699 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
701 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
702 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
706 if ($localtax1_type && $localtax1ligne != 0) {
707 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
708 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
710 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
713 if ($localtax2_type && $localtax2ligne != 0) {
714 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
715 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
717 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
721 if (((
int)
$object->lines[$i]->info_bits & 0x01) == 0x01) {
726 if (!isset($this->tva[$vatrate])) {
727 $this->tva[$vatrate] = 0;
729 $this->tva[$vatrate] += $tvaligne;
730 $vatcode =
$object->lines[$i]->vat_src_code;
731 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
732 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
734 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
736 $nexY = max($nexY, $posYAfterImage);
739 if (
getDolGlobalInt(
'MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
740 $pdf->setPage($pageposafter);
741 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
743 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
744 $pdf->SetLineStyle(array(
'dash' => 0));
748 while ($pagenb < $pageposafter) {
749 $pdf->setPage($pagenb);
750 if ($pagenb == $pageposbeforeprintlines) {
751 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
753 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
757 $pdf->setPage($pagenb);
758 $pdf->setPageOrientation(
'',
true, 0);
762 if (!empty($tplidx)) {
763 $pdf->useTemplate($tplidx);
767 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
768 if ($pagenb == $pageposafter) {
769 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
771 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
776 if (!empty($tplidx)) {
777 $pdf->useTemplate($tplidx);
787 if ($pagenb == $pageposbeforeprintlines) {
788 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0,
$object->multicurrency_code, $outputlangsbis);
790 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code, $outputlangsbis);
792 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
810 if (method_exists($pdf,
'AliasNbPages')) {
811 $pdf->AliasNbPages();
816 $pdf->Output($file,
'F');
819 $hookmanager->initHooks(array(
'pdfgeneration'));
820 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
822 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
823 $this->warnings = $hookmanager->warnings;
825 $this->error = $hookmanager->error;
826 $this->errors = $hookmanager->errors;
833 $this->result = array(
'fullpath' => $file);
837 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
841 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"FAC_OUTPUTDIR");
932 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null)
935 global
$conf, $langs;
938 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
943 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"companies"));
954 $pdf->SetTextColor(0, 0, 60);
955 $pdf->SetFont(
'',
'B', $default_font_size + 3);
959 $posy = $this->marge_haute;
960 $posx = $this->page_largeur - $this->marge_droite - $w;
962 $pdf->SetXY($this->marge_gauche, $posy);
966 if ($this->emetteur->logo) {
967 $logodir =
$conf->mycompany->dir_output;
972 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
974 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
976 if (is_readable($logo)) {
978 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
980 $pdf->SetTextColor(200, 0, 0);
981 $pdf->SetFont(
'',
'B', $default_font_size - 2);
982 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
983 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
986 $text = $this->emetteur->name;
987 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
991 $pdf->SetFont(
'',
'B', $default_font_size + 3);
992 $pdf->SetXY($posx, $posy);
993 $pdf->SetTextColor(0, 0, 60);
994 $title = $outputlangs->transnoentities(
"PdfTitle");
995 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
997 $title .= $outputlangsbis->transnoentities(
"PdfTitle");
999 $pdf->MultiCell($w, 3, $title,
'',
'R');
1001 $pdf->SetFont(
'',
'B', $default_font_size);
1004 $pdf->SetXY($posx, $posy);
1005 $pdf->SetTextColor(0, 0, 60);
1006 $textref = $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset(
$object->ref);
1007 if (
$object->status == $object::STATUS_DRAFT) {
1008 $pdf->SetTextColor(128, 0, 0);
1009 $textref .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1011 $pdf->MultiCell($w, 4, $textref,
'',
'R');
1014 $pdf->SetFont(
'',
'', $default_font_size - 2);
1017 if (property_exists(
$object,
'ref_client') &&
$object->ref_client) {
1019 $pdf->SetXY($posx, $posy);
1020 $pdf->SetTextColor(0, 0, 60);
1022 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".
pdf_truncate_text($pdf, $outputlangs->convToOutputCharset(
$object->ref_client), 65),
'',
'R');
1027 if (!empty(
$object->project->ref)) {
1029 $pdf->SetXY($posx, $posy);
1030 $pdf->SetTextColor(0, 0, 60);
1031 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1037 if (!empty(
$object->project->ref)) {
1038 $outputlangs->load(
"projects");
1040 $pdf->SetXY($posx, $posy);
1041 $pdf->SetTextColor(0, 0, 60);
1042 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1047 $pdf->SetXY($posx, $posy);
1048 $pdf->SetTextColor(0, 0, 60);
1050 $title = $outputlangs->transnoentities(
"Date");
1051 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1052 $title .=
' - '.$outputlangsbis->transnoentities(
"Date");
1054 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date(
$object->date_creation,
"day",
false, $outputlangs,
true),
'',
'R');
1058 $pdf->SetXY($posx, $posy);
1059 $pdf->SetTextColor(0, 0, 60);
1060 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_client),
'',
'R');
1065 $pdf->SetXY($posx, $posy);
1066 $pdf->SetTextColor(0, 0, 60);
1067 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_compta_client),
'',
'R');
1072 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1073 if (count($arrayidcontact) > 0) {
1074 $usertmp =
new User($this->db);
1075 $usertmp->fetch($arrayidcontact[0]);
1077 $pdf->SetXY($posx, $posy);
1078 $pdf->SetTextColor(0, 0, 60);
1079 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1087 $current_y = $pdf->getY();
1089 if ($current_y < $pdf->getY()) {
1090 $top_shift = $pdf->getY() - $current_y;
1099 $posy += $top_shift;
1100 $posx = $this->marge_gauche;
1102 $posx = $this->page_largeur - $this->marge_droite - 80;
1106 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82;
1111 $pdf->SetTextColor(0, 0, 0);
1112 $pdf->SetFont(
'',
'', $default_font_size - 2);
1113 $pdf->SetXY($posx, $posy - 5);
1114 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0, $ltrdirection);
1115 $pdf->SetXY($posx, $posy);
1116 $pdf->SetFillColor(230, 230, 230);
1117 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R',
true);
1118 $pdf->SetTextColor(0, 0, 60);
1123 $pdf->SetXY($posx + 2, $posy + 3);
1124 $pdf->SetFont(
'',
'B', $default_font_size);
1125 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1126 $posy = $pdf->getY();
1130 $pdf->SetXY($posx + 2, $posy);
1131 $pdf->SetFont(
'',
'', $default_font_size - 1);
1132 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection);
1135 $usecontact =
false;
1136 $arrayidcontact =
$object->getIdContact(
'external',
'BILLING');
1137 if (count($arrayidcontact) > 0) {
1139 $result =
$object->fetch_contact($arrayidcontact[0]);
1144 $thirdparty =
$object->contact;
1146 $thirdparty =
$object->thirdparty;
1149 if (is_object($thirdparty)) {
1152 $carac_client_name =
null;
1159 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100;
1160 if ($this->page_largeur < 210) {
1164 $posy += $top_shift;
1165 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1167 $posx = $this->marge_gauche;
1172 $pdf->SetTextColor(0, 0, 0);
1173 $pdf->SetFont(
'',
'', $default_font_size - 2);
1174 $pdf->SetXY($posx + 2, $posy - 5);
1175 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"To").
":", 0, $ltrdirection);
1176 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1180 $pdf->SetXY($posx + 2, $posy + 3);
1181 $pdf->SetFont(
'',
'B', $default_font_size);
1183 $pdf->MultiCell($widthrecbox, 2, (
string) $carac_client_name, 0, $ltrdirection);
1185 $posy = $pdf->getY();
1188 $pdf->SetFont(
'',
'', $default_font_size - 1);
1189 $pdf->SetXY($posx + 2, $posy);
1191 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1194 $pdf->SetTextColor(0, 0, 0);