dolibarr  13.0.2
pdf_sepamandate.modules.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2020 Josep LluĂ­s Amador <joseplluis@lliuretic.cat>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  * or see https://www.gnu.org/
18  */
19 
26 require_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
27 require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
31 
32 
38 {
43  public $emetteur;
44 
49  public $version = 'dolibarr';
50 
56  public function __construct($db)
57  {
58  global $conf, $langs, $mysoc;
59 
60  // Translations
61  $langs->loadLangs(array("main", "bank", "withdrawals", "companies"));
62 
63  $this->db = $db;
64  $this->name = "sepamandate";
65  $this->description = $langs->transnoentitiesnoconv("DocumentModelSepaMandate");
66 
67  // Page size for A4 format
68  $this->type = 'pdf';
69  $formatarray = pdf_getFormat();
70  $this->page_largeur = $formatarray['width'];
71  $this->page_hauteur = $formatarray['height'];
72  $this->format = array($this->page_largeur, $this->page_hauteur);
73  $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10;
74  $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10;
75  $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10;
76  $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10;
77 
78  $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
79  $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
80  $this->option_codeproduitservice = 1; // Affiche code produit-service
81 
82  // Retrieves transmitter
83  $this->emetteur = $mysoc;
84  if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
85 
86  // Define column position
87  $this->posxref = $this->marge_gauche;
88  }
89 
90 
91  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
104  public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
105  {
106  // phpcs:enable
107  global $conf, $hookmanager, $langs, $user, $mysoc;
108 
109  if (!is_object($outputlangs)) $outputlangs = $langs;
110  // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
111  if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
112 
113  // Load translation files required by the page
114  $outputlangs->loadLangs(array("main", "dict", "withdrawals", "companies", "projects", "bills"));
115 
116  if (!empty($conf->bank->dir_output))
117  {
118  //$nblines = count($object->lines); // This is set later with array of tasks
119 
120  // Definition of $dir and $file
121  if ($object->specimen)
122  {
123  if (!empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output'];
124  else $dir = $conf->bank->dir_output;
125  $file = $dir."/SPECIMEN.pdf";
126  } else {
127  $objectref = dol_sanitizeFileName($object->ref);
128  if (!empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output'];
129  else $dir = $conf->bank->dir_output."/".$objectref;
130  $file = $dir."/".$langs->transnoentitiesnoconv("SepaMandateShort").' '.$objectref."-".dol_sanitizeFileName($object->rum).".pdf";
131  }
132 
133  if (!file_exists($dir))
134  {
135  if (dol_mkdir($dir) < 0)
136  {
137  $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
138  return 0;
139  }
140  }
141 
142  if (file_exists($dir))
143  {
144  // Add pdfgeneration hook
145  if (!is_object($hookmanager))
146  {
147  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
148  $hookmanager = new HookManager($this->db);
149  }
150  $hookmanager->initHooks(array('pdfgeneration'));
151  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
152  global $action;
153  $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
154 
155  $pdf = pdf_getInstance($this->format);
156  $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
157  $heightforinfotot = 50; // Height reserved to output the info and total part
158  $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
159  $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
160  if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
161  $pdf->SetAutoPageBreak(1, 0);
162 
163  if (class_exists('TCPDF'))
164  {
165  $pdf->setPrintHeader(false);
166  $pdf->setPrintFooter(false);
167  }
168  $pdf->SetFont(pdf_getPDFFont($outputlangs));
169 
170  $pdf->Open();
171  $pagenb = 0;
172  $pdf->SetDrawColor(128, 128, 128);
173 
174  $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
175  $pdf->SetSubject($outputlangs->transnoentities("SepaMandate"));
176  $pdf->SetCreator("Dolibarr ".DOL_VERSION);
177  $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
178  $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SepaMandate"));
179  if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
180 
181  $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
182 
183  // New page
184  $pdf->AddPage();
185  $pagenb++;
186  $this->_pagehead($pdf, $object, 1, $outputlangs);
187  $pdf->SetFont('', '', $default_font_size - 1);
188  $pdf->MultiCell(0, 3, ''); // Set interline to 3
189  $pdf->SetTextColor(0, 0, 0);
190 
191  $tab_top = 50;
192  $tab_height = 200;
193  $tab_top_newpage = 40;
194  $tab_height_newpage = 210;
195 
196  // Show notes
197  if (!empty($object->note_public))
198  {
199  $pdf->SetFont('', '', $default_font_size - 1);
200  $pdf->writeHTMLCell(190, 3, $this->posxref, $tab_top - 2, dol_htmlentitiesbr($object->note_public), 0, 1);
201  $nexY = $pdf->GetY();
202  $height_note = $nexY - ($tab_top - 2);
203 
204  // Rect takes a length in 3rd parameter
205  $pdf->SetDrawColor(192, 192, 192);
206  $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
207 
208  $tab_height = $tab_height - $height_note;
209  $tab_top = $nexY + 6;
210  } else {
211  $height_note = 0;
212  }
213 
214  $iniY = $tab_top + 7;
215  $curY = $tab_top + 7;
216  $nexY = $tab_top + 7;
217 
218  $posY = $curY;
219 
220  $pdf->SetFont('', '', $default_font_size);
221 
222  $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
223  $posY += 2;
224 
225  $pdf->SetXY($this->marge_gauche, $posY);
226  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").') : '.$object->rum, 0, 'L');
227 
228  $posY = $pdf->GetY();
229  $posY += 2;
230  $pdf->SetXY($this->marge_gauche, $posY);
231  $ics = '';
232  if (!empty($conf->global->PRELEVEMENT_ICS)) $ics = $conf->global->PRELEVEMENT_ICS;
233  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").') : '.$ics, 0, 'L');
234 
235  $posY = $pdf->GetY();
236  $posY += 1;
237  $pdf->SetXY($this->marge_gauche, $posY);
238  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorName").' : '.$mysoc->name, 0, 'L');
239 
240  $posY = $pdf->GetY();
241  $posY += 1;
242  $pdf->SetXY($this->marge_gauche, $posY);
243  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
244  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(), 0, 'L');
245 
246  $posY = $pdf->GetY();
247  $posY += 3;
248 
249  $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
250 
251  $pdf->SetFont('', '', $default_font_size - 1);
252 
253  $posY += 8;
254  $pdf->SetXY($this->marge_gauche, $posY);
255  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 8, $outputlangs->transnoentitiesnoconv("SEPALegalText", $mysoc->name, $mysoc->name), 0, 'L');
256 
257  // Your data form
258  $posY = $pdf->GetY();
259  $posY += 8;
260  $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
261  $posY += 2;
262 
263  $pdf->SetFont('', '', $default_font_size);
264 
265  $pdf->SetXY($this->marge_gauche, $posY);
266  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFillForm"), 0, 'C');
267 
268  $thirdparty = new Societe($this->db);
269  if ($object->socid > 0) $thirdparty->fetch($object->socid);
270 
271  $sepaname = '______________________________________________';
272  if ($thirdparty->id > 0)
273  {
274  $sepaname = $thirdparty->name.($object->account_owner ? ' ('.$object->account_owner.')' : '');
275  }
276  $posY = $pdf->GetY();
277  $posY += 3;
278  $pdf->SetXY($this->marge_gauche, $posY);
279  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourName").' * : ', 0, 'L');
280  $pdf->SetXY(80, $posY);
281  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepaname, 0, 'L');
282 
283  $sepavatid = '__________________________________________________';
284  if (!empty($thirdparty->idprof1)) $sepavatid = $thirdparty->idprof1;
285  $posY = $pdf->GetY();
286  $posY += 1;
287  $pdf->SetXY($this->marge_gauche, $posY);
288  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv('ProfId1'.$thirdparty->country_code).' * : ', 0, 'L');
289  $pdf->SetXY(80, $posY);
290  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepavatid, 0, 'L');
291 
292  $address = '______________________________________________';
293  if ($thirdparty->id > 0)
294  {
295  $address = $thirdparty->getFullAddress();
296  }
297  $posY = $pdf->GetY();
298  $posY += 1;
299  $pdf->SetXY($this->marge_gauche, $posY);
300  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
301  $pdf->SetXY(80, $posY);
302  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
303  if (preg_match('/_____/', $address))
304  {
305  $posY += 6;
306  $pdf->SetXY(80, $posY);
307  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
308  }
309 
310  $ban = '__________________________________________________';
311  if (!empty($object->iban)) $ban = $object->iban;
312  $posY = $pdf->GetY();
313  $posY += 1;
314  $pdf->SetXY($this->marge_gauche, $posY);
315  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBAN").' * : ', 0, 'L');
316  $pdf->SetXY(80, $posY);
317  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $ban, 0, 'L');
318 
319  $bic = '__________________________________________________';
320  if (!empty($object->bic)) $bic = $object->bic;
321  $posY = $pdf->GetY();
322  $posY += 1;
323  $pdf->SetXY($this->marge_gauche, $posY);
324  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBIC").' * : ', 0, 'L');
325  $pdf->SetXY(80, $posY);
326  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $bic, 0, 'L');
327 
328 
329  $posY = $pdf->GetY();
330  $posY += 1;
331  $pdf->SetXY($this->marge_gauche, $posY);
332  $txt = $outputlangs->transnoentitiesnoconv("SEPAFrstOrRecur").' * : ';
333  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
334  $pdf->Rect(80, $posY, 5, 5);
335  $pdf->SetXY(80, $posY);
336  if ($object->frstrecur == 'RECUR') $pdf->MultiCell(5, 3, 'X', 0, 'L');
337  $pdf->SetXY(86, $posY);
338  $txt = $langs->transnoentitiesnoconv("ModeRECUR").' '.$langs->transnoentitiesnoconv("or");
339  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
340  $posY += 6;
341  $pdf->Rect(80, $posY, 5, 5);
342  $pdf->SetXY(80, $posY);
343  if ($object->frstrecur == 'FRST') $pdf->MultiCell(5, 3, 'X', 0, 'L');
344  $pdf->SetXY(86, $posY);
345  $txt = $langs->transnoentitiesnoconv("ModeFRST");
346  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
347  if (empty($object->frstrecur))
348  {
349  $posY += 6;
350  $pdf->SetXY(80, $posY);
351  $txt = '('.$langs->transnoentitiesnoconv("PleaseCheckOne").')';
352  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
353  }
354 
355  $posY = $pdf->GetY();
356  $posY += 3;
357  $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
358  $posY += 3;
359 
360 
361  // Show square
362  if ($pagenb == 1)
363  {
364  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
365  $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
366  } else {
367  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
368  $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
369  }
370 
371  /*var_dump($tab_top);
372  var_dump($heightforinfotot);
373  var_dump($heightforfreetext);
374  var_dump($heightforfooter);
375  var_dump($bottomlasttab);*/
376 
377  // Affiche zone infos
378  $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
379 
380  /*
381  * Footer of the page
382  */
383  $this->_pagefoot($pdf, $object, $outputlangs);
384  if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
385 
386  $pdf->Close();
387 
388  $pdf->Output($file, 'F');
389 
390  // Add pdfgeneration hook
391  if (!is_object($hookmanager))
392  {
393  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
394  $hookmanager = new HookManager($this->db);
395  }
396  $hookmanager->initHooks(array('pdfgeneration'));
397  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
398  global $action;
399  $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
400  if ($reshook < 0)
401  {
402  $this->error = $hookmanager->error;
403  $this->errors = $hookmanager->errors;
404  }
405 
406  if (!empty($conf->global->MAIN_UMASK))
407  @chmod($file, octdec($conf->global->MAIN_UMASK));
408 
409  $this->result = array('fullpath'=>$file);
410 
411  return 1; // No error
412  } else {
413  $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
414  return 0;
415  }
416  }
417 
418  $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR");
419  return 0;
420  }
421 
422 
423  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
436  protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
437  {
438  // phpcs:enable
439  global $conf, $mysoc;
440 
441  $default_font_size = pdf_getPDFFontSize($outputlangs);
442  }
443 
444 
445  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
446  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
456  protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
457  {
458  // phpcs:enable
459  global $conf, $mysoc;
460 
461  $default_font_size = pdf_getPDFFontSize($outputlangs);
462 
463  $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 1 : $conf->global->PDF_DIFFSIZE_TITLE);
464 
465  $posy += $this->_signature_area($pdf, $object, $posy, $outputlangs);
466 
467  $pdf->SetXY($this->marge_gauche, $posy);
468  $pdf->SetFont('', '', $default_font_size);
469  $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("PleaseReturnMandate", $mysoc->email).':', 0, 'L', 0);
470  $posy = $pdf->GetY() + 2;
471 
472  $pdf->SetXY($this->marge_gauche, $posy);
473  $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
474  $pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0);
475  $pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress()), 0, 'L', 0);
476  $posy = $pdf->GetY() + 2;
477 
478  return $posy;
479  }
480 
481 
482 
483  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
484  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
494  protected function _signature_area(&$pdf, $object, $posy, $outputlangs)
495  {
496  // phpcs:enable
497  $default_font_size = pdf_getPDFFontSize($outputlangs);
498  $tab_top = $posy + 4;
499  $tab_hl = 4;
500 
501  $posx = $this->marge_gauche;
502  $pdf->SetXY($posx, $tab_top + 0);
503 
504  $pdf->SetFont('', '', $default_font_size - 2);
505 
506  $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("DateOfSignature"), 0, 'L', 0);
507  $pdf->MultiCell(100, 3, ' ');
508  $pdf->MultiCell(100, 3, '______________________', 0, 'L', 0);
509 
510  $posx = 120;
511  $largcol = ($this->page_largeur - $this->marge_droite - $posx);
512  $useborder = 0;
513  $index = 0;
514  // Total HT
515  $pdf->SetFillColor(255, 255, 255);
516  $pdf->SetXY($posx, $tab_top + 0);
517  $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', 1);
518 
519  $pdf->SetXY($posx, $tab_top + $tab_hl);
520  $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R');
521 
522  return ($tab_hl * 7);
523  }
524 
525 
526  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
536  protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
537  {
538  // phpcs:enable
539  global $langs, $conf, $mysoc;
540 
541  $default_font_size = pdf_getPDFFontSize($outputlangs);
542 
543  pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
544 
545  $pdf->SetTextColor(0, 0, 60);
546  $pdf->SetFont('', 'B', $default_font_size + 3);
547 
548  $posx = $this->page_largeur - $this->marge_droite - 100;
549  $posy = $this->marge_haute;
550 
551  $pdf->SetXY($this->marge_gauche, $posy);
552 
553  // Logo
554  $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
555  if ($mysoc->logo)
556  {
557  if (is_readable($logo))
558  {
559  $height = pdf_getHeightForLogo($logo);
560  $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
561  } else {
562  $pdf->SetTextColor(200, 0, 0);
563  $pdf->SetFont('', 'B', $default_font_size - 2);
564  $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
565  $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
566  }
567  } else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
568 
569  $pdf->SetFont('', 'B', $default_font_size + 3);
570  $pdf->SetXY($posx, $posy);
571  $pdf->SetTextColor(0, 0, 60);
572  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("SepaMandate"), '', 'R');
573  $pdf->SetFont('', '', $default_font_size + 2);
574 
575  $posy += 6;
576  $pdf->SetXY($posx, $posy);
577  $pdf->SetTextColor(0, 0, 60);
578  $daterum = '__________________';
579  if (!empty($object->date_rum))
580  {
581  $daterum = dol_print_date($object->date_rum, 'day', false, $outputlangs, true);
582  } else $daterum = dol_print_date($object->datec, 'day', false, $outputlangs, true); // For old record, the date_rum was not saved.
583  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".$daterum, '', 'R');
584  /*$posy+=6;
585  $pdf->SetXY($posx,$posy);
586  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
587  */
588 
589  $pdf->SetTextColor(0, 0, 60);
590 
591  // Add list of linked objects
592  /* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc....
593  $object->fetchObjectLinked();
594 
595  foreach($object->linkedObjects as $objecttype => $objects)
596  {
597  var_dump($objects);exit;
598  if ($objecttype == 'commande')
599  {
600  $outputlangs->load('orders');
601  $num=count($objects);
602  for ($i=0;$i<$num;$i++)
603  {
604  $posy+=4;
605  $pdf->SetXY($posx,$posy);
606  $pdf->SetFont('','', $default_font_size - 1);
607  $text=$objects[$i]->ref;
608  if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')';
609  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
610  }
611  }
612  }
613  */
614  }
615 
616  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
626  protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
627  {
628  // phpcs:enable
629  global $conf;
630 
631  $showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
632  return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
633  }
634 }
pdf_getFormat(Translate $outputlangs=null, $mode= 'setup')
Return array with format properties of default PDF format.
Definition: pdf.lib.php:45
Parent class for bank account models.
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition: pdf.lib.php:620
</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
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition: pdf.lib.php:245
write_file($object, $outputlangs, $srctemplatepath= '', $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Function to create pdf of company bank account sepa mandate.
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
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
Class to manage hooks.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
Class to manage third parties objects (customers, suppliers, prospects...)
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
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition: pdf.lib.php:270
Class to generate SEPA mandate.
pdf_getInstance($format= '', $metric= 'mm', $pagetype= 'P')
Return a PDF instance object.
Definition: pdf.lib.php:88
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
_signature_area(&$pdf, $object, $posy, $outputlangs)
Show area for the customer to sign.
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)
__construct($db)
Constructor.