dolibarr 18.0.6
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
26require_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
27require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
30require_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 = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
74 $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
75 $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
76 $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
77
78 $this->option_logo = 1; // Display logo FAC_PDF_LOGO
79 $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
80
81 // Retrieves transmitter
82 $this->emetteur = $mysoc;
83 if (!$this->emetteur->country_code) {
84 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
85 }
86
87 // Define column position
88 $this->posxref = $this->marge_gauche;
89 }
90
91
92 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
105 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
106 {
107 // phpcs:enable
108 global $conf, $hookmanager, $langs, $user, $mysoc;
109
110 if (!is_object($outputlangs)) {
111 $outputlangs = $langs;
112 }
113 // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
114 if (!empty($conf->global->MAIN_USE_FPDF)) {
115 $outputlangs->charset_output = 'ISO-8859-1';
116 }
117
118 // Load translation files required by the page
119 $outputlangs->loadLangs(array("main", "dict", "withdrawals", "companies", "projects", "bills"));
120
121 if (!empty($conf->bank->dir_output)) {
122 //$nblines = count($object->lines); // This is set later with array of tasks
123
124 // Definition of $dir and $file
125 if ($object->specimen) {
126 if (!empty($moreparams['force_dir_output'])) {
127 $dir = $moreparams['force_dir_output'];
128 } else {
129 $dir = $conf->bank->dir_output;
130 }
131 $file = $dir."/SPECIMEN.pdf";
132 } else {
133 $objectref = dol_sanitizeFileName($object->ref);
134 if (!empty($moreparams['force_dir_output'])) {
135 $dir = $moreparams['force_dir_output'];
136 } else {
137 $dir = $conf->bank->dir_output."/".$objectref;
138 }
139 $file = $dir."/".$langs->transnoentitiesnoconv("SepaMandateShort").' '.$objectref."-".dol_sanitizeFileName($object->rum).".pdf";
140 }
141
142 if (!file_exists($dir)) {
143 if (dol_mkdir($dir) < 0) {
144 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
145 return 0;
146 }
147 }
148
149 if (file_exists($dir)) {
150 // Add pdfgeneration hook
151 if (!is_object($hookmanager)) {
152 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
153 $hookmanager = new HookManager($this->db);
154 }
155 $hookmanager->initHooks(array('pdfgeneration'));
156 $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
157 global $action;
158 $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
159
160 $pdf = pdf_getInstance($this->format);
161 $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
162 $heightforinfotot = 50; // Height reserved to output the info and total part
163 $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
164 $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
165 if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
166 $heightforfooter += 6;
167 }
168 $pdf->SetAutoPageBreak(1, 0);
169
170 if (class_exists('TCPDF')) {
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 (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
186 $pdf->SetCompression(false);
187 }
188
189 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
190
191 // New page
192 $pdf->AddPage();
193 $pagenb++;
194 $this->_pagehead($pdf, $object, 1, $outputlangs);
195 $pdf->SetFont('', '', $default_font_size - 1);
196 $pdf->MultiCell(0, 3, ''); // Set interline to 3
197 $pdf->SetTextColor(0, 0, 0);
198
199 $tab_top = 50;
200 $tab_top_newpage = 40;
201
202 $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext;
203
204 // Show notes
205 if (!empty($object->note_public)) {
206 $pdf->SetFont('', '', $default_font_size - 1);
207 $pdf->writeHTMLCell(190, 3, $this->posxref, $tab_top - 2, dol_htmlentitiesbr($object->note_public), 0, 1);
208 $nexY = $pdf->GetY();
209 $height_note = $nexY - ($tab_top - 2);
210
211 // Rect takes a length in 3rd parameter
212 $pdf->SetDrawColor(192, 192, 192);
213 $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
214
215 $tab_height = $tab_height - $height_note;
216 $tab_top = $nexY + 6;
217 } else {
218 $height_note = 0;
219 }
220
221 $iniY = $tab_top + 7;
222 $curY = $tab_top + 7;
223 $nexY = $tab_top + 7;
224
225 $posY = $curY;
226
227 $pdf->SetFont('', '', $default_font_size);
228
229 $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
230 $posY += 2;
231
232 $pdf->SetXY($this->marge_gauche, $posY);
233 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").') : '.$object->rum, 0, 'L');
234
235 $posY = $pdf->GetY();
236 $posY += 2;
237 $pdf->SetXY($this->marge_gauche, $posY);
238
239 $ics = '';
240 $idbankfordirectdebit = getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT');
241 if ($idbankfordirectdebit > 0) {
242 $tmpbankfordirectdebit = new Account($this->db);
243 $tmpbankfordirectdebit->fetch($idbankfordirectdebit);
244 $ics = $tmpbankfordirectdebit->ics; // ICS for direct debit
245 }
246 if (empty($ics) && !empty($conf->global->PRELEVEMENT_ICS)) {
247 $ics = $conf->global->PRELEVEMENT_ICS;
248 }
249 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").') : '.$ics, 0, 'L');
250
251 $posY = $pdf->GetY();
252 $posY += 1;
253 $pdf->SetXY($this->marge_gauche, $posY);
254 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorName").' : '.$mysoc->name, 0, 'L');
255
256 $posY = $pdf->GetY();
257 $posY += 1;
258 $pdf->SetXY($this->marge_gauche, $posY);
259 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
260 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(1), 0, 'L');
261
262 $posY = $pdf->GetY();
263 $posY += 3;
264
265 $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
266
267 $pdf->SetFont('', '', $default_font_size - 1);
268
269 $posY += 8;
270 $pdf->SetXY($this->marge_gauche, $posY);
271 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 8, $outputlangs->transnoentitiesnoconv("SEPALegalText", $mysoc->name, $mysoc->name), 0, 'L');
272
273 // Your data form
274 $posY = $pdf->GetY();
275 $posY += 8;
276 $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
277 $posY += 2;
278
279 $pdf->SetFont('', '', $default_font_size);
280
281 $pdf->SetXY($this->marge_gauche, $posY);
282 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFillForm"), 0, 'C');
283
284 $thirdparty = new Societe($this->db);
285 if ($object->socid > 0) {
286 $thirdparty->fetch($object->socid);
287 }
288
289 $sepaname = '______________________________________________';
290 if ($thirdparty->id > 0) {
291 $sepaname = $thirdparty->name.($object->proprio ? ' ('.$object->proprio.')' : '');
292 }
293 $posY = $pdf->GetY();
294 $posY += 3;
295 $pdf->SetXY($this->marge_gauche, $posY);
296 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourName").' * : ', 0, 'L');
297 $pdf->SetXY(80, $posY);
298 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepaname, 0, 'L');
299
300 $sepavatid = '__________________________________________________';
301 if (!empty($thirdparty->idprof1)) {
302 $sepavatid = $thirdparty->idprof1;
303 }
304 $posY = $pdf->GetY();
305 $posY += 1;
306 $pdf->SetXY($this->marge_gauche, $posY);
307 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv('ProfId1'.$thirdparty->country_code).' * : ', 0, 'L');
308 $pdf->SetXY(80, $posY);
309 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepavatid, 0, 'L');
310
311 $address = '______________________________________________';
312 if ($thirdparty->id > 0) {
313 $tmpaddresswithoutcountry = $thirdparty->getFullAddress(); // we test on address without country
314 if ($tmpaddresswithoutcountry) {
315 $address = $thirdparty->getFullAddress(1); // full address
316 }
317 }
318 $posY = $pdf->GetY();
319 $posY += 1;
320 $pdf->SetXY($this->marge_gauche, $posY);
321 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
322 $pdf->SetXY(80, $posY);
323 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
324 if (preg_match('/_____/', $address)) {
325 $posY += 6;
326 $pdf->SetXY(80, $posY);
327 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
328 }
329
330 $ban = '__________________________________________________';
331 if (!empty($object->iban)) {
332 $ban = $object->iban;
333 }
334 $posY = $pdf->GetY();
335 $posY += 1;
336 $pdf->SetXY($this->marge_gauche, $posY);
337 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBAN").' * : ', 0, 'L');
338 $pdf->SetXY(80, $posY);
339 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $ban, 0, 'L');
340
341 $bic = '__________________________________________________';
342 if (!empty($object->bic)) {
343 $bic = $object->bic;
344 }
345 $posY = $pdf->GetY();
346 $posY += 1;
347 $pdf->SetXY($this->marge_gauche, $posY);
348 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBIC").' * : ', 0, 'L');
349 $pdf->SetXY(80, $posY);
350 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $bic, 0, 'L');
351
352
353 $posY = $pdf->GetY();
354 $posY += 1;
355 $pdf->SetXY($this->marge_gauche, $posY);
356 $txt = $outputlangs->transnoentitiesnoconv("SEPAFrstOrRecur").' * : ';
357 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
358 $pdf->Rect(80, $posY, 5, 5);
359 $pdf->SetXY(80, $posY);
360 if ($object->frstrecur == 'RECUR') {
361 $pdf->MultiCell(5, 3, 'X', 0, 'L');
362 }
363 $pdf->SetXY(86, $posY);
364 $txt = $langs->transnoentitiesnoconv("ModeRECUR").' '.$langs->transnoentitiesnoconv("or");
365 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
366 $posY += 6;
367 $pdf->Rect(80, $posY, 5, 5);
368 $pdf->SetXY(80, $posY);
369 if ($object->frstrecur == 'FRST') {
370 $pdf->MultiCell(5, 3, 'X', 0, 'L');
371 }
372 $pdf->SetXY(86, $posY);
373 $txt = $langs->transnoentitiesnoconv("ModeFRST");
374 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
375 if (empty($object->frstrecur)) {
376 $posY += 6;
377 $pdf->SetXY(80, $posY);
378 $txt = '('.$langs->transnoentitiesnoconv("PleaseCheckOne").')';
379 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
380 }
381
382 $posY = $pdf->GetY();
383 $posY += 3;
384 $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
385 $posY += 3;
386
387
388 // Show square
389 if ($pagenb == 1) {
390 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
391 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
392 } else {
393 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
394 $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
395 }
396
397 //var_dump($tab_top);
398 //var_dump($heightforinfotot);
399 //var_dump($heightforfreetext);
400 //var_dump($heightforfooter);
401 //var_dump($bottomlasttab);
402
403 // Affiche zone infos
404 $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
405
406 /*
407 * Footer of the page
408 */
409 $this->_pagefoot($pdf, $object, $outputlangs);
410 if (method_exists($pdf, 'AliasNbPages')) {
411 $pdf->AliasNbPages();
412 }
413
414 $pdf->Close();
415
416 $pdf->Output($file, 'F');
417
418 // Add pdfgeneration hook
419 if (!is_object($hookmanager)) {
420 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
421 $hookmanager = new HookManager($this->db);
422 }
423 $hookmanager->initHooks(array('pdfgeneration'));
424 $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
425 global $action;
426 $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
427 if ($reshook < 0) {
428 $this->error = $hookmanager->error;
429 $this->errors = $hookmanager->errors;
430 }
431
432 dolChmod($file);
433
434 $this->result = array('fullpath'=>$file);
435
436 return 1; // No error
437 } else {
438 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
439 return 0;
440 }
441 }
442
443 $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR");
444 return 0;
445 }
446
447
448 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
461 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
462 {
463 // phpcs:enable
464 global $conf, $mysoc;
465
466 $default_font_size = pdf_getPDFFontSize($outputlangs);
467 }
468
469
470 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
471 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
481 protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
482 {
483 // phpcs:enable
484 global $conf, $mysoc;
485
486 $default_font_size = pdf_getPDFFontSize($outputlangs);
487
488 $diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 1 : $conf->global->PDF_DIFFSIZE_TITLE);
489
490 $posy += $this->_signature_area($pdf, $object, $posy, $outputlangs);
491
492 $pdf->SetXY($this->marge_gauche, $posy);
493 $pdf->SetFont('', '', $default_font_size);
494 $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("PleaseReturnMandate", $mysoc->email).':', 0, 'L', 0);
495 $posy = $pdf->GetY() + 2;
496
497 $pdf->SetXY($this->marge_gauche, $posy);
498 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
499 $pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0);
500 $pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress(1)), 0, 'L', 0);
501 $posy = $pdf->GetY() + 2;
502
503 return $posy;
504 }
505
506
507 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
508 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
518 protected function _signature_area(&$pdf, $object, $posy, $outputlangs)
519 {
520 // phpcs:enable
521 $default_font_size = pdf_getPDFFontSize($outputlangs);
522 $tab_top = $posy + 4;
523 $tab_hl = 4;
524
525 $posx = $this->marge_gauche;
526 $pdf->SetXY($posx, $tab_top);
527
528 $pdf->SetFont('', '', $default_font_size - 2);
529
530 $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("DateOfSignature"), 0, 'L', 0);
531 $pdf->MultiCell(100, 3, ' ');
532 $pdf->MultiCell(100, 3, '______________________', 0, 'L', 0);
533
534 $posx = 120;
535 $largcol = ($this->page_largeur - $this->marge_droite - $posx);
536 $useborder = 0;
537 $index = 0;
538 // Total HT
539 $pdf->SetFillColor(255, 255, 255);
540 $pdf->SetXY($posx, $tab_top);
541 $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', 1);
542
543 $pdf->SetXY($posx, $tab_top + $tab_hl);
544 $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R');
545
546 return ($tab_hl * 7);
547 }
548
549
550 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
560 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
561 {
562 // phpcs:enable
563 global $langs, $conf, $mysoc;
564
565 $default_font_size = pdf_getPDFFontSize($outputlangs);
566
567 pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
568
569 $pdf->SetTextColor(0, 0, 60);
570 $pdf->SetFont('', 'B', $default_font_size + 3);
571
572 $posx = $this->page_largeur - $this->marge_droite - 100;
573 $posy = $this->marge_haute;
574
575 $pdf->SetXY($this->marge_gauche, $posy);
576
577 // Logo
578 $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
579 if ($mysoc->logo) {
580 if (is_readable($logo)) {
581 $height = pdf_getHeightForLogo($logo);
582 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
583 } else {
584 $pdf->SetTextColor(200, 0, 0);
585 $pdf->SetFont('', 'B', $default_font_size - 2);
586 $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
587 $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
588 }
589 } else {
590 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
591 }
592
593 $pdf->SetFont('', 'B', $default_font_size + 3);
594 $pdf->SetXY($posx, $posy);
595 $pdf->SetTextColor(0, 0, 60);
596 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("SepaMandate"), '', 'R');
597 $pdf->SetFont('', '', $default_font_size + 2);
598
599 $posy += 6;
600 $pdf->SetXY($posx, $posy);
601 $pdf->SetTextColor(0, 0, 60);
602 $daterum = '__________________';
603 if (!empty($object->date_rum)) {
604 $daterum = dol_print_date($object->date_rum, 'day', false, $outputlangs, true);
605 } else {
606 $daterum = dol_print_date($object->datec, 'day', false, $outputlangs, true); // For old record, the date_rum was not saved.
607 }
608 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".$daterum, '', 'R');
609 /*$posy+=6;
610 $pdf->SetXY($posx,$posy);
611 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
612 */
613
614 $pdf->SetTextColor(0, 0, 60);
615
616 // Add list of linked objects
617 /* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc....
618 $object->fetchObjectLinked();
619
620 foreach($object->linkedObjects as $objecttype => $objects)
621 {
622 var_dump($objects);exit;
623 if ($objecttype == 'commande')
624 {
625 $outputlangs->load('orders');
626 $num=count($objects);
627 for ($i=0;$i<$num;$i++)
628 {
629 $posy+=4;
630 $pdf->SetXY($posx,$posy);
631 $pdf->SetFont('','', $default_font_size - 1);
632 $text=$objects[$i]->ref;
633 if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')';
634 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
635 }
636 }
637 }
638 */
639 }
640
641 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
651 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
652 {
653 // phpcs:enable
654 $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
655 return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
656 }
657}
Class to manage bank accounts.
Class to manage hooks.
Parent class for bank account models.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to generate SEPA mandate.
_tableau_info(&$pdf, $object, $posy, $outputlangs)
Show miscellaneous information (payment mode, payment term, ...)
__construct($db)
Constructor.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
Function to create pdf of company bank account sepa mandate.
_tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
Show table for lines.
_pagehead(&$pdf, $object, $showaddress, $outputlangs)
Show top header of page.
_signature_area(&$pdf, $object, $posy, $outputlangs)
Show area for the customer to sign.
_pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
Show footer of page.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
pdf_getPDFFontSize($outputlangs)
Return font size to use for PDF generation.
Definition pdf.lib.php:289
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition pdf.lib.php:85
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition pdf.lib.php:314
pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails=0, $hidefreetext=0, $page_largeur=0, $watermark='')
Show footer of page for PDF generation.
Definition pdf.lib.php:1010
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition pdf.lib.php:726
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition pdf.lib.php:266
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition pdf.lib.php:127
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:120
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:123