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