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