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