126 public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
129 global $user, $conf, $langs, $hookmanager;
133 if (!is_object($outputlangs)) {
134 $outputlangs = $langs;
138 $outputlangs->charset_output =
'ISO-8859-1';
142 $outputlangs->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"other",
"propal",
"deliveries",
"sendings",
"productbatch"));
149 global $outputlangsbis;
150 $outputlangsbis =
null;
152 $outputlangsbis =
new Translate(
'', $conf);
154 $outputlangsbis->loadLangs(array(
"main",
"bills",
"orders",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch"));
157 $nblines = count(
$object->lines);
160 $realpatharray = array();
161 $this->atleastonephoto =
false;
163 $objphoto =
new Product($this->db);
165 for ($i = 0; $i < $nblines; $i++) {
166 if (empty(
$object->lines[$i]->fk_product)) {
170 $objphoto->fetch(
$object->lines[$i]->fk_product);
173 $pdir =
get_exdir(
$object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
174 $dir = $conf->product->dir_output.
'/'.$pdir;
176 $pdir =
get_exdir(0, 0, 0, 0, $objphoto,
'product');
177 $dir = $conf->product->dir_output.
'/'.$pdir;
182 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
185 if ($obj[
'photo_vignette']) {
186 $filename = $obj[
'photo_vignette'];
188 $filename = $obj[
'photo'];
191 $filename = $obj[
'photo'];
194 $realpath = $dir.$filename;
195 $this->atleastonephoto =
true;
200 $realpatharray[$i] = $realpath;
205 if (count($realpatharray) == 0) {
206 $this->posxpicture = $this->posxweightvol;
209 if ($conf->expedition->dir_output) {
212 $dir = $conf->expedition->dir_output.
"/sending";
213 $file = $dir.
"/SPECIMEN.pdf";
216 $dir = $conf->expedition->dir_output.
"/sending/".$expref;
217 $file = $dir.
"/".$expref.
".pdf";
220 if (!file_exists($dir)) {
222 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
227 if (file_exists($dir)) {
229 if (!is_object($hookmanager)) {
230 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
233 $hookmanager->initHooks(array(
'pdfgeneration'));
234 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
236 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters,
$object, $action);
243 $heightforinfotot = 8;
244 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
245 $heightforfooter = $this->marge_basse + 8;
247 $heightforfooter += 6;
249 $pdf->SetAutoPageBreak(1, 0);
251 if (class_exists(
'TCPDF')) {
252 $pdf->setPrintHeader(
false);
253 $pdf->setPrintFooter(
false);
258 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
259 $tplidx = $pdf->importPage(1);
264 $pdf->SetDrawColor(128, 128, 128);
266 if (method_exists($pdf,
'AliasNbPages')) {
267 $pdf->AliasNbPages();
270 $pdf->SetTitle($outputlangs->convToOutputCharset(
$object->ref));
271 $pdf->SetSubject($outputlangs->transnoentities(
"Shipment"));
272 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
273 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
274 $pdf->SetKeyWords($outputlangs->convToOutputCharset(
$object->ref).
" ".$outputlangs->transnoentities(
"Shipment"));
276 $pdf->SetCompression(
false);
280 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
284 if (!empty($tplidx)) {
285 $pdf->useTemplate($tplidx);
289 $pdf->SetFont(
'',
'', $default_font_size - 1);
290 $pdf->MultiCell(0, 3,
'');
291 $pdf->SetTextColor(0, 0, 0);
294 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
296 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
298 $this->posxdesc = $this->marge_gauche + 1;
301 $height_incoterms = 0;
302 if (isModEnabled(
'incoterm')) {
303 $desc_incoterms =
$object->getIncotermsForPDF();
304 if ($desc_incoterms) {
307 $pdf->SetFont(
'',
'', $default_font_size - 1);
308 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
309 $nexY = $pdf->GetY();
310 $height_incoterms = $nexY - $tab_top;
313 $pdf->SetDrawColor(192, 192, 192);
314 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
316 $tab_top = $nexY + 6;
317 $height_incoterms += 4;
322 $notetoshow = empty(
$object->note_public) ?
'' :
$object->note_public;
325 $extranote = $this->getExtrafieldsInHtml(
$object, $outputlangs);
326 if (!empty($extranote)) {
330 if (!empty($notetoshow) || !empty(
$object->tracking_number)) {
332 $tab_topbeforetrackingnumber = $tab_top;
335 if (!empty(
$object->tracking_number)) {
336 $height_trackingnumber = 4;
338 $pdf->SetFont(
'',
'B', $default_font_size - 2);
339 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber") .
" : " .
$object->tracking_number, 0, 1,
false,
true,
'L');
340 $tab_top_alt = $pdf->GetY();
343 if (!empty(
$object->tracking_url)) {
344 if (
$object->shipping_method_id > 0) {
346 $code = $outputlangs->getLabelFromKey($this->db,
$object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
349 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
351 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
355 $label .=
$object->tracking_url;
358 $height_trackingnumber += 4;
359 $pdf->SetFont(
'',
'B', $default_font_size - 2);
360 $pdf->writeHTMLCell(60, $height_trackingnumber, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
363 $tab_top = $pdf->GetY();
367 $pagenb = $pdf->getPage();
368 if (!empty($notetoshow) || !empty(
$object->tracking_number)) {
371 $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite;
372 $pageposbeforenote = $pagenb;
379 $pdf->startTransaction();
381 $pdf->SetFont(
'',
'', $default_font_size - 1);
382 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
384 $pageposafternote = $pdf->getPage();
385 $posyafter = $pdf->GetY();
387 if ($pageposafternote > $pageposbeforenote) {
388 $pdf->rollbackTransaction(
true);
391 while ($pagenb < $pageposafternote) {
394 if (!empty($tplidx)) {
395 $pdf->useTemplate($tplidx);
401 $pdf->setTopMargin($tab_top_newpage);
403 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
407 $pdf->setPage($pageposbeforenote);
408 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
409 $pdf->SetFont(
'',
'', $default_font_size - 1);
410 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
411 $pageposafternote = $pdf->getPage();
413 $posyafter = $pdf->GetY();
415 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
416 $pdf->AddPage(
'',
'',
true);
419 $pdf->setPage($pageposafternote);
420 $pdf->setTopMargin($tab_top_newpage);
422 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext);
428 $i = $pageposbeforenote;
429 while ($i < $pageposafternote) {
433 $pdf->SetDrawColor(128, 128, 128);
435 if ($i > $pageposbeforenote) {
436 if (empty($height_trackingnumber)) {
437 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter);
439 $height_note = $this->page_hauteur - ($tab_top_newpage + $heightforfooter) + $height_trackingnumber + 1;
440 $tab_top_newpage = $tab_topbeforetrackingnumber;
442 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 2);
444 if (empty($height_trackingnumber)) {
445 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter);
447 $height_note = $this->page_hauteur - ($tab_top + $heightforfooter) + $height_trackingnumber + 1;
448 $tab_top = $tab_topbeforetrackingnumber;
450 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 2);
454 $pdf->setPageOrientation(
'', 1, 0);
461 $pdf->setPage($pageposafternote);
462 if (!empty($tplidx)) {
463 $pdf->useTemplate($tplidx);
468 $height_note = $posyafter - $tab_top_newpage;
469 $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
471 $pdf->commitTransaction();
472 $posyafter = $pdf->GetY();
473 if (empty($height_trackingnumber)) {
474 $height_note = $posyafter - $tab_top + 1;
476 $height_note = $posyafter - $tab_top + $height_trackingnumber + 1;
477 $tab_top = $tab_topbeforetrackingnumber;
479 $pdf->Rect($this->marge_gauche, $tab_top - 1, $tab_width, $height_note + 2);
482 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + 20))) {
484 $pdf->AddPage(
'',
'',
true);
487 $pdf->setPage($pageposafternote);
488 if (!empty($tplidx)) {
489 $pdf->useTemplate($tplidx);
495 $posyafter = $tab_top_newpage;
499 $tab_height = $tab_height - $height_note;
500 $tab_top = $posyafter + 6;
510 require_once DOL_DOCUMENT_ROOT.
'/core/modules/barcode/doc/tcpdfbarcode.modules.php';
512 $encoding =
'QRCODE';
516 if ($module->encodingIsSupported($encoding)) {
517 $result = $module->writeBarCode(
$object->ref, $encoding);
521 if (!preg_match(
'/^\w+$/', $newcode) ||
dol_strlen($newcode) > 32) {
522 $newcode =
dol_hash($newcode,
'md5');
524 $barcode_path = $conf->barcode->dir_temp .
'/barcode_' . $newcode .
'_' . $encoding .
'.png';
530 $pdf->Image($barcode_path, $this->marge_gauche, $tab_top, 20, 20);
532 $nexY = $pdf->GetY();
533 $height_barcode = 20;
537 $this->error =
'Failed to generate barcode';
545 $pdf->startTransaction();
546 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs);
547 $pdf->rollbackTransaction(
true);
550 $nexY = $tab_top + $this->tabTitleHeight;
553 $pageposbeforeprintlines = $pdf->getPage();
554 $pagenb = $pageposbeforeprintlines;
555 for ($i = 0; $i < $nblines; $i++) {
557 $pdf->SetFont(
'',
'', $default_font_size - 1);
558 $pdf->SetTextColor(0, 0, 0);
561 $imglinesize = array();
562 if (!empty($realpatharray[$i])) {
566 $pdf->setTopMargin($tab_top_newpage);
567 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
568 $pageposbefore = $pdf->getPage();
570 $showpricebeforepagebreak = 1;
572 $posYAfterDescription = 0;
573 $heightforsignature = 0;
577 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) {
578 $pdf->AddPage(
'',
'',
true);
579 if (!empty($tplidx)) {
580 $pdf->useTemplate($tplidx);
583 $pdf->setPage($pageposbefore + 1);
585 $curY = $tab_top_newpage;
589 $showpricebeforepagebreak = 1;
591 $showpricebeforepagebreak = 0;
596 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
597 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY + 1, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
599 $posYAfterImage = $curY + $imglinesize[
'height'];
605 $pdf->startTransaction();
609 $pageposafter = $pdf->getPage();
610 if ($pageposafter > $pageposbefore) {
611 $pdf->rollbackTransaction(
true);
615 $pageposafter = $pdf->getPage();
616 $posyafter = $pdf->GetY();
618 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) {
619 if ($i == ($nblines - 1)) {
620 $pdf->AddPage(
'',
'',
true);
621 if (!empty($tplidx)) {
622 $pdf->useTemplate($tplidx);
625 $pdf->setPage($pageposafter + 1);
631 $showpricebeforepagebreak = 1;
633 $showpricebeforepagebreak = 0;
637 $pdf->commitTransaction();
639 $posYAfterDescription = $pdf->GetY();
642 $nexY = max($pdf->GetY(), $posYAfterImage);
643 $pageposafter = $pdf->getPage();
645 $pdf->setPage($pageposbefore);
646 $pdf->setTopMargin($this->marge_haute);
647 $pdf->setPageOrientation(
'', 1, 0);
650 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
651 $pdf->setPage($pageposafter);
652 $curY = $tab_top_newpage;
656 if ($pageposafter > $pageposbefore) {
657 $pdf->setPage($pageposafter);
658 $curY = $tab_top_newpage;
661 $pdf->SetFont(
'',
'', $default_font_size - 1);
666 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->weight) {
670 if (empty(
$object->lines[$i]->fk_product_type) &&
$object->lines[$i]->volume) {
676 $this->
printStdColumnContent($pdf, $curY,
'weight', $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt);
677 $nexY = max($pdf->GetY(), $nexY);
682 $nexY = max($pdf->GetY(), $nexY);
687 $nexY = max($pdf->GetY(), $nexY);
692 $nexY = max($pdf->GetY(), $nexY);
697 $nexY = max($pdf->GetY(), $nexY);
701 if (!empty(
$object->lines[$i]->array_options)) {
702 foreach (
$object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
706 $nexY = max($pdf->GetY(), $nexY);
713 $pdf->setPage($pageposafter);
714 $pdf->SetLineStyle(array(
'dash' =>
'1,1',
'color' => array(80, 80, 80)));
716 $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
717 $pdf->SetLineStyle(array(
'dash' => 0));
721 while ($pagenb < $pageposafter) {
722 $pdf->setPage($pagenb);
723 if ($pagenb == $pageposbeforeprintlines) {
724 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
726 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
730 $pdf->setPage($pagenb);
731 $pdf->setPageOrientation(
'', 1, 0);
735 if (!empty($tplidx)) {
736 $pdf->useTemplate($tplidx);
739 if (isset(
$object->lines[$i + 1]->pagebreak) &&
$object->lines[$i + 1]->pagebreak) {
741 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
743 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
748 if (!empty($tplidx)) {
749 $pdf->useTemplate($tplidx);
760 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
761 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
763 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
764 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
772 if (method_exists($pdf,
'AliasNbPages')) {
773 $pdf->AliasNbPages();
778 $pdf->Output($file,
'F');
781 $hookmanager->initHooks(array(
'pdfgeneration'));
782 $parameters = array(
'file' => $file,
'object' =>
$object,
'outputlangs' => $outputlangs);
784 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
786 $this->error = $hookmanager->error;
787 $this->errors = $hookmanager->errors;
792 $this->result = array(
'fullpath' => $file);
796 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
800 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
976 global $conf, $langs, $mysoc;
978 $langs->load(
"orders");
985 $pdf->SetTextColor(0, 0, 60);
986 $pdf->SetFont(
'',
'B', $default_font_size + 3);
990 $posy = $this->marge_haute;
991 $posx = $this->page_largeur - $this->marge_droite - $w;
993 $pdf->SetXY($this->marge_gauche, $posy);
996 if ($this->emetteur->logo) {
997 $logodir = $conf->mycompany->dir_output;
998 if (!empty($conf->mycompany->multidir_output[
$object->entity])) {
999 $logodir = $conf->mycompany->multidir_output[
$object->entity];
1002 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
1004 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
1006 if (is_readable($logo)) {
1008 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
1010 $pdf->SetTextColor(200, 0, 0);
1011 $pdf->SetFont(
'',
'B', $default_font_size - 2);
1012 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
1013 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
1016 $text = $this->emetteur->name;
1017 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
1020 $pdf->SetDrawColor(128, 128, 128);
1022 $posx = $this->page_largeur - $w - $this->marge_droite;
1023 $posy = $this->marge_haute;
1025 $pdf->SetFont(
'',
'B', $default_font_size + 2);
1026 $pdf->SetXY($posx, $posy);
1027 $pdf->SetTextColor(0, 0, 60);
1028 $title = $outputlangs->transnoentities(
"SendingSheet");
1029 $pdf->MultiCell($w, 4, $title,
'',
'R');
1031 $pdf->SetFont(
'',
'', $default_font_size + 1);
1035 $pdf->SetXY($posx, $posy);
1036 $pdf->SetTextColor(0, 0, 60);
1037 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefSending").
" : ".
$object->ref,
'',
'R');
1040 if (!empty(
$object->date_delivery)) {
1042 $pdf->SetXY($posx, $posy);
1043 $pdf->SetTextColor(0, 0, 60);
1044 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date(
$object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
1049 $pdf->SetXY($posx, $posy);
1050 $pdf->SetTextColor(0, 0, 60);
1051 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities(
$object->thirdparty->code_client),
'',
'R');
1055 $pdf->SetFont(
'',
'', $default_font_size + 3);
1060 $origin_id =
$object->origin_id;
1064 if (isModEnabled($origin)) {
1065 $outputlangs->load(
'orders');
1067 $classname = ucfirst($origin);
1068 $linkedobject =
new $classname($this->db);
1069 $result = $linkedobject->fetch($origin_id);
1073 $pdf->SetFont(
'',
'', $default_font_size - 2);
1074 $text = $linkedobject->ref;
1075 if (isset($linkedobject->ref_client) && !empty($linkedobject->ref_client)) {
1076 $text .=
' ('.$linkedobject->ref_client.
')';
1079 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1080 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
1082 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
1083 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
1099 $carac_emetteur =
'';
1101 $arrayidcontact = array();
1102 if (!empty($origin) && is_object(
$object->origin_object)) {
1103 $arrayidcontact =
$object->origin_object->getIdContact(
'internal',
'SALESREPFOLL');
1105 if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
1106 $object->fetch_user(reset($arrayidcontact));
1107 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
1108 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset(
$object->user->getFullName($outputlangs));
1110 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty(
$object->user->office_phone)) ?
$object->user->office_phone :
'';
1114 $carac_emetteur .=
"\n";
1121 $posx = $this->marge_gauche;
1123 $posx = $this->page_largeur - $this->marge_droite - 80;
1131 $pdf->SetTextColor(0, 0, 0);
1132 $pdf->SetFont(
'',
'', $default_font_size - 2);
1133 $pdf->SetXY($posx, $posy - 5);
1134 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender"), 0,
'L');
1135 $pdf->SetXY($posx, $posy);
1136 $pdf->SetFillColor(230, 230, 230);
1137 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1138 $pdf->SetTextColor(0, 0, 60);
1139 $pdf->SetFillColor(255, 255, 255);
1144 $pdf->SetXY($posx + 2, $posy + 3);
1145 $pdf->SetFont(
'',
'B', $default_font_size);
1146 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1147 $posy = $pdf->getY();
1151 $pdf->SetXY($posx + 2, $posy);
1152 $pdf->SetFont(
'',
'', $default_font_size - 1);
1153 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1157 $usecontact =
false;
1158 $arrayidcontact =
$object->origin_object->getIdContact(
'external',
'SHIPPING');
1159 if (count($arrayidcontact) > 0) {
1161 $result =
$object->fetch_contact($arrayidcontact[0]);
1165 if ($usecontact && (
$object->contact->socid !=
$object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1166 $thirdparty =
$object->contact;
1168 $thirdparty =
$object->thirdparty;
1177 if ($this->page_largeur < 210) {
1181 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1183 $posx = $this->marge_gauche;
1188 $pdf->SetTextColor(0, 0, 0);
1189 $pdf->SetFont(
'',
'', $default_font_size - 2);
1190 $pdf->SetXY($posx + 2, $posy - 5);
1191 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient"), 0,
'L');
1192 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1196 $pdf->SetXY($posx + 2, $posy + 3);
1197 $pdf->SetFont(
'',
'B', $default_font_size);
1198 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1200 $posy = $pdf->getY();
1203 $pdf->SetXY($posx + 2, $posy);
1204 $pdf->SetFont(
'',
'', $default_font_size - 1);
1205 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1208 $pdf->SetTextColor(0, 0, 0);