dolibarr 23.0.3
pdf_standard_member.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003 Steve Dillon
3 * Copyright (C) 2003 Laurent Passebecq
4 * Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
5 * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
6 * Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
7 * Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
8 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
9 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
31require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php';
32
37{
42 public $version = 'dolibarr';
43
44
50 public function __construct($db)
51 {
52 global $langs, $_Avery_Labels;
53
54 // Translations
55 $langs->loadLangs(array("main", "admin"));
56
57 $this->db = $db;
58 $this->name = "standard";
59 $this->description = $langs->trans('TemplateforBusinessCards');
60 //$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
61 $this->_Avery_Labels = $_Avery_Labels;
62
63 $this->type = 'pdf-various-sizes';
64 }
65
74 public function addSticker(&$pdf, $outputlangs, $param)
75 {
76 // use this method in future refactoring
77 }
78
79 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
95 public function Add_PDF_card(&$pdf, $textleft, $header, $footer, $outputlangs, $textright = '', $idmember = 0, $photo = '')
96 {
97 // phpcs:enable
98 global $db, $mysoc, $conf, $langs;
99 global $forceimgscalewidth, $forceimgscaleheight;
100
101 $imgscalewidth = (empty($forceimgscalewidth) ? 0.3 : $forceimgscalewidth); // Scale of image for width (1=Full width of sticker)
102 $imgscaleheight = (empty($forceimgscalewidth) ? 0.5 : $forceimgscalewidth); // Scale of image for height (1=Full height of sticker)
103
104 // We are in a new page, then we must add a page
105 if (($this->_COUNTX == 0) && ($this->_COUNTY == 0) and (!$this->_First == 1)) {
106 $pdf->AddPage();
107 }
108 $this->_First = 0;
109 $_PosX = $this->_Margin_Left + ($this->_COUNTX * ($this->_Width + $this->_X_Space));
110 $_PosY = $this->_Margin_Top + ($this->_COUNTY * ($this->_Height + $this->_Y_Space));
111
112 // Define logo
113 $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
114 if (!is_readable($logo)) {
115 $logo = '';
116 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
117 $logo = $conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
118 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
119 $logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
120 }
121 }
122
123 $member = new Adherent($db);
124 $member->id = $idmember;
125 $member->ref = (string) $idmember;
126
127 // Define photo
128 $dir = $conf->adherent->dir_output;
129 if (!empty($photo)) {
130 $file = get_exdir(0, 0, 0, 0, $member, 'member').'photos/'.$photo;
131 $photo = $dir.'/'.$file;
132 if (!is_readable($photo)) {
133 $photo = '';
134 }
135 }
136
137 // Define background image
138 $backgroundimage = '';
139 if (getDolGlobalString('ADHERENT_CARD_BACKGROUND') && file_exists($conf->adherent->dir_output.'/' . getDolGlobalString('ADHERENT_CARD_BACKGROUND'))) {
140 $backgroundimage = $conf->adherent->dir_output.'/' . getDolGlobalString('ADHERENT_CARD_BACKGROUND');
141 }
142
143 // Print lines
144 if ($this->code == "CARD") {
145 $this->Tformat = $this->_Avery_Labels["CARD"];
146 //$this->_Pointille($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25);
147 $this->_Croix($pdf, $_PosX, $_PosY, $_PosX + $this->_Width, $_PosY + $this->_Height, 0.1, 10);
148 }
149
150 // Background
151 if ($backgroundimage) {
152 $pdf->image($backgroundimage, $_PosX, $_PosY, $this->_Width, $this->_Height);
153 }
154
155 $xleft = 2;
156 $ytop = 2;
157
158 // Top
159 if ($header != '') {
160 if ($this->code == "CARD") {
161 $pdf->SetDrawColor(128, 128, 128);
162 $pdf->Line($_PosX, $_PosY + $this->_Line_Height + 1, $_PosX + $this->_Width, $_PosY + $this->_Line_Height + 1); // Only 1 mm and not ytop for top text
163 $pdf->SetDrawColor(0, 0, 0);
164 }
165 $pdf->SetXY($_PosX + $xleft, $_PosY + 1); // Only 1 mm and not ytop for top text
166 $pdf->Cell($this->_Width - 2 * $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($header), 0, 1, 'C');
167 }
168
169 $ytop += (empty($header) ? 0 : (1 + $this->_Line_Height));
170
171 // Define widthtouse and heighttouse
172 $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth);
173 $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight);
174 $defaultratio = ($maxwidthtouse / $maxheighttouse);
175 $widthtouse = $maxwidthtouse;
176 $heighttouse = 0; // old value for image
177 $tmp = dol_getImageSize($photo, false);
178 if (isset($tmp['height'])) {
179 $imgratio = $tmp['width'] / $tmp['height'];
180 if ($imgratio >= $defaultratio) {
181 $widthtouse = $maxwidthtouse;
182 $heighttouse = round($widthtouse / $imgratio);
183 } else {
184 $heighttouse = $maxheighttouse;
185 $widthtouse = round($heighttouse * $imgratio);
186 }
187 }
188 //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit;
189
190 // Center
191 if ($textright == '') { // Only a left part
192 // Output left area
193 if ($textleft == '__LOGO__' && $logo) {
194 $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
195 } elseif (($textleft == '__PHOTO__' || $textleft == '__MEMBER_PHOTO__') && $photo) {
196 $pdf->Image($photo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
197 } else {
198 $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
199 $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
200 }
201 } elseif ($textleft != '' && $textright != '') { //
202 if ($textleft == '__LOGO__' || $textleft == '__PHOTO__' || $textleft == '__MEMBER_PHOTO__') {
203 if ($textleft == '__LOGO__' && $logo) {
204 $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
205 } elseif (($textleft == '__PHOTO__' || $textright == '__MEMBER_PHOTO__') && $photo) {
206 $pdf->Image($photo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
207 }
208 $pdf->SetXY($_PosX + $xleft + $widthtouse + 1, $_PosY + $ytop);
209 $pdf->MultiCell($this->_Width - $xleft - $xleft - $widthtouse - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
210 } elseif ($textright == '__LOGO__' || $textright == '__PHOTO__' || $textright == '__MEMBER_PHOTO__') {
211 if ($textright == '__LOGO__' && $logo) {
212 $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
213 } elseif (($textright == '__PHOTO__' || $textright == '__MEMBER_PHOTO__') && $photo) {
214 $pdf->Image($photo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
215 }
216 $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
217 $pdf->MultiCell($this->_Width - $widthtouse - $xleft - $xleft - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
218 } else { // text on halft left and text on half right
219 $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
220 $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
221 $pdf->SetXY($_PosX + round($this->_Width / 2), $_PosY + $ytop);
222 $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
223 }
224 } else { // Only a right part
225 // Output right area
226 if ($textright == '__LOGO__' && $logo) {
227 $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
228 } elseif (($textright == '__PHOTO__' || $textright == '__MEMBER_PHOTO__') && $photo) {
229 $pdf->Image($photo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
230 } else {
231 $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
232 $pdf->MultiCell($this->_Width - $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
233 }
234 }
235
236 // Bottom
237 if ($footer != '') {
238 if ($this->code == "CARD") {
239 $pdf->SetDrawColor(128, 128, 128);
240 $pdf->Line($_PosX, $_PosY + $this->_Height - $this->_Line_Height - 2, $_PosX + $this->_Width, $_PosY + $this->_Height - $this->_Line_Height - 2);
241 $pdf->SetDrawColor(0, 0, 0);
242 }
243 $pdf->SetXY($_PosX, $_PosY + $this->_Height - $this->_Line_Height - 1);
244 $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($footer), 0, 1, 'C');
245 }
246 //print "$_PosY+$this->_Height-$this->_Line_Height-1<br>\n";
247
248 $this->_COUNTY++;
249
250 if ($this->_COUNTY == $this->_Y_Number) {
251 // Si on est en bas de page, on remonte le 'curseur' de position
252 $this->_COUNTX++;
253 $this->_COUNTY = 0;
254 }
255
256 if ($this->_COUNTX == $this->_X_Number) {
257 // Si on est en bout de page, alors on repart sur une nouvelle page
258 $this->_COUNTX = 0;
259 $this->_COUNTY = 0;
260 }
261 }
262
263 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
275 public function write_file($object, $outputlangs, $srctemplatepath = '', $mode = 'member', $nooutput = '', $filename = 'tmp_cards')
276 {
277 // phpcs:enable
278 global $user, $conf, $langs, $mysoc;
279
280 $this->code = $srctemplatepath;
281
282 if (!is_object($outputlangs)) {
283 $outputlangs = $langs;
284 }
285
286 if (is_object($object)) {
287 // If function is called to build the PDF of a sheet for the same member.
288 if ($object->country == '-') {
289 $object->country = '';
290 }
291
292 $now = dol_now();
293 $year = dol_print_date($now, '%Y');
294 $month = dol_print_date($now, '%m');
295 $day = dol_print_date($now, '%d');
296
297 // List of values to scan for a replacement
298 $substitutionarray = array(
299 '__MEMBER_ID__' => (string) $object->id,
300 '__MEMBER_REF__' => $object->ref,
301 '__MEMBER_LOGIN__' => empty($object->login) ? '' : $object->login,
302 '__MEMBER_CIVILITY__' => empty($object->civility) ? '' : $outputlangs->trans("Civility".$object->civility),
303 '__MEMBER_FIRSTNAME__' => empty($object->firstname) ? '' : $object->firstname,
304 '__MEMBER_LASTNAME__' => empty($object->lastname) ? '' : $object->lastname,
305 '__MEMBER_FULLNAME__' => $object->getFullName($outputlangs),
306 '__MEMBER_COMPANY__' => empty($object->company) ? '' : $object->company,
307 '__MEMBER_ADDRESS__' => empty($object->address) ? '' : $object->address,
308 '__MEMBER_ZIP__' => empty($object->zip) ? '' : $object->zip,
309 '__MEMBER_TOWN__' => empty($object->town) ? '' : $object->town,
310 '__MEMBER_COUNTRY__' => empty($object->country) ? '' : $object->country,
311 '__MEMBER_COUNTRY_CODE__' => empty($object->country_code) ? '' : $object->country_code,
312 '__MEMBER_EMAIL__' => empty($object->email) ? '' : $object->email,
313 '__MEMBER_BIRTH__' => dol_print_date($object->birth, 'day'),
314 '__MEMBER_TYPE__' => empty($object->type) ? '' : $object->type,
315 '__YEAR__' => $year,
316 '__MONTH__' => $month,
317 '__DAY__' => $day,
318 '__DOL_MAIN_URL_ROOT__' => (string) DOL_MAIN_URL_ROOT,
319 '__SERVER__' => "https://".$_SERVER["SERVER_NAME"]."/"
320 );
321
322 // Add old values for backward compatibility (need upgrade of member setup to be removed)
323 $substitutionarrayold = array(
324 '__ID__' => (string) $object->id,
325 '__REF__' => $object->ref,
326 '__LOGIN__' => empty($object->login) ? '' : $object->login,
327 '__CIVILITY__' => empty($object->civility) ? '' : $outputlangs->trans("Civility".$object->civility),
328 '__FIRSTNAME__' => empty($object->firstname) ? '' : $object->firstname,
329 '__LASTNAME__' => empty($object->lastname) ? '' : $object->lastname,
330 '__FULLNAME__' => $object->getFullName($outputlangs),
331 '__COMPANY__' => empty($object->company) ? '' : $object->company,
332 '__ADDRESS__' => empty($object->address) ? '' : $object->address,
333 '__ZIP__' => empty($object->zip) ? '' : $object->zip,
334 '__TOWN__' => empty($object->town) ? '' : $object->town,
335 '__COUNTRY__' => empty($object->country) ? '' : $object->country,
336 '__COUNTRY_CODE__' => empty($object->country_code) ? '' : $object->country_code,
337 '__EMAIL__' => empty($object->email) ? '' : $object->email,
338 '__BIRTH__' => dol_print_date($object->birth, 'day'),
339 '__TYPE__' => empty($object->type) ? '' : $object->type
340 );
341
342 // Make substitutions for new variables
343 /*
344 $array_member = $this->getSubstitutionarrayMember($object, $outputlangs);
345 $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
346 $array_other = $this->get_substitutionarray_other($outputlangs);
347 */
348
349 //$substitutionarray = array_merge($substitutionarray, $substitutionarrayold, $array_member, $array_soc, $array_other);
350 $substitutionarray = array_merge($substitutionarray, $substitutionarrayold);
351 complete_substitutions_array($substitutionarray, $outputlangs);
352
353 // For business cards
354 $textleft = make_substitutions(getDolGlobalString("ADHERENT_CARD_TEXT"), $substitutionarray);
355 $textheader = make_substitutions(getDolGlobalString("ADHERENT_CARD_HEADER_TEXT"), $substitutionarray);
356 $textfooter = make_substitutions(getDolGlobalString("ADHERENT_CARD_FOOTER_TEXT"), $substitutionarray);
357 $textright = make_substitutions(getDolGlobalString("ADHERENT_CARD_TEXT_RIGHT"), $substitutionarray);
358
359 $nb = $this->_Avery_Labels[$this->code]['NX'] * $this->_Avery_Labels[$this->code]['NY'];
360 if ($nb <= 0) {
361 $nb = 1; // Protection to avoid empty page
362 }
363
364 $arrayofmembers = array();
365 for ($j = 0; $j < $nb; $j++) {
366 $arrayofmembers[] = array(
367 'textleft' => $textleft,
368 'textheader' => $textheader,
369 'textfooter' => $textfooter,
370 'textright' => $textright,
371 'id' => (isset($object->id) ? $object->id : ""),
372 'photo' => (isset($object->photo) ? $object->photo : "")
373 );
374 }
375
376 $arrayofrecords = $arrayofmembers;
377 } else {
378 // If function is called to build a sheet with all members
379 // In such a case, substitution should have been done already
380 $arrayofrecords = $object;
381 }
382
383 $this->Tformat = $this->_Avery_Labels[$this->code];
384 if (empty($this->Tformat)) {
385 dol_print_error(null, 'ErrorBadTypeForCard'.$this->code);
386 exit;
387 }
388
389 $this->type = 'pdf';
390 $filename .= '.pdf';
391
392 // standard format or custom
393 $paper_size = $this->Tformat['paper-size'];
394 if (!is_string($paper_size) || $paper_size != 'custom') {
395 $this->format = $paper_size;
396 } else {
397 //custom
398 $resolution = array($this->Tformat['custom_x'], $this->Tformat['custom_y']);
399 $this->format = $resolution;
400 }
401
402 // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
403 if (getDolGlobalString('MAIN_USE_FPDF')) {
404 $outputlangs->charset_output = 'ISO-8859-1';
405 }
406
407 // Load traductions files required by page
408 $outputlangs->loadLangs(array("main", "dict", "companies", "admin", "members"));
409
410 if (empty($mode) || $mode == 'member') {
411 $title = $outputlangs->transnoentities('MembersCards');
412 $keywords = $outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name);
413 } else {
414 dol_print_error(null, 'Bad value for $mode');
415 return -1;
416 }
417
418
419 if (is_object($object)) {
420 $outputdir = $conf->adherent->dir_output;
421 $dir = $outputdir."/".get_exdir(0, 0, 0, 0, $object, 'member');
422 $file = $dir.'/'.$filename;
423 } else {
424 $outputdir = $conf->adherent->dir_temp;
425 $dir = $outputdir;
426 $file = $dir.'/'.$filename;
427 }
428
429 if (!file_exists($dir)) {
430 if (dol_mkdir($dir) < 0) {
431 $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
432 return 0;
433 }
434 }
435
436 $pdf = pdf_getInstance($this->format, $this->Tformat['metric'], $this->Tformat['orientation']);
437
438 if (class_exists('TCPDF')) {
439 $pdf->setPrintHeader(false);
440 $pdf->setPrintFooter(false);
441 }
442 $pdf->SetFont(pdf_getPDFFont($outputlangs));
443
444 $pdf->SetTitle($title);
445 $pdf->SetSubject($title);
446 $pdf->SetCreator("Dolibarr ".DOL_VERSION);
447 $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
448 $pdf->SetKeyWords($keywords);
449 if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
450 $pdf->SetCompression(false);
451 }
452
453 $pdf->SetMargins(0, 0);
454 $pdf->setAutoPageBreak(false);
455
456 $this->_Metric_Doc = $this->Tformat['metric'];
457 // Permet de commencer l'impression de l'etiquette desiree dans le cas ou la page a deja service
458 $posX = 1;
459 $posY = 1;
460 if ($posX > 0) {
461 $posX--;
462 } else {
463 $posX = 0;
464 }
465 if ($posY > 0) {
466 $posY--;
467 } else {
468 $posY = 0;
469 }
470 $this->_COUNTX = $posX;
471 $this->_COUNTY = $posY;
472 $this->_Set_Format($pdf, $this->Tformat);
473
474
475 $pdf->Open();
476 $pdf->AddPage();
477
478
479 // Add each record
480 foreach ($arrayofrecords as $val) {
481 // imprime le texte specifique sur la carte
482 $this->Add_PDF_card($pdf, $val['textleft'], $val['textheader'], $val['textfooter'], $langs, $val['textright'], $val['id'], $val['photo']);
483 }
484
485 //$pdf->SetXY(10, 295);
486 //$pdf->Cell($this->_Width, $this->_Line_Height, 'XXX',0,1,'C');
487
488
489 // Output to file
490 $pdf->Output($file, 'F');
491
492 dolChmod($file);
493
494 $this->result = array('fullpath' => $file);
495
496 // Output to http stream
497 if (empty($nooutput)) {
498 clearstatcache();
499
500 $attachment = true;
501 if (getDolGlobalString('MAIN_DISABLE_FORCE_SAVEAS')) {
502 $attachment = false;
503 }
504 $type = dol_mimetype($filename);
505
506 //if ($encoding) header('Content-Encoding: '.$encoding);
507 if ($type) {
508 header('Content-Type: '.$type);
509 }
510 if ($attachment) {
511 header('Content-Disposition: attachment; filename="'.$filename.'"');
512 } else {
513 header('Content-Disposition: inline; filename="'.$filename.'"');
514 }
515
516 // Ajout directives pour resoudre bug IE
517 header('Cache-Control: Public, must-revalidate');
518 header('Pragma: public');
519
520 readfile($file);
521 }
522
523 return 1;
524 }
525}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage members of a foundation.
Class to generate stick sheet with format Avery or other personalised format.
_Croix(&$pdf, $x1=0, $y1=0, $x2=210, $y2=297, $epaisseur=1, $taille=4)
protected Function making a cross at the 4 corners of the labels
_Set_Format(&$pdf, $format)
protected Set format
Class to generate stick sheet with format Avery or other personalised.
Add_PDF_card(&$pdf, $textleft, $header, $footer, $outputlangs, $textright='', $idmember=0, $photo='')
Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
write_file($object, $outputlangs, $srctemplatepath='', $mode='member', $nooutput='', $filename='tmp_cards')
Function to build PDF on disk, then output on HTTP stream.
addSticker(&$pdf, $outputlangs, $param)
Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
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.
dol_now($mode='gmt')
Return date for now.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dolChmod($filepath, $newmask='')
Change mod of a file.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_getImageSize($file, $url=false)
Return size of image file on disk (Supported extensions are gif, jpg, png, bmp and webp)
pdf_getPDFFont($outputlangs)
Return font name to use for PDF generation.
Definition pdf.lib.php:268
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:125
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:128