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;
637 if (!empty($conf->global->MAIN_UMASK)) {
638 @chmod($file, octdec($conf->global->MAIN_UMASK));
641 $this->result = array(
'fullpath'=>$file);
645 $this->error = $langs->transnoentities(
"ErrorCanNotCreateDir", $dir);
650 $this->error = $langs->transnoentities(
"ErrorConstantNotDefined",
"LIVRAISON_OUTPUTDIR");
668 global $conf, $mysoc;
671 $pdf->SetFont(
'',
'', $default_font_size);
672 $pdf->SetXY($this->marge_gauche, $posy);
674 $larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3;
675 $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
676 $pdf->SetXY($this->marge_gauche + 2, $posy + 2);
677 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans(
"For").
' '.$outputlangs->convToOutputCharset($mysoc->name).
":",
'',
'L');
679 $pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25);
680 $pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2);
681 $pdf->MultiCell($larg_sign, 2, $outputlangs->trans(
"ForCustomer").
':',
'',
'L');
698 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
708 $currency = !empty($currency) ? $currency : $conf->currency;
712 $pdf->SetTextColor(0, 0, 0);
713 $pdf->SetFont(
'',
'', $default_font_size - 2);
715 if (empty($hidetop)) {
717 if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
718 $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));
722 $pdf->SetDrawColor(128, 128, 128);
723 $pdf->SetFont(
'',
'', $default_font_size - 1);
726 $this->
printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
729 $this->
pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
731 if (empty($hidetop)) {
732 $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight);
746 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
748 global $conf, $langs, $hookmanager;
759 $pdf->SetTextColor(0, 0, 60);
760 $pdf->SetFont(
'',
'B', $default_font_size + 3);
762 $posy = $this->marge_haute;
763 $posx = $this->page_largeur - $this->marge_droite - 100;
765 $pdf->SetXY($this->marge_gauche, $posy);
768 $logo = $conf->mycompany->dir_output.
'/logos/'.$this->emetteur->logo;
769 if ($this->emetteur->logo) {
770 if (is_readable($logo)) {
772 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);
774 $pdf->SetTextColor(200, 0, 0);
775 $pdf->SetFont(
'',
'B', $default_font_size - 2);
776 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorLogoFileNotFound", $logo), 0,
'L');
777 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"ErrorGoToGlobalSetup"), 0,
'L');
780 $pdf->MultiCell(100, 4, $this->emetteur->name, 0,
'L');
783 $pdf->SetFont(
'',
'B', $default_font_size + 2);
784 $pdf->SetXY($posx, $posy);
785 $pdf->SetTextColor(0, 0, 60);
786 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"DeliveryOrder").
" ".$outputlangs->convToOutputCharset($object->ref),
'',
'R');
788 $pdf->SetFont(
'',
'', $default_font_size + 2);
791 $pdf->SetXY($posx, $posy);
792 $pdf->SetTextColor(0, 0, 60);
793 if ($object->date_valid) {
794 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"Date").
" : ".
dol_print_date($object->date_delivery,
"%d %b %Y",
false, $outputlangs,
true),
'',
'R');
796 $pdf->SetTextColor(255, 0, 0);
797 $pdf->MultiCell(100, 4, $outputlangs->transnoentities(
"DeliveryNotValidated"),
'',
'R');
798 $pdf->SetTextColor(0, 0, 60);
801 if ($object->thirdparty->code_client) {
803 $pdf->SetXY($posx, $posy);
804 $pdf->SetTextColor(0, 0, 60);
805 $pdf->MultiCell(100, 3, $outputlangs->transnoentities(
"CustomerCode").
" : ".$outputlangs->transnoentities($object->thirdparty->code_client),
'',
'R');
808 $pdf->SetTextColor(0, 0, 60);
813 $posy =
pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3,
'R', $default_font_size);
817 $carac_emetteur =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty,
'', 0,
'source', $object);
821 $posx = $this->marge_gauche;
822 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
823 $posx = $this->page_largeur - $this->marge_droite - 80;
828 $pdf->SetTextColor(0, 0, 0);
829 $pdf->SetFont(
'',
'', $default_font_size - 2);
830 $pdf->SetXY($posx, $posy - 5);
831 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"BillFrom"), 0,
'L');
832 $pdf->SetXY($posx, $posy);
833 $pdf->SetFillColor(230, 230, 230);
834 $pdf->MultiCell(82, $hautcadre,
"", 0,
'R', 1);
835 $pdf->SetTextColor(0, 0, 60);
838 $pdf->SetXY($posx + 2, $posy + 3);
839 $pdf->SetFont(
'',
'B', $default_font_size);
840 $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0,
'L');
841 $posy = $pdf->getY();
844 $pdf->SetXY($posx + 2, $posy);
845 $pdf->SetFont(
'',
'', $default_font_size - 1);
846 $pdf->MultiCell(80, 4, $carac_emetteur, 0,
'L');
851 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
852 $posx = $this->marge_gauche;
854 $pdf->SetTextColor(0, 0, 0);
855 $pdf->SetFont(
'',
'', $default_font_size - 2);
856 $pdf->SetXY($posx, $posy - 5);
857 $pdf->MultiCell(80, 5, $outputlangs->transnoentities(
"DeliveryAddress"), 0,
'L');
861 $arrayidcontact = $object->commande->getIdContact(
'external',
'SHIPPING');
862 if (count($arrayidcontact) > 0) {
864 $result = $object->fetch_contact($arrayidcontact[0]);
868 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)))) {
869 $thirdparty = $object->contact;
871 $thirdparty = $object->thirdparty;
876 $carac_client =
pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact :
''), $usecontact,
'target', $object);
880 if ($this->page_largeur < 210) {
884 $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
885 if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
886 $posx = $this->marge_gauche;
890 $pdf->SetTextColor(0, 0, 0);
891 $pdf->SetFont(
'',
'', $default_font_size - 2);
892 $pdf->SetXY($posx + 2, $posy - 5);
894 $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
897 $pdf->SetXY($posx + 2, $posy + 3);
898 $pdf->SetFont(
'',
'B', $default_font_size);
899 $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0,
'L');
901 $posy = $pdf->getY();
904 $pdf->SetFont(
'',
'', $default_font_size - 1);
905 $pdf->SetXY($posx + 2, $posy);
906 $pdf->MultiCell($widthrecbox, 4, $carac_client, 0,
'L');
909 $pdf->SetTextColor(0, 0, 60);
922 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
924 $showdetails =
getDolGlobalInt(
'MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
925 return pdf_pagefoot($pdf, $outputlangs,
'DELIVERY_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
940 public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
942 global $conf, $hookmanager;
945 $this->defaultContentsFieldsStyle = array(
947 'padding' => array(0.5, 0.5, 0.5, 0.5),
951 $this->defaultTitlesFieldsStyle = array(
953 'padding' => array(0.5, 0, 0.5, 0),
975 $this->cols[
'desc'] = array(
980 'textkey' =>
'Designation',
984 'padding' => array(0.5, 0.5, 0.5, 0.5),
992 $this->cols[
'photo'] = array(
994 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH),
997 'textkey' =>
'Photo',
1001 'padding' => array(0, 0, 0, 0),
1003 'border-left' =>
false,
1006 if (!empty($conf->global->MAIN_GENERATE_DELIVERY_WITH_PICTURE) && !empty($this->atleastonephoto)) {
1007 $this->cols[
'photo'][
'status'] =
true;
1012 $this->cols[
'Comments'] = array(
1017 'textkey' =>
'Comments'
1019 'border-left' =>
true,
1034 $this->cols[
'qty_shipped'] = array(
1039 'textkey' =>
'QtyShippedShort'
1041 'border-left' =>
true,
1045 $this->cols[
'qty_remaining'] = array(
1050 'textkey' =>
'KeepToShipShort'
1052 'border-left' =>
true,
1057 if (!empty($object->lines)) {
1058 $line = reset($object->lines);
1062 $parameters = array(
1063 'object' => $object,
1064 'outputlangs' => $outputlangs,
1065 'hidedetails' => $hidedetails,
1066 'hidedesc' => $hidedesc,
1067 'hideref' => $hideref
1070 $reshook = $hookmanager->executeHooks(
'defineColumnField', $parameters, $this);
1073 } elseif (empty($reshook)) {
1074 $this->cols = array_replace($this->cols, $hookmanager->resArray);
1076 $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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
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.
$conf db
API class for accounts.