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