dolibarr 24.0.0-beta
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 *
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 $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(true, 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->getAnonymisableFullName($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((string) $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 (!is_null($thirdparty->idprof1) && !empty($thirdparty->idprof1)) {
335 $sepavatid = (string) $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 $this->warnings = $hookmanager->warnings;
463 if ($reshook < 0) {
464 $this->error = $hookmanager->error;
465 $this->errors = $hookmanager->errors;
466 dolChmod($file);
467 return -1;
468 }
469
470 dolChmod($file);
471
472 $this->result = array('fullpath' => $file);
473
474 return 1; // No error
475 } else {
476 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
477 return 0;
478 }
479 }
480
481 $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR");
482 return 0;
483 }
484
485
486 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
499 protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
500 {
501 // phpcs:enable
502 global $conf, $mysoc;
503
504 $default_font_size = pdf_getPDFFontSize($outputlangs);
505 }
506
507
508 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
509 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
519 protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
520 {
521 // phpcs:enable
522 global $conf, $mysoc;
523
524 $default_font_size = pdf_getPDFFontSize($outputlangs);
525
526 $diffsizetitle = (!getDolGlobalString('PDF_DIFFSIZE_TITLE') ? 1 : $conf->global->PDF_DIFFSIZE_TITLE);
527
528 $posy += $this->_signature_area($pdf, $object, $posy, $outputlangs);
529
530 $pdf->SetXY($this->marge_gauche, $posy);
531 $pdf->SetFont('', '', $default_font_size);
532 $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("PleaseReturnMandate", (string) $mysoc->email).':', 0, 'L', false);
533 $posy = $pdf->GetY() + 2;
534
535 $pdf->SetXY($this->marge_gauche, $posy);
536 $pdf->SetFont('', '', $default_font_size - $diffsizetitle);
537 $pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', false);
538 $pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress(1)), 0, 'L', false);
539 $posy = $pdf->GetY() + 2;
540
541 return $posy;
542 }
543
544
545 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
546 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
556 protected function _signature_area(&$pdf, $object, $posy, $outputlangs)
557 {
558 // phpcs:enable
559 $default_font_size = pdf_getPDFFontSize($outputlangs);
560 $tab_top = $posy + 4;
561 $tab_hl = 4;
562
563 $posx = $this->marge_gauche;
564 $pdf->SetXY($posx, $tab_top);
565
566 $pdf->SetFont('', '', $default_font_size - 2);
567
568 $pdf->MultiCell(100, 3, $outputlangs->transnoentitiesnoconv("DateSigning"), 0, 'L', false);
569 $pdf->MultiCell(100, 3, ' ');
570 $pdf->MultiCell(100, 3, '______________________', 0, 'L', false);
571
572 $posx = $this->xPosSignArea;
573 $largcol = ($this->page_largeur - $this->marge_droite - $posx);
574
575 // Total HT
576 $pdf->SetFillColor(255, 255, 255);
577 $pdf->SetXY($posx, $tab_top);
578 $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', true);
579
580 $pdf->SetXY($posx, $tab_top + $tab_hl);
581 //$pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R');
582 $pdf->RoundedRect($posx, $tab_top + $tab_hl + 3, $largcol, $tab_hl * 3, $this->corner_radius, '1234', 'D');
583
584 return ($tab_hl * 7);
585 }
586
587
588 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
598 protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
599 {
600 // phpcs:enable
601 global $langs, $conf, $mysoc;
602
603 $default_font_size = pdf_getPDFFontSize($outputlangs);
604
605 pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
606
607 $pdf->SetTextColor(0, 0, 60);
608 $pdf->SetFont('', 'B', $default_font_size + 3);
609
610 $posx = $this->page_largeur - $this->marge_droite - 100;
611 $posy = $this->marge_haute;
612
613 $pdf->SetXY($this->marge_gauche, $posy);
614
615 // Logo
616 $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
617 if ($mysoc->logo) {
618 if (is_readable($logo)) {
619 $height = pdf_getHeightForLogo($logo);
620 $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
621 } else {
622 $pdf->SetTextColor(200, 0, 0);
623 $pdf->SetFont('', 'B', $default_font_size - 2);
624 $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
625 $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
626 }
627 } else {
628 $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
629 }
630
631 $pdf->SetFont('', 'B', $default_font_size + 3);
632 $pdf->SetXY($posx, $posy);
633 $pdf->SetTextColor(0, 0, 60);
634 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("SepaMandate"), '', 'R');
635 $pdf->SetFont('', '', $default_font_size + 2);
636
637 $posy += 6;
638 $pdf->SetXY($posx, $posy);
639 $pdf->SetTextColor(0, 0, 60);
640 $daterum = '__________________';
641 if (!empty($object->date_rum)) {
642 $daterum = dol_print_date($object->date_rum, 'day', false, $outputlangs, true);
643 } else {
644 $daterum = dol_print_date($object->datec, 'day', false, $outputlangs, true); // For old record, the date_rum was not saved.
645 }
646 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".$daterum, '', 'R');
647 /*$posy+=6;
648 $pdf->SetXY($posx,$posy);
649 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
650 */
651
652 $pdf->SetTextColor(0, 0, 60);
653
654 // Add list of linked objects
655 /* Removed: A project can have more than thousands linked objects (orders, invoices, proposals, etc....
656 $object->fetchObjectLinked();
657
658 foreach($object->linkedObjects as $objecttype => $objects)
659 {
660 var_dump($objects);exit;
661 if ($objecttype == 'commande')
662 {
663 $outputlangs->load('orders');
664 $num=count($objects);
665 for ($i=0;$i<$num;$i++)
666 {
667 $posy+=4;
668 $pdf->SetXY($posx,$posy);
669 $pdf->SetFont('','', $default_font_size - 1);
670 $text=$objects[$i]->ref;
671 if ($objects[$i]->ref_client) $text.=' ('.$objects[$i]->ref_client.')';
672 $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
673 }
674 }
675 }
676 */
677
678 return 0;
679 }
680
681 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
691 protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
692 {
693 // phpcs:enable
694 $showdetails = getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', 0);
695 return pdf_pagefoot($pdf, $outputlangs, 'PAYMENTORDER_FREE_TEXT', null, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
696 }
697}
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
buildzip.php
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:747
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:1421
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