171 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
174 global $user, $langs,
$conf,
$mysoc, $hookmanager, $nblines;
176 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
178 if (!is_object($outputlangs)) {
179 $outputlangs = $langs;
183 $outputlangs->charset_output =
'ISO-8859-1';
187 $langfiles = array(
"main",
"bills",
"products",
"dict",
"companies",
"compta");
188 $outputlangs->loadLangs($langfiles);
195 global $outputlangsbis;
196 $outputlangsbis =
null;
200 $outputlangsbis->loadLangs($langfiles);
203 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
211 $realpatharray = array();
212 $this->atleastonephoto =
false;
268 if (!empty($dir_output)) {
269 $dir_output .=
'/' .
$object->element;
277 $file = $dir.
"/SPECIMEN.pdf";
280 $dir = $dir_output.
"/".$objectref;
281 $file = $dir.
"/".$objectref.
".pdf";
286 if (!file_exists($dir)) {
288 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
293 if (file_exists($dir)) {
295 if (!is_object($hookmanager)) {
296 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
299 $hookmanager->initHooks(array(
'pdfgeneration'));
300 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
302 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
305 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
309 '@phan-var-force TCPDI|TCPDF $pdf';
311 $pdf->setAutoPageBreak(
true, 0);
313 $heightforinfotot = 50;
315 $heightforfooter = $this->marge_basse + (
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);
317 if (class_exists(
'TCPDF')) {
318 $pdf->setPrintHeader(
false);
319 $pdf->setPrintFooter(
false);
325 $logodir =
$conf->mycompany->dir_output;
326 if (!empty(
$conf->mycompany->multidir_output[
$object->entity ??
$conf->entity])) {
329 $pagecount = $pdf->setSourceFile($logodir.
'/'.
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
330 $tplidx = $pdf->importPage(1);
335 $pdf->SetDrawColor(128, 128, 128);
337 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
338 $pdf->SetSubject($outputlangs->transnoentities(
"PdfTitle"));
339 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
340 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
341 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"PdfTitle").
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name));
343 $pdf->SetCompression(
false);
347 $cert = empty($user->conf->CERTIFICATE_CRT) ?
'' : $user->conf->CERTIFICATE_CRT;
355 'Name' => $this->emetteur->name,
356 'Location' =>
getCountry($this->emetteur->country_code,
''),
357 'Reason' =>
'MYOBJECT',
358 'ContactInfo' => $this->emetteur->email
360 $pdf->setSignature($cert, $cert, $this->emetteur->name,
'', 2, $info);
364 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
369 if (!empty($tplidx)) {
370 $pdf->useTemplate($tplidx);
374 $top_shift = $this->
_pagehead($pdf,
$object, 1, $outputlangs, $outputlangsbis);
375 $pdf->SetFont(
'',
'', $default_font_size - 1);
376 $pdf->MultiCell(0, 3,
'');
377 $pdf->SetTextColor(0, 0, 0);
379 $tab_top = 90 + $top_shift;
380 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
382 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
384 $tab_height_newpage = 150;
386 $tab_height_newpage -= $top_shift;
389 $nexY = $tab_top - 1;
392 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
394 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
395 if (!empty($extranote)) {
399 $pagenb = $pdf->getPage();
403 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
404 $pageposbeforenote = $pagenb;
411 $pdf->startTransaction();
413 $pdf->SetFont(
'',
'', $default_font_size - 1);
414 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
416 $pageposafternote = $pdf->getPage();
417 $posyafter = $pdf->GetY();
419 if ($pageposafternote > $pageposbeforenote) {
420 $pdf->rollbackTransaction(
true);
423 while ($pagenb < $pageposafternote) {
426 if (!empty($tplidx)) {
427 $pdf->useTemplate($tplidx);
433 $pdf->setTopMargin($tab_top_newpage);
435 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
439 $pdf->setPage($pageposbeforenote);
440 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
441 $pdf->SetFont(
'',
'', $default_font_size - 1);
442 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
443 $pageposafternote = $pdf->getPage();
445 $posyafter = $pdf->GetY();
447 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
448 $pdf->AddPage(
'',
'',
true);
451 $pdf->setPage($pageposafternote);
452 $pdf->setTopMargin($tab_top_newpage);
454 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
460 $i = $pageposbeforenote;
461 while ($i < $pageposafternote) {
465 $pdf->SetDrawColor(128, 128, 128);
467 if ($i > $pageposbeforenote) {
468 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
469 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
471 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
472 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
476 $pdf->setPageOrientation(
'',
true, 0);
483 $pdf->setPage($pageposafternote);
484 if (!empty($tplidx)) {
485 $pdf->useTemplate($tplidx);
490 $height_note = $posyafter - $tab_top_newpage;
491 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
494 $pdf->commitTransaction();
495 $posyafter = $pdf->GetY();
496 $height_note = $posyafter - $tab_top;
497 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
500 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
502 $pdf->AddPage(
'',
'',
true);
505 $pdf->setPage($pageposafternote);
506 if (!empty($tplidx)) {
507 $pdf->useTemplate($tplidx);
513 $posyafter = $tab_top_newpage;
517 $tab_height -= $height_note;
518 $tab_top = $posyafter + 6;
527 $pdf->startTransaction();
528 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
529 $pdf->rollbackTransaction(
true);
531 $nexY = $tab_top + $this->tabTitleHeight;
534 $pageposbeforeprintlines = $pdf->getPage();
535 $pagenb = $pageposbeforeprintlines;
536 for ($i = 0; $i < $nblines; $i++) {
538 $pdf->SetFont(
'',
'', $default_font_size - 1);
539 $pdf->SetTextColor(0, 0, 0);
547 $pdf->setTopMargin($tab_top_newpage);
548 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext + $heightforinfotot);
549 $pageposbefore = $pdf->getPage();
551 $showpricebeforepagebreak = 1;
553 $posYAfterDescription = 0;
583 $pdf->startTransaction();
586 $pageposafter = $pdf->getPage();
588 if ($pageposafter > $pageposbefore) {
589 $pdf->rollbackTransaction(
true);
590 $pageposafter = $pageposbefore;
591 $pdf->setPageOrientation(
'',
true, $heightforfooter);
595 $pageposafter = $pdf->getPage();
596 $posyafter = $pdf->GetY();
598 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
599 if ($i == ($nblines - 1)) {
600 $pdf->AddPage(
'',
'',
true);
601 if (!empty($tplidx)) {
602 $pdf->useTemplate($tplidx);
604 $pdf->setPage($pageposafter + 1);
610 $showpricebeforepagebreak = 1;
612 $showpricebeforepagebreak = 0;
616 $pdf->commitTransaction();
618 $posYAfterDescription = $pdf->GetY();
621 $nexY = max($pdf->GetY(), $posYAfterImage);
624 $pageposafter = $pdf->getPage();
625 $pdf->setPage($pageposbefore);
626 $pdf->setTopMargin($this->marge_haute);
627 $pdf->setPageOrientation(
'',
true, 0);
630 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
631 $pdf->setPage($pageposafter);
632 $curY = $tab_top_newpage;
635 $pdf->SetFont(
'',
'', $default_font_size - 1);
642 $nexY = max($pdf->GetY(), $nexY);
646 if (!empty(
$object->lines[$i]->array_options)) {
647 foreach (
$object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
651 $nexY = max($pdf->GetY(), $nexY);
663 'outputlangs' => $outputlangs,
664 'hidedetails' => $hidedetails
666 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
671 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
674 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
676 $tvaligne = $sign *
$object->lines[$i]->total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
680 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva;
682 $tvaligne = $sign *
$object->lines[$i]->total_tva;
686 $localtax1ligne =
$object->lines[$i]->total_localtax1;
687 $localtax2ligne =
$object->lines[$i]->total_localtax2;
689 $localtax1_rate =
$object->lines[$i]->localtax1_tx;
690 $localtax2_rate =
$object->lines[$i]->localtax2_tx;
691 $localtax1_type =
$object->lines[$i]->localtax1_type;
692 $localtax2_type =
$object->lines[$i]->localtax2_type;
697 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
698 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
700 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
701 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
705 if ($localtax1_type && $localtax1ligne != 0) {
706 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
707 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
709 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
712 if ($localtax2_type && $localtax2ligne != 0) {
713 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
714 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
716 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
720 if (((
int)
$object->lines[$i]->info_bits & 0x01) == 0x01) {
725 if (!isset($this->tva[$vatrate])) {
726 $this->tva[$vatrate] = 0;
728 $this->tva[$vatrate] += $tvaligne;
729 $vatcode =
$object->lines[$i]->vat_src_code;
730 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
731 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
733 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
735 $nexY = max($nexY, $posYAfterImage);
738 if (
getDolGlobalInt(
'MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
739 $pdf->setPage($pageposafter);
740 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
742 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
743 $pdf->SetLineStyle(array(
'dash' => 0));
747 while ($pagenb < $pageposafter) {
748 $pdf->setPage($pagenb);
749 if ($pagenb == $pageposbeforeprintlines) {
750 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
752 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
756 $pdf->setPage($pagenb);
757 $pdf->setPageOrientation(
'',
true, 0);
761 if (!empty($tplidx)) {
762 $pdf->useTemplate($tplidx);
766 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
767 if ($pagenb == $pageposafter) {
768 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
770 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
775 if (!empty($tplidx)) {
776 $pdf->useTemplate($tplidx);
786 if ($pagenb == $pageposbeforeprintlines) {
787 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0,
$object->multicurrency_code, $outputlangsbis);
789 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code, $outputlangsbis);
791 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
809 if (method_exists($pdf,
'AliasNbPages')) {
810 $pdf->AliasNbPages();
815 $pdf->Output($file,
'F');
818 $hookmanager->initHooks(array(
'pdfgeneration'));
819 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
821 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
822 $this->warnings = $hookmanager->warnings;
824 $this->error = $hookmanager->error;
825 $this->errors = $hookmanager->errors;
832 $this->result = array(
'fullpath' => $file);
836 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
840 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"FAC_OUTPUTDIR");
931 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null)
934 global
$conf, $langs;
937 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
942 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"companies"));
953 $pdf->SetTextColor(0, 0, 60);
954 $pdf->SetFont(
'',
'B', $default_font_size + 3);
958 $posy = $this->marge_haute;
959 $posx = $this->page_largeur - $this->marge_droite - $w;
961 $pdf->SetXY($this->marge_gauche, $posy);
965 if ($this->emetteur->logo) {
966 $logodir =
$conf->mycompany->dir_output;
971 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
973 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
975 if (is_readable($logo)) {
977 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
979 $pdf->SetTextColor(200, 0, 0);
980 $pdf->SetFont(
'',
'B', $default_font_size - 2);
981 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
982 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
985 $text = $this->emetteur->name;
986 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
990 $pdf->SetFont(
'',
'B', $default_font_size + 3);
991 $pdf->SetXY($posx, $posy);
992 $pdf->SetTextColor(0, 0, 60);
993 $title = $outputlangs->transnoentities(
"PdfTitle");
994 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
996 $title .= $outputlangsbis->transnoentities(
"PdfTitle");
998 $pdf->MultiCell($w, 3, $title,
'',
'R');
1000 $pdf->SetFont(
'',
'B', $default_font_size);
1003 $pdf->SetXY($posx, $posy);
1004 $pdf->SetTextColor(0, 0, 60);
1005 $textref = $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset(
$object->ref);
1006 if (
$object->status == $object::STATUS_DRAFT) {
1007 $pdf->SetTextColor(128, 0, 0);
1008 $textref .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1010 $pdf->MultiCell($w, 4, $textref,
'',
'R');
1013 $pdf->SetFont(
'',
'', $default_font_size - 2);
1016 if (property_exists(
$object,
'ref_client') &&
$object->ref_client) {
1018 $pdf->SetXY($posx, $posy);
1019 $pdf->SetTextColor(0, 0, 60);
1021 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".
dol_trunc($outputlangs->convToOutputCharset(
$object->ref_client), 65),
'',
'R');
1026 if (!empty(
$object->project->ref)) {
1028 $pdf->SetXY($posx, $posy);
1029 $pdf->SetTextColor(0, 0, 60);
1030 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1036 if (!empty(
$object->project->ref)) {
1037 $outputlangs->load(
"projects");
1039 $pdf->SetXY($posx, $posy);
1040 $pdf->SetTextColor(0, 0, 60);
1041 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1046 $pdf->SetXY($posx, $posy);
1047 $pdf->SetTextColor(0, 0, 60);
1049 $title = $outputlangs->transnoentities(
"Date");
1050 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1051 $title .=
' - '.$outputlangsbis->transnoentities(
"Date");
1053 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date(
$object->date_creation,
"day",
false, $outputlangs,
true),
'',
'R');
1057 $pdf->SetXY($posx, $posy);
1058 $pdf->SetTextColor(0, 0, 60);
1059 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_client),
'',
'R');
1064 $pdf->SetXY($posx, $posy);
1065 $pdf->SetTextColor(0, 0, 60);
1066 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities((
string)
$object->thirdparty->code_compta_client),
'',
'R');
1071 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1072 if (count($arrayidcontact) > 0) {
1073 $usertmp =
new User($this->db);
1074 $usertmp->fetch($arrayidcontact[0]);
1076 $pdf->SetXY($posx, $posy);
1077 $pdf->SetTextColor(0, 0, 60);
1078 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1086 $current_y = $pdf->getY();
1088 if ($current_y < $pdf->getY()) {
1089 $top_shift = $pdf->getY() - $current_y;
1098 $posy += $top_shift;
1099 $posx = $this->marge_gauche;
1101 $posx = $this->page_largeur - $this->marge_droite - 80;
1105 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82;
1110 $pdf->SetTextColor(0, 0, 0);
1111 $pdf->SetFont(
'',
'', $default_font_size - 2);
1112 $pdf->SetXY($posx, $posy - 5);
1113 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0, $ltrdirection);
1114 $pdf->SetXY($posx, $posy);
1115 $pdf->SetFillColor(230, 230, 230);
1116 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R',
true);
1117 $pdf->SetTextColor(0, 0, 60);
1122 $pdf->SetXY($posx + 2, $posy + 3);
1123 $pdf->SetFont(
'',
'B', $default_font_size);
1124 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1125 $posy = $pdf->getY();
1129 $pdf->SetXY($posx + 2, $posy);
1130 $pdf->SetFont(
'',
'', $default_font_size - 1);
1131 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection);
1134 $usecontact =
false;
1135 $arrayidcontact =
$object->getIdContact(
'external',
'BILLING');
1136 if (count($arrayidcontact) > 0) {
1138 $result =
$object->fetch_contact($arrayidcontact[0]);
1143 $thirdparty =
$object->contact;
1145 $thirdparty =
$object->thirdparty;
1148 if (is_object($thirdparty)) {
1151 $carac_client_name =
null;
1158 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100;
1159 if ($this->page_largeur < 210) {
1163 $posy += $top_shift;
1164 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1166 $posx = $this->marge_gauche;
1171 $pdf->SetTextColor(0, 0, 0);
1172 $pdf->SetFont(
'',
'', $default_font_size - 2);
1173 $pdf->SetXY($posx + 2, $posy - 5);
1174 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"To").
":", 0, $ltrdirection);
1175 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1179 $pdf->SetXY($posx + 2, $posy + 3);
1180 $pdf->SetFont(
'',
'B', $default_font_size);
1182 $pdf->MultiCell($widthrecbox, 2, (
string) $carac_client_name, 0, $ltrdirection);
1184 $posy = $pdf->getY();
1187 $pdf->SetFont(
'',
'', $default_font_size - 1);
1188 $pdf->SetXY($posx + 2, $posy);
1190 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1193 $pdf->SetTextColor(0, 0, 0);