31 require_once DOL_DOCUMENT_ROOT.
'/core/modules/delivery/modules_delivery.php';
32 require_once DOL_DOCUMENT_ROOT.
'/delivery/class/delivery.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
66 public $phpmin = array(5, 5);
72 public $version =
'dolibarr';
122 global $conf, $langs, $mysoc;
125 $langs->loadLangs(array(
"main",
"bills",
"sendings",
"companies"));
128 $this->
name =
"Storm";
129 $this->
description = $langs->trans(
"DocumentModelStorm");
134 $this->page_largeur = $formatarray[
'width'];
135 $this->page_hauteur = $formatarray[
'height'];
136 $this->format = array($this->page_largeur, $this->page_hauteur);
137 $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
138 $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
139 $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
140 $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
142 $this->option_logo = 1;
143 $this->option_tva = 1;
144 $this->option_codeproduitservice = 1;
147 $this->emetteur = $mysoc;
148 if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2);
150 $this->tva = array();
151 $this->atleastoneratenotnull = 0;
152 $this->atleastonediscount = 0;
168 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
171 global $user, $langs, $conf, $mysoc, $hookmanager;
173 if (!is_object($outputlangs)) $outputlangs = $langs;
175 if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output =
'ISO-8859-1';
178 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"sendings",
"deliveries"));
180 if ($conf->expedition->dir_output)
182 $object->fetch_thirdparty();
185 if ($object->specimen)
187 $dir = $conf->expedition->dir_output.
"/receipt";
188 $file = $dir.
"/SPECIMEN.pdf";
192 $dir = $conf->expedition->dir_output.
"/receipt/".$objectref;
193 $file = $dir.
"/".$objectref.
".pdf";
196 if (!file_exists($dir))
200 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
205 if (file_exists($dir))
208 if (!is_object($hookmanager))
210 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
213 $hookmanager->initHooks(array(
'pdfgeneration'));
214 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
216 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
218 $nblines = count($object->lines);
222 $realpatharray = array();
223 $this->atleastonephoto =
false;
224 if (!empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE))
228 for ($i = 0; $i < $nblines; $i++)
230 if (empty($object->lines[$i]->fk_product))
continue;
232 $objphoto->fetch($object->lines[$i]->fk_product);
234 if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
236 $pdir[0] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
237 $pdir[1] =
get_exdir(0, 0, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
240 $pdir[0] =
get_exdir(0, 0, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
241 $pdir[1] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
245 foreach ($pdir as $midir)
249 $dir = $conf->product->dir_output.
'/'.$midir;
251 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
253 if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES))
255 if ($obj[
'photo_vignette'])
257 $filename = $obj[
'photo_vignette'];
260 $filename = $obj[
'photo'];
264 $filename = $obj[
'photo'];
267 $realpath = $dir.$filename;
269 $this->atleastonephoto =
true;
274 if ($realpath && $arephoto) $realpatharray[$i] = $realpath;
278 if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol;
285 $heightforinfotot = 30;
286 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
287 $heightforfooter = $this->marge_basse + 8;
288 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
289 $pdf->SetAutoPageBreak(1, 0);
291 if (class_exists(
'TCPDF'))
293 $pdf->setPrintHeader(
false);
294 $pdf->setPrintFooter(
false);
298 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
300 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
301 $tplidx = $pdf->importPage(1);
306 $result = $expedition->fetch($object->origin_id);
309 if ($expedition->origin ==
'commande')
311 $commande->fetch($expedition->origin_id);
313 $object->commande = $commande;
314 $object->commande->loadExpeditions();
319 $pdf->SetDrawColor(128, 128, 128);
321 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
322 $pdf->SetSubject($outputlangs->transnoentities(
"DeliveryOrder"));
323 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
324 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
325 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"DeliveryOrder"));
326 if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(
false);
328 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
333 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
335 $this->
_pagehead($pdf, $object, 1, $outputlangs);
336 $pdf->SetFont(
'',
'', $default_font_size - 1);
337 $pdf->MultiCell(0, 3,
'');
338 $pdf->SetTextColor(0, 0, 0);
341 $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10);
343 $tab_height_newpage = 150;
345 $this->posxdesc = $this->marge_gauche + 1;
348 $height_incoterms = 0;
349 if (!empty($conf->incoterm->enabled))
351 $desc_incoterms = $object->getIncotermsForPDF();
356 $pdf->SetFont(
'',
'', $default_font_size - 1);
357 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
358 $nexY = $pdf->GetY();
359 $height_incoterms = $nexY - $tab_top;
362 $pdf->SetDrawColor(192, 192, 192);
363 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
365 $tab_top = $nexY + 6;
366 $height_incoterms += 4;
371 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
374 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
375 if (!empty($extranote))
380 if (!empty($notetoshow))
382 $tab_top = 88 + $height_incoterms;
384 $pdf->SetFont(
'',
'', $default_font_size - 1);
385 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
386 $nexY = $pdf->GetY();
387 $height_note = $nexY - $tab_top;
390 $pdf->SetDrawColor(192, 192, 192);
391 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
393 $tab_height = $tab_height - $height_note;
394 $tab_top = $nexY + 6;
404 $pdf->startTransaction();
405 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, 0);
406 $pdf->rollbackTransaction(
true);
408 $iniY = $tab_top + $this->tabTitleHeight + 2;
409 $curY = $tab_top + $this->tabTitleHeight + 2;
410 $nexY = $tab_top + $this->tabTitleHeight + 2;
413 for ($i = 0; $i < $nblines; $i++)
416 if (empty($object->lines[$i]->array_options)) {
417 $object->lines[$i]->fetch_optionals();
421 $pdf->SetFont(
'',
'', $default_font_size - 1);
422 $pdf->SetTextColor(0, 0, 0);
425 $imglinesize = array();
429 $pdf->setTopMargin($tab_top_newpage);
430 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
431 $pageposbefore = $pdf->getPage();
434 $curX = $this->posxdesc - 1;
436 $showpricebeforepagebreak = 1;
439 $posYAfterDescription = 0;
443 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
445 $pdf->AddPage(
'',
'',
true);
446 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
448 $pdf->setPage($pageposbefore + 1);
450 $curY = $tab_top_newpage;
453 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
454 $showpricebeforepagebreak = 1;
455 else $showpricebeforepagebreak = 0;
459 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height']))
461 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
463 $posYAfterImage = $curY + $imglinesize[
'height'];
470 $pdf->startTransaction();
472 $pageposafter = $pdf->getPage();
473 if ($pageposafter > $pageposbefore)
475 $pdf->rollbackTransaction(
true);
476 $pageposafter = $pageposbefore;
478 $pdf->setPageOrientation(
'', 1, $heightforfooter);
480 $posyafter = $pdf->GetY();
481 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)))
483 if ($i == ($nblines - 1))
485 $pdf->AddPage(
'',
'',
true);
486 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
487 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
488 $pdf->setPage($pageposafter + 1);
493 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
494 $showpricebeforepagebreak = 1;
495 else $showpricebeforepagebreak = 0;
499 $pdf->commitTransaction();
502 $posYAfterDescription = $pdf->GetY();
505 $nexY = $pdf->GetY();
506 $pageposafter = $pdf->getPage();
507 $pdf->setPage($pageposbefore);
508 $pdf->setTopMargin($this->marge_haute);
509 $pdf->setPageOrientation(
'', 1, 0);
512 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
513 $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
516 $pdf->SetFont(
'',
'', $default_font_size - 1);
522 $nexY = max($pdf->GetY(), $nexY);
527 $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
529 $nexY = max($pdf->GetY(), $nexY);
532 $nexY = max($nexY, $posYAfterImage);
535 if (!empty($object->lines[$i]->array_options)) {
536 foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
541 $nexY = max($pdf->GetY(), $nexY);
547 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
549 $pdf->setPage($pageposafter);
550 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
552 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
553 $pdf->SetLineStyle(array(
'dash'=>0));
559 while ($pagenb < $pageposafter)
561 $pdf->setPage($pagenb);
564 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
567 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
569 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
571 $pdf->setPage($pagenb);
572 $pdf->setPageOrientation(
'', 1, 0);
573 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
575 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);
582 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
584 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
587 if (!empty($tplidx)) $pdf->useTemplate($tplidx);
589 if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->
_pagehead($pdf, $object, 0, $outputlangs);
596 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
597 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
600 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
601 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
605 $this->
_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
608 $this->
_pagefoot($pdf, $object, $outputlangs);
610 if (method_exists($pdf,
'AliasNbPages')) $pdf->AliasNbPages();
614 $pdf->Output($file,
'F');
617 if (!is_object($hookmanager))
619 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
622 $hookmanager->initHooks(array(
'pdfgeneration'));
623 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
625 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
628 $this->error = $hookmanager->error;
629 $this->errors = $hookmanager->errors;
632 if (!empty($conf->global->MAIN_UMASK))
633 @chmod($file, octdec($conf->global->MAIN_UMASK));
635 $this->result = array(
'fullpath'=>$file);
640 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
645 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"LIVRAISON_OUTPUTDIR");
663 global $conf, $mysoc;
666 $pdf->SetFont(
'',
'', $default_font_size);
667 $pdf->SetXY($this->marge_gauche, $posy);
669 $larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3;
670 $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
671 $pdf->SetXY($this->marge_gauche + 2, $posy + 2);
672 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans(
"For").
' '.$outputlangs->convToOutputCharset($mysoc->name).
":",
'',
'L');
674 $pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25);
675 $pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2);
676 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans(
"ForCustomer").
':',
'',
'L');
693 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
699 if ($hidetop) $hidetop = -1;
701 $currency = !empty($currency) ? $currency : $conf->currency;
705 $pdf->SetTextColor(0, 0, 0);
706 $pdf->SetFont(
'',
'', $default_font_size - 2);
711 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5,
'F', null, explode(
',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
714 $pdf->SetDrawColor(128, 128, 128);
715 $pdf->SetFont(
'',
'', $default_font_size - 1);
718 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
721 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
723 if (empty($hidetop)) {
724 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
738 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
740 global $conf, $langs, $hookmanager;
747 if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK)))
749 pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur,
'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
752 $pdf->SetTextColor(0, 0, 60);
753 $pdf->SetFont(
'',
'B', $default_font_size + 3);
755 $posy = $this->marge_haute;
756 $posx = $this->page_largeur - $this->marge_droite - 100;
758 $pdf->SetXY($this->marge_gauche, $posy);
761 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
762 if ($this->emetteur->logo)
764 if (is_readable($logo))
767 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
770 $pdf->SetTextColor(200, 0, 0);
771 $pdf->SetFont(
'',
'B', $default_font_size - 2);
772 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
773 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
776 else $pdf->MultiCell(100, 4, $this->emetteur->name, 0,
'L');
778 $pdf->SetFont(
'',
'B', $default_font_size + 2);
779 $pdf->SetXY($posx, $posy);
780 $pdf->SetTextColor(0, 0, 60);
781 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"DeliveryOrder").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
783 $pdf->SetFont(
'',
'', $default_font_size + 2);
786 $pdf->SetXY($posx, $posy);
787 $pdf->SetTextColor(0, 0, 60);
788 if ($object->date_valid)
790 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date($object->date_delivery,
"%d %b %Y",
false, $outputlangs,
true),
'',
'R');
793 $pdf->SetTextColor(255, 0, 0);
794 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"DeliveryNotValidated"),
'',
'R');
795 $pdf->SetTextColor(0, 0, 60);
798 if ($object->thirdparty->code_client)
801 $pdf->SetXY($posx, $posy);
802 $pdf->SetTextColor(0, 0, 60);
803 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
806 $pdf->SetTextColor(0, 0, 60);
811 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
816 $carac_emetteur =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
820 $posx = $this->marge_gauche;
821 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
825 $pdf->SetTextColor(0, 0, 0);
826 $pdf->SetFont(
'',
'', $default_font_size - 2);
827 $pdf->SetXY($posx, $posy - 5);
828 $pdf->MultiCell(66, 5, $outputlangs->transnoentities(
"BillFrom").
":", 0,
'L');
829 $pdf->SetXY($posx, $posy);
830 $pdf->SetFillColor(230, 230, 230);
831 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
832 $pdf->SetTextColor(0, 0, 60);
835 $pdf->SetXY($posx + 2, $posy + 3);
836 $pdf->SetFont(
'',
'B', $default_font_size);
837 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
838 $posy = $pdf->getY();
841 $pdf->SetXY($posx + 2, $posy);
842 $pdf->SetFont(
'',
'', $default_font_size - 1);
843 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
848 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
849 $pdf->SetTextColor(0, 0, 0);
850 $pdf->SetFont(
'',
'', $default_font_size - 2);
851 $pdf->SetXY($posx, $posy - 5);
852 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"DeliveryAddress").
":", 0,
'L');
856 $arrayidcontact = $object->commande->getIdContact(
'external',
'SHIPPING');
857 if (count($arrayidcontact) > 0)
860 $result = $object->fetch_contact($arrayidcontact[0]);
864 if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
865 $thirdparty = $object->contact;
867 $thirdparty = $object->thirdparty;
872 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
876 if ($this->page_largeur < 210) $widthrecbox = 84;
878 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
879 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
882 $pdf->SetTextColor(0, 0, 0);
883 $pdf->SetFont(
'',
'', $default_font_size - 2);
884 $pdf->SetXY($posx + 2, $posy - 5);
886 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
889 $pdf->SetXY($posx + 2, $posy + 3);
890 $pdf->SetFont(
'',
'B', $default_font_size);
891 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0,
'L');
893 $posy = $pdf->getY();
896 $pdf->SetFont(
'',
'', $default_font_size - 1);
897 $pdf->SetXY($posx + 2, $posy);
898 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
901 $pdf->SetTextColor(0, 0, 60);
914 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
917 $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
918 return pdf_pagefoot($pdf, $outputlangs,
'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
933 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
935 global $conf, $hookmanager;
938 $this->defaultContentsFieldsStyle = array(
940 'padding' => array(0.5, 0.5, 0.5, 0.5),
944 $this->defaultTitlesFieldsStyle = array(
946 'padding' => array(0.5, 0, 0.5, 0),
968 $this->cols[
'desc'] = array(
973 'textkey' =>
'Designation',
977 'padding' => array(0.5, 0.5, 0.5, 0.5),
985 $this->cols[
'photo'] = array(
987 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH),
990 'textkey' =>
'Photo',
994 'padding' => array(0, 0, 0, 0),
996 'border-left' =>
false,
999 if (!empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE) && !empty($this->atleastonephoto))
1001 $this->cols[
'photo'][
'status'] =
true;
1006 $this->cols[
'Comments'] = array(
1011 'textkey' =>
'Comments'
1013 'border-left' =>
true,
1028 $this->cols[
'qty_shipped'] = array(
1033 'textkey' =>
'QtyShippedShort'
1035 'border-left' =>
true,
1039 $this->cols[
'qty_remaining'] = array(
1044 'textkey' =>
'KeepToShipShort'
1046 'border-left' =>
true,
1051 if (!empty($object->lines)) {
1052 $line = reset($object->lines);
1056 $parameters = array(
1057 'object' => $object,
1058 'outputlangs' => $outputlangs,
1059 'hidedetails' => $hidedetails,
1060 'hidedesc' => $hidedesc,
1061 'hideref' => $hideref
1064 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1069 elseif (empty($reshook))
1071 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1074 $this->cols = $hookmanager->resArray;
pdf_getFormat(Translate $outputlangs=null, $mode= 'setup')
Return array with format properties of default PDF format.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
getExtrafieldContent($object, $extrafieldKey)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note...
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
__construct($db)
Constructor.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Class to manage products or services.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom= 'UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
printStdColumnContent($pdf, &$curY, $colKey, $columnText= '')
print standard column content
Class to build Delivery Order documents with storm model.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
$conf db name
Only used if Module[ID]Name translation string is not found.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
$conf db
API class for accounts.
getColumnStatus($colKey)
get column status from column key
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
write_file($object, $outputlangs, $srctemplatepath= '', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
Class to manage shipments.
Class to manage customers orders.
Classe mere des modeles de bon de livraison.
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany= '', $targetcontact= '', $usecontact=0, $mode= 'source', $object=null)
Return a string with full address formated for output on documents.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field.
getColumnContentWidth($colKey)
get column content width from column key
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)