164 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
167 global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
169 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
171 if (!is_object($outputlangs)) {
172 $outputlangs = $langs;
176 $outputlangs->charset_output =
'ISO-8859-1';
180 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies"));
187 global $outputlangsbis;
188 $outputlangsbis =
null;
190 $outputlangsbis =
new Translate(
'', $conf);
192 $outputlangsbis->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies"));
195 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
203 $realpatharray = array();
204 $this->atleastonephoto =
false;
266 $file = $dir.
"/SPECIMEN.pdf";
270 $file = $dir.
"/".$objectref.
".pdf";
272 if (!file_exists($dir)) {
274 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
279 if (file_exists($dir)) {
281 if (!is_object($hookmanager)) {
282 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
285 $hookmanager->initHooks(array(
'pdfgeneration'));
286 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
288 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
291 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
296 $pdf->SetAutoPageBreak(1, 0);
298 $heightforinfotot = 50;
300 $heightforfooter = $this->marge_basse + (
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);
302 if (class_exists(
'TCPDF')) {
303 $pdf->setPrintHeader(
false);
304 $pdf->setPrintFooter(
false);
310 $logodir = $conf->mycompany->dir_output;
311 if (!empty($conf->mycompany->multidir_output[
$object->entity])) {
312 $logodir = $conf->mycompany->multidir_output[
$object->entity];
314 $pagecount = $pdf->setSourceFile($logodir.
'/'.
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
315 $tplidx = $pdf->importPage(1);
320 $pdf->SetDrawColor(128, 128, 128);
322 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
323 $pdf->SetSubject($outputlangs->transnoentities(
"PdfTitle"));
324 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
325 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
326 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"PdfTitle").
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name));
328 $pdf->SetCompression(
false);
332 $cert = empty($user->conf->CERTIFICATE_CRT) ?
'' : $user->conf->CERTIFICATE_CRT;
340 'Name' => $this->emetteur->name,
341 'Location' =>
getCountry($this->emetteur->country_code, 0),
342 'Reason' =>
'MYOBJECT',
343 'ContactInfo' => $this->emetteur->email
345 $pdf->setSignature($cert, $cert, $this->emetteur->name,
'', 2, $info);
348 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
353 if (!empty($tplidx)) {
354 $pdf->useTemplate($tplidx);
358 $top_shift = $this->
_pagehead($pdf,
$object, 1, $outputlangs, $outputlangsbis);
359 $pdf->SetFont(
'',
'', $default_font_size - 1);
360 $pdf->MultiCell(0, 3,
'');
361 $pdf->SetTextColor(0, 0, 0);
363 $tab_top = 90 + $top_shift;
364 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
366 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
368 $tab_height_newpage = 150;
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);
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);
467 $pdf->setPage($pageposafternote);
468 if (!empty($tplidx)) {
469 $pdf->useTemplate($tplidx);
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);
484 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
486 $pdf->AddPage(
'',
'',
true);
489 $pdf->setPage($pageposafternote);
490 if (!empty($tplidx)) {
491 $pdf->useTemplate($tplidx);
497 $posyafter = $tab_top_newpage;
501 $tab_height = $tab_height - $height_note;
502 $tab_top = $posyafter + 6;
511 $pdf->startTransaction();
512 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
513 $pdf->rollbackTransaction(
true);
515 $nexY = $tab_top + $this->tabTitleHeight;
518 $pageposbeforeprintlines = $pdf->getPage();
519 $pagenb = $pageposbeforeprintlines;
520 for ($i = 0; $i < $nblines; $i++) {
522 $pdf->SetFont(
'',
'', $default_font_size - 1);
523 $pdf->SetTextColor(0, 0, 0);
531 $pdf->setTopMargin($tab_top_newpage);
532 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
533 $pageposbefore = $pdf->getPage();
535 $showpricebeforepagebreak = 1;
537 $posYAfterDescription = 0;
567 $pdf->startTransaction();
570 $pageposafter = $pdf->getPage();
572 if ($pageposafter > $pageposbefore) {
573 $pdf->rollbackTransaction(
true);
574 $pageposafter = $pageposbefore;
575 $pdf->setPageOrientation(
'', 1, $heightforfooter);
579 $pageposafter = $pdf->getPage();
580 $posyafter = $pdf->GetY();
582 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
583 if ($i == ($nblines - 1)) {
584 $pdf->AddPage(
'',
'',
true);
585 if (!empty($tplidx)) {
586 $pdf->useTemplate($tplidx);
588 $pdf->setPage($pageposafter + 1);
594 $showpricebeforepagebreak = 1;
596 $showpricebeforepagebreak = 0;
600 $pdf->commitTransaction();
602 $posYAfterDescription = $pdf->GetY();
605 $nexY = max($pdf->GetY(), $posYAfterImage);
608 $pageposafter = $pdf->getPage();
609 $pdf->setPage($pageposbefore);
610 $pdf->setTopMargin($this->marge_haute);
611 $pdf->setPageOrientation(
'', 1, 0);
614 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
615 $pdf->setPage($pageposafter);
616 $curY = $tab_top_newpage;
619 $pdf->SetFont(
'',
'', $default_font_size - 1);
626 $nexY = max($pdf->GetY(), $nexY);
630 if (!empty(
$object->lines[$i]->array_options)) {
631 foreach (
$object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
635 $nexY = max($pdf->GetY(), $nexY);
647 'outputlangs' => $outputlangs,
648 'hidedetails' => $hidedetails
650 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
655 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
656 if ($prev_progress > 0 && !empty(
$object->lines[$i]->situation_percent)) {
657 if (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) {
658 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
660 $tvaligne = $sign *
$object->lines[$i]->total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
663 if (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) {
664 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva;
666 $tvaligne = $sign *
$object->lines[$i]->total_tva;
670 $localtax1ligne =
$object->lines[$i]->total_localtax1;
671 $localtax2ligne =
$object->lines[$i]->total_localtax2;
672 $localtax1_rate =
$object->lines[$i]->localtax1_tx;
673 $localtax2_rate =
$object->lines[$i]->localtax2_tx;
674 $localtax1_type =
$object->lines[$i]->localtax1_type;
675 $localtax2_type =
$object->lines[$i]->localtax2_type;
677 $vatrate = (string)
$object->lines[$i]->tva_tx;
680 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
681 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
683 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
684 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
688 if ($localtax1_type && $localtax1ligne != 0) {
689 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
690 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
692 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
695 if ($localtax2_type && $localtax2ligne != 0) {
696 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
697 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
699 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
703 if ((
$object->lines[$i]->info_bits & 0x01) == 0x01) {
708 if (!isset($this->tva[$vatrate])) {
709 $this->tva[$vatrate] = 0;
711 $this->tva[$vatrate] += $tvaligne;
712 $vatcode =
$object->lines[$i]->vat_src_code;
713 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
714 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
716 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
718 $nexY = max($nexY, $posYAfterImage);
721 if (
getDolGlobalInt(
'MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
722 $pdf->setPage($pageposafter);
723 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
725 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
726 $pdf->SetLineStyle(array(
'dash' => 0));
730 while ($pagenb < $pageposafter) {
731 $pdf->setPage($pagenb);
732 if ($pagenb == $pageposbeforeprintlines) {
733 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
735 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
739 $pdf->setPage($pagenb);
740 $pdf->setPageOrientation(
'', 1, 0);
744 if (!empty($tplidx)) {
745 $pdf->useTemplate($tplidx);
749 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
750 if ($pagenb == $pageposafter) {
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);
758 if (!empty($tplidx)) {
759 $pdf->useTemplate($tplidx);
769 if ($pagenb == $pageposbeforeprintlines) {
770 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0,
$object->multicurrency_code, $outputlangsbis);
772 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code, $outputlangsbis);
774 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
792 if (method_exists($pdf,
'AliasNbPages')) {
793 $pdf->AliasNbPages();
798 $pdf->Output($file,
'F');
801 $hookmanager->initHooks(array(
'pdfgeneration'));
802 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
804 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
806 $this->error = $hookmanager->error;
807 $this->errors = $hookmanager->errors;
812 $this->result = array(
'fullpath' => $file);
816 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
820 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"FAC_OUTPUTDIR");
911 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null)
914 global $conf, $langs;
917 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
922 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"companies"));
933 $pdf->SetTextColor(0, 0, 60);
934 $pdf->SetFont(
'',
'B', $default_font_size + 3);
938 $posy = $this->marge_haute;
939 $posx = $this->page_largeur - $this->marge_droite - $w;
941 $pdf->SetXY($this->marge_gauche, $posy);
945 if ($this->emetteur->logo) {
946 $logodir = $conf->mycompany->dir_output;
951 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
953 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
955 if (is_readable($logo)) {
957 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
959 $pdf->SetTextColor(200, 0, 0);
960 $pdf->SetFont(
'',
'B', $default_font_size - 2);
961 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
962 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
965 $text = $this->emetteur->name;
966 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
970 $pdf->SetFont(
'',
'B', $default_font_size + 3);
971 $pdf->SetXY($posx, $posy);
972 $pdf->SetTextColor(0, 0, 60);
973 $title = $outputlangs->transnoentities(
"PdfTitle");
974 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
976 $title .= $outputlangsbis->transnoentities(
"PdfTitle");
978 $pdf->MultiCell($w, 3, $title,
'',
'R');
980 $pdf->SetFont(
'',
'B', $default_font_size);
983 $pdf->SetXY($posx, $posy);
984 $pdf->SetTextColor(0, 0, 60);
985 $textref = $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset(
$object->ref);
986 if (
$object->statut == $object::STATUS_DRAFT) {
987 $pdf->SetTextColor(128, 0, 0);
988 $textref .=
' - '.$outputlangs->transnoentities(
"NotValidated");
990 $pdf->MultiCell($w, 4, $textref,
'',
'R');
993 $pdf->SetFont(
'',
'', $default_font_size - 2);
997 $pdf->SetXY($posx, $posy);
998 $pdf->SetTextColor(0, 0, 60);
999 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".
dol_trunc($outputlangs->convToOutputCharset(
$object->ref_client), 65),
'',
'R');
1004 if (!empty(
$object->project->ref)) {
1006 $pdf->SetXY($posx, $posy);
1007 $pdf->SetTextColor(0, 0, 60);
1008 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1014 if (!empty(
$object->project->ref)) {
1015 $outputlangs->load(
"projects");
1017 $pdf->SetXY($posx, $posy);
1018 $pdf->SetTextColor(0, 0, 60);
1019 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1024 $pdf->SetXY($posx, $posy);
1025 $pdf->SetTextColor(0, 0, 60);
1027 $title = $outputlangs->transnoentities(
"Date");
1028 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1029 $title .=
' - '.$outputlangsbis->transnoentities(
"Date");
1031 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date(
$object->date,
"day",
false, $outputlangs,
true),
'',
'R');
1035 $pdf->SetXY($posx, $posy);
1036 $pdf->SetTextColor(0, 0, 60);
1037 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1042 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1043 if (count($arrayidcontact) > 0) {
1044 $usertmp =
new User($this->db);
1045 $usertmp->fetch($arrayidcontact[0]);
1047 $pdf->SetXY($posx, $posy);
1048 $pdf->SetTextColor(0, 0, 60);
1049 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1057 $current_y = $pdf->getY();
1059 if ($current_y < $pdf->getY()) {
1060 $top_shift = $pdf->getY() - $current_y;
1069 $posy += $top_shift;
1070 $posx = $this->marge_gauche;
1072 $posx = $this->page_largeur - $this->marge_droite - 80;
1076 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82;
1081 $pdf->SetTextColor(0, 0, 0);
1082 $pdf->SetFont(
'',
'', $default_font_size - 2);
1083 $pdf->SetXY($posx, $posy - 5);
1084 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0, $ltrdirection);
1085 $pdf->SetXY($posx, $posy);
1086 $pdf->SetFillColor(230, 230, 230);
1087 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1088 $pdf->SetTextColor(0, 0, 60);
1093 $pdf->SetXY($posx + 2, $posy + 3);
1094 $pdf->SetFont(
'',
'B', $default_font_size);
1095 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1096 $posy = $pdf->getY();
1100 $pdf->SetXY($posx + 2, $posy);
1101 $pdf->SetFont(
'',
'', $default_font_size - 1);
1102 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection);
1105 $usecontact =
false;
1106 $arrayidcontact =
$object->getIdContact(
'external',
'BILLING');
1107 if (count($arrayidcontact) > 0) {
1109 $result =
$object->fetch_contact($arrayidcontact[0]);
1114 $thirdparty =
$object->contact;
1116 $thirdparty =
$object->thirdparty;
1119 if (is_object($thirdparty)) {
1127 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100;
1128 if ($this->page_largeur < 210) {
1132 $posy += $top_shift;
1133 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1135 $posx = $this->marge_gauche;
1140 $pdf->SetTextColor(0, 0, 0);
1141 $pdf->SetFont(
'',
'', $default_font_size - 2);
1142 $pdf->SetXY($posx + 2, $posy - 5);
1143 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"To").
":", 0, $ltrdirection);
1144 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1148 $pdf->SetXY($posx + 2, $posy + 3);
1149 $pdf->SetFont(
'',
'B', $default_font_size);
1150 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection);
1152 $posy = $pdf->getY();
1155 $pdf->SetFont(
'',
'', $default_font_size - 1);
1156 $pdf->SetXY($posx + 2, $posy);
1157 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1160 $pdf->SetTextColor(0, 0, 0);