170 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
173 global $user, $langs,
$conf, $mysoc, $hookmanager, $nblines;
175 dol_syslog(
"write_file outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang :
'null'));
177 if (!is_object($outputlangs)) {
178 $outputlangs = $langs;
182 $outputlangs->charset_output =
'ISO-8859-1';
186 $langfiles = array(
"main",
"bills",
"products",
"dict",
"companies",
"compta");
187 $outputlangs->loadLangs($langfiles);
194 global $outputlangsbis;
195 $outputlangsbis =
null;
199 $outputlangsbis->loadLangs($langfiles);
202 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
210 $realpatharray = array();
211 $this->atleastonephoto =
false;
267 if (!empty($dir_output)) {
268 $dir_output .=
'/' .
$object->element;
276 $file = $dir.
"/SPECIMEN.pdf";
279 $dir = $dir_output.
"/".$objectref;
280 $file = $dir.
"/".$objectref.
".pdf";
285 if (!file_exists($dir)) {
287 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
292 if (file_exists($dir)) {
294 if (!is_object($hookmanager)) {
295 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
298 $hookmanager->initHooks(array(
'pdfgeneration'));
299 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
301 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
304 $nblines = (is_array(
$object->lines) ? count(
$object->lines) : 0);
308 '@phan-var-force TCPDI|TCPDF $pdf';
310 $pdf->setAutoPageBreak(
true, 0);
312 $heightforinfotot = 50;
314 $heightforfooter = $this->marge_basse + (
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);
316 if (class_exists(
'TCPDF')) {
317 $pdf->setPrintHeader(
false);
318 $pdf->setPrintFooter(
false);
324 $logodir =
$conf->mycompany->dir_output;
325 if (!empty(
$conf->mycompany->multidir_output[
$object->entity])) {
326 $logodir =
$conf->mycompany->multidir_output[
$object->entity];
328 $pagecount = $pdf->setSourceFile($logodir.
'/'.
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
329 $tplidx = $pdf->importPage(1);
334 $pdf->SetDrawColor(128, 128, 128);
336 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
337 $pdf->SetSubject($outputlangs->transnoentities(
"PdfTitle"));
338 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
339 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
340 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"PdfTitle").
" ".$outputlangs->convToOutputCharset(
$object->thirdparty->name));
342 $pdf->SetCompression(
false);
346 $cert = empty($user->conf->CERTIFICATE_CRT) ?
'' : $user->conf->CERTIFICATE_CRT;
354 'Name' => $this->emetteur->name,
355 'Location' =>
getCountry($this->emetteur->country_code,
''),
356 'Reason' =>
'MYOBJECT',
357 'ContactInfo' => $this->emetteur->email
359 $pdf->setSignature($cert, $cert, $this->emetteur->name,
'', 2, $info);
363 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
368 if (!empty($tplidx)) {
369 $pdf->useTemplate($tplidx);
373 $top_shift = $this->
_pagehead($pdf,
$object, 1, $outputlangs, $outputlangsbis);
374 $pdf->SetFont(
'',
'', $default_font_size - 1);
375 $pdf->MultiCell(0, 3,
'');
376 $pdf->SetTextColor(0, 0, 0);
378 $tab_top = 90 + $top_shift;
379 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
381 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
383 $tab_height_newpage = 150;
385 $tab_height_newpage -= $top_shift;
388 $nexY = $tab_top - 1;
391 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
393 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
394 if (!empty($extranote)) {
398 $pagenb = $pdf->getPage();
402 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
403 $pageposbeforenote = $pagenb;
410 $pdf->startTransaction();
412 $pdf->SetFont(
'',
'', $default_font_size - 1);
413 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
415 $pageposafternote = $pdf->getPage();
416 $posyafter = $pdf->GetY();
418 if ($pageposafternote > $pageposbeforenote) {
419 $pdf->rollbackTransaction(
true);
422 while ($pagenb < $pageposafternote) {
425 if (!empty($tplidx)) {
426 $pdf->useTemplate($tplidx);
432 $pdf->setTopMargin($tab_top_newpage);
434 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
438 $pdf->setPage($pageposbeforenote);
439 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
440 $pdf->SetFont(
'',
'', $default_font_size - 1);
441 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
442 $pageposafternote = $pdf->getPage();
444 $posyafter = $pdf->GetY();
446 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
447 $pdf->AddPage(
'',
'',
true);
450 $pdf->setPage($pageposafternote);
451 $pdf->setTopMargin($tab_top_newpage);
453 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext);
459 $i = $pageposbeforenote;
460 while ($i < $pageposafternote) {
464 $pdf->SetDrawColor(128, 128, 128);
466 if ($i > $pageposbeforenote) {
467 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
468 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
470 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
471 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
475 $pdf->setPageOrientation(
'',
true, 0);
482 $pdf->setPage($pageposafternote);
483 if (!empty($tplidx)) {
484 $pdf->useTemplate($tplidx);
489 $height_note = $posyafter - $tab_top_newpage;
490 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
493 $pdf->commitTransaction();
494 $posyafter = $pdf->GetY();
495 $height_note = $posyafter - $tab_top;
496 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 1);
499 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
501 $pdf->AddPage(
'',
'',
true);
504 $pdf->setPage($pageposafternote);
505 if (!empty($tplidx)) {
506 $pdf->useTemplate($tplidx);
512 $posyafter = $tab_top_newpage;
516 $tab_height -= $height_note;
517 $tab_top = $posyafter + 6;
526 $pdf->startTransaction();
527 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
528 $pdf->rollbackTransaction(
true);
530 $nexY = $tab_top + $this->tabTitleHeight;
533 $pageposbeforeprintlines = $pdf->getPage();
534 $pagenb = $pageposbeforeprintlines;
535 for ($i = 0; $i < $nblines; $i++) {
537 $pdf->SetFont(
'',
'', $default_font_size - 1);
538 $pdf->SetTextColor(0, 0, 0);
546 $pdf->setTopMargin($tab_top_newpage);
547 $pdf->setPageOrientation(
'',
true, $heightforfooter + $heightforfreetext + $heightforinfotot);
548 $pageposbefore = $pdf->getPage();
550 $showpricebeforepagebreak = 1;
552 $posYAfterDescription = 0;
582 $pdf->startTransaction();
585 $pageposafter = $pdf->getPage();
587 if ($pageposafter > $pageposbefore) {
588 $pdf->rollbackTransaction(
true);
589 $pageposafter = $pageposbefore;
590 $pdf->setPageOrientation(
'',
true, $heightforfooter);
594 $pageposafter = $pdf->getPage();
595 $posyafter = $pdf->GetY();
597 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
598 if ($i == ($nblines - 1)) {
599 $pdf->AddPage(
'',
'',
true);
600 if (!empty($tplidx)) {
601 $pdf->useTemplate($tplidx);
603 $pdf->setPage($pageposafter + 1);
609 $showpricebeforepagebreak = 1;
611 $showpricebeforepagebreak = 0;
615 $pdf->commitTransaction();
617 $posYAfterDescription = $pdf->GetY();
620 $nexY = max($pdf->GetY(), $posYAfterImage);
623 $pageposafter = $pdf->getPage();
624 $pdf->setPage($pageposbefore);
625 $pdf->setTopMargin($this->marge_haute);
626 $pdf->setPageOrientation(
'',
true, 0);
629 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
630 $pdf->setPage($pageposafter);
631 $curY = $tab_top_newpage;
634 $pdf->SetFont(
'',
'', $default_font_size - 1);
641 $nexY = max($pdf->GetY(), $nexY);
645 if (!empty(
$object->lines[$i]->array_options)) {
646 foreach (
$object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
650 $nexY = max($pdf->GetY(), $nexY);
662 'outputlangs' => $outputlangs,
663 'hidedetails' => $hidedetails
665 $reshook = $hookmanager->executeHooks(
'printPDFline', $parameters, $this);
670 $prev_progress =
$object->lines[$i]->get_prev_progress(
$object->id);
672 if (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) {
673 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
675 $tvaligne = $sign *
$object->lines[$i]->total_tva * (
$object->lines[$i]->situation_percent - $prev_progress) /
$object->lines[$i]->situation_percent;
678 if (isModEnabled(
"multicurrency") &&
$object->multicurrency_tx != 1) {
679 $tvaligne = $sign *
$object->lines[$i]->multicurrency_total_tva;
681 $tvaligne = $sign *
$object->lines[$i]->total_tva;
685 $localtax1ligne =
$object->lines[$i]->total_localtax1;
686 $localtax2ligne =
$object->lines[$i]->total_localtax2;
687 $localtax1_rate =
$object->lines[$i]->localtax1_tx;
688 $localtax2_rate =
$object->lines[$i]->localtax2_tx;
689 $localtax1_type =
$object->lines[$i]->localtax1_type;
690 $localtax2_type =
$object->lines[$i]->localtax2_type;
692 $vatrate = (string)
$object->lines[$i]->tva_tx;
695 if ((!isset($localtax1_type) || $localtax1_type ==
'' || !isset($localtax2_type) || $localtax2_type ==
'')
696 && (!empty($localtax1_rate) || !empty($localtax2_rate))) {
698 $localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] :
'';
699 $localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] :
'';
703 if ($localtax1_type && $localtax1ligne != 0) {
704 if (empty($this->localtax1[$localtax1_type][$localtax1_rate])) {
705 $this->localtax1[$localtax1_type][$localtax1_rate] = $localtax1ligne;
707 $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
710 if ($localtax2_type && $localtax2ligne != 0) {
711 if (empty($this->localtax2[$localtax2_type][$localtax2_rate])) {
712 $this->localtax2[$localtax2_type][$localtax2_rate] = $localtax2ligne;
714 $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
718 if ((
$object->lines[$i]->info_bits & 0x01) == 0x01) {
723 if (!isset($this->tva[$vatrate])) {
724 $this->tva[$vatrate] = 0;
726 $this->tva[$vatrate] += $tvaligne;
727 $vatcode =
$object->lines[$i]->vat_src_code;
728 if (empty($this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'])) {
729 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] = 0;
731 $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')] = array(
'vatrate' => $vatrate,
'vatcode' => $vatcode,
'amount' => $this->tva_array[$vatrate.($vatcode ?
' ('.$vatcode.
')' :
'')][
'amount'] + $tvaligne);
733 $nexY = max($nexY, $posYAfterImage);
736 if (
getDolGlobalInt(
'MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
737 $pdf->setPage($pageposafter);
738 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
740 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
741 $pdf->SetLineStyle(array(
'dash' => 0));
745 while ($pagenb < $pageposafter) {
746 $pdf->setPage($pagenb);
747 if ($pagenb == $pageposbeforeprintlines) {
748 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
750 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
754 $pdf->setPage($pagenb);
755 $pdf->setPageOrientation(
'',
true, 0);
759 if (!empty($tplidx)) {
760 $pdf->useTemplate($tplidx);
764 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
765 if ($pagenb == $pageposafter) {
766 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1,
$object->multicurrency_code, $outputlangsbis);
768 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1,
$object->multicurrency_code, $outputlangsbis);
773 if (!empty($tplidx)) {
774 $pdf->useTemplate($tplidx);
784 if ($pagenb == $pageposbeforeprintlines) {
785 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0,
$object->multicurrency_code, $outputlangsbis);
787 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0,
$object->multicurrency_code, $outputlangsbis);
789 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
807 if (method_exists($pdf,
'AliasNbPages')) {
808 $pdf->AliasNbPages();
813 $pdf->Output($file,
'F');
816 $hookmanager->initHooks(array(
'pdfgeneration'));
817 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
819 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
821 $this->error = $hookmanager->error;
822 $this->errors = $hookmanager->errors;
827 $this->result = array(
'fullpath' => $file);
831 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
835 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"FAC_OUTPUTDIR");
926 protected function _pagehead(&$pdf,
$object, $showaddress, $outputlangs, $outputlangsbis =
null)
929 global
$conf, $langs;
932 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
937 $outputlangs->loadLangs(array(
"main",
"bills",
"propal",
"companies"));
948 $pdf->SetTextColor(0, 0, 60);
949 $pdf->SetFont(
'',
'B', $default_font_size + 3);
953 $posy = $this->marge_haute;
954 $posx = $this->page_largeur - $this->marge_droite - $w;
956 $pdf->SetXY($this->marge_gauche, $posy);
960 if ($this->emetteur->logo) {
961 $logodir =
$conf->mycompany->dir_output;
966 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
968 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
970 if (is_readable($logo)) {
972 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
974 $pdf->SetTextColor(200, 0, 0);
975 $pdf->SetFont(
'',
'B', $default_font_size - 2);
976 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
977 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
980 $text = $this->emetteur->name;
981 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
985 $pdf->SetFont(
'',
'B', $default_font_size + 3);
986 $pdf->SetXY($posx, $posy);
987 $pdf->SetTextColor(0, 0, 60);
988 $title = $outputlangs->transnoentities(
"PdfTitle");
989 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
991 $title .= $outputlangsbis->transnoentities(
"PdfTitle");
993 $pdf->MultiCell($w, 3, $title,
'',
'R');
995 $pdf->SetFont(
'',
'B', $default_font_size);
998 $pdf->SetXY($posx, $posy);
999 $pdf->SetTextColor(0, 0, 60);
1000 $textref = $outputlangs->transnoentities(
"Ref").
" : ".$outputlangs->convToOutputCharset(
$object->ref);
1001 if (
$object->status == $object::STATUS_DRAFT) {
1002 $pdf->SetTextColor(128, 0, 0);
1003 $textref .=
' - '.$outputlangs->transnoentities(
"NotValidated");
1005 $pdf->MultiCell($w, 4, $textref,
'',
'R');
1008 $pdf->SetFont(
'',
'', $default_font_size - 2);
1011 if (property_exists(
$object,
'ref_client') &&
$object->ref_client) {
1013 $pdf->SetXY($posx, $posy);
1014 $pdf->SetTextColor(0, 0, 60);
1016 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefCustomer").
" : ".
dol_trunc($outputlangs->convToOutputCharset(
$object->ref_client), 65),
'',
'R');
1021 if (!empty(
$object->project->ref)) {
1023 $pdf->SetXY($posx, $posy);
1024 $pdf->SetTextColor(0, 0, 60);
1025 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"Project").
" : ".(empty(
$object->project->title) ?
'' :
$object->project->title),
'',
'R');
1031 if (!empty(
$object->project->ref)) {
1032 $outputlangs->load(
"projects");
1034 $pdf->SetXY($posx, $posy);
1035 $pdf->SetTextColor(0, 0, 60);
1036 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"RefProject").
" : ".(empty(
$object->project->ref) ?
'' :
$object->project->ref),
'',
'R');
1041 $pdf->SetXY($posx, $posy);
1042 $pdf->SetTextColor(0, 0, 60);
1044 $title = $outputlangs->transnoentities(
"Date");
1045 if (
getDolGlobalInt(
'PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
1046 $title .=
' - '.$outputlangsbis->transnoentities(
"Date");
1048 $pdf->MultiCell($w, 3, $title.
" : ".
dol_print_date(
$object->date_creation,
"day",
false, $outputlangs,
true),
'',
'R');
1052 $pdf->SetXY($posx, $posy);
1053 $pdf->SetTextColor(0, 0, 60);
1054 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1059 $pdf->SetXY($posx, $posy);
1060 $pdf->SetTextColor(0, 0, 60);
1061 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerAccountancyCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_compta_client),
'',
'R');
1066 $arrayidcontact =
$object->getIdContact(
'internal',
'SALESREPFOLL');
1067 if (count($arrayidcontact) > 0) {
1068 $usertmp =
new User($this->db);
1069 $usertmp->fetch($arrayidcontact[0]);
1071 $pdf->SetXY($posx, $posy);
1072 $pdf->SetTextColor(0, 0, 60);
1073 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"SalesRepresentative").
" : ".$usertmp->getFullName($langs),
'',
'R');
1081 $current_y = $pdf->getY();
1083 if ($current_y < $pdf->getY()) {
1084 $top_shift = $pdf->getY() - $current_y;
1093 $posy += $top_shift;
1094 $posx = $this->marge_gauche;
1096 $posx = $this->page_largeur - $this->marge_droite - 80;
1100 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 82;
1105 $pdf->SetTextColor(0, 0, 0);
1106 $pdf->SetFont(
'',
'', $default_font_size - 2);
1107 $pdf->SetXY($posx, $posy - 5);
1108 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0, $ltrdirection);
1109 $pdf->SetXY($posx, $posy);
1110 $pdf->SetFillColor(230, 230, 230);
1111 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R',
true);
1112 $pdf->SetTextColor(0, 0, 60);
1117 $pdf->SetXY($posx + 2, $posy + 3);
1118 $pdf->SetFont(
'',
'B', $default_font_size);
1119 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
1120 $posy = $pdf->getY();
1124 $pdf->SetXY($posx + 2, $posy);
1125 $pdf->SetFont(
'',
'', $default_font_size - 1);
1126 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection);
1129 $usecontact =
false;
1130 $arrayidcontact =
$object->getIdContact(
'external',
'BILLING');
1131 if (count($arrayidcontact) > 0) {
1133 $result =
$object->fetch_contact($arrayidcontact[0]);
1138 $thirdparty =
$object->contact;
1140 $thirdparty =
$object->thirdparty;
1143 if (is_object($thirdparty)) {
1146 $carac_client_name =
null;
1153 $widthrecbox =
getDolGlobalInt(
'MAIN_PDF_USE_ISO_LOCATION') ? 92 : 100;
1154 if ($this->page_largeur < 210) {
1158 $posy += $top_shift;
1159 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1161 $posx = $this->marge_gauche;
1166 $pdf->SetTextColor(0, 0, 0);
1167 $pdf->SetFont(
'',
'', $default_font_size - 2);
1168 $pdf->SetXY($posx + 2, $posy - 5);
1169 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"To").
":", 0, $ltrdirection);
1170 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1174 $pdf->SetXY($posx + 2, $posy + 3);
1175 $pdf->SetFont(
'',
'B', $default_font_size);
1177 $pdf->MultiCell($widthrecbox, 2, (
string) $carac_client_name, 0, $ltrdirection);
1179 $posy = $pdf->getY();
1182 $pdf->SetFont(
'',
'', $default_font_size - 1);
1183 $pdf->SetXY($posx + 2, $posy);
1185 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1188 $pdf->SetTextColor(0, 0, 0);