dolibarr  9.0.0
pdf_sepamandate.modules.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
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 <http://www.gnu.org/licenses/>.
16  * or see http://www.gnu.org/
17  */
18 
25 require_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
26 require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
30 
31 
37 {
42  public $emetteur;
43 
48  public $version = 'dolibarr';
49 
55  function __construct($db)
56  {
57  global $conf, $langs, $mysoc;
58 
59  // Translations
60  $langs->loadLangs(array("main", "bank", "withdrawals", "companies"));
61 
62  $this->db = $db;
63  $this->name = "sepamandate";
64  $this->description = $langs->transnoentitiesnoconv("DocumentModelSepaMandate");
65 
66  // Dimension page pour format A4
67  $this->type = 'pdf';
68  $formatarray=pdf_getFormat();
69  $this->page_largeur = $formatarray['width'];
70  $this->page_hauteur = $formatarray['height'];
71  $this->format = array($this->page_largeur,$this->page_hauteur);
72  $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
73  $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
74  $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
75  $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
76 
77  $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
78  $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
79  $this->option_codeproduitservice = 1; // Affiche code produit-service
80 
81  // Recupere emmetteur
82  $this->emetteur=$mysoc;
83  if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
84 
85  // Defini position des colonnes
86  $this->posxref=$this->marge_gauche+1;
87  $this->posxlabel=$this->marge_gauche+25;
88  $this->posxworkload=$this->marge_gauche+100;
89  $this->posxprogress=$this->marge_gauche+130;
90  $this->posxdatestart=$this->marge_gauche+150;
91  $this->posxdateend=$this->marge_gauche+170;
92  }
93 
94 
95  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
108  function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
109  {
110  // phpcs:enable
111  global $conf, $hookmanager, $langs, $user, $mysoc;
112 
113  if (! is_object($outputlangs)) $outputlangs=$langs;
114  // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
115  if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
116 
117  // Load traductions files requiredby by page
118  $outputlangs->loadLangs(array("main", "dict", "withdrawals", "companies", "projects", "bills"));
119 
120  if (! empty($conf->bank->dir_output))
121  {
122  //$nblignes = count($object->lines); // This is set later with array of tasks
123 
124  // Definition of $dir and $file
125  if ($object->specimen)
126  {
127  if (! empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output'];
128  else $dir = $conf->bank->dir_output;
129  $file = $dir . "/SPECIMEN.pdf";
130  }
131  else
132  {
133  $objectref = dol_sanitizeFileName($object->ref);
134  if (! empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output'];
135  else $dir = $conf->bank->dir_output . "/" . $objectref;
136  $file = $dir . "/" . $langs->transnoentitiesnoconv("SepaMandateShort").' '.$objectref . "-".dol_sanitizeFileName($object->rum).".pdf";
137  }
138 
139  if (! file_exists($dir))
140  {
141  if (dol_mkdir($dir) < 0)
142  {
143  $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
144  return 0;
145  }
146  }
147 
148  if (file_exists($dir))
149  {
150  // Add pdfgeneration hook
151  if (! is_object($hookmanager))
152  {
153  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
154  $hookmanager=new HookManager($this->db);
155  }
156  $hookmanager->initHooks(array('pdfgeneration'));
157  $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
158  global $action;
159  $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
160 
161  $pdf=pdf_getInstance($this->format);
162  $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
163  $heightforinfotot = 50; // Height reserved to output the info and total part
164  $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
165  $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
166  if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6;
167  $pdf->SetAutoPageBreak(1,0);
168 
169  if (class_exists('TCPDF'))
170  {
171  $pdf->setPrintHeader(false);
172  $pdf->setPrintFooter(false);
173  }
174  $pdf->SetFont(pdf_getPDFFont($outputlangs));
175 
176  $pdf->Open();
177  $pagenb=0;
178  $pdf->SetDrawColor(128,128,128);
179 
180  $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
181  $pdf->SetSubject($outputlangs->transnoentities("SepaMandate"));
182  $pdf->SetCreator("Dolibarr ".DOL_VERSION);
183  $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
184  $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SepaMandate"));
185  if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
186 
187  $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
188 
189  // New page
190  $pdf->AddPage();
191  $pagenb++;
192  $this->_pagehead($pdf, $object, 1, $outputlangs);
193  $pdf->SetFont('','', $default_font_size - 1);
194  $pdf->MultiCell(0, 3, ''); // Set interline to 3
195  $pdf->SetTextColor(0,0,0);
196 
197  $tab_top = 50;
198  $tab_height = 200;
199  $tab_top_newpage = 40;
200  $tab_height_newpage = 210;
201 
202  // Affiche notes
203  if (! empty($object->note_public))
204  {
205  $pdf->SetFont('','', $default_font_size - 1);
206  $pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($object->note_public), 0, 1);
207  $nexY = $pdf->GetY();
208  $height_note=$nexY-($tab_top-2);
209 
210  // Rect prend une longueur en 3eme param
211  $pdf->SetDrawColor(192,192,192);
212  $pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
213 
214  $tab_height = $tab_height - $height_note;
215  $tab_top = $nexY+6;
216  }
217  else
218  {
219  $height_note=0;
220  }
221 
222  $iniY = $tab_top + 7;
223  $curY = $tab_top + 7;
224  $nexY = $tab_top + 7;
225 
226  $posY = $curY;
227 
228  $pdf->SetFont('','', $default_font_size);
229 
230  $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
231  $posY+=2;
232 
233  $pdf->SetXY($this->marge_gauche, $posY);
234  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").')'.' : '.$object->rum, 0, 'L');
235 
236  $posY=$pdf->GetY();
237  $posY+=2;
238  $pdf->SetXY($this->marge_gauche, $posY);
239  $ics='';
240  if (! empty($conf->global->PRELEVEMENT_ICS)) $ics=$conf->global->PRELEVEMENT_ICS;
241  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").')'.' : '.$ics, 0, 'L');
242 
243  $posY=$pdf->GetY();
244  $posY+=1;
245  $pdf->SetXY($this->marge_gauche, $posY);
246  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorName").' : '.$mysoc->name, 0, 'L');
247 
248  $posY=$pdf->GetY();
249  $posY+=1;
250  $pdf->SetXY($this->marge_gauche, $posY);
251  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
252  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(), 0, 'L');
253 
254  $posY=$pdf->GetY();
255  $posY+=3;
256 
257  $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
258 
259  $pdf->SetFont('','', $default_font_size - 1);
260 
261  $posY+=8;
262  $pdf->SetXY($this->marge_gauche, $posY);
263  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 8, $outputlangs->transnoentitiesnoconv("SEPALegalText", $mysoc->name, $mysoc->name), 0, 'L');
264 
265  // Your data form
266  $posY=$pdf->GetY();
267  $posY+=8;
268  $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
269  $posY+=2;
270 
271  $pdf->SetFont('','', $default_font_size);
272 
273  $pdf->SetXY($this->marge_gauche, $posY);
274  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFillForm"), 0, 'C');
275 
276  $thirdparty=new Societe($this->db);
277  if ($object->socid > 0) $thirdparty->fetch($object->socid);
278 
279  $sepaname = '______________________________________________';
280  if ($thirdparty->id > 0)
281  {
282  $sepaname = $thirdparty->name.($object->account_owner?' ('.$object->account_owner.')':'');
283  }
284  $posY=$pdf->GetY();
285  $posY+=3;
286  $pdf->SetXY($this->marge_gauche, $posY);
287  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourName").' * : ', 0, 'L');
288  $pdf->SetXY(80, $posY);
289  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepaname, 0, 'L');
290 
291  $address = '______________________________________________';
292  if ($thirdparty->id > 0)
293  {
294  $address = $thirdparty->getFullAddress();
295  }
296  $posY=$pdf->GetY();
297  $posY+=1;
298  $pdf->SetXY($this->marge_gauche, $posY);
299  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
300  $pdf->SetXY(80, $posY);
301  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
302  if (preg_match('/_____/', $address))
303  {
304  $posY+=6;
305  $pdf->SetXY(80, $posY);
306  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
307  }
308 
309  $ban = '__________________________________________________';
310  if (! empty($object->iban)) $ban = $object->iban;
311  $posY=$pdf->GetY();
312  $posY+=1;
313  $pdf->SetXY($this->marge_gauche, $posY);
314  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBAN").' * : ', 0, 'L');
315  $pdf->SetXY(80, $posY);
316  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $ban, 0, 'L');
317 
318  $bic = '__________________________________________________';
319  if (! empty($object->bic)) $bic = $object->bic;
320  $posY=$pdf->GetY();
321  $posY+=1;
322  $pdf->SetXY($this->marge_gauche, $posY);
323  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBIC").' * : ', 0, 'L');
324  $pdf->SetXY(80, $posY);
325  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $bic, 0, 'L');
326 
327 
328  $posY=$pdf->GetY();
329  $posY+=1;
330  $pdf->SetXY($this->marge_gauche, $posY);
331  $txt = $outputlangs->transnoentitiesnoconv("SEPAFrstOrRecur").' * : ';
332  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
333  $pdf->Rect(80, $posY, 5, 5);
334  $pdf->SetXY(80, $posY);
335  if ($object->frstrecur == 'RECUR') $pdf->MultiCell(5, 3, 'X', 0, 'L');
336  $pdf->SetXY(86, $posY);
337  $txt = $langs->transnoentitiesnoconv("ModeRECUR").' '.$langs->transnoentitiesnoconv("or");
338  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
339  $posY+=6;
340  $pdf->Rect(80, $posY, 5, 5);
341  $pdf->SetXY(80, $posY);
342  if ($object->frstrecur == 'FRST') $pdf->MultiCell(5, 3, 'X', 0, 'L');
343  $pdf->SetXY(86, $posY);
344  $txt = $langs->transnoentitiesnoconv("ModeFRST");
345  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
346  if (empty($object->frstrecur))
347  {
348  $posY+=6;
349  $pdf->SetXY(80, $posY);
350  $txt = '('.$langs->transnoentitiesnoconv("PleaseCheckOne").')';
351  $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
352  }
353 
354  $posY=$pdf->GetY();
355  $posY+=3;
356  $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
357  $posY+=3;
358 
359 
360  // Show square
361  if ($pagenb == 1)
362  {
363  $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
364  $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
365  }
366  else
367  {
368  $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
369  $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
370  }
371 
372  /*var_dump($tab_top);
373  var_dump($heightforinfotot);
374  var_dump($heightforfreetext);
375  var_dump($heightforfooter);
376  var_dump($bottomlasttab);*/
377 
378  // Affiche zone infos
379  $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
380 
381  /*
382  * Pied de page
383  */
384  $this->_pagefoot($pdf,$object,$outputlangs);
385  if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
386 
387  $pdf->Close();
388 
389  $pdf->Output($file,'F');
390 
391  // Add pdfgeneration hook
392  if (! is_object($hookmanager))
393  {
394  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
395  $hookmanager=new HookManager($this->db);
396  }
397  $hookmanager->initHooks(array('pdfgeneration'));
398  $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
399  global $action;
400  $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
401 
402  if (! empty($conf->global->MAIN_UMASK))
403  @chmod($file, octdec($conf->global->MAIN_UMASK));
404 
405  $this->result = array('fullpath'=>$file);
406 
407  return 1; // Pas d'erreur
408  }
409  else
410  {
411  $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
412  return 0;
413  }
414  }
415 
416  $this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
417  return 0;
418  }
419 
420 
433  function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
434  {
435  global $conf,$mysoc;
436 
437  $default_font_size = pdf_getPDFFontSize($outputlangs);
438  }
439 
440 
441  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
451  function _tableau_info(&$pdf, $object, $posy, $outputlangs)
452  {
453  // phpcs:enable
454  global $conf, $mysoc;
455 
456  $default_font_size = pdf_getPDFFontSize($outputlangs);
457 
458  $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?1:$conf->global->PDF_DIFFSIZE_TITLE);
459 
460  $posy+=$this->_signature_area($pdf, $object, $posy, $outputlangs);
461 
462  $pdf->SetXY($this->marge_gauche, $posy);
463  $pdf->SetFont('','', $default_font_size);
464  $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("PleaseReturnMandate", $mysoc->email).':', 0, 'L', 0);
465  $posy=$pdf->GetY()+2;
466 
467  $pdf->SetXY($this->marge_gauche, $posy);
468  $pdf->SetFont('','', $default_font_size - $diffsizetitle);
469  $pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0);
470  $pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress()), 0, 'L', 0);
471  $posy=$pdf->GetY()+2;
472 
473  return $posy;
474  }
475 
476 
477 
478  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
488  function _signature_area(&$pdf, $object, $posy, $outputlangs)
489  {
490  // phpcs:enable
491  $default_font_size = pdf_getPDFFontSize($outputlangs);
492  $tab_top = $posy + 4;
493  $tab_hl = 4;
494 
495  $posx = $this->marge_gauche;
496  $pdf->SetXY($posx, $tab_top + 0);
497 
498  $pdf->SetFont('','', $default_font_size - 2);
499 
500  $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("DateOfSignature"), 0, 'L', 0);
501  $pdf->MultiCell(100, 3, ' ');
502  $pdf->MultiCell(100, 3, '______________________', 0, 'L', 0);
503 
504  $posx = 120;
505  $largcol = ($this->page_largeur - $this->marge_droite - $posx);
506  $useborder=0;
507  $index = 0;
508  // Total HT
509  $pdf->SetFillColor(255,255,255);
510  $pdf->SetXY($posx, $tab_top + 0);
511  $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', 1);
512 
513  $pdf->SetXY($posx, $tab_top + $tab_hl);
514  $pdf->MultiCell($largcol, $tab_hl*3, '', 1, 'R');
515 
516  return ($tab_hl*7);
517  }
518 
519 
529  function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
530  {
531  global $langs,$conf,$mysoc;
532 
533  $default_font_size = pdf_getPDFFontSize($outputlangs);
534 
535  pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
536 
537  $pdf->SetTextColor(0,0,60);
538  $pdf->SetFont('','B', $default_font_size + 3);
539 
540  $posx=$this->page_largeur-$this->marge_droite-100;
541  $posy=$this->marge_haute;
542 
543  $pdf->SetXY($this->marge_gauche,$posy);
544 
545  // Logo
546  $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
547  if ($mysoc->logo)
548  {
549  if (is_readable($logo))
550  {
551  $height=pdf_getHeightForLogo($logo);
552  $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
553  }
554  else
555  {
556  $pdf->SetTextColor(200,0,0);
557  $pdf->SetFont('','B', $default_font_size - 2);
558  $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
559  $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
560  }
561  }
562  else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
563 
564  $pdf->SetFont('','B', $default_font_size + 3);
565  $pdf->SetXY($posx,$posy);
566  $pdf->SetTextColor(0,0,60);
567  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("SepaMandate"), '', 'R');
568  $pdf->SetFont('','', $default_font_size + 2);
569 
570  $posy+=6;
571  $pdf->SetXY($posx,$posy);
572  $pdf->SetTextColor(0,0,60);
573  $daterum = '__________________';
574  if (! empty($object->date_rum))
575  {
576  $daterum = dol_print_date($object->date_rum,'day',false,$outputlangs,true);
577  }
578  else $daterum = dol_print_date($object->datec,'day',false,$outputlangs,true); // For old record, the date_rum was not saved.
579  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . $daterum, '', 'R');
580  /*$posy+=6;
581  $pdf->SetXY($posx,$posy);
582  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
583  */
584 
585  $pdf->SetTextColor(0,0,60);
586 
587  // Add list of linked objects
588  /* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc....
589  $object->fetchObjectLinked();
590 
591  foreach($object->linkedObjects as $objecttype => $objects)
592  {
593  var_dump($objects);exit;
594  if ($objecttype == 'commande')
595  {
596  $outputlangs->load('orders');
597  $num=count($objects);
598  for ($i=0;$i<$num;$i++)
599  {
600  $posy+=4;
601  $pdf->SetXY($posx,$posy);
602  $pdf->SetFont('','', $default_font_size - 1);
603  $text=$objects[$i]->ref;
604  if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')';
605  $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
606  }
607  }
608  }
609  */
610  }
611 
621  function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
622  {
623  global $conf;
624  $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
625  return pdf_pagefoot($pdf,$outputlangs,'PAYMENTORDER_FREE_TEXT',null,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
626  }
627 }
Parent class for bank account models.
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition: pdf.lib.php:82
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition: pdf.lib.php:600
</td >< td class="liste_titre" align="right"></td ></tr >< tr class="liste_titre">< input type="checkbox" onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< tr class="oddeven">< td >< input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td >< td >< input type="checkbox" class="check" name="choose'.$i.'"></td >< td class="nowrap"></td >< td >< input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:573
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.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Fonction generant le projet sur le disque.
_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:224
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition: pdf.lib.php:201
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
Class to manage hooks.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
type
Definition: viewcat.php:284
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:872
$version
Dolibarr version of the loaded document string.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition: pdf.lib.php:245
Classe permettant de generer les projets au modele SEPAMandate.
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_mkdir($dir, $dataroot='', $newmask=null)
Creation of a directory (this can create recursive subdir)
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...
_signature_area(&$pdf, $object, $posy, $outputlangs)
Show area for the customer to sign.
__construct($db)
Constructor.