dolibarr 20.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 * Copyright (C) 2020 Josep LluĂ­s Amador <joseplluis@lliuretic.cat>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
27require_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php';
28require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32
33
39{
44 public $version = 'dolibarr';
45
49 public $heightforinfotot;
50
54 public $heightforfreetext;
55
59 public $heightforfooter;
60
64 public $xPosSignArea;
70 public function __construct($db)
71 {
72 global $conf, $langs, $mysoc;
73
74 // Translations
75 $langs->loadLangs(array("main", "bank", "withdrawals", "companies"));
76
77 $this->db = $db;
78 $this->name = "sepamandate";
79 $this->description = $langs->transnoentitiesnoconv("DocumentModelSepaMandate");
80
81 // Page size for A4 format
82 $this->type = 'pdf';
83 $formatarray = pdf_getFormat();
84 $this->page_largeur = $formatarray['width'];
85 $this->page_hauteur = $formatarray['height'];
86 $this->format = array($this->page_largeur, $this->page_hauteur);
87 $this->marge_gauche = getDolGlobalInt('MAIN_PDF_MARGIN_LEFT', 10);
88 $this->marge_droite = getDolGlobalInt('MAIN_PDF_MARGIN_RIGHT', 10);
89 $this->marge_haute = getDolGlobalInt('MAIN_PDF_MARGIN_TOP', 10);
90 $this->marge_basse = getDolGlobalInt('MAIN_PDF_MARGIN_BOTTOM', 10);
91
92 $this->option_logo = 1; // Display logo FAC_PDF_LOGO
93 $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
94
95 // Retrieves transmitter
96 $this->emetteur = $mysoc;
97 if (!$this->emetteur->country_code) {
98 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
99 }
100
101 // Define column position
102 $this->posxref = $this->marge_gauche;
103
104 $this->update_main_doc_field = 1;
105
106 $this->heightforinfotot = 50;
107
108 $this->xPosSignArea = 120;
109
110 $this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') > 0 ? getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT') : 5);
111
112 $this->heightforfooter = $this->marge_basse + 8;
113 }
114
115 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
128 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
129 {
130 // phpcs:enable
131 global $conf, $hookmanager, $langs, $user, $mysoc;
132
133 if (!$object instanceof CompanyBankAccount) {
134 dol_syslog(get_class($this)."::write_file object is of type ".get_class($object)." which is not expected", LOG_ERR);
135 return -1;
136 }
137
138 if (!is_object($outputlangs)) {
139 $outputlangs = $langs;
140 }
141 // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
142 if (getDolGlobalString('MAIN_USE_FPDF')) {
143 $outputlangs->charset_output = 'ISO-8859-1';
144 }
145
146 // Load translation files required by the page
147 $outputlangs->loadLangs(array("main", "dict", "withdrawals", "companies", "projects", "bills"));
148
149 if (!empty($conf->bank->dir_output)) {
150 //$nblines = count($object->lines); // This is set later with array of tasks
151
152 // Definition of $dir and $file
153 if ($object->specimen) {
154 if (!empty($moreparams['force_dir_output'])) {
155 $dir = $moreparams['force_dir_output'];
156 } else {
157 $dir = $conf->bank->dir_output;
158 }
159 $file = $dir."/SPECIMEN.pdf";
160 } else {
161 $objectref = dol_sanitizeFileName($object->ref);
162 if (!empty($moreparams['force_dir_output'])) {
163 $dir = $moreparams['force_dir_output'];
164 } else {
165 $dir = $conf->bank->dir_output."/".$objectref;
166 }
167 $file = $dir."/".$langs->transnoentitiesnoconv("SepaMandateShort").' '.$objectref."-".dol_sanitizeFileName($object->rum).".pdf";
168 }
169
170 if (!file_exists($dir)) {
171 if (dol_mkdir($dir) < 0) {
172 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
173 return 0;
174 }
175 }
176
177 if (file_exists($dir)) {
178 // Add pdfgeneration hook
179 if (!is_object($hookmanager)) {
180 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
181 $hookmanager = new HookManager($this->db);
182 }
183 $hookmanager->initHooks(array('pdfgeneration'));
184 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
185 global $action;
186 $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
187
188 $pdf = pdf_getInstance($this->format);
189 $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
190
191 if (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) {
192 $this->heightforfooter += 6;
193 }
194 $pdf->SetAutoPageBreak(1, 0);
195
196 if (class_exists('TCPDF')) {
197 $pdf->setPrintHeader(false);
198 $pdf->setPrintFooter(false);
199 }
200 $pdf->SetFont(pdf_getPDFFont($outputlangs));
201
202 $pdf->Open();
203 $pagenb = 0;
204 $pdf->SetDrawColor(128, 128, 128);
205
206 $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
207 $pdf->SetSubject($outputlangs->transnoentities("SepaMandate"));
208 $pdf->SetCreator("Dolibarr ".DOL_VERSION);
209 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
210 $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SepaMandate"));
211 if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
212 $pdf->SetCompression(false);
213 }
214
215 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
216 $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
217
218 // New page
219 $pdf->AddPage();
220 $pagenb++;
221 $this->_pagehead($pdf, $object, 1, $outputlangs);
222 $pdf->SetFont('', '', $default_font_size - 1);
223 $pdf->MultiCell(0, 3, ''); // Set interline to 3
224 $pdf->SetTextColor(0, 0, 0);
225
226 $tab_top = 50;
227 $tab_top_newpage = 40;
228
229 $tab_height = $this->page_hauteur - $tab_top - $this->heightforfooter - $this->heightforfreetext ;
230
231 // Show notes
232 if (!empty($object->note_public)) {
233 $pdf->SetFont('', '', $default_font_size - 1);
234 $pdf->writeHTMLCell(190, 3, $this->posxref, $tab_top - 2, dol_htmlentitiesbr($object->note_public), 0, 1);
235 $nexY = $pdf->GetY();
236 $height_note = $nexY - ($tab_top - 2);
237
238 // Rect takes a length in 3rd parameter
239 $pdf->SetDrawColor(192, 192, 192);
240 $pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
241
242 $tab_height = $tab_height - $height_note;
243 $tab_top = $nexY + 6;
244 } else {
245 $height_note = 0;
246 }
247
248 $iniY = $tab_top + 7;
249 $curY = $tab_top + 7;
250 $nexY = $tab_top + 7;
251
252 $posY = $curY;
253
254 $pdf->SetFont('', '', $default_font_size - 1);
255
256 $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
257 $posY += 2;
258
259 $pdf->SetXY($this->marge_gauche, $posY);
260 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").') : '.$object->rum, 0, 'L');
261
262 $posY = $pdf->GetY();
263 $posY += 2;
264 $pdf->SetXY($this->marge_gauche, $posY);
265
266 $ics = '';
267 $idbankfordirectdebit = getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT');
268 if ($idbankfordirectdebit > 0) {
269 $tmpbankfordirectdebit = new Account($this->db);
270 $tmpbankfordirectdebit->fetch($idbankfordirectdebit);
271 $ics = $tmpbankfordirectdebit->ics; // ICS for direct debit
272 }
273 if (empty($ics) && getDolGlobalString('PRELEVEMENT_ICS')) {
274 $ics = getDolGlobalString('PRELEVEMENT_ICS');
275 }
276 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").') : '.$ics, 0, 'L');
277
278 $posY = $pdf->GetY();
279 $posY += 1;
280 $pdf->SetXY($this->marge_gauche, $posY);
281 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorName").' : '.$mysoc->name, 0, 'L');
282
283 $posY = $pdf->GetY();
284 $posY += 1;
285 $pdf->SetXY($this->marge_gauche, $posY);
286 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
287 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(1), 0, 'L');
288
289 $posY = $pdf->GetY();
290 $posY += 3;
291
292 $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
293
294 $pdf->SetFont('', '', $default_font_size - 1);
295
296 $posY += 8;
297 $pdf->SetXY($this->marge_gauche, $posY);
298 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 8, $outputlangs->transnoentitiesnoconv("SEPALegalText", $mysoc->name, $mysoc->name), 0, 'L');
299
300 // Your data form
301 $posY = $pdf->GetY();
302 $posY += 8;
303 $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
304 $posY += 2;
305
306 $pdf->SetFont('', '', $default_font_size - 2);
307
308 $pdf->SetXY($this->marge_gauche, $posY);
309 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFillForm"), 0, 'C');
310
311 $thirdparty = new Societe($this->db);
312 if ($object->socid > 0) {
313 $thirdparty->fetch($object->socid);
314 }
315
316 $sepaname = '______________________________________________';
317 if ($thirdparty->id > 0) {
318 $sepaname = $thirdparty->name.($object->owner_name ? ' ('.$object->owner_name.')' : '');
319 }
320 $posY = $pdf->GetY();
321 $posY += 3;
322 $pdf->SetXY($this->marge_gauche, $posY);
323 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourName").' * : ', 0, 'L');
324 $pdf->SetXY(80, $posY);
325 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepaname, 0, 'L');
326
327 $sepavatid = '__________________________________________________';
328 if (!empty($thirdparty->idprof1)) {
329 $sepavatid = $thirdparty->idprof1;
330 }
331 $posY = $pdf->GetY();
332 $posY += 1;
333 $pdf->SetXY($this->marge_gauche, $posY);
334 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv('ProfId1'.$thirdparty->country_code).' * : ', 0, 'L');
335 $pdf->SetXY(80, $posY);
336 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $sepavatid, 0, 'L');
337
338 $address = '__________________________________________________';
339 if (!empty($object->owner_address)) {
340 $address = $object->owner_address;
341 } elseif ($thirdparty->id > 0) {
342 $tmpaddresswithoutcountry = $thirdparty->getFullAddress(); // we test on address without country
343 if ($tmpaddresswithoutcountry) {
344 $address = $thirdparty->getFullAddress(1); // full address
345 }
346 }
347 $posY = $pdf->GetY();
348 $posY += 1;
349 $pdf->SetXY($this->marge_gauche, $posY);
350 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
351 $pdf->SetXY(80, $posY);
352 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
353 if (preg_match('/_____/', $address)) { // Second line ____ for address
354 $posY += 5;
355 $pdf->SetXY(80, $posY);
356 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $address, 0, 'L');
357 }
358
359 $ban = '__________________________________________________';
360 if (!empty($object->iban)) {
361 $ban = $object->iban;
362 }
363 $posY = $pdf->GetY();
364 $posY += 1;
365 $pdf->SetXY($this->marge_gauche, $posY);
366 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBAN").' * : ', 0, 'L');
367 $pdf->SetXY(80, $posY);
368 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $ban, 0, 'L');
369
370 $bic = '__________________________________________________';
371 if (!empty($object->bic)) {
372 $bic = $object->bic;
373 }
374 $posY = $pdf->GetY();
375 $posY += 1;
376 $pdf->SetXY($this->marge_gauche, $posY);
377 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("SEPAFormYourBIC").' * : ', 0, 'L');
378 $pdf->SetXY(80, $posY);
379 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $bic, 0, 'L');
380
381
382 $posY = $pdf->GetY();
383 $posY += 1;
384 $pdf->SetXY($this->marge_gauche, $posY);
385 $txt = $outputlangs->transnoentitiesnoconv("SEPAFrstOrRecur").' * : ';
386 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
387 $pdf->Rect(80, $posY, 5, 5);
388 $pdf->SetXY(80, $posY);
389 if ($object->frstrecur == 'RCUR') {
390 $pdf->MultiCell(5, 3, 'X', 0, 'L');
391 }
392 $pdf->SetXY(86, $posY);
393 $txt = $langs->transnoentitiesnoconv("ModeRECUR").' '.$langs->transnoentitiesnoconv("or");
394 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
395 $posY += 6;
396 $pdf->Rect(80, $posY, 5, 5);
397 $pdf->SetXY(80, $posY);
398 if ($object->frstrecur == 'FRST') {
399 $pdf->MultiCell(5, 3, 'X', 0, 'L');
400 }
401 $pdf->SetXY(86, $posY);
402 $txt = $langs->transnoentitiesnoconv("ModeFRST");
403 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
404 if (empty($object->frstrecur)) {
405 $posY += 6;
406 $pdf->SetXY(80, $posY);
407 $txt = '('.$langs->transnoentitiesnoconv("PleaseCheckOne").')';
408 $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $txt, 0, 'L');
409 }
410
411 $posY = $pdf->GetY();
412 $posY += 3;
413 $pdf->line($this->marge_gauche, $posY, $this->page_largeur - $this->marge_droite, $posY);
414 $posY += 3;
415
416
417 // Show square
418 if ($pagenb == 1) {
419 $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 0, 0);
420 $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
421 } else {
422 $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 1, 0);
423 $bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
424 }
425
426 //var_dump($tab_top);
427 //var_dump($this->heightforinfotot );
428 //var_dump($this->heightforfreetext );
429 //var_dump($this->heightforfooter );
430 //var_dump($bottomlasttab);
431
432 // Affiche zone infos
433 $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
434
435 /*
436 * Footer of the page
437 */
438 $this->_pagefoot($pdf, $object, $outputlangs);
439 if (method_exists($pdf, 'AliasNbPages')) {
440 $pdf->AliasNbPages();
441 }
442
443 $pdf->Close();
444
445 $pdf->Output($file, 'F');
446
447 // Add pdfgeneration hook
448 if (!is_object($hookmanager)) {
449 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
450 $hookmanager = new HookManager($this->db);
451 }
452 $hookmanager->initHooks(array('pdfgeneration'));
453 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
454 global $action;
455 $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
456 if ($reshook < 0) {
457 $this->error = $hookmanager->error;
458 $this->errors = $hookmanager->errors;
459 }
460
461 dolChmod($file);
462
463 $this->result = array('fullpath' => $file);
464
465 return 1; // No error
466 } else {
467 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
468 return 0;
469 }
470 }
471
472 $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR");
473 return 0;
474 }
475
476
477 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
490 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
491 {
492 // phpcs:enable
493 global $conf, $mysoc;
494
495 $default_font_size = pdf_getPDFFontSize($outputlangs);
496 }
497
498
499 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
500 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
510 protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
511 {
512 // phpcs:enable
513 global $conf, $mysoc;
514
515 $default_font_size = pdf_getPDFFontSize($outputlangs);
516
517 $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 1 : $conf->global->PDF_DIFFSIZE_TITLE);
518
519 $posy += $this->_signature_area($pdf, $object, $posy, $outputlangs);
520
521 $pdf->SetXY($this->marge_gauche, $posy);
522 $pdf->SetFont('', '', $default_font_size);
523 $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("PleaseReturnMandate", $mysoc->email).':', 0, 'L', 0);
524 $posy = $pdf->GetY() + 2;
525
526 $pdf->SetXY($this->marge_gauche, $posy);
527 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
528 $pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0);
529 $pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress(1)), 0, 'L', 0);
530 $posy = $pdf->GetY() + 2;
531
532 return $posy;
533 }
534
535
536 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
537 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
547 protected function _signature_area(&$pdf, $object, $posy, $outputlangs)
548 {
549 // phpcs:enable
550 $default_font_size = pdf_getPDFFontSize($outputlangs);
551 $tab_top = $posy + 4;
552 $tab_hl = 4;
553
554 $posx = $this->marge_gauche;
555 $pdf->SetXY($posx, $tab_top);
556
557 $pdf->SetFont('', '', $default_font_size - 2);
558
559 $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("DateSigning"), 0, 'L', 0);
560 $pdf->MultiCell(100, 3, ' ');
561 $pdf->MultiCell(100, 3, '______________________', 0, 'L', 0);
562
563 $posx = $this->xPosSignArea;
564 $largcol = ($this->page_largeur - $this->marge_droite - $posx);
565
566 // Total HT
567 $pdf->SetFillColor(255, 255, 255);
568 $pdf->SetXY($posx, $tab_top);
569 $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', 1);
570
571 $pdf->SetXY($posx, $tab_top + $tab_hl);
572 $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R');
573
574 return ($tab_hl * 7);
575 }
576
577
578 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
588 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
589 {
590 // phpcs:enable
591 global $langs, $conf, $mysoc;
592
593 $default_font_size = pdf_getPDFFontSize($outputlangs);
594
595 pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
596
597 $pdf->SetTextColor(0, 0, 60);
598 $pdf->SetFont('', 'B', $default_font_size + 3);
599
600 $posx = $this->page_largeur - $this->marge_droite - 100;
601 $posy = $this->marge_haute;
602
603 $pdf->SetXY($this->marge_gauche, $posy);
604
605 // Logo
606 $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
607 if ($mysoc->logo) {
608 if (is_readable($logo)) {
609 $height = pdf_getHeightForLogo($logo);
610 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
611 } else {
612 $pdf->SetTextColor(200, 0, 0);
613 $pdf->SetFont('', 'B', $default_font_size - 2);
614 $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
615 $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
616 }
617 } else {
618 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
619 }
620
621 $pdf->SetFont('', 'B', $default_font_size + 3);
622 $pdf->SetXY($posx, $posy);
623 $pdf->SetTextColor(0, 0, 60);
624 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("SepaMandate"), '', 'R');
625 $pdf->SetFont('', '', $default_font_size + 2);
626
627 $posy += 6;
628 $pdf->SetXY($posx, $posy);
629 $pdf->SetTextColor(0, 0, 60);
630 $daterum = '__________________';
631 if (!empty($object->date_rum)) {
632 $daterum = dol_print_date($object->date_rum, 'day', false, $outputlangs, true);
633 } else {
634 $daterum = dol_print_date($object->datec, 'day', false, $outputlangs, true); // For old record, the date_rum was not saved.
635 }
636 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".$daterum, '', 'R');
637 /*$posy+=6;
638 $pdf->SetXY($posx,$posy);
639 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
640 */
641
642 $pdf->SetTextColor(0, 0, 60);
643
644 // Add list of linked objects
645 /* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc....
646 $object->fetchObjectLinked();
647
648 foreach($object->linkedObjects as $objecttype => $objects)
649 {
650 var_dump($objects);exit;
651 if ($objecttype == 'commande')
652 {
653 $outputlangs->load('orders');
654 $num=count($objects);
655 for ($i=0;$i<$num;$i++)
656 {
657 $posy+=4;
658 $pdf->SetXY($posx,$posy);
659 $pdf->SetFont('','', $default_font_size - 1);
660 $text=$objects[$i]->ref;
661 if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')';
662 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
663 }
664 }
665 }
666 */
667
668 return 0;
669 }
670
671 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
681 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
682 {
683 // phpcs:enable
684 $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
685 return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
686 }
687}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Class to manage bank accounts.
Class to manage bank accounts description of third parties.
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.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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:290
pdf_getFormat(Translate $outputlangs=null, $mode='setup')
Return array with format properties of default PDF format.
Definition pdf.lib.php:86
pdf_getHeightForLogo($logo, $url=false)
Return height to use for Logo onto PDF.
Definition pdf.lib.php:315
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:1020
pdf_pagehead(&$pdf, $outputlangs, $page_height)
Show header of page for PDF generation.
Definition pdf.lib.php:733
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition pdf.lib.php:267
pdf_getInstance($format='', $metric='mm', $pagetype='P')
Return a PDF instance object.
Definition pdf.lib.php:128
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:139
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:142