127 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
130 global $user, $conf, $langs, $hookmanager;
134 if (!is_object($outputlangs)) {
135 $outputlangs = $langs;
139 $outputlangs->charset_output =
'ISO-8859-1';
143 $outputlangs->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"other",
"propal",
"deliveries",
"sendings",
"productbatch"));
150 global $outputlangsbis;
151 $outputlangsbis =
null;
153 $outputlangsbis =
new Translate(
'', $conf);
155 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch"));
158 $nblines = count(
$object->lines);
161 $realpatharray = array();
162 $this->atleastonephoto =
false;
164 $objphoto =
new Product($this->db);
166 for ($i = 0; $i < $nblines; $i++) {
167 if (empty(
$object->lines[$i]->fk_product)) {
171 $objphoto->fetch(
$object->lines[$i]->fk_product);
174 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
175 $dir = $conf->product->dir_output.
'/'.$pdir;
177 $pdir =
get_exdir(0, 0, 0, 0, $objphoto,
'product');
178 $dir = $conf->product->dir_output.
'/'.$pdir;
184 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
186 if ($obj[
'photo_vignette']) {
187 $filename = $obj[
'photo_vignette'];
189 $filename = $obj[
'photo'];
192 $filename = $obj[
'photo'];
195 $realpath = $dir.$filename;
197 $this->atleastonephoto =
true;
201 if ($realpath && $arephoto) {
202 $realpatharray[$i] = $realpath;
207 if (count($realpatharray) == 0) {
208 $this->posxpicture = $this->posxweightvol;
211 if ($conf->expedition->dir_output) {
214 $dir = $conf->expedition->dir_output.
"/sending";
215 $file = $dir.
"/SPECIMEN.pdf";
218 $dir = $conf->expedition->dir_output.
"/sending/".$expref;
219 $file = $dir.
"/".$expref.
".pdf";
222 if (!file_exists($dir)) {
224 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
229 if (file_exists($dir)) {
231 if (!is_object($hookmanager)) {
232 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
235 $hookmanager->initHooks(array(
'pdfgeneration'));
236 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
238 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
245 $heightforinfotot = 8;
246 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
247 $heightforfooter = $this->marge_basse + 8;
249 $heightforfooter += 6;
251 $pdf->SetAutoPageBreak(1, 0);
253 if (class_exists(
'TCPDF')) {
254 $pdf->setPrintHeader(
false);
255 $pdf->setPrintFooter(
false);
260 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
261 $tplidx = $pdf->importPage(1);
266 $pdf->SetDrawColor(128, 128, 128);
268 if (method_exists($pdf,
'AliasNbPages')) {
269 $pdf->AliasNbPages();
272 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
273 $pdf->SetSubject($outputlangs->transnoentities(
"Shipment"));
274 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
275 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
276 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"Shipment"));
278 $pdf->SetCompression(
false);
282 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
286 if (!empty($tplidx)) {
287 $pdf->useTemplate($tplidx);
291 $pdf->SetFont(
'',
'', $default_font_size - 1);
292 $pdf->MultiCell(0, 3,
'');
293 $pdf->SetTextColor(0, 0, 0);
296 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
298 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
300 $this->posxdesc = $this->marge_gauche + 1;
303 $height_incoterms = 0;
304 if (isModEnabled(
'incoterm')) {
305 $desc_incoterms =
$object->getIncotermsForPDF();
306 if ($desc_incoterms) {
309 $pdf->SetFont(
'',
'', $default_font_size - 1);
310 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
311 $nexY = $pdf->GetY();
312 $height_incoterms = $nexY - $tab_top;
315 $pdf->SetDrawColor(192, 192, 192);
316 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
318 $tab_top = $nexY + 6;
319 $height_incoterms += 4;
324 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
327 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
328 if (!empty($extranote)) {
332 if (!empty($notetoshow) || !empty(
$object->tracking_number)) {
334 $tab_topbeforetrackingnumber = $tab_top;
337 if (!empty(
$object->tracking_number)) {
338 $height_trackingnumber = 4;
340 $pdf->SetFont(
'',
'B', $default_font_size - 2);
341 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber") .
" : " .
$object->tracking_number, 0, 1,
false,
true,
'L');
342 $tab_top_alt = $pdf->GetY();
345 if (!empty(
$object->tracking_url)) {
346 if (
$object->shipping_method_id > 0) {
348 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
351 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
353 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
357 $label .=
$object->tracking_url;
360 $height_trackingnumber += 4;
361 $pdf->SetFont(
'',
'B', $default_font_size - 2);
362 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
365 $tab_top = $pdf->GetY();
369 $pagenb = $pdf->getPage();
370 if (!empty($notetoshow) || !empty(
$object->tracking_number)) {
373 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
374 $pageposbeforenote = $pagenb;
381 $pdf->startTransaction();
383 $pdf->SetFont(
'',
'', $default_font_size - 1);
384 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
386 $pageposafternote = $pdf->getPage();
387 $posyafter = $pdf->GetY();
389 if ($pageposafternote > $pageposbeforenote) {
390 $pdf->rollbackTransaction(
true);
393 while ($pagenb < $pageposafternote) {
396 if (!empty($tplidx)) {
397 $pdf->useTemplate($tplidx);
403 $pdf->setTopMargin($tab_top_newpage);
405 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
409 $pdf->setPage($pageposbeforenote);
410 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
411 $pdf->SetFont(
'',
'', $default_font_size - 1);
412 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
413 $pageposafternote = $pdf->getPage();
415 $posyafter = $pdf->GetY();
417 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
418 $pdf->AddPage(
'',
'',
true);
421 $pdf->setPage($pageposafternote);
422 $pdf->setTopMargin($tab_top_newpage);
424 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
430 $i = $pageposbeforenote;
431 while ($i < $pageposafternote) {
435 $pdf->SetDrawColor(128, 128, 128);
437 if ($i > $pageposbeforenote) {
438 if (empty($height_trackingnumber)) {
439 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
441 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter) + $height_trackingnumber + 1;
442 $tab_top_newpage = $tab_topbeforetrackingnumber;
444 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 2);
446 if (empty($height_trackingnumber)) {
447 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
449 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter) + $height_trackingnumber + 1;
450 $tab_top = $tab_topbeforetrackingnumber;
452 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 2);
456 $pdf->setPageOrientation(
'', 1, 0);
463 $pdf->setPage($pageposafternote);
464 if (!empty($tplidx)) {
465 $pdf->useTemplate($tplidx);
470 $height_note = $posyafter - $tab_top_newpage;
471 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
473 $pdf->commitTransaction();
474 $posyafter = $pdf->GetY();
475 if (empty($height_trackingnumber)) {
476 $height_note = $posyafter - $tab_top + 1;
478 $height_note = $posyafter - $tab_top + $height_trackingnumber + 1;
479 $tab_top = $tab_topbeforetrackingnumber;
481 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 2);
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;
512 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
514 $encoding =
'QRCODE';
518 if ($module->encodingIsSupported($encoding)) {
519 $result = $module->writeBarCode(
$object->ref, $encoding);
523 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
524 $newcode =
dol_hash($newcode,
'md5');
526 $barcode_path = $conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
532 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
534 $nexY = $pdf->GetY();
535 $height_barcode = 20;
539 $this->error =
'Failed to generate barcode';
547 $pdf->startTransaction();
548 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs);
549 $pdf->rollbackTransaction(
true);
552 $nexY = $tab_top + $this->tabTitleHeight;
555 $pageposbeforeprintlines = $pdf->getPage();
556 $pagenb = $pageposbeforeprintlines;
557 for ($i = 0; $i < $nblines; $i++) {
559 $pdf->SetFont(
'',
'', $default_font_size - 1);
560 $pdf->SetTextColor(0, 0, 0);
563 $imglinesize = array();
564 if (!empty($realpatharray[$i])) {
568 $pdf->setTopMargin($tab_top_newpage);
569 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
570 $pageposbefore = $pdf->getPage();
572 $showpricebeforepagebreak = 1;
574 $posYAfterDescription = 0;
575 $heightforsignature = 0;
579 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) {
580 $pdf->AddPage(
'',
'',
true);
581 if (!empty($tplidx)) {
582 $pdf->useTemplate($tplidx);
585 $pdf->setPage($pageposbefore + 1);
587 $curY = $tab_top_newpage;
591 $showpricebeforepagebreak = 1;
593 $showpricebeforepagebreak = 0;
598 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
599 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY + 1, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
601 $posYAfterImage = $curY + $imglinesize[
'height'];
607 $pdf->startTransaction();
611 $pageposafter = $pdf->getPage();
612 if ($pageposafter > $pageposbefore) {
613 $pdf->rollbackTransaction(
true);
617 $pageposafter = $pdf->getPage();
618 $posyafter = $pdf->GetY();
620 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) {
621 if ($i == ($nblines - 1)) {
622 $pdf->AddPage(
'',
'',
true);
623 if (!empty($tplidx)) {
624 $pdf->useTemplate($tplidx);
627 $pdf->setPage($pageposafter + 1);
633 $showpricebeforepagebreak = 1;
635 $showpricebeforepagebreak = 0;
639 $pdf->commitTransaction();
641 $posYAfterDescription = $pdf->GetY();
644 $nexY = max($pdf->GetY(), $posYAfterImage);
645 $pageposafter = $pdf->getPage();
647 $pdf->setPage($pageposbefore);
648 $pdf->setTopMargin($this->marge_haute);
649 $pdf->setPageOrientation(
'', 1, 0);
652 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
653 $pdf->setPage($pageposafter);
654 $curY = $tab_top_newpage;
658 if ($pageposafter > $pageposbefore) {
659 $pdf->setPage($pageposafter);
660 $curY = $tab_top_newpage;
663 $pdf->SetFont(
'',
'', $default_font_size - 1);
672 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->weight) {
676 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->volume) {
682 $this->
printStdColumnContent($pdf, $curY,
'weight', $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt);
683 $nexY = max($pdf->GetY(), $nexY);
688 $nexY = max($pdf->GetY(), $nexY);
693 $nexY = max($pdf->GetY(), $nexY);
698 $nexY = max($pdf->GetY(), $nexY);
703 $nexY = max($pdf->GetY(), $nexY);
707 if (!empty(
$object->lines[$i]->array_options)) {
708 foreach (
$object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
712 $nexY = max($pdf->GetY(), $nexY);
719 $pdf->setPage($pageposafter);
720 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
722 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
723 $pdf->SetLineStyle(array(
'dash' => 0));
727 while ($pagenb < $pageposafter) {
728 $pdf->setPage($pagenb);
729 if ($pagenb == $pageposbeforeprintlines) {
730 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
732 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
736 $pdf->setPage($pagenb);
737 $pdf->setPageOrientation(
'', 1, 0);
741 if (!empty($tplidx)) {
742 $pdf->useTemplate($tplidx);
745 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
747 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
749 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
754 if (!empty($tplidx)) {
755 $pdf->useTemplate($tplidx);
766 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
767 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
769 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
770 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
778 if (method_exists($pdf,
'AliasNbPages')) {
779 $pdf->AliasNbPages();
784 $pdf->Output($file,
'F');
787 $hookmanager->initHooks(array(
'pdfgeneration'));
788 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
790 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
792 $this->error = $hookmanager->error;
793 $this->errors = $hookmanager->errors;
798 $this->result = array(
'fullpath' => $file);
802 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
806 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
982 global $conf, $langs, $mysoc;
985 if ($outputlangs->trans(
"DIRECTION") ==
'rtl') {
989 $outputlangs->load(
"orders");
996 $pdf->SetTextColor(0, 0, 60);
997 $pdf->SetFont(
'',
'B', $default_font_size + 3);
1001 $posy = $this->marge_haute;
1002 $posx = $this->page_largeur - $this->marge_droite - $w;
1004 $pdf->SetXY($this->marge_gauche, $posy);
1007 if ($this->emetteur->logo) {
1008 $logodir = $conf->mycompany->dir_output;
1009 if (!empty($conf->mycompany->multidir_output[
$object->entity])) {
1010 $logodir = $conf->mycompany->multidir_output[
$object->entity];
1013 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1015 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1017 if (is_readable($logo)) {
1019 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1021 $pdf->SetTextColor(200, 0, 0);
1022 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1023 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1024 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1027 $text = $this->emetteur->name;
1028 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection);
1031 $pdf->SetDrawColor(128, 128, 128);
1033 $posx = $this->page_largeur - $w - $this->marge_droite;
1034 $posy = $this->marge_haute;
1036 $pdf->SetFont(
'',
'B', $default_font_size + 2);
1037 $pdf->SetXY($posx, $posy);
1038 $pdf->SetTextColor(0, 0, 60);
1039 $title = $outputlangs->transnoentities(
"SendingSheet");
1040 $pdf->MultiCell($w, 4, $title,
'',
'R');
1042 $pdf->SetFont(
'',
'', $default_font_size + 1);
1046 $pdf->SetXY($posx, $posy);
1047 $pdf->SetTextColor(0, 0, 60);
1048 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefSending").
" : ".
$object->ref,
'',
'R');
1051 if (!empty(
$object->date_delivery)) {
1053 $pdf->SetXY($posx, $posy);
1054 $pdf->SetTextColor(0, 0, 60);
1055 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
1060 $pdf->SetXY($posx, $posy);
1061 $pdf->SetTextColor(0, 0, 60);
1062 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1066 $pdf->SetFont(
'',
'', $default_font_size + 3);
1071 $origin_id =
$object->origin_id;
1075 if (isModEnabled($origin)) {
1076 $outputlangs->load(
'orders');
1078 $classname = ucfirst($origin);
1079 $linkedobject =
new $classname($this->db);
1080 $result = $linkedobject->fetch($origin_id);
1084 $pdf->SetFont(
'',
'', $default_font_size - 2);
1085 $text = $linkedobject->ref;
1086 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1087 $text .=
' ('.$linkedobject->ref_client.
')';
1090 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1091 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1093 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1094 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1110 $carac_emetteur =
'';
1112 $arrayidcontact = array();
1113 if (!empty($origin) && is_object(
$object->origin_object)) {
1114 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SALESREPFOLL');
1116 if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
1117 $object->fetch_user(reset($arrayidcontact));
1118 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1119 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1121 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1125 $carac_emetteur .=
"\n";
1132 $posx = $this->marge_gauche;
1134 $posx = $this->page_largeur - $this->marge_droite - 80;
1142 $pdf->SetTextColor(0, 0, 0);
1143 $pdf->SetFont(
'',
'', $default_font_size - 2);
1144 $pdf->SetXY($posx, $posy - 5);
1145 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender"), 0, $ltrdirection);
1146 $pdf->SetXY($posx, $posy);
1147 $pdf->SetFillColor(230, 230, 230);
1148 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1149 $pdf->SetTextColor(0, 0, 60);
1150 $pdf->SetFillColor(255, 255, 255);
1155 $pdf->SetXY($posx + 2, $posy + 3);
1156 $pdf->SetFont(
'',
'B', $default_font_size);
1157 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1158 $posy = $pdf->getY();
1162 $pdf->SetXY($posx + 2, $posy);
1163 $pdf->SetFont(
'',
'', $default_font_size - 1);
1164 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection);
1168 $usecontact =
false;
1169 $arrayidcontact =
$object->origin_object->getIdContact(
'external',
'SHIPPING');
1170 if (count($arrayidcontact) > 0) {
1172 $result =
$object->fetch_contact($arrayidcontact[0]);
1176 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1177 $thirdparty =
$object->contact;
1179 $thirdparty =
$object->thirdparty;
1188 if ($this->page_largeur < 210) {
1192 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1194 $posx = $this->marge_gauche;
1199 $pdf->SetTextColor(0, 0, 0);
1200 $pdf->SetFont(
'',
'', $default_font_size - 2);
1201 $pdf->SetXY($posx + 2, $posy - 5);
1202 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient"), 0, $ltrdirection);
1203 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1207 $pdf->SetXY($posx + 2, $posy + 3);
1208 $pdf->SetFont(
'',
'B', $default_font_size);
1210 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection);
1212 $posy = $pdf->getY();
1215 $pdf->SetXY($posx + 2, $posy);
1216 $pdf->SetFont(
'',
'', $default_font_size - 1);
1218 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection);
1221 $pdf->SetTextColor(0, 0, 0);