dolibarr  9.0.0
pdf_rouget.modules.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
6  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * or see http://www.gnu.org/
21  */
22 
29 require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
32 
33 
38 {
42  public $db;
43 
47  public $name;
48 
52  public $description;
53 
57  public $type;
58 
63  public $phpmin = array(5, 4);
64 
69  public $version = 'dolibarr';
70 
74  public $page_largeur;
75 
79  public $page_hauteur;
80 
84  public $format;
85 
89  public $marge_gauche;
90 
94  public $marge_droite;
95 
99  public $marge_haute;
100 
104  public $marge_basse;
105 
110  public $emetteur;
111 
112 
118  function __construct($db=0)
119  {
120  global $conf,$langs,$mysoc;
121 
122  $this->db = $db;
123  $this->name = "rouget";
124  $this->description = $langs->trans("DocumentModelStandardPDF");
125 
126  $this->type = 'pdf';
127  $formatarray=pdf_getFormat();
128  $this->page_largeur = $formatarray['width'];
129  $this->page_hauteur = $formatarray['height'];
130  $this->format = array($this->page_largeur,$this->page_hauteur);
131  $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
132  $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
133  $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
134  $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
135 
136  $this->option_logo = 1;
137 
138  // Get source company
139  $this->emetteur=$mysoc;
140  if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
141 
142  // Define position of columns
143  $this->posxdesc=$this->marge_gauche+1;
144  $this->posxweightvol=$this->page_largeur - $this->marge_droite - 78;
145  $this->posxqtyordered=$this->page_largeur - $this->marge_droite - 56;
146  $this->posxqtytoship=$this->page_largeur - $this->marge_droite - 28;
147  $this->posxpuht=$this->page_largeur - $this->marge_droite;
148 
149  if (!empty($conf->global->SHIPPING_PDF_DISPLAY_AMOUNT_HT)) { // Show also the prices
150  $this->posxweightvol=$this->page_largeur - $this->marge_droite - 118;
151  $this->posxqtyordered=$this->page_largeur - $this->marge_droite - 96;
152  $this->posxqtytoship=$this->page_largeur - $this->marge_droite - 68;
153  $this->posxpuht=$this->page_largeur - $this->marge_droite - 40;
154  $this->posxtotalht=$this->page_largeur - $this->marge_droite - 20;
155  }
156 
157  $this->posxpicture=$this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
158 
159  if ($this->page_largeur < 210) // To work with US executive format
160  {
161  $this->posxweightvol-=20;
162  $this->posxpicture-=20;
163  $this->posxqtyordered-=20;
164  $this->posxqtytoship-=20;
165  }
166 
167  if (! empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
168  {
169  $this->posxweightvol += ($this->posxqtytoship - $this->posxqtyordered);
170  $this->posxpicture += ($this->posxqtytoship - $this->posxqtyordered);
171  $this->posxqtyordered = $this->posxqtytoship;
172  }
173  }
174 
175  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
187  function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
188  {
189  // phpcs:enable
190  global $user,$conf,$langs,$hookmanager;
191 
192  $object->fetch_thirdparty();
193 
194  if (! is_object($outputlangs)) $outputlangs=$langs;
195  // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
196  if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
197 
198  // Load traductions files requiredby by page
199  $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch"));
200 
201  $nblignes = count($object->lines);
202 
203  // Loop on each lines to detect if there is at least one image to show
204  $realpatharray=array();
205  if (! empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE))
206  {
207  $objphoto = new Product($this->db);
208 
209  for ($i = 0 ; $i < $nblignes ; $i++)
210  {
211  if (empty($object->lines[$i]->fk_product)) continue;
212 
213  $objphoto = new Product($this->db);
214  $objphoto->fetch($object->lines[$i]->fk_product);
215 
216  $pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/";
217  $dir = $conf->product->dir_output.'/'.$pdir;
218 
219  $realpath='';
220 
221  foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
222  {
223  if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
224  {
225  if ($obj['photo_vignette'])
226  {
227  $filename= $obj['photo_vignette'];
228  }
229  else
230  {
231  $filename=$obj['photo'];
232  }
233  }
234  else
235  {
236  $filename=$obj['photo'];
237  }
238 
239  $realpath = $dir.$filename;
240  break;
241  }
242 
243  if ($realpath) $realpatharray[$i]=$realpath;
244  }
245  }
246 
247  if (count($realpatharray) == 0) $this->posxpicture=$this->posxweightvol;
248 
249  if ($conf->expedition->dir_output)
250  {
251  // Definition de $dir et $file
252  if ($object->specimen)
253  {
254  $dir = $conf->expedition->dir_output."/sending";
255  $file = $dir . "/SPECIMEN.pdf";
256  }
257  else
258  {
259  $expref = dol_sanitizeFileName($object->ref);
260  $dir = $conf->expedition->dir_output."/sending/" . $expref;
261  $file = $dir . "/" . $expref . ".pdf";
262  }
263 
264  if (! file_exists($dir))
265  {
266  if (dol_mkdir($dir) < 0)
267  {
268  $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
269  return 0;
270  }
271  }
272 
273  if (file_exists($dir))
274  {
275  // Add pdfgeneration hook
276  if (! is_object($hookmanager))
277  {
278  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
279  $hookmanager=new HookManager($this->db);
280  }
281  $hookmanager->initHooks(array('pdfgeneration'));
282  $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
283  global $action;
284  $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
285 
286  // Set nblignes with the new facture lines content after hook
287  $nblignes = count($object->lines);
288 
289  $pdf=pdf_getInstance($this->format);
290  $default_font_size = pdf_getPDFFontSize($outputlangs);
291  $heightforinfotot = 8; // Height reserved to output the info and total part
292  $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
293  $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
294  if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
295  $pdf->SetAutoPageBreak(1,0);
296 
297  if (class_exists('TCPDF'))
298  {
299  $pdf->setPrintHeader(false);
300  $pdf->setPrintFooter(false);
301  }
302  $pdf->SetFont(pdf_getPDFFont($outputlangs));
303  // Set path to the background PDF File
304  if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
305  {
306  $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
307  $tplidx = $pdf->importPage(1);
308  }
309 
310  $pdf->Open();
311  $pagenb=0;
312  $pdf->SetDrawColor(128,128,128);
313 
314  if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
315 
316  $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
317  $pdf->SetSubject($outputlangs->transnoentities("Shipment"));
318  $pdf->SetCreator("Dolibarr ".DOL_VERSION);
319  $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
320  $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment"));
321  if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
322 
323  $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
324 
325  // New page
326  $pdf->AddPage();
327  if (! empty($tplidx)) $pdf->useTemplate($tplidx);
328  $pagenb++;
329  $this->_pagehead($pdf, $object, 1, $outputlangs);
330  $pdf->SetFont('','', $default_font_size - 1);
331  $pdf->MultiCell(0, 3, ''); // Set interline to 3
332  $pdf->SetTextColor(0,0,0);
333 
334  $tab_top = 90;
335  $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
336  $tab_height = 130;
337  $tab_height_newpage = 150;
338 
339  // Incoterm
340  $height_incoterms = 0;
341  if ($conf->incoterm->enabled)
342  {
343  $desc_incoterms = $object->getIncotermsForPDF();
344  if ($desc_incoterms)
345  {
346  $tab_top = 88;
347 
348  $pdf->SetFont('','', $default_font_size - 1);
349  $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
350  $nexY = $pdf->GetY();
351  $height_incoterms=$nexY-$tab_top;
352 
353  // Rect prend une longueur en 3eme param
354  $pdf->SetDrawColor(192,192,192);
355  $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
356 
357  $tab_top = $nexY+6;
358  $height_incoterms += 4;
359  }
360  }
361 
362  if (! empty($object->note_public) || ! empty($object->tracking_number))
363  {
364  $tab_top = 88 + $height_incoterms;
365  $tab_top_alt = $tab_top;
366 
367  $pdf->SetFont('','B', $default_font_size - 2);
368  $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, 0, 1, false, true, 'L');
369 
370  $tab_top_alt = $pdf->GetY();
371  //$tab_top_alt += 1;
372 
373  // Tracking number
374  if (! empty($object->tracking_number))
375  {
376  $object->GetUrlTrackingStatus($object->tracking_number);
377  if (! empty($object->tracking_url))
378  {
379  if ($object->shipping_method_id > 0)
380  {
381  // Get code using getLabelFromKey
382  $code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code');
383  $label='';
384  if ($object->tracking_url != $object->tracking_number) $label.=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
385  $label.=$outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code));
386  //var_dump($object->tracking_url != $object->tracking_number);exit;
387  if ($object->tracking_url != $object->tracking_number)
388  {
389  $label.=" : ";
390  $label.=$object->tracking_url;
391  }
392  $pdf->SetFont('','B', $default_font_size - 2);
393  $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top_alt, $label, 0, 1, false, true, 'L');
394 
395  $tab_top_alt = $pdf->GetY();
396  }
397  }
398  }
399 
400  // Notes
401  if (! empty($object->note_public))
402  {
403  $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
404  $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top_alt, dol_htmlentitiesbr($object->note_public), 0, 1);
405  }
406 
407  $nexY = $pdf->GetY();
408  $height_note=$nexY-$tab_top;
409 
410  // Rect prend une longueur en 3eme param
411  $pdf->SetDrawColor(192,192,192);
412  $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
413 
414  $tab_height = $tab_height - $height_note;
415  $tab_top = $nexY+6;
416  }
417  else
418  {
419  $height_note=0;
420  }
421 
422  $iniY = $tab_top + 7;
423  $curY = $tab_top + 7;
424  $nexY = $tab_top + 7;
425 
426  // Loop on each lines
427  for ($i = 0; $i < $nblignes; $i++)
428  {
429  $curY = $nexY;
430  $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
431  $pdf->SetTextColor(0,0,0);
432 
433  // Define size of image if we need it
434  $imglinesize=array();
435  if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]);
436 
437  $pdf->setTopMargin($tab_top_newpage);
438  $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
439  $pageposbefore=$pdf->getPage();
440 
441  $showpricebeforepagebreak=1;
442  $posYAfterImage=0;
443  $posYAfterDescription=0;
444 
445  // We start with Photo of product line
446  if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page
447  {
448  $pdf->AddPage('','',true);
449  if (! empty($tplidx)) $pdf->useTemplate($tplidx);
450  if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
451  $pdf->setPage($pageposbefore+1);
452 
453  $curY = $tab_top_newpage;
454  $showpricebeforepagebreak=0;
455  }
456 
457  if (isset($imglinesize['width']) && isset($imglinesize['height']))
458  {
459  $curX = $this->posxpicture-1;
460  $pdf->Image($realpatharray[$i], $curX + (($this->posxweightvol-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
461  // $pdf->Image does not increase value return by getY, so we save it manually
462  $posYAfterImage=$curY+$imglinesize['height'];
463  }
464 
465  // Description of product line
466  $curX = $this->posxdesc-1;
467 
468  $pdf->startTransaction();
469  pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
470 
471  $pageposafter=$pdf->getPage();
472  if ($pageposafter > $pageposbefore) // There is a pagebreak
473  {
474  $pdf->rollbackTransaction(true);
475  $pageposafter=$pageposbefore;
476  //print $pageposafter.'-'.$pageposbefore;exit;
477  $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
478  pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
479 
480  $pageposafter=$pdf->getPage();
481  $posyafter=$pdf->GetY();
482  //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
483  if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
484  {
485  if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page
486  {
487  $pdf->AddPage('','',true);
488  if (! empty($tplidx)) $pdf->useTemplate($tplidx);
489  if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
490  $pdf->setPage($pageposafter+1);
491  }
492  }
493  else
494  {
495  // We found a page break
496  $showpricebeforepagebreak=0;
497  }
498  }
499  else // No pagebreak
500  {
501  $pdf->commitTransaction();
502  }
503  $posYAfterDescription=$pdf->GetY();
504 
505  $nexY = $pdf->GetY();
506  $pageposafter=$pdf->getPage();
507 
508  $pdf->setPage($pageposbefore);
509  $pdf->setTopMargin($this->marge_haute);
510  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
511 
512  // We suppose that a too long description or photo were moved completely on next page
513  if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
514  $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
515  }
516 
517  // We suppose that a too long description is moved completely on next page
518  if ($pageposafter > $pageposbefore) {
519  $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
520  }
521 
522  $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
523 
524  $pdf->SetXY($this->posxweightvol, $curY);
525  $weighttxt='';
526  if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight)
527  {
528  $weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units,"weight");
529  }
530  $voltxt='';
531  if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
532  {
533  $voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0,"volume");
534  }
535 
536  if (empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME))
537  {
538  $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C');
539  //$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 3, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt,'','C');
540  }
541 
542  if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
543  {
544  $pdf->SetXY($this->posxqtyordered, $curY);
545  $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 3, $object->lines[$i]->qty_asked,'','C');
546  }
547 
548  if (empty($conf->global->SHIPPING_PDF_HIDE_QTYTOSHIP))
549  {
550  $pdf->SetXY($this->posxqtytoship, $curY);
551  $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');
552  }
553 
554  if(!empty($conf->global->SHIPPING_PDF_DISPLAY_AMOUNT_HT))
555  {
556  $pdf->SetXY($this->posxpuht, $curY);
557  $pdf->MultiCell(($this->posxtotalht - $this->posxpuht-1), 3, price($object->lines[$i]->subprice, 0, $outputlangs),'','R');
558 
559  $pdf->SetXY($this->posxtotalht, $curY);
560  $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 3, price($object->lines[$i]->total_ht, 0, $outputlangs),'','R');
561  }
562 
563  $nexY+=3;
564  if ($weighttxt && $voltxt) $nexY+=2;
565 
566  // Add line
567  if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
568  {
569  $pdf->setPage($pageposafter);
570  $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));
571  //$pdf->SetDrawColor(190,190,200);
572  $pdf->line($this->marge_gauche, $nexY-1, $this->page_largeur - $this->marge_droite, $nexY-1);
573  $pdf->SetLineStyle(array('dash'=>0));
574  }
575 
576  // Detect if some page were added automatically and output _tableau for past pages
577  while ($pagenb < $pageposafter)
578  {
579  $pdf->setPage($pagenb);
580  if ($pagenb == 1)
581  {
582  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
583  }
584  else
585  {
586  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
587  }
588  $this->_pagefoot($pdf,$object,$outputlangs,1);
589  $pagenb++;
590  $pdf->setPage($pagenb);
591  $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
592  if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
593  }
594  if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
595  {
596  if ($pagenb == 1)
597  {
598  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
599  }
600  else
601  {
602  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
603  }
604  $this->_pagefoot($pdf,$object,$outputlangs,1);
605  // New page
606  $pdf->AddPage();
607  if (! empty($tplidx)) $pdf->useTemplate($tplidx);
608  $pagenb++;
609  if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
610  }
611  }
612 
613  // Show square
614  if ($pagenb == 1)
615  {
616  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
617  $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
618  }
619  else
620  {
621  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
622  $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
623  }
624 
625  // Affiche zone totaux
626  $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs);
627 
628  // Pied de page
629  $this->_pagefoot($pdf,$object,$outputlangs);
630  if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
631 
632  $pdf->Close();
633 
634  $pdf->Output($file,'F');
635 
636  // Add pdfgeneration hook
637  $hookmanager->initHooks(array('pdfgeneration'));
638  $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
639  global $action;
640  $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
641 
642  if (! empty($conf->global->MAIN_UMASK))
643  @chmod($file, octdec($conf->global->MAIN_UMASK));
644 
645  $this->result = array('fullpath'=>$file);
646 
647  return 1; // No error
648  }
649  else
650  {
651  $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
652  return 0;
653  }
654  }
655  else
656  {
657  $this->error=$langs->transnoentities("ErrorConstantNotDefined","EXP_OUTPUTDIR");
658  return 0;
659  }
660  }
661 
662  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
673  function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
674  {
675  // phpcs:enable
676  global $conf,$mysoc;
677 
678  $sign=1;
679 
680  $default_font_size = pdf_getPDFFontSize($outputlangs);
681 
682  $tab2_top = $posy;
683  $tab2_hl = 4;
684  $pdf->SetFont('','B', $default_font_size - 1);
685 
686  // Tableau total
687  $col1x = $this->posxweightvol-50; $col2x = $this->posxweightvol;
688  /*if ($this->page_largeur < 210) // To work with US executive format
689  {
690  $col2x-=20;
691  }*/
692  if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxqtyordered - $this->posxweightvol);
693  else $largcol2 = ($this->posxqtytoship - $this->posxweightvol);
694 
695  $useborder=0;
696  $index = 0;
697 
698  $totalWeighttoshow='';
699  $totalVolumetoshow='';
700 
701  // Load dim data
702  $tmparray=$object->getTotalWeightVolume();
703  $totalWeight=$tmparray['weight'];
704  $totalVolume=$tmparray['volume'];
705  $totalOrdered=$tmparray['ordered'];
706  $totalToShip=$tmparray['toship'];
707  // Set trueVolume and volume_units not currently stored into database
708  if ($object->trueWidth && $object->trueHeight && $object->trueDepth)
709  {
710  $object->trueVolume=price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0);
711  $object->volume_units=$object->size_units * 3;
712  }
713 
714  if ($totalWeight!='') $totalWeighttoshow=showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
715  if ($totalVolume!='') $totalVolumetoshow=showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
716  if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
717  if ($object->trueVolume) $totalVolumetoshow=showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
718 
719  $pdf->SetFillColor(255,255,255);
720  $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
721  $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Total"), 0, 'L', 1);
722 
723  if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
724  {
725  $pdf->SetXY($this->posxqtyordered, $tab2_top + $tab2_hl * $index);
726  $pdf->MultiCell($this->posxqtytoship - $this->posxqtyordered, $tab2_hl, $totalOrdered, 0, 'C', 1);
727  }
728 
729  if (empty($conf->global->SHIPPING_PDF_HIDE_QTYTOSHIP))
730  {
731  $pdf->SetXY($this->posxqtytoship, $tab2_top + $tab2_hl * $index);
732  $pdf->MultiCell($this->posxpuht - $this->posxqtytoship, $tab2_hl, $totalToShip, 0, 'C', 1);
733  }
734 
735  if (!empty($conf->global->SHIPPING_PDF_DISPLAY_AMOUNT_HT))
736  {
737  $pdf->SetXY($this->posxpuht, $tab2_top + $tab2_hl * $index);
738  $pdf->MultiCell($this->posxtotalht - $this->posxpuht, $tab2_hl, '', 0, 'C', 1);
739 
740  $pdf->SetXY($this->posxtotalht, $tab2_top + $tab2_hl * $index);
741  $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxtotalht, $tab2_hl, price($object->total_ht, 0, $outputlangs), 0, 'C', 1);
742  }
743 
744  if (empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME))
745  {
746  // Total Weight
747  if ($totalWeighttoshow)
748  {
749  $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
750  $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalWeighttoshow, 0, 'C', 1);
751 
752  $index++;
753  }
754  if ($totalVolumetoshow)
755  {
756  $pdf->SetXY($this->posxweightvol, $tab2_top + $tab2_hl * $index);
757  $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), $tab2_hl, $totalVolumetoshow, 0, 'C', 1);
758 
759  $index++;
760  }
761  if (! $totalWeighttoshow && ! $totalVolumetoshow) $index++;
762  }
763 
764  $pdf->SetTextColor(0,0,0);
765 
766  return ($tab2_top + ($tab2_hl * $index));
767  }
768 
781  function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
782  {
783  global $conf;
784 
785  // Force to disable hidetop and hidebottom
786  $hidebottom=0;
787  if ($hidetop) $hidetop=-1;
788 
789  $default_font_size = pdf_getPDFFontSize($outputlangs);
790 
791  // Amount in (at tab_top - 1)
792  $pdf->SetTextColor(0,0,0);
793  $pdf->SetFont('','',$default_font_size - 2);
794 
795  // Output Rect
796  $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
797 
798  $pdf->SetDrawColor(128,128,128);
799  $pdf->SetFont('','', $default_font_size - 1);
800 
801  if (empty($hidetop))
802  {
803  $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
804 
805  $pdf->SetXY($this->posxdesc-1, $tab_top+1);
806  $pdf->MultiCell($this->posxqtyordered - $this->posxdesc, 2, $outputlangs->transnoentities("Description"), '', 'L');
807  }
808 
809  if (empty($conf->global->SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME))
810  {
811  $pdf->line($this->posxweightvol-1, $tab_top, $this->posxweightvol-1, $tab_top + $tab_height);
812  if (empty($hidetop))
813  {
814  $pdf->SetXY($this->posxweightvol-1, $tab_top+1);
815  $pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 2, $outputlangs->transnoentities("WeightVolShort"),'','C');
816  }
817  }
818 
819  if (empty($conf->global->SHIPPING_PDF_HIDE_ORDERED))
820  {
821  $pdf->line($this->posxqtyordered-1, $tab_top, $this->posxqtyordered-1, $tab_top + $tab_height);
822  if (empty($hidetop))
823  {
824  $pdf->SetXY($this->posxqtyordered-1, $tab_top+1);
825  $pdf->MultiCell(($this->posxqtytoship - $this->posxqtyordered), 2, $outputlangs->transnoentities("QtyOrdered"),'','C');
826  }
827  }
828 
829  if (empty($conf->global->SHIPPING_PDF_HIDE_QTYTOSHIP))
830  {
831  $pdf->line($this->posxqtytoship-1, $tab_top, $this->posxqtytoship-1, $tab_top + $tab_height);
832  if (empty($hidetop))
833  {
834  $pdf->SetXY($this->posxqtytoship, $tab_top+1);
835  $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToShip"),'','C');
836  }
837  }
838 
839  if (!empty($conf->global->SHIPPING_PDF_DISPLAY_AMOUNT_HT)) {
840 
841  $pdf->line($this->posxpuht-1, $tab_top, $this->posxpuht-1, $tab_top + $tab_height);
842  if (empty($hidetop))
843  {
844  $pdf->SetXY($this->posxpuht-1, $tab_top+1);
845  $pdf->MultiCell(($this->posxtotalht - $this->posxpuht), 2, $outputlangs->transnoentities("PriceUHT"),'','C');
846  }
847 
848  $pdf->line($this->posxtotalht-1, $tab_top, $this->posxtotalht-1, $tab_top + $tab_height);
849  if (empty($hidetop))
850  {
851  $pdf->SetXY($this->posxtotalht-1, $tab_top+1);
852  $pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxtotalht), 2, $outputlangs->transnoentities("TotalHT"),'','C');
853  }
854  }
855  }
856 
866  function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
867  {
868  global $conf,$langs,$mysoc;
869 
870  $langs->load("orders");
871 
872  $default_font_size = pdf_getPDFFontSize($outputlangs);
873 
874  pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
875 
876  // Show Draft Watermark
877  if($object->statut==0 && (! empty($conf->global->SHIPPING_DRAFT_WATERMARK)) )
878  {
879  pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->SHIPPING_DRAFT_WATERMARK);
880  }
881 
882  //Prepare la suite
883  $pdf->SetTextColor(0,0,60);
884  $pdf->SetFont('','B', $default_font_size + 3);
885 
886  $w = 110;
887 
888  $posy=$this->marge_haute;
889  $posx=$this->page_largeur-$this->marge_droite-$w;
890 
891  $pdf->SetXY($this->marge_gauche,$posy);
892 
893  // Logo
894  $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
895  if ($this->emetteur->logo)
896  {
897  if (is_readable($logo))
898  {
899  $height=pdf_getHeightForLogo($logo);
900  $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
901  }
902  else
903  {
904  $pdf->SetTextColor(200,0,0);
905  $pdf->SetFont('','B', $default_font_size - 2);
906  $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
907  $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
908  }
909  }
910  else
911  {
912  $text=$this->emetteur->name;
913  $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
914  }
915 
916  // Show barcode
917  if (! empty($conf->barcode->enabled))
918  {
919  $posx=105;
920  }
921  else
922  {
923  $posx=$this->marge_gauche+3;
924  }
925  //$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30);
926  if (! empty($conf->barcode->enabled))
927  {
928  // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
929  //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
930  //$pdf->Image($logo,10, 5, 0, 24);
931  }
932 
933  $pdf->SetDrawColor(128,128,128);
934  if (! empty($conf->barcode->enabled))
935  {
936  // TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
937  //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
938  //$pdf->Image($logo,10, 5, 0, 24);
939  }
940 
941 
942  $posx=$this->page_largeur - $w - $this->marge_droite;
943  $posy=$this->marge_haute;
944 
945  $pdf->SetFont('','B', $default_font_size + 2);
946  $pdf->SetXY($posx,$posy);
947  $pdf->SetTextColor(0,0,60);
948  $title=$outputlangs->transnoentities("SendingSheet");
949  $pdf->MultiCell($w, 4, $title, '', 'R');
950 
951  $pdf->SetFont('','', $default_font_size + 1);
952 
953  $posy+=5;
954 
955  $pdf->SetXY($posx,$posy);
956  $pdf->SetTextColor(0,0,60);
957  $pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R');
958 
959  // Date planned delivery
960  if (! empty($object->date_delivery))
961  {
962  $posy+=4;
963  $pdf->SetXY($posx,$posy);
964  $pdf->SetTextColor(0,0,60);
965  $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R');
966  }
967 
968  if (! empty($object->thirdparty->code_client))
969  {
970  $posy+=4;
971  $pdf->SetXY($posx,$posy);
972  $pdf->SetTextColor(0,0,60);
973  $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
974  }
975 
976 
977  $pdf->SetFont('','', $default_font_size + 3);
978  $Yoff=25;
979 
980  // Add list of linked orders
981  $origin = $object->origin;
982  $origin_id = $object->origin_id;
983 
984  // TODO move to external function
985  if (! empty($conf->$origin->enabled)) // commonly $origin='commande'
986  {
987  $outputlangs->load('orders');
988 
989  $classname = ucfirst($origin);
990  $linkedobject = new $classname($this->db);
991  $result=$linkedobject->fetch($origin_id);
992  if ($result >= 0)
993  {
994  //$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects
995 
996  $pdf->SetFont('','', $default_font_size - 2);
997  $text=$linkedobject->ref;
998  if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
999  $Yoff = $Yoff+8;
1000  $pdf->SetXY($this->page_largeur - $this->marge_droite - $w,$Yoff);
1001  $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
1002  $Yoff = $Yoff+3;
1003  $pdf->SetXY($this->page_largeur - $this->marge_droite - $w,$Yoff);
1004  $pdf->MultiCell($w, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date,"day",false,$outputlangs,true), 0, 'R');
1005  }
1006  }
1007 
1008  if ($showaddress)
1009  {
1010  // Sender properties
1011  $carac_emetteur='';
1012  // Add internal contact of origin element if defined
1013  $arrayidcontact=array();
1014  if (! empty($origin) && is_object($object->$origin)) $arrayidcontact=$object->$origin->getIdContact('internal','SALESREPFOLL');
1015  if (count($arrayidcontact) > 0)
1016  {
1017  $object->fetch_user(reset($arrayidcontact));
1018  $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
1019  }
1020 
1021  $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
1022 
1023  // Show sender
1024  $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1025  $posx=$this->marge_gauche;
1026  if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
1027 
1028  $hautcadre=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
1029  $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
1030 
1031  // Show sender frame
1032  $pdf->SetTextColor(0,0,0);
1033  $pdf->SetFont('','', $default_font_size - 2);
1034  $pdf->SetXY($posx,$posy-5);
1035  $pdf->MultiCell(66,5, $outputlangs->transnoentities("Sender").":", 0, 'L');
1036  $pdf->SetXY($posx,$posy);
1037  $pdf->SetFillColor(230,230,230);
1038  $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
1039  $pdf->SetTextColor(0,0,60);
1040  $pdf->SetFillColor(255,255,255);
1041 
1042  // Show sender name
1043  $pdf->SetXY($posx+2,$posy+3);
1044  $pdf->SetFont('','B',$default_font_size);
1045  $pdf->MultiCell($widthrecbox-2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
1046  $posy=$pdf->getY();
1047 
1048  // Show sender information
1049  $pdf->SetXY($posx+2,$posy);
1050  $pdf->SetFont('','', $default_font_size - 1);
1051  $pdf->MultiCell($widthrecbox-2, 4, $carac_emetteur, 0, 'L');
1052 
1053 
1054  // If SHIPPING contact defined, we use it
1055  $usecontact=false;
1056  $arrayidcontact=$object->$origin->getIdContact('external','SHIPPING');
1057  if (count($arrayidcontact) > 0)
1058  {
1059  $usecontact=true;
1060  $result=$object->fetch_contact($arrayidcontact[0]);
1061  }
1062 
1063  //Recipient name
1064  // On peut utiliser le nom de la societe du contact
1065  if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
1066  $thirdparty = $object->contact;
1067  } else {
1068  $thirdparty = $object->thirdparty;
1069  }
1070 
1071  $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
1072 
1073  $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,(!empty($object->contact)?$object->contact:null),$usecontact,'targetwithdetails',$object);
1074 
1075  // Show recipient
1076  $widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100;
1077  if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format
1078  $posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
1079  $posx=$this->page_largeur - $this->marge_droite - $widthrecbox;
1080  if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche;
1081 
1082  // Show recipient frame
1083  $pdf->SetTextColor(0,0,0);
1084  $pdf->SetFont('','', $default_font_size - 2);
1085  $pdf->SetXY($posx+2,$posy-5);
1086  $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient").":", 0, 'L');
1087  $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
1088 
1089  // Show recipient name
1090  $pdf->SetXY($posx+2,$posy+3);
1091  $pdf->SetFont('','B', $default_font_size);
1092  $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L');
1093 
1094  $posy = $pdf->getY();
1095 
1096  // Show recipient information
1097  $pdf->SetFont('','', $default_font_size - 1);
1098  $pdf->SetXY($posx+2,$posy);
1099  $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
1100  }
1101 
1102  $pdf->SetTextColor(0,0,0);
1103  }
1104 
1114  function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
1115  {
1116  global $conf;
1117  $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
1118  return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
1119  }
1120 }
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition: pdf.lib.php:82
pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includealias=0)
Returns the name of the thirdparty.
Definition: pdf.lib.php:319
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition: pdf.lib.php:600
_tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
Show total to pay.
pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
Add a draft watermark on PDF files.
Definition: pdf.lib.php:643
pdf_build_address($outputlangs, $sourcecompany, $targetcompany='', $targetcontact='', $usecontact=0, $mode='source', $object=null)
Return a string with full address formated for output on documents.
Definition: pdf.lib.php:353
</td >< td class="liste_titre" align="right"></td ></tr >< tr class="liste_titre">< input type="checkbox" onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< tr class="oddeven">< td >< input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td >< td >< input type="checkbox" class="check" name="choose'.$i.'"></td >< td class="nowrap"></td >< td >< input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:573
Parent class of sending receipts models.
pdf_getFormat(Translate $outputlangs=null)
Return array with format properties of default PDF format.
Definition: pdf.lib.php:42
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
Return a path to have a the directory according to object where files are stored. ...
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition: pdf.lib.php:224
Class to manage products or services.
Class to build sending documents with model Rouget.
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition: pdf.lib.php:201
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
$version
Dolibarr version of the loaded document string.
Class to manage hooks.
type
Definition: viewcat.php:284
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0)
Show footer of page for PDF generation.
Definition: pdf.lib.php:872
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build pdf onto disk.
pdf_getSizeForImage($realpath)
Return dimensions to use for images onto PDF checking that width and height are not higher than maxim...
Definition: pdf.lib.php:2170
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.
Definition: pdf.lib.php:245
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
__construct($db=0)
Constructor.
measuring_units_string($unit, $measuring_style='')
Return translation label of a unit key.
pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref=0, $hidedesc=0, $issupplierline=0)
Output line description into PDF.
Definition: pdf.lib.php:1158
dol_mkdir($dir, $dataroot='', $newmask=null)
Creation of a directory (this can create recursive subdir)
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
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...
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no')
Output a dimension with best unit.