158 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
161 global $user, $conf, $langs, $hookmanager;
163 $object->fetch_thirdparty();
165 if (!is_object($outputlangs)) {
166 $outputlangs = $langs;
170 $outputlangs->charset_output =
'ISO-8859-1';
174 $outputlangs->loadLangs(array(
"main",
"bills",
"products",
"dict",
"companies",
"propal",
"deliveries",
"sendings",
"productbatch",
"other"));
177 if ($object->statut == $object::STATUS_DRAFT && (
getDolGlobalString(
'SHIPPING_DRAFT_WATERMARK'))) {
178 $this->watermark = $conf->global->SHIPPING_DRAFT_WATERMARK;
181 $nblines = count($object->lines);
184 $realpatharray = array();
186 $objphoto =
new Product($this->db);
188 for ($i = 0; $i < $nblines; $i++) {
189 if (empty($object->lines[$i]->fk_product)) {
193 $objphoto =
new Product($this->db);
194 $objphoto->fetch($object->lines[$i]->fk_product);
196 $pdir =
get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto,
'product').$object->lines[$i]->fk_product.
"/photos/";
197 $dir = $conf->product->dir_output.
'/'.$pdir;
199 $pdir =
get_exdir(0, 2, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
200 $dir = $conf->product->dir_output.
'/'.$pdir;
205 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
208 if ($obj[
'photo_vignette']) {
209 $filename = $obj[
'photo_vignette'];
211 $filename = $obj[
'photo'];
214 $filename = $obj[
'photo'];
217 $realpath = $dir.$filename;
222 $realpatharray[$i] = $realpath;
227 if (count($realpatharray) == 0) {
228 $this->posxpicture = $this->posxweightvol;
231 if ($conf->expedition->dir_output) {
233 if ($object->specimen) {
234 $dir = $conf->expedition->dir_output.
"/sending";
235 $file = $dir.
"/SPECIMEN.pdf";
238 $dir = $conf->expedition->dir_output.
"/sending/".$expref;
239 $file = $dir.
"/".$expref.
".pdf";
242 if (!file_exists($dir)) {
244 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
249 if (file_exists($dir)) {
251 if (!is_object($hookmanager)) {
252 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
255 $hookmanager->initHooks(array(
'pdfgeneration'));
256 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
258 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
261 $nblines = count($object->lines);
265 $heightforinfotot = 8;
266 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
267 $heightforfooter = $this->marge_basse + 8;
269 $heightforfooter += 6;
271 $pdf->SetAutoPageBreak(1, 0);
273 if (class_exists(
'TCPDF')) {
274 $pdf->setPrintHeader(
false);
275 $pdf->setPrintFooter(
false);
280 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/' .
getDolGlobalString(
'MAIN_ADD_PDF_BACKGROUND'));
281 $tplidx = $pdf->importPage(1);
286 $pdf->SetDrawColor(128, 128, 128);
288 if (method_exists($pdf,
'AliasNbPages')) {
289 $pdf->AliasNbPages();
292 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
293 $pdf->SetSubject($outputlangs->transnoentities(
"Shipment"));
294 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
295 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
296 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"Shipment"));
298 $pdf->SetCompression(
false);
301 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
305 if (!empty($tplidx)) {
306 $pdf->useTemplate($tplidx);
309 $this->
_pagehead($pdf, $object, 1, $outputlangs);
310 $pdf->SetFont(
'',
'', $default_font_size - 1);
311 $pdf->MultiCell(0, 3,
'');
312 $pdf->SetTextColor(0, 0, 0);
315 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
317 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
320 $height_incoterms = 0;
321 if (isModEnabled(
'incoterm')) {
322 $desc_incoterms = $object->getIncotermsForPDF();
323 if ($desc_incoterms) {
326 $pdf->SetFont(
'',
'', $default_font_size - 1);
327 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
328 $nexY = $pdf->GetY();
329 $height_incoterms = $nexY - $tab_top;
332 $pdf->SetDrawColor(192, 192, 192);
333 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
335 $tab_top = $nexY + 6;
336 $height_incoterms += 4;
340 if (!empty($object->note_public) || !empty($object->tracking_number)) {
341 $tab_top = 88 + $height_incoterms;
342 $tab_top_alt = $tab_top;
344 $pdf->SetFont(
'',
'B', $default_font_size - 2);
349 if (!empty($object->tracking_number)) {
350 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top - 1, $outputlangs->transnoentities(
"TrackingNumber").
" : ".$object->tracking_number, 0, 1,
false,
true,
'L');
351 $tab_top_alt = $pdf->GetY();
353 $object->getUrlTrackingStatus($object->tracking_number);
354 if (!empty($object->tracking_url)) {
355 if ($object->shipping_method_id > 0) {
357 $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id,
'c_shipment_mode',
'rowid',
'code');
359 if ($object->tracking_url != $object->tracking_number) {
360 $label .= $outputlangs->trans(
"LinkToTrackYourPackage").
"<br>";
362 $label .= $outputlangs->trans(
"SendingMethod").
": ".$outputlangs->trans(
"SendingMethod".strtoupper($code));
364 if ($object->tracking_url != $object->tracking_number) {
366 $label .= $object->tracking_url;
368 $pdf->SetFont(
'',
'B', $default_font_size - 2);
369 $pdf->writeHTMLCell(60, 4, $this->posxdesc - 1, $tab_top_alt, $label, 0, 1,
false,
true,
'L');
371 $tab_top_alt = $pdf->GetY();
377 if (!empty($object->note_public)) {
378 $pdf->SetFont(
'',
'', $default_font_size - 1);
379 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top_alt,
dol_htmlentitiesbr($object->note_public), 0, 1);
382 $nexY = $pdf->GetY();
383 $height_note = $nexY - $tab_top;
386 $pdf->SetDrawColor(192, 192, 192);
387 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
389 $tab_height = $tab_height - $height_note;
390 $tab_top = $nexY + 6;
395 $iniY = $tab_top + 7;
396 $curY = $tab_top + 7;
397 $nexY = $tab_top + 7;
400 for ($i = 0; $i < $nblines; $i++) {
402 $pdf->SetFont(
'',
'', $default_font_size - 1);
403 $pdf->SetTextColor(0, 0, 0);
406 $imglinesize = array();
407 if (!empty($realpatharray[$i])) {
411 $pdf->setTopMargin($tab_top_newpage);
412 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
413 $pageposbefore = $pdf->getPage();
415 $showpricebeforepagebreak = 1;
417 $posYAfterDescription = 0;
420 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
421 $pdf->AddPage(
'',
'',
true);
422 if (!empty($tplidx)) {
423 $pdf->useTemplate($tplidx);
426 $this->
_pagehead($pdf, $object, 0, $outputlangs);
428 $pdf->setPage($pageposbefore + 1);
430 $curY = $tab_top_newpage;
434 $showpricebeforepagebreak = 1;
436 $showpricebeforepagebreak = 0;
440 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
441 $curX = $this->posxpicture - 1;
442 $pdf->Image($realpatharray[$i], $curX + (($this->posxweightvol - $this->posxpicture - $imglinesize[
'width']) / 2), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
444 $posYAfterImage = $curY + $imglinesize[
'height'];
448 $curX = $this->posxdesc - 1;
450 $pdf->startTransaction();
451 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
453 $pageposafter = $pdf->getPage();
454 if ($pageposafter > $pageposbefore) {
455 $pdf->rollbackTransaction(
true);
456 $pageposafter = $pageposbefore;
458 $pdf->setPageOrientation(
'', 1, $heightforfooter);
459 pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxpicture - $curX, 3, $curX, $curY, $hideref, $hidedesc);
461 $pageposafter = $pdf->getPage();
462 $posyafter = $pdf->GetY();
464 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
465 if ($i == ($nblines - 1)) {
466 $pdf->AddPage(
'',
'',
true);
467 if (!empty($tplidx)) {
468 $pdf->useTemplate($tplidx);
471 $this->
_pagehead($pdf, $object, 0, $outputlangs);
473 $pdf->setPage($pageposafter + 1);
480 $showpricebeforepagebreak = 1;
482 $showpricebeforepagebreak = 0;
486 $pdf->commitTransaction();
488 $posYAfterDescription = $pdf->GetY();
490 $nexY = $pdf->GetY();
491 $pageposafter = $pdf->getPage();
493 $pdf->setPage($pageposbefore);
494 $pdf->setTopMargin($this->marge_haute);
495 $pdf->setPageOrientation(
'', 1, 0);
498 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
499 $pdf->setPage($pageposafter);
500 $curY = $tab_top_newpage;
504 if ($pageposafter > $pageposbefore) {
505 $pdf->setPage($pageposafter);
506 $curY = $tab_top_newpage;
509 $pdf->SetFont(
'',
'', $default_font_size - 1);
511 $pdf->SetXY($this->posxweightvol, $curY);
513 if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->weight) {
514 $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).
' '.
measuringUnitString(0,
"weight", $object->lines[$i]->weight_units, 1);
517 if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume) {
518 $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).
' '.
measuringUnitString(0,
"volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0, 1);
522 $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt) ?
'<br>' :
'').$voltxt, 0, 0,
false,
true,
'C');
527 $pdf->SetXY($this->posxqtyordered, $curY);
528 $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,
'',
'C');
532 $pdf->SetXY($this->posxqtytoship, $curY);
533 $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,
'',
'C');
537 $pdf->SetXY($this->posxpuht, $curY);
538 $pdf->MultiCell(($this->posxtotalht - $this->posxpuht - 1), 3,
price($object->lines[$i]->subprice, 0, $outputlangs),
'',
'R');
540 $pdf->SetXY($this->posxtotalht, $curY);
541 $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3,
price($object->lines[$i]->total_ht, 0, $outputlangs),
'',
'R');
545 if ($weighttxt && $voltxt) {
551 $pdf->setPage($pageposafter);
552 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
554 $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
555 $pdf->SetLineStyle(array(
'dash'=>0));
559 while ($pagenb < $pageposafter) {
560 $pdf->setPage($pagenb);
562 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
564 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
566 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
568 $pdf->setPage($pagenb);
569 $pdf->setPageOrientation(
'', 1, 0);
571 $this->
_pagehead($pdf, $object, 0, $outputlangs);
573 if (!empty($tplidx)) {
574 $pdf->useTemplate($tplidx);
577 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
579 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
581 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
583 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
586 if (!empty($tplidx)) {
587 $pdf->useTemplate($tplidx);
591 $this->
_pagehead($pdf, $object, 0, $outputlangs);
598 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
599 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
601 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
602 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
606 $posy = $this->
_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
609 $this->
_pagefoot($pdf, $object, $outputlangs);
610 if (method_exists($pdf,
'AliasNbPages')) {
611 $pdf->AliasNbPages();
616 $pdf->Output($file,
'F');
619 $hookmanager->initHooks(array(
'pdfgeneration'));
620 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
622 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
624 $this->error = $hookmanager->error;
625 $this->errors = $hookmanager->errors;
630 $this->result = array(
'fullpath'=>$file);
634 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
638 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"EXP_OUTPUTDIR");
655 protected function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
658 global $conf, $mysoc;
666 $pdf->SetFont(
'',
'B', $default_font_size - 1);
669 $col1x = $this->posxweightvol - 50;
670 $col2x = $this->posxweightvol;
676 $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
678 $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
684 $totalWeighttoshow =
'';
685 $totalVolumetoshow =
'';
688 $tmparray = $object->getTotalWeightVolume();
689 $totalWeight = $tmparray[
'weight'];
690 $totalVolume = $tmparray[
'volume'];
691 $totalOrdered = $tmparray[
'ordered'];
692 $totalToShip = $tmparray[
'toship'];
694 if ($object->trueWidth && $object->trueHeight && $object->trueDepth) {
695 $object->trueVolume =
price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0);
696 $object->volume_units = $object->size_units * 3;
699 if (!empty($totalWeight)) {
702 if (!empty($totalVolume)) {
705 if (!empty($object->trueWeight)) {
706 $totalWeighttoshow =
showDimensionInBestUnit($object->trueWeight, $object->weight_units,
"weight", $outputlangs);
708 if (!empty($object->trueVolume)) {
709 $totalVolumetoshow =
showDimensionInBestUnit($object->trueVolume, $object->volume_units,
"volume", $outputlangs);
712 $pdf->SetFillColor(255, 255, 255);
713 $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
714 $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(
"Total"), 0,
'L', 1);
717 $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
718 $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0,
'C', 1);
722 $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
723 $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0,
'C', 1);
727 $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
728 $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl,
'', 0,
'C', 1);
730 $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
731 $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl,
price($object->total_ht, 0, $outputlangs), 0,
'C', 1);
736 if ($totalWeighttoshow) {
737 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
738 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0,
'C', 1);
742 if ($totalVolumetoshow) {
743 $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
744 $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0,
'C', 1);
748 if (!$totalWeighttoshow && !$totalVolumetoshow) {
753 $pdf->SetTextColor(0, 0, 0);
755 return ($tab2_top + ($tab2_hl * $index));
849 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
851 global $conf, $langs, $mysoc;
853 $langs->load(
"orders");
860 $pdf->SetTextColor(0, 0, 60);
861 $pdf->SetFont(
'',
'B', $default_font_size + 3);
865 $posy = $this->marge_haute;
866 $posx = $this->page_largeur - $this->marge_droite - $w;
868 $pdf->SetXY($this->marge_gauche, $posy);
871 if ($this->emetteur->logo) {
872 $logodir = $conf->mycompany->dir_output;
873 if (!empty($conf->mycompany->multidir_output[$object->entity])) {
874 $logodir = $conf->mycompany->multidir_output[$object->entity];
877 $logo = $logodir.
'/logos/thumbs/'.$this->emetteur->logo_small;
879 $logo = $logodir.
'/logos/'.$this->emetteur->logo;
881 if (is_readable($logo)) {
883 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
885 $pdf->SetTextColor(200, 0, 0);
886 $pdf->SetFont(
'',
'B', $default_font_size - 2);
887 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
888 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
891 $text = $this->emetteur->name;
892 $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0,
'L');
896 if (isModEnabled(
'barcode')) {
899 $posx = $this->marge_gauche + 3;
902 if (isModEnabled(
'barcode')) {
908 $pdf->SetDrawColor(128, 128, 128);
910 $posx = $this->page_largeur - $w - $this->marge_droite;
911 $posy = $this->marge_haute;
913 $pdf->SetFont(
'',
'B', $default_font_size + 2);
914 $pdf->SetXY($posx, $posy);
915 $pdf->SetTextColor(0, 0, 60);
916 $title = $outputlangs->transnoentities(
"SendingSheet");
917 $pdf->MultiCell($w, 4, $title,
'',
'R');
919 $pdf->SetFont(
'',
'', $default_font_size + 1);
923 $pdf->SetXY($posx, $posy);
924 $pdf->SetTextColor(0, 0, 60);
925 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"RefSending").
" : ".$object->ref,
'',
'R');
928 if (!empty($object->date_delivery)) {
930 $pdf->SetXY($posx, $posy);
931 $pdf->SetTextColor(0, 0, 60);
932 $pdf->MultiCell($w, 4, $outputlangs->transnoentities(
"DateDeliveryPlanned").
" : ".
dol_print_date($object->date_delivery,
"day",
false, $outputlangs,
true),
'',
'R');
935 if (!
getDolGlobalString(
'MAIN_PDF_HIDE_CUSTOMER_CODE') && !empty($object->thirdparty->code_client)) {
937 $pdf->SetXY($posx, $posy);
938 $pdf->SetTextColor(0, 0, 60);
939 $pdf->MultiCell($w, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
943 $pdf->SetFont(
'',
'', $default_font_size + 3);
947 $origin = $object->origin;
948 $origin_id = $object->origin_id;
951 if (!empty($conf->$origin->enabled)) {
952 $outputlangs->load(
'orders');
954 $classname = ucfirst($origin);
955 $linkedobject =
new $classname($this->db);
956 $result = $linkedobject->fetch($origin_id);
960 $pdf->SetFont(
'',
'', $default_font_size - 2);
961 $text = $linkedobject->ref;
962 if ($linkedobject->ref_client) {
963 $text .=
' ('.$linkedobject->ref_client.
')';
966 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
967 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"RefOrder").
" : ".$outputlangs->transnoentities($text), 0,
'R');
969 $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff);
970 $pdf->MultiCell($w, 2, $outputlangs->transnoentities(
"OrderDate").
" : ".
dol_print_date($linkedobject->date,
"day",
false, $outputlangs,
true), 0,
'R');
986 $carac_emetteur =
'';
988 $arrayidcontact = array();
989 if (!empty($origin) && is_object($object->$origin)) {
990 $arrayidcontact = $object->$origin->getIdContact(
'internal',
'SALESREPFOLL');
992 if (count($arrayidcontact) > 0) {
993 $object->fetch_user(reset($arrayidcontact));
994 $labelbeforecontactname = ($outputlangs->transnoentities(
"FromContactName") !=
'FromContactName' ? $outputlangs->transnoentities(
"FromContactName") : $outputlangs->transnoentities(
"Name"));
995 $carac_emetteur .= ($carac_emetteur ?
"\n" :
'').$labelbeforecontactname.
": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs));
997 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_PHONE_AFTER_USER_CONTACT') && !empty($object->user->office_phone)) ? $object->user->office_phone :
'';
999 $carac_emetteur .= (
getDolGlobalInt(
'PDF_SHOW_EMAIL_AFTER_USER_CONTACT') && !empty($object->user->email)) ? $object->user->email :
'';
1001 $carac_emetteur .=
"\n";
1004 $carac_emetteur .=
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
1008 $posx = $this->marge_gauche;
1010 $posx = $this->page_largeur - $this->marge_droite - 80;
1018 $pdf->SetTextColor(0, 0, 0);
1019 $pdf->SetFont(
'',
'', $default_font_size - 2);
1020 $pdf->SetXY($posx, $posy - 5);
1021 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Sender"), 0,
'L');
1022 $pdf->SetXY($posx, $posy);
1023 $pdf->SetFillColor(230, 230, 230);
1024 $pdf->MultiCell($widthrecbox, $hautcadre,
"", 0,
'R', 1);
1025 $pdf->SetTextColor(0, 0, 60);
1026 $pdf->SetFillColor(255, 255, 255);
1031 $pdf->SetXY($posx + 2, $posy + 3);
1032 $pdf->SetFont(
'',
'B', $default_font_size);
1033 $pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
1034 $posy = $pdf->getY();
1038 $pdf->SetXY($posx + 2, $posy);
1039 $pdf->SetFont(
'',
'', $default_font_size - 1);
1040 $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0,
'L');
1044 $usecontact =
false;
1045 $arrayidcontact = $object->$origin->getIdContact(
'external',
'SHIPPING');
1046 if (count($arrayidcontact) > 0) {
1048 $result = $object->fetch_contact($arrayidcontact[0]);
1052 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) ||
getDolGlobalString(
'MAIN_USE_COMPANY_NAME_OF_CONTACT')))) {
1053 $thirdparty = $object->contact;
1055 $thirdparty = $object->thirdparty;
1060 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact :
null), $usecontact,
'targetwithdetails', $object);
1064 if ($this->page_largeur < 210) {
1068 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
1070 $posx = $this->marge_gauche;
1075 $pdf->SetTextColor(0, 0, 0);
1076 $pdf->SetFont(
'',
'', $default_font_size - 2);
1077 $pdf->SetXY($posx + 2, $posy - 5);
1078 $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities(
"Recipient"), 0,
'L');
1079 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1083 $pdf->SetXY($posx + 2, $posy + 3);
1084 $pdf->SetFont(
'',
'B', $default_font_size);
1085 $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0,
'L');
1087 $posy = $pdf->getY();
1090 $pdf->SetFont(
'',
'', $default_font_size - 1);
1091 $pdf->SetXY($posx + 2, $posy);
1092 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
1095 $pdf->SetTextColor(0, 0, 0);