178 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
181 global $user, $langs,
$conf,
$mysoc, $hookmanager, $nblines;
183 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
185 if (!is_object($outputlangs)) {
186 $outputlangs = $langs;
190 $outputlangs->charset_output =
'ISO-8859-1';
194 $langfiles = array(
"main",
"bills",
"products",
"dict",
"companies",
"compta");
195 $outputlangs->loadLangs($langfiles);
202 global $outputlangsbis;
203 $outputlangsbis =
null;
207 $outputlangsbis->loadLangs($langfiles);
210 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
218 $realpatharray = array();
219 $this->atleastonephoto =
false;
275 if (!empty($dir_output)) {
276 $dir_output .=
'/' .
$object->element;
284 $file = $dir.
"/SPECIMEN.pdf";
287 $dir = $dir_output.
"/".$objectref;
288 $file = $dir.
"/".$objectref.
".pdf";
293 if (!file_exists($dir)) {
295 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
300 if (file_exists($dir)) {
302 if (!is_object($hookmanager)) {
303 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
306 $hookmanager->initHooks(array(
'pdfgeneration'));
307 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
309 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
312 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
316 '@phan-var-force TCPDI|TCPDF $pdf';
318 $pdf->setAutoPageBreak(
true, 0);
320 $heightforinfotot = 50;
322 $heightforfooter = $this->marge_basse + (
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);
324 if (class_exists(
'TCPDF')) {
325 $pdf->setPrintHeader(
false);
326 $pdf->setPrintFooter(
false);
332 $logodir =
$conf->mycompany->dir_output;
333 if (!empty(
$conf->mycompany->multidir_output[
$object->entity ??
$conf->entity])) {
336 $pagecount = $pdf->setSourceFile($logodir.
'/'.
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
337 $tplidx = $pdf->importPage(1);
342 $pdf->SetDrawColor(128, 128, 128);
344 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
345 $pdf->SetSubject($outputlangs->transnoentities(
"PdfTitle"));
346 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
347 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
348 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"PdfTitle").
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name));
350 $pdf->SetCompression(
false);
354 $cert = empty($user->conf->CERTIFICATE_CRT) ?
'' : $user->conf->CERTIFICATE_CRT;
362 'Name' => $this->emetteur->name,
363 'Location' =>
getCountry($this->emetteur->country_code,
''),
364 'Reason' =>
'MYOBJECT',
365 'ContactInfo' => $this->emetteur->email
367 $pdf->setSignature($cert, $cert, $this->emetteur->name,
'', 2, $info);
371 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
376 if (!empty($tplidx)) {
377 $pdf->useTemplate($tplidx);
381 $top_shift = $this->
_pagehead($pdf,
$object, 1, $outputlangs, $outputlangsbis);
382 $pdf->SetFont(
'',
'', $default_font_size - 1);
383 $pdf->MultiCell(0, 3,
'');
384 $pdf->SetTextColor(0, 0, 0);
386 $tab_top = 90 + $top_shift;
387 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
389 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
391 $tab_height_newpage = 150;
393 $tab_height_newpage -= $top_shift;
396 $nexY = $tab_top - 1;
399 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
401 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
402 if (!empty($extranote)) {
406 $pagenb = $pdf->getPage();
410 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
411 $pageposbeforenote = $pagenb;
418 $pdf->startTransaction();
420 $pdf->SetFont(
'',
'', $default_font_size - 1);
421 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
423 $pageposafternote = $pdf->getPage();
424 $posyafter = $pdf->GetY();
426 if ($pageposafternote > $pageposbeforenote) {
427 $pdf->rollbackTransaction(
true);
430 while ($pagenb < $pageposafternote) {
433 if (!empty($tplidx)) {
434 $pdf->useTemplate($tplidx);
440 $pdf->setTopMargin($tab_top_newpage);
442 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
446 $pdf->setPage($pageposbeforenote);
447 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
448 $pdf->SetFont(
'',
'', $default_font_size - 1);
449 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
450 $pageposafternote = $pdf->getPage();
452 $posyafter = $pdf->GetY();
454 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
455 $pdf->AddPage(
'',
'',
true);
458 $pdf->setPage($pageposafternote);
459 $pdf->setTopMargin($tab_top_newpage);
461 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
467 $i = $pageposbeforenote;
468 while ($i < $pageposafternote) {
472 $pdf->SetDrawColor(128, 128, 128);
474 if ($i > $pageposbeforenote) {
475 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
476 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
478 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
479 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
483 $pdf->setPageOrientation(
'',
true, 0);
490 $pdf->setPage($pageposafternote);
491 if (!empty($tplidx)) {
492 $pdf->useTemplate($tplidx);
497 $height_note = $posyafter - $tab_top_newpage;
498 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
501 $pdf->commitTransaction();
502 $posyafter = $pdf->GetY();
503 $height_note = $posyafter - $tab_top;
504 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
507 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
509 $pdf->AddPage(
'',
'',
true);
512 $pdf->setPage($pageposafternote);
513 if (!empty($tplidx)) {
514 $pdf->useTemplate($tplidx);
520 $posyafter = $tab_top_newpage;
524 $tab_height -= $height_note;
525 $tab_top = $posyafter + 6;
534 $pdf->startTransaction();
535 $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
536 $pdf->rollbackTransaction(
true);
538 $nexY = $tab_top + $this->tabTitleHeight;
541 $pageposbeforeprintlines = $pdf->getPage();
542 $pagenb = $pageposbeforeprintlines;
543 for ($i = 0; $i < $nblines; $i++) {
545 $pdf->SetFont(
'',
'', $default_font_size - 1);
546 $pdf->SetTextColor(0, 0, 0);
554 $pdf->setTopMargin($tab_top_newpage);
555 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext + $heightforinfotot);
556 $pageposbefore = $pdf->getPage();
558 $showpricebeforepagebreak = 1;
560 $posYAfterDescription = 0;
590 $pdf->startTransaction();
593 $pageposafter = $pdf->getPage();
595 if ($pageposafter > $pageposbefore) {
596 $pdf->rollbackTransaction(
true);
597 $pageposafter = $pageposbefore;
598 $pdf->setPageOrientation(
'',
true, $heightforfooter);
602 $pageposafter = $pdf->getPage();
603 $posyafter = $pdf->GetY();
605 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
606 if ($i == ($nblines - 1)) {
607 $pdf->AddPage(
'',
'',
true);
608 if (!empty($tplidx)) {
609 $pdf->useTemplate($tplidx);
611 $pdf->setPage($pageposafter + 1);
617 $showpricebeforepagebreak = 1;
619 $showpricebeforepagebreak = 0;
623 $pdf->commitTransaction();
625 $posYAfterDescription = $pdf->GetY();
628 $nexY = max($pdf->GetY(), $posYAfterImage);
631 $pageposafter = $pdf->getPage();
632 $pdf->setPage($pageposbefore);
633 $pdf->setTopMargin($this->marge_haute);
634 $pdf->setPageOrientation(
'',
true, 0);
637 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
638 $pdf->setPage($pageposafter);
639 $curY = $tab_top_newpage;
642 $pdf->SetFont(
'',
'', $default_font_size - 1);
649 $nexY = max($pdf->GetY(), $nexY);
653 if (!empty(
$object->lines[$i]->array_options)) {
654 foreach (
$object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
658 $nexY = max($pdf->GetY(), $nexY);
670 'outputlangs' => $outputlangs,
671 'hidedetails' => $hidedetails
673 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
678 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
681 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
683 $tvaligne = $sign *
$object->lines[$i]->total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
687 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva;
689 $tvaligne = $sign *
$object->lines[$i]->total_tva;
693 $localtax1ligne =
$object->lines[$i]->total_localtax1;
694 $localtax2ligne =
$object->lines[$i]->total_localtax2;
696 $localtax1_rate =
$object->lines[$i]->localtax1_tx;
697 $localtax2_rate =
$object->lines[$i]->localtax2_tx;
698 $localtax1_type =
$object->lines[$i]->localtax1_type;
699 $localtax2_type =
$object->lines[$i]->localtax2_type;
701 $vatrate = (string)
$object->lines[$i]->tva_tx;
704 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
705 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
707 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
708 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
712 if ($localtax1_type && $localtax1ligne != 0) {
713 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
714 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
716 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
719 if ($localtax2_type && $localtax2ligne != 0) {
720 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
721 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
723 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
727 if (((
int)
$object->lines[$i]->info_bits & 0x01) == 0x01) {
732 if (!isset($this->tva[$vatrate])) {
733 $this->tva[$vatrate] = 0;
735 $this->tva[$vatrate] += $tvaligne;
736 $vatcode =
$object->lines[$i]->vat_src_code;
737 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
738 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
740 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
742 $nexY = max($nexY, $posYAfterImage);
745 if (
getDolGlobalInt(
'MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
746 $pdf->setPage($pageposafter);
747 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
749 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
750 $pdf->SetLineStyle(array(
'dash' => 0));
754 while ($pagenb < $pageposafter) {
755 $pdf->setPage($pagenb);
756 if ($pagenb == $pageposbeforeprintlines) {
757 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
759 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
763 $pdf->setPage($pagenb);
764 $pdf->setPageOrientation(
'',
true, 0);
768 if (!empty($tplidx)) {
769 $pdf->useTemplate($tplidx);
773 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
774 if ($pagenb == $pageposafter) {
775 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
777 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
782 if (!empty($tplidx)) {
783 $pdf->useTemplate($tplidx);
793 if ($pagenb == $pageposbeforeprintlines) {
794 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0,
$object->multicurrency_code, $outputlangsbis);
796 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code, $outputlangsbis);
798 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
816 if (method_exists($pdf,
'AliasNbPages')) {
817 $pdf->AliasNbPages();
822 $pdf->Output($file,
'F');
825 $hookmanager->initHooks(array(
'pdfgeneration'));
826 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
828 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
829 $this->warnings = $hookmanager->warnings;
831 $this->error = $hookmanager->error;
832 $this->errors = $hookmanager->errors;
839 $this->result = array(
'fullpath' => $file);
843 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
847 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"FAC_OUTPUTDIR");
938 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null)
941 global
$conf, $langs;
944 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
949 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"companies"));
960 $pdf->SetTextColor(0, 0, 60);
961 $pdf->SetFont(
'',
'B', $default_font_size + 3);
965 $posy = $this->marge_haute;
966 $posx = $this->page_largeur - $this->marge_droite - $w;
968 $pdf->SetXY($this->marge_gauche, $posy);
972 if ($this->emetteur->logo) {
973 $logodir =
$conf->mycompany->dir_output;
978 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
980 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
982 if (is_readable($logo)) {
984 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
986 $pdf->SetTextColor(200, 0, 0);
987 $pdf->SetFont(
'',
'B', $default_font_size - 2);
988 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
989 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
992 $text = $this->emetteur->name;
993 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
997 $pdf->SetFont(
'',
'B', $default_font_size + 3);
998 $pdf->SetXY($posx, $posy);
999 $pdf->SetTextColor(0, 0, 60);
1000 $title = $outputlangs->transnoentities(
"PdfTitle");
1001 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1003 $title .= $outputlangsbis->transnoentities(
"PdfTitle");
1005 $pdf->MultiCell($w, 3, $title,
'',
'R');
1007 $pdf->SetFont(
'',
'B', $default_font_size);
1010 $pdf->SetXY($posx, $posy);
1011 $pdf->SetTextColor(0, 0, 60);
1012 $textref = $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset(
$object->ref);
1013 if (
$object->status == $object::STATUS_DRAFT) {
1014 $pdf->SetTextColor(128, 0, 0);
1015 $textref .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1017 $pdf->MultiCell($w, 4, $textref,
'',
'R');
1020 $pdf->SetFont(
'',
'', $default_font_size - 2);
1023 if (property_exists(
$object,
'ref_client') &&
$object->ref_client) {
1025 $pdf->SetXY($posx, $posy);
1026 $pdf->SetTextColor(0, 0, 60);
1028 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".
pdf_truncate_text($pdf, $outputlangs->convToOutputCharset(
$object->ref_client), 65),
'',
'R');
1033 if (!empty(
$object->project->ref)) {
1035 $pdf->SetXY($posx, $posy);
1036 $pdf->SetTextColor(0, 0, 60);
1037 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1043 if (!empty(
$object->project->ref)) {
1044 $outputlangs->load(
"projects");
1046 $pdf->SetXY($posx, $posy);
1047 $pdf->SetTextColor(0, 0, 60);
1048 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1053 $pdf->SetXY($posx, $posy);
1054 $pdf->SetTextColor(0, 0, 60);
1056 $title = $outputlangs->transnoentities(
"Date");
1057 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1058 $title .=
' - '.$outputlangsbis->transnoentities(
"Date");
1060 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date(
$object->date_creation,
"day",
false, $outputlangs,
true),
'',
'R');
1064 $pdf->SetXY($posx, $posy);
1065 $pdf->SetTextColor(0, 0, 60);
1066 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_client),
'',
'R');
1071 $pdf->SetXY($posx, $posy);
1072 $pdf->SetTextColor(0, 0, 60);
1073 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_compta_client),
'',
'R');
1078 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1079 if (count($arrayidcontact) > 0) {
1080 $usertmp =
new User($this->db);
1081 $usertmp->fetch($arrayidcontact[0]);
1083 $pdf->SetXY($posx, $posy);
1084 $pdf->SetTextColor(0, 0, 60);
1085 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1093 $current_y = $pdf->getY();
1095 if ($current_y < $pdf->getY()) {
1096 $top_shift = $pdf->getY() - $current_y;
1105 $posy += $top_shift;
1106 $posx = $this->marge_gauche;
1108 $posx = $this->page_largeur - $this->marge_droite - 80;
1112 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82;
1117 $pdf->SetTextColor(0, 0, 0);
1118 $pdf->SetFont(
'',
'', $default_font_size - 2);
1119 $pdf->SetXY($posx, $posy - 5);
1120 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0, $ltrdirection);
1121 $pdf->SetXY($posx, $posy);
1122 $pdf->SetFillColor(230, 230, 230);
1123 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R',
true);
1124 $pdf->SetTextColor(0, 0, 60);
1129 $pdf->SetXY($posx + 2, $posy + 3);
1130 $pdf->SetFont(
'',
'B', $default_font_size);
1131 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1132 $posy = $pdf->getY();
1136 $pdf->SetXY($posx + 2, $posy);
1137 $pdf->SetFont(
'',
'', $default_font_size - 1);
1138 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection);
1141 $usecontact =
false;
1142 $arrayidcontact =
$object->getIdContact(
'external',
'BILLING');
1143 if (count($arrayidcontact) > 0) {
1145 $result =
$object->fetch_contact($arrayidcontact[0]);
1150 $thirdparty =
$object->contact;
1152 $thirdparty =
$object->thirdparty;
1155 if (is_object($thirdparty)) {
1158 $carac_client_name =
null;
1165 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100;
1166 if ($this->page_largeur < 210) {
1170 $posy += $top_shift;
1171 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1173 $posx = $this->marge_gauche;
1178 $pdf->SetTextColor(0, 0, 0);
1179 $pdf->SetFont(
'',
'', $default_font_size - 2);
1180 $pdf->SetXY($posx + 2, $posy - 5);
1181 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"To").
":", 0, $ltrdirection);
1182 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1186 $pdf->SetXY($posx + 2, $posy + 3);
1187 $pdf->SetFont(
'',
'B', $default_font_size);
1189 $pdf->MultiCell($widthrecbox, 2, (
string) $carac_client_name, 0, $ltrdirection);
1191 $posy = $pdf->getY();
1194 $pdf->SetFont(
'',
'', $default_font_size - 1);
1195 $pdf->SetXY($posx + 2, $posy);
1197 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1200 $pdf->SetTextColor(0, 0, 0);