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 $version =
'dolibarr';
121 global $conf, $langs, $mysoc;
124 $langs->loadLangs(array(
"main",
"bills",
"sendings",
"companies"));
127 $this->
name =
"Storm";
128 $this->
description = $langs->trans(
"DocumentModelStorm");
129 $this->update_main_doc_field = 1;
134 $this->page_largeur = $formatarray[
'width'];
135 $this->page_hauteur = $formatarray[
'height'];
136 $this->format = array($this->page_largeur, $this->page_hauteur);
142 $this->option_logo = 1;
143 $this->option_tva = 1;
146 $this->emetteur = $mysoc;
147 if (empty($this->emetteur->country_code)) {
148 $this->emetteur->country_code = substr($langs->defaultlang, -2);
151 $this->tva = array();
152 $this->tva_array = array();
153 $this->localtax1 = array();
154 $this->localtax2 = array();
155 $this->atleastoneratenotnull = 0;
156 $this->atleastonediscount = 0;
172 public function write_file($object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
175 global $user, $langs, $conf, $mysoc, $hookmanager;
177 if (!is_object($outputlangs)) {
178 $outputlangs = $langs;
181 if (!empty($conf->global->MAIN_USE_FPDF)) {
182 $outputlangs->charset_output =
'ISO-8859-1';
186 $outputlangs->loadLangs(array(
"main",
"dict",
"companies",
"bills",
"products",
"sendings",
"deliveries"));
188 if ($conf->expedition->dir_output) {
189 $object->fetch_thirdparty();
192 if ($object->specimen) {
193 $dir = $conf->expedition->dir_output.
"/receipt";
194 $file = $dir.
"/SPECIMEN.pdf";
197 $dir = $conf->expedition->dir_output.
"/receipt/".$objectref;
198 $file = $dir.
"/".$objectref.
".pdf";
201 if (!file_exists($dir)) {
203 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
208 if (file_exists($dir)) {
210 if (!is_object($hookmanager)) {
211 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
214 $hookmanager->initHooks(array(
'pdfgeneration'));
215 $parameters = array(
'file'=>$file,
'object'=>$object,
'outputlangs'=>$outputlangs);
217 $reshook = $hookmanager->executeHooks(
'beforePDFCreation', $parameters, $object, $action);
219 $nblines = count($object->lines);
223 $realpatharray = array();
224 $this->atleastonephoto =
false;
225 if (!empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE)) {
226 $objphoto =
new Product($this->db);
228 for ($i = 0; $i < $nblines; $i++) {
229 if (empty($object->lines[$i]->fk_product)) {
233 $objphoto->fetch($object->lines[$i]->fk_product);
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).
'/';
239 $pdir[0] =
get_exdir(0, 0, 0, 0, $objphoto,
'product');
240 $pdir[1] =
get_exdir($objphoto->id, 2, 0, 0, $objphoto,
'product').$objphoto->id.
"/photos/";
244 foreach ($pdir as $midir) {
246 $dir = $conf->product->dir_output.
'/'.$midir;
248 foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
250 if ($obj[
'photo_vignette']) {
251 $filename = $obj[
'photo_vignette'];
253 $filename = $obj[
'photo'];
256 $filename = $obj[
'photo'];
259 $realpath = $dir.$filename;
261 $this->atleastonephoto =
true;
266 if ($realpath && $arephoto) {
267 $realpatharray[$i] = $realpath;
272 if (count($realpatharray) == 0) {
273 $this->posxpicture = $this->posxweightvol;
281 $heightforinfotot = 30;
282 $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5);
283 $heightforfooter = $this->marge_basse + 8;
284 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
285 $heightforfooter += 6;
287 $pdf->SetAutoPageBreak(1, 0);
289 if (class_exists(
'TCPDF')) {
290 $pdf->setPrintHeader(
false);
291 $pdf->setPrintFooter(
false);
295 if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
296 $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.
'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
297 $tplidx = $pdf->importPage(1);
302 $result = $expedition->fetch($object->origin_id);
304 $commande =
new Commande($this->db);
305 if ($expedition->origin ==
'commande') {
306 $commande->fetch($expedition->origin_id);
308 $object->commande = $commande;
309 $object->commande->loadExpeditions();
314 $pdf->SetDrawColor(128, 128, 128);
316 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
317 $pdf->SetSubject($outputlangs->transnoentities(
"DeliveryOrder"));
318 $pdf->SetCreator(
"Dolibarr ".DOL_VERSION);
319 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
320 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref).
" ".$outputlangs->transnoentities(
"DeliveryOrder"));
322 $pdf->SetCompression(
false);
325 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
330 if (!empty($tplidx)) {
331 $pdf->useTemplate($tplidx);
334 $this->
_pagehead($pdf, $object, 1, $outputlangs);
335 $pdf->SetFont(
'',
'', $default_font_size - 1);
336 $pdf->MultiCell(0, 3,
'');
337 $pdf->SetTextColor(0, 0, 0);
340 $tab_top_newpage = (!
getDolGlobalInt(
'MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10);
342 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
344 $this->posxdesc = $this->marge_gauche + 1;
347 $height_incoterms = 0;
349 $desc_incoterms = $object->getIncotermsForPDF();
350 if ($desc_incoterms) {
353 $pdf->SetFont(
'',
'', $default_font_size - 1);
354 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1,
dol_htmlentitiesbr($desc_incoterms), 0, 1);
355 $nexY = $pdf->GetY();
356 $height_incoterms = $nexY - $tab_top;
359 $pdf->SetDrawColor(192, 192, 192);
360 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1);
362 $tab_top = $nexY + 6;
363 $height_incoterms += 4;
368 $notetoshow = empty($object->note_public) ?
'' : $object->note_public;
371 $extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
372 if (!empty($extranote)) {
376 if (!empty($notetoshow)) {
377 $tab_top = 88 + $height_incoterms;
379 $pdf->SetFont(
'',
'', $default_font_size - 1);
380 $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top,
dol_htmlentitiesbr($notetoshow), 0, 1);
381 $nexY = $pdf->GetY();
382 $height_note = $nexY - $tab_top;
385 $pdf->SetDrawColor(192, 192, 192);
386 $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
388 $tab_height = $tab_height - $height_note;
389 $tab_top = $nexY + 6;
398 $pdf->startTransaction();
399 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, 0);
400 $pdf->rollbackTransaction(
true);
402 $iniY = $tab_top + $this->tabTitleHeight + 2;
403 $curY = $tab_top + $this->tabTitleHeight + 2;
404 $nexY = $tab_top + $this->tabTitleHeight + 2;
407 for ($i = 0; $i < $nblines; $i++) {
409 if (empty($object->lines[$i]->array_options)) {
410 $object->lines[$i]->fetch_optionals();
414 $pdf->SetFont(
'',
'', $default_font_size - 1);
415 $pdf->SetTextColor(0, 0, 0);
418 $imglinesize = array();
419 if (!empty($realpatharray[$i])) {
424 $pdf->setTopMargin($tab_top_newpage);
425 $pdf->setPageOrientation(
'', 1, $heightforfooter + $heightforfreetext + $heightforinfotot);
426 $pageposbefore = $pdf->getPage();
429 $curX = $this->posxdesc - 1;
431 $showpricebeforepagebreak = 1;
434 $posYAfterDescription = 0;
437 if (isset($imglinesize[
'width']) && isset($imglinesize[
'height']) && ($curY + $imglinesize[
'height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
438 $pdf->AddPage(
'',
'',
true);
439 if (!empty($tplidx)) {
440 $pdf->useTemplate($tplidx);
443 $pdf->setPage($pageposbefore + 1);
445 $curY = $tab_top_newpage;
448 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
449 $showpricebeforepagebreak = 1;
451 $showpricebeforepagebreak = 0;
456 if (!empty($this->cols[
'photo']) && isset($imglinesize[
'width']) && isset($imglinesize[
'height'])) {
457 $pdf->Image($realpatharray[$i], $this->
getColumnContentXStart(
'photo'), $curY + 1, $imglinesize[
'width'], $imglinesize[
'height'],
'',
'',
'', 2, 300);
459 $posYAfterImage = $curY + $imglinesize[
'height'];
466 $pdf->startTransaction();
468 $pageposafter = $pdf->getPage();
469 if ($pageposafter > $pageposbefore) {
470 $pdf->rollbackTransaction(
true);
471 $pageposafter = $pageposbefore;
473 $pdf->setPageOrientation(
'', 1, $heightforfooter);
475 $posyafter = $pdf->GetY();
476 if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) {
477 if ($i == ($nblines - 1)) {
478 $pdf->AddPage(
'',
'',
true);
479 if (!empty($tplidx)) {
480 $pdf->useTemplate($tplidx);
483 $this->
_pagehead($pdf, $object, 0, $outputlangs);
485 $pdf->setPage($pageposafter + 1);
490 if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
491 $showpricebeforepagebreak = 1;
493 $showpricebeforepagebreak = 0;
498 $pdf->commitTransaction();
501 $posYAfterDescription = $pdf->GetY();
504 $nexY = $pdf->GetY();
505 $pageposafter = $pdf->getPage();
506 $pdf->setPage($pageposbefore);
507 $pdf->setTopMargin($this->marge_haute);
508 $pdf->setPageOrientation(
'', 1, 0);
511 if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
512 $pdf->setPage($pageposafter);
513 $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) {
538 $extrafieldValue = $this->
getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
540 $nexY = max($pdf->GetY(), $nexY);
546 if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
547 $pdf->setPage($pageposafter);
548 $pdf->SetLineStyle(array(
'dash'=>
'1,1',
'color'=>array(80, 80, 80)));
550 $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
551 $pdf->SetLineStyle(array(
'dash'=>0));
557 while ($pagenb < $pageposafter) {
558 $pdf->setPage($pagenb);
560 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
562 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
564 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
566 $pdf->setPage($pagenb);
567 $pdf->setPageOrientation(
'', 1, 0);
569 $this->
_pagehead($pdf, $object, 0, $outputlangs);
571 if (!empty($tplidx)) {
572 $pdf->useTemplate($tplidx);
575 if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
577 $this->
_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
579 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
581 $this->
_pagefoot($pdf, $object, $outputlangs, 1);
584 if (!empty($tplidx)) {
585 $pdf->useTemplate($tplidx);
589 $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;
599 $this->
_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
600 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
604 $this->
_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
607 $this->
_pagefoot($pdf, $object, $outputlangs);
609 if (method_exists($pdf,
'AliasNbPages')) {
610 $pdf->AliasNbPages();
615 $pdf->Output($file,
'F');
618 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);
627 $this->error = $hookmanager->error;
628 $this->errors = $hookmanager->errors;
633 $this->result = array(
'fullpath'=>$file);
637 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
642 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"LIVRAISON_OUTPUTDIR");
660 global $conf, $mysoc;
663 $pdf->SetFont(
'',
'', $default_font_size);
664 $pdf->SetXY($this->marge_gauche, $posy);
666 $larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3;
667 $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
668 $pdf->SetXY($this->marge_gauche + 2, $posy + 2);
669 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans(
"For").
' '.$outputlangs->convToOutputCharset($mysoc->name).
":",
'',
'L');
671 $pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25);
672 $pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2);
673 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans(
"ForCustomer").
':',
'',
'L');
690 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
700 $currency = !empty($currency) ? $currency : $conf->currency;
704 $pdf->SetTextColor(0, 0, 0);
705 $pdf->SetFont(
'',
'', $default_font_size - 2);
707 if (empty($hidetop)) {
709 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
710 $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;
751 $pdf->SetTextColor(0, 0, 60);
752 $pdf->SetFont(
'',
'B', $default_font_size + 3);
754 $posy = $this->marge_haute;
755 $posx = $this->page_largeur - $this->marge_droite - 100;
757 $pdf->SetXY($this->marge_gauche, $posy);
760 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
761 if ($this->emetteur->logo) {
762 if (is_readable($logo)) {
764 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
766 $pdf->SetTextColor(200, 0, 0);
767 $pdf->SetFont(
'',
'B', $default_font_size - 2);
768 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
769 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
772 $pdf->MultiCell(100, 4, $this->emetteur->name, 0,
'L');
775 $pdf->SetFont(
'',
'B', $default_font_size + 2);
776 $pdf->SetXY($posx, $posy);
777 $pdf->SetTextColor(0, 0, 60);
778 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"DeliveryOrder").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
780 $pdf->SetFont(
'',
'', $default_font_size + 2);
783 $pdf->SetXY($posx, $posy);
784 $pdf->SetTextColor(0, 0, 60);
785 if ($object->date_valid) {
786 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date($object->date_delivery,
"%d %b %Y",
false, $outputlangs,
true),
'',
'R');
788 $pdf->SetTextColor(255, 0, 0);
789 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"DeliveryNotValidated"),
'',
'R');
790 $pdf->SetTextColor(0, 0, 60);
793 if ($object->thirdparty->code_client) {
795 $pdf->SetXY($posx, $posy);
796 $pdf->SetTextColor(0, 0, 60);
797 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
800 $pdf->SetTextColor(0, 0, 60);
805 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
809 $carac_emetteur =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
813 $posx = $this->marge_gauche;
814 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
815 $posx = $this->page_largeur - $this->marge_droite - 80;
820 $pdf->SetTextColor(0, 0, 0);
821 $pdf->SetFont(
'',
'', $default_font_size - 2);
822 $pdf->SetXY($posx, $posy - 5);
823 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0,
'L');
824 $pdf->SetXY($posx, $posy);
825 $pdf->SetFillColor(230, 230, 230);
826 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
827 $pdf->SetTextColor(0, 0, 60);
830 $pdf->SetXY($posx + 2, $posy + 3);
831 $pdf->SetFont(
'',
'B', $default_font_size);
832 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
833 $posy = $pdf->getY();
836 $pdf->SetXY($posx + 2, $posy);
837 $pdf->SetFont(
'',
'', $default_font_size - 1);
838 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
843 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
844 $posx = $this->marge_gauche;
846 $pdf->SetTextColor(0, 0, 0);
847 $pdf->SetFont(
'',
'', $default_font_size - 2);
848 $pdf->SetXY($posx, $posy - 5);
849 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"DeliveryAddress"), 0,
'L');
853 $arrayidcontact = $object->commande->getIdContact(
'external',
'SHIPPING');
854 if (count($arrayidcontact) > 0) {
856 $result = $object->fetch_contact($arrayidcontact[0]);
860 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)))) {
861 $thirdparty = $object->contact;
863 $thirdparty = $object->thirdparty;
868 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
872 if ($this->page_largeur < 210) {
876 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
877 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
878 $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)
916 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
917 return pdf_pagefoot($pdf, $outputlangs,
'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
932 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
934 global $conf, $hookmanager;
937 $this->defaultContentsFieldsStyle = array(
939 'padding' => array(0.5, 0.5, 0.5, 0.5),
943 $this->defaultTitlesFieldsStyle = array(
945 'padding' => array(0.5, 0, 0.5, 0),
967 $this->cols[
'desc'] = array(
972 'textkey' =>
'Designation',
976 'padding' => array(0.5, 0.5, 0.5, 0.5),
984 $this->cols[
'photo'] = array(
986 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH),
989 'textkey' =>
'Photo',
993 'padding' => array(0, 0, 0, 0),
995 'border-left' =>
false,
998 if (!empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE) && !empty($this->atleastonephoto)) {
999 $this->cols[
'photo'][
'status'] =
true;
1004 $this->cols[
'Comments'] = array(
1009 'textkey' =>
'Comments'
1011 'border-left' =>
true,
1026 $this->cols[
'qty_shipped'] = array(
1031 'textkey' =>
'QtyShippedShort'
1033 'border-left' =>
true,
1037 $this->cols[
'qty_remaining'] = array(
1042 'textkey' =>
'KeepToShipShort'
1044 'border-left' =>
true,
1049 if (!empty($object->lines)) {
1050 $line = reset($object->lines);
1054 $parameters = array(
1055 'object' => $object,
1056 'outputlangs' => $outputlangs,
1057 'hidedetails' => $hidedetails,
1058 'hidedesc' => $hidedesc,
1059 'hideref' => $hideref
1062 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1065 } elseif (empty($reshook)) {
1066 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1068 $this->cols = $hookmanager->resArray;
Class to manage customers orders.
prepareArrayColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Prepare Array Column Field.
getColumnStatus($colKey)
get column status from column key
printStdColumnContent($pdf, &$curY, $colKey, $columnText='')
print standard column content
pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop=0)
Print standard column content.
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
Rect pdf.
getColumnContentWidth($colKey)
get column content width from column key
getExtrafieldContent($object, $extrafieldKey, $outputlangs=null)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note...
defineColumnExtrafield($object, $outputlangs, $hidedetails=0)
Define Array Column Field for extrafields.
Class to manage shipments.
Classe mere des modeles de bon de livraison.
Class to manage products or services.
Class to build Delivery Order documents with storm model.
defineColumnField($object, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
Define Array Column Field.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
__construct($db)
Constructor.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0, $page_largeur=0, $watermark='')
Show footer of page for PDF generation.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
Show linked objects for PDF generation.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formated for output on documents.
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.