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';
60 public $update_main_doc_field;
71 public $phpmin = array(7, 0);
77 public $version =
'dolibarr';
102 public $marge_droite;
127 global $conf, $langs, $mysoc;
130 $langs->loadLangs(array(
"main",
"bills",
"sendings",
"companies"));
133 $this->
name =
"Storm";
134 $this->
description = $langs->trans(
"DocumentModelStorm");
135 $this->update_main_doc_field = 1;
140 $this->page_largeur = $formatarray[
'width'];
141 $this->page_hauteur = $formatarray[
'height'];
142 $this->format = array($this->page_largeur, $this->page_hauteur);
148 $this->option_logo = 1;
149 $this->option_tva = 1;
152 $this->emetteur = $mysoc;
153 if (empty($this->emetteur->country_code)) {
154 $this->emetteur->country_code = substr($langs->defaultlang, -2);
157 $this->tva = array();
158 $this->tva_array = array();
159 $this->localtax1 = array();
160 $this->localtax2 = array();
161 $this->atleastoneratenotnull = 0;
162 $this->atleastonediscount = 0;
178 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
181 global $user, $langs, $conf, $mysoc, $hookmanager;
183 if (!is_object($outputlangs)) {
184 $outputlangs = $langs;
187 if (!empty($conf->global->MAIN_USE_FPDF)) {
188 $outputlangs->charset_output =
'ISO-8859-1';
192 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"sendings",
"deliveries"));
194 if ($conf->expedition->dir_output) {
195 $object->fetch_thirdparty();
198 if ($object->specimen) {
199 $dir = $conf->expedition->dir_output.
"/receipt";
200 $file = $dir.
"/SPECIMEN.pdf";
203 $dir = $conf->expedition->dir_output.
"/receipt/".$objectref;
204 $file = $dir.
"/".$objectref.
".pdf";
207 if (!file_exists($dir)) {
209 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
214 if (file_exists($dir)) {
216 if (!is_object($hookmanager)) {
217 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
220 $hookmanager->initHooks(array(
'pdfgeneration'));
221 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
223 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
225 $nblines = count($object->lines);
229 $realpatharray = array();
230 $this->atleastonephoto =
false;
231 if (!empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE)) {
234 for ($i = 0; $i < $nblines; $i++) {
235 if (empty($object->lines[$i]->fk_product)) {
239 $objphoto->fetch($object->lines[$i]->fk_product);
242 $pdir[0] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
243 $pdir[1] =
get_exdir(0, 0, 0, 0, $objphoto,
'product').dol_sanitizeFileName($objphoto->ref).
'/';
245 $pdir[0] =
get_exdir(0, 0, 0, 0, $objphoto,
'product');
246 $pdir[1] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
250 foreach ($pdir as $midir) {
252 $dir = $conf->product->dir_output.
'/'.$midir;
254 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
256 if ($obj[
'photo_vignette']) {
257 $filename = $obj[
'photo_vignette'];
259 $filename = $obj[
'photo'];
262 $filename = $obj[
'photo'];
265 $realpath = $dir.$filename;
267 $this->atleastonephoto =
true;
272 if ($realpath && $arephoto) {
273 $realpatharray[$i] = $realpath;
278 if (count($realpatharray) == 0) {
279 $this->posxpicture = $this->posxweightvol;
287 $heightforinfotot = 30;
288 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
289 $heightforfooter = $this->marge_basse + 8;
290 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
291 $heightforfooter += 6;
293 $pdf->SetAutoPageBreak(1, 0);
295 if (class_exists(
'TCPDF')) {
296 $pdf->setPrintHeader(
false);
297 $pdf->setPrintFooter(
false);
301 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
302 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
303 $tplidx = $pdf->importPage(1);
308 $result = $expedition->fetch($object->origin_id);
311 if ($expedition->origin ==
'commande') {
312 $commande->fetch($expedition->origin_id);
314 $object->commande = $commande;
315 $object->commande->loadExpeditions();
320 $pdf->SetDrawColor(128, 128, 128);
322 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
323 $pdf->SetSubject($outputlangs->transnoentities(
"DeliveryOrder"));
324 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
325 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
326 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"DeliveryOrder"));
328 $pdf->SetCompression(
false);
331 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
336 if (!empty($tplidx)) {
337 $pdf->useTemplate($tplidx);
340 $this->
_pagehead($pdf, $object, 1, $outputlangs);
341 $pdf->SetFont(
'',
'', $default_font_size - 1);
342 $pdf->MultiCell(0, 3,
'');
343 $pdf->SetTextColor(0, 0, 0);
346 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
348 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
350 $this->posxdesc = $this->marge_gauche + 1;
353 $height_incoterms = 0;
355 $desc_incoterms = $object->getIncotermsForPDF();
356 if ($desc_incoterms) {
359 $pdf->SetFont(
'',
'', $default_font_size - 1);
360 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
361 $nexY = $pdf->GetY();
362 $height_incoterms = $nexY - $tab_top;
365 $pdf->SetDrawColor(192, 192, 192);
366 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
368 $tab_top = $nexY + 6;
369 $height_incoterms += 4;
374 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
377 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
378 if (!empty($extranote)) {
382 if (!empty($notetoshow)) {
383 $tab_top = 88 + $height_incoterms;
385 $pdf->SetFont(
'',
'', $default_font_size - 1);
386 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
387 $nexY = $pdf->GetY();
388 $height_note = $nexY - $tab_top;
391 $pdf->SetDrawColor(192, 192, 192);
392 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
394 $tab_height = $tab_height - $height_note;
395 $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++) {
415 if (empty($object->lines[$i]->array_options)) {
416 $object->lines[$i]->fetch_optionals();
420 $pdf->SetFont(
'',
'', $default_font_size - 1);
421 $pdf->SetTextColor(0, 0, 0);
424 $imglinesize = array();
425 if (!empty($realpatharray[$i])) {
430 $pdf->setTopMargin($tab_top_newpage);
431 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
432 $pageposbefore = $pdf->getPage();
435 $curX = $this->posxdesc - 1;
437 $showpricebeforepagebreak = 1;
440 $posYAfterDescription = 0;
443 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
444 $pdf->AddPage(
'',
'',
true);
445 if (!empty($tplidx)) {
446 $pdf->useTemplate($tplidx);
449 $pdf->setPage($pageposbefore + 1);
451 $curY = $tab_top_newpage;
454 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
455 $showpricebeforepagebreak = 1;
457 $showpricebeforepagebreak = 0;
462 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
463 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY + 1, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
465 $posYAfterImage = $curY + $imglinesize[
'height'];
472 $pdf->startTransaction();
474 $pageposafter = $pdf->getPage();
475 if ($pageposafter > $pageposbefore) {
476 $pdf->rollbackTransaction(
true);
477 $pageposafter = $pageposbefore;
479 $pdf->setPageOrientation(
'', 1, $heightforfooter);
481 $posyafter = $pdf->GetY();
482 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
483 if ($i == ($nblines - 1)) {
484 $pdf->AddPage(
'',
'',
true);
485 if (!empty($tplidx)) {
486 $pdf->useTemplate($tplidx);
489 $this->
_pagehead($pdf, $object, 0, $outputlangs);
491 $pdf->setPage($pageposafter + 1);
496 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
497 $showpricebeforepagebreak = 1;
499 $showpricebeforepagebreak = 0;
504 $pdf->commitTransaction();
507 $posYAfterDescription = $pdf->GetY();
510 $nexY = $pdf->GetY();
511 $pageposafter = $pdf->getPage();
512 $pdf->setPage($pageposbefore);
513 $pdf->setTopMargin($this->marge_haute);
514 $pdf->setPageOrientation(
'', 1, 0);
517 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
518 $pdf->setPage($pageposafter);
519 $curY = $tab_top_newpage;
522 $pdf->SetFont(
'',
'', $default_font_size - 1);
528 $nexY = max($pdf->GetY(), $nexY);
533 $qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
535 $nexY = max($pdf->GetY(), $nexY);
538 $nexY = max($nexY, $posYAfterImage);
541 if (!empty($object->lines[$i]->array_options)) {
542 foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
544 $extrafieldValue = $this->
getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
546 $nexY = max($pdf->GetY(), $nexY);
552 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
553 $pdf->setPage($pageposafter);
554 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
556 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
557 $pdf->SetLineStyle(array(
'dash'=>0));
563 while ($pagenb < $pageposafter) {
564 $pdf->setPage($pagenb);
566 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
568 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
570 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
572 $pdf->setPage($pagenb);
573 $pdf->setPageOrientation(
'', 1, 0);
575 $this->
_pagehead($pdf, $object, 0, $outputlangs);
577 if (!empty($tplidx)) {
578 $pdf->useTemplate($tplidx);
581 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
583 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
585 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
587 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
590 if (!empty($tplidx)) {
591 $pdf->useTemplate($tplidx);
595 $this->
_pagehead($pdf, $object, 0, $outputlangs);
602 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
603 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
605 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
606 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
610 $this->
_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
613 $this->
_pagefoot($pdf, $object, $outputlangs);
615 if (method_exists($pdf,
'AliasNbPages')) {
616 $pdf->AliasNbPages();
621 $pdf->Output($file,
'F');
624 if (!is_object($hookmanager)) {
625 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
628 $hookmanager->initHooks(array(
'pdfgeneration'));
629 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
631 $reshook = $hookmanager->executeHooks(
'afterPDFCreation', $parameters, $this, $action);
633 $this->error = $hookmanager->error;
634 $this->errors = $hookmanager->errors;
639 $this->result = array(
'fullpath'=>$file);
643 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
648 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"LIVRAISON_OUTPUTDIR");
666 global $conf, $mysoc;
669 $pdf->SetFont(
'',
'', $default_font_size);
670 $pdf->SetXY($this->marge_gauche, $posy);
672 $larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3;
673 $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
674 $pdf->SetXY($this->marge_gauche + 2, $posy + 2);
675 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans(
"For").
' '.$outputlangs->convToOutputCharset($mysoc->name).
":",
'',
'L');
677 $pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25);
678 $pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2);
679 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans(
"ForCustomer").
':',
'',
'L');
696 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
706 $currency = !empty($currency) ? $currency : $conf->currency;
710 $pdf->SetTextColor(0, 0, 0);
711 $pdf->SetFont(
'',
'', $default_font_size - 2);
713 if (empty($hidetop)) {
715 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
716 $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));
720 $pdf->SetDrawColor(128, 128, 128);
721 $pdf->SetFont(
'',
'', $default_font_size - 1);
724 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
727 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
729 if (empty($hidetop)) {
730 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
744 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
746 global $conf, $langs, $hookmanager;
757 $pdf->SetTextColor(0, 0, 60);
758 $pdf->SetFont(
'',
'B', $default_font_size + 3);
760 $posy = $this->marge_haute;
761 $posx = $this->page_largeur - $this->marge_droite - 100;
763 $pdf->SetXY($this->marge_gauche, $posy);
766 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
767 if ($this->emetteur->logo) {
768 if (is_readable($logo)) {
770 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
772 $pdf->SetTextColor(200, 0, 0);
773 $pdf->SetFont(
'',
'B', $default_font_size - 2);
774 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
775 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
778 $pdf->MultiCell(100, 4, $this->emetteur->name, 0,
'L');
781 $pdf->SetFont(
'',
'B', $default_font_size + 2);
782 $pdf->SetXY($posx, $posy);
783 $pdf->SetTextColor(0, 0, 60);
784 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"DeliveryOrder").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
786 $pdf->SetFont(
'',
'', $default_font_size + 2);
789 $pdf->SetXY($posx, $posy);
790 $pdf->SetTextColor(0, 0, 60);
791 if ($object->date_valid) {
792 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date($object->date_delivery,
"%d %b %Y",
false, $outputlangs,
true),
'',
'R');
794 $pdf->SetTextColor(255, 0, 0);
795 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"DeliveryNotValidated"),
'',
'R');
796 $pdf->SetTextColor(0, 0, 60);
799 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);
815 $carac_emetteur =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
819 $posx = $this->marge_gauche;
820 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
821 $posx = $this->page_largeur - $this->marge_droite - 80;
826 $pdf->SetTextColor(0, 0, 0);
827 $pdf->SetFont(
'',
'', $default_font_size - 2);
828 $pdf->SetXY($posx, $posy - 5);
829 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0,
'L');
830 $pdf->SetXY($posx, $posy);
831 $pdf->SetFillColor(230, 230, 230);
832 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
833 $pdf->SetTextColor(0, 0, 60);
836 $pdf->SetXY($posx + 2, $posy + 3);
837 $pdf->SetFont(
'',
'B', $default_font_size);
838 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
839 $posy = $pdf->getY();
842 $pdf->SetXY($posx + 2, $posy);
843 $pdf->SetFont(
'',
'', $default_font_size - 1);
844 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
849 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
850 $posx = $this->marge_gauche;
852 $pdf->SetTextColor(0, 0, 0);
853 $pdf->SetFont(
'',
'', $default_font_size - 2);
854 $pdf->SetXY($posx, $posy - 5);
855 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"DeliveryAddress"), 0,
'L');
859 $arrayidcontact = $object->commande->getIdContact(
'external',
'SHIPPING');
860 if (count($arrayidcontact) > 0) {
862 $result = $object->fetch_contact($arrayidcontact[0]);
866 if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
867 $thirdparty = $object->contact;
869 $thirdparty = $object->thirdparty;
874 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
878 if ($this->page_largeur < 210) {
882 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
883 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
884 $posx = $this->marge_gauche;
888 $pdf->SetTextColor(0, 0, 0);
889 $pdf->SetFont(
'',
'', $default_font_size - 2);
890 $pdf->SetXY($posx + 2, $posy - 5);
892 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
895 $pdf->SetXY($posx + 2, $posy + 3);
896 $pdf->SetFont(
'',
'B', $default_font_size);
897 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0,
'L');
899 $posy = $pdf->getY();
902 $pdf->SetFont(
'',
'', $default_font_size - 1);
903 $pdf->SetXY($posx + 2, $posy);
904 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
907 $pdf->SetTextColor(0, 0, 60);
920 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
922 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
923 return pdf_pagefoot($pdf, $outputlangs,
'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
938 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
940 global $conf, $hookmanager;
943 $this->defaultContentsFieldsStyle = array(
945 'padding' => array(0.5, 0.5, 0.5, 0.5),
949 $this->defaultTitlesFieldsStyle = array(
951 'padding' => array(0.5, 0, 0.5, 0),
973 $this->cols[
'desc'] = array(
978 'textkey' =>
'Designation',
982 'padding' => array(0.5, 0.5, 0.5, 0.5),
990 $this->cols[
'photo'] = array(
992 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH),
995 'textkey' =>
'Photo',
999 'padding' => array(0, 0, 0, 0),
1001 'border-left' =>
false,
1004 if (!empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE) && !empty($this->atleastonephoto)) {
1005 $this->cols[
'photo'][
'status'] =
true;
1010 $this->cols[
'Comments'] = array(
1015 'textkey' =>
'Comments'
1017 'border-left' =>
true,
1032 $this->cols[
'qty_shipped'] = array(
1037 'textkey' =>
'QtyShippedShort'
1039 'border-left' =>
true,
1043 $this->cols[
'qty_remaining'] = array(
1048 'textkey' =>
'KeepToShipShort'
1050 'border-left' =>
true,
1055 if (!empty($object->lines)) {
1056 $line = reset($object->lines);
1060 $parameters = array(
1061 'object' => $object,
1062 'outputlangs' => $outputlangs,
1063 'hidedetails' => $hidedetails,
1064 'hidedesc' => $hidedesc,
1065 'hideref' => $hideref
1068 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1071 } elseif (empty($reshook)) {
1072 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1074 $this->cols = $hookmanager->resArray;