dolibarr 24.0.1
doc_generic_contract_odt.modules.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
4 * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
5 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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/contract/modules_contract.php';
30require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
35
36
41{
45 public $version = 'dolibarr';
46
47
53 public function __construct($db)
54 {
55 global $langs, $mysoc;
56
57 // Load translation files required by the page
58 $langs->loadLangs(array("main", "companies"));
59
60 $this->db = $db;
61 $this->name = "ODT templates";
62 $this->description = $langs->trans("DocumentModelOdt");
63 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
64 $this->scandir = 'CONTRACT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
65
66 // Page size for A4 format
67 $this->type = 'odt';
68 $this->page_largeur = 0;
69 $this->page_hauteur = 0;
70 $this->format = array($this->page_largeur, $this->page_hauteur);
71 $this->marge_gauche = 0;
72 $this->marge_droite = 0;
73 $this->marge_haute = 0;
74 $this->marge_basse = 0;
75
76 $this->option_logo = 1; // Display logo
77 $this->option_tva = 0; // Manage the vat CONTRACT_TVAOPTION
78 $this->option_modereg = 0; // Display payment mode
79 $this->option_condreg = 0; // Display payment terms
80 $this->option_multilang = 1; // Available in several languages
81 $this->option_escompte = 0; // Displays if there has been a discount
82 $this->option_credit_note = 0; // Support credit notes
83 $this->option_freetext = 1; // Support add of a personalised text
84 $this->option_draft_watermark = 0; // Support add of a watermark on drafts
85
86 if ($mysoc === null) {
87 dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
88 return;
89 }
90
91 // Get source company
92 $this->emetteur = $mysoc;
93 if (!$this->emetteur->country_code) {
94 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
95 }
96 }
97
98
105 public function info($langs)
106 {
107 global $conf, $langs;
108
109 // Load translation files required by the page
110 $langs->loadLangs(array('companies', 'errors'));
111
112 $form = new Form($this->db);
113
114 $texte = $this->description.".<br>\n";
115 $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
116 $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
117 $texte .= '<input type="hidden" name="page_y" value="">';
118 $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
119 $texte .= '<input type="hidden" name="param1" value="CONTRACT_ADDON_PDF_ODT_PATH">';
120 $texte .= '<table class="nobordernopadding centpercent">';
121
122 // List of directories area
123 $texte .= '<tr><td>';
124 $texttitle = $langs->trans("ListOfDirectories");
125 $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->CONTRACT_ADDON_PDF_ODT_PATH)));
126 $listoffiles = array();
127 foreach ($listofdir as $key => $tmpdir) {
128 $tmpdir = trim($tmpdir);
129 $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
130 if (!$tmpdir) {
131 unset($listofdir[$key]);
132 continue;
133 }
134 if (!is_dir($tmpdir)) {
135 $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), '');
136 } else {
137 $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
138 if (count($tmpfiles)) {
139 $listoffiles = array_merge($listoffiles, $tmpfiles);
140 }
141 }
142 }
143 $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
144 $texthelp .= '<br><br><span class="opacitymedium">'.$langs->trans("ExampleOfDirectoriesForModelGen").'</span>';
145 // Add list of substitution keys
146 $texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
147 $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
148
149 $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
150 $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
151 $texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
152 $texte .= getDolGlobalString('CONTRACT_ADDON_PDF_ODT_PATH');
153 $texte .= '</textarea>';
154 $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
155 $texte .= '<input type="submit" class="button reposition smallpaddingimp" name="modify" value="'.dol_escape_htmltag($langs->trans("Modify")).'">';
156 $texte .= '<br></div></div>';
157
158 // Scan directories
159 $nbofiles = count($listoffiles);
160 if (getDolGlobalString('CONTRACT_ADDON_PDF_ODT_PATH')) {
161 $texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
162 //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
163 $texte .= $nbofiles;
164 //$texte.=$nbofiles?'</a>':'';
165 $texte .= '</b>';
166 }
167
168 if ($nbofiles) {
169 $texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
170 // Show list of found files
171 foreach ($listoffiles as $file) {
172 $texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=contracts/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a>';
173 $texte .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?modulepart=doctemplates&keyforuploaddir=CONTRACT_ADDON_PDF_ODT_PATH&action=deletefile&token='.newToken().'&file='.urlencode(basename($file['name'])).'">'.img_picto('', 'delete').'</a>';
174 $texte .= '<br>';
175 }
176 $texte .= '</div>';
177 }
178 // Add input to upload a new template file.
179 $texte .= '<div>'.$langs->trans("UploadNewTemplate");
180 $maxfilesizearray = getMaxFileSizeArray();
181 $maxmin = $maxfilesizearray['maxmin'];
182 if ($maxmin > 0) {
183 $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
184 }
185 $texte .= ' <input type="file" name="uploadfile">';
186 $texte .= '<input type="hidden" value="CONTRACT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
187 $texte .= '<input type="submit" class="button reposition smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
188 $texte .= '</div>';
189
190 $texte .= '</td>';
191
192 $texte .= '</tr>';
193
194 $texte .= '</table>';
195 $texte .= '</form>';
196
197 return $texte;
198 }
199
200 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
212 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
213 {
214 // phpcs:enable
215 global $user, $langs, $conf, $mysoc, $hookmanager;
216
217 if (empty($srctemplatepath)) {
218 dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
219 return -1;
220 }
221
222 // Add odtgeneration hook
223 if (!is_object($hookmanager)) {
224 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
225 $hookmanager = new HookManager($this->db);
226 }
227 $hookmanager->initHooks(array('odtgeneration'));
228 global $action;
229
230 if (!is_object($outputlangs)) {
231 $outputlangs = $langs;
232 }
233 $sav_charset_output = $outputlangs->charset_output;
234 $outputlangs->charset_output = 'UTF-8';
235
236 // Load translation files required by page
237 $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "sendginds"));
238
239 if ($conf->contract->multidir_output[$object->entity ?? $conf->entity]) {
240 // If $object is id instead of object
241 if (!is_object($object)) {
242 $id = $object;
243 $object = new Contrat($this->db);
244 $result = $object->fetch($id);
245 if ($result < 0) {
246 dol_print_error($this->db, $object->error);
247 return -1;
248 }
249 }
250
251 $object->fetch_thirdparty();
252
253 $dir = $conf->contract->multidir_output[$object->entity ?? $conf->entity];
254 $objectref = dol_sanitizeFileName((string) $object->ref);
255 if (!preg_match('/specimen/i', $objectref)) {
256 $dir .= "/".$objectref;
257 }
258 $file = $dir."/".$objectref.".odt";
259
260 if (!file_exists($dir)) {
261 if (dol_mkdir($dir) < 0) {
262 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
263 return -1;
264 }
265 }
266
267 if (file_exists($dir)) {
268 //print "srctemplatepath=".$srctemplatepath; // Src filename
269 $newfile = basename($srctemplatepath);
270 $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile);
271 $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
272 $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
273
274 $newfiletmp = $objectref . '_' . $newfiletmp;
275
276 // Get extension (ods or odt)
277 $newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
278 if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
279 $format = getDolGlobalString('MAIN_DOC_USE_TIMING');
280 if ($format == '1') {
281 $format = '%Y%m%d%H%M%S';
282 }
283 $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
284 } else {
285 $filename = $newfiletmp . '.' . $newfileformat;
286 }
287 $file = $dir . '/' . $filename;
288 //print "newdir=".$dir;
289 //print "newfile=".$newfile;
290 //print "file=".$file;
291 //print "conf->contrat->dir_temp=".$conf->contrat->dir_temp;
292
293 dol_mkdir($conf->contract->dir_temp);
294 if (!is_writable($conf->contract->dir_temp)) {
295 $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->contrat->dir_temp);
296 dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
297 return -1;
298 }
299
300 // If CUSTOMER contact defined on contract, we use it
301 $usecontact = false;
302 $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
303 if (count($arrayidcontact) > 0) {
304 $usecontact = true;
305 $result = $object->fetch_contact($arrayidcontact[0]);
306 }
307
308 // Recipient name
309 $contactobject = null;
310 if (!empty($usecontact)) {
311 // We can use the company of contact instead of thirdparty company
312 if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT'))) {
313 $object->contact->fetch_thirdparty();
314 $socobject = $object->contact->thirdparty;
315 $contactobject = $object->contact;
316 } else {
317 $socobject = $object->thirdparty;
318 // if we have a CUSTOMER contact and we don't use it as thirdparty recipient we store the contact object for later use
319 $contactobject = $object->contact;
320 }
321 } else {
322 $socobject = $object->thirdparty;
323 }
324
325 $object->fetch_optionals();
326
327
328 // Define substitution array
329 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
330 $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs);
331 $array_objet = $this->get_substitutionarray_object($object, $outputlangs); // complete with vars not set as properties by get_substitutionarray_each_var_object
332 $array_user = $this->get_substitutionarray_user($user, $outputlangs);
333 $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
334 $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
335 $array_other = $this->get_substitutionarray_other($outputlangs);
336 // retrieve contact information for use in order as contact_xxx tags
337 $array_thirdparty_contact = array();
338 if ($usecontact && is_object($contactobject)) {
339 $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
340 }
341
342 $substitutionarray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
343 complete_substitutions_array($substitutionarray, $outputlangs, $object);
344
345 $tmparray = $substitutionarray;
346
347 // Call the ODTSubstitution hook
348 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
349 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
350
351 // Line of free text
352 $newfreetext = '';
353 $paramfreetext = 'CONTRACT_FREE_TEXT';
354 if (getDolGlobalString($paramfreetext)) {
355 $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $tmparray);
356 }
357
358
359 // Open and load template
360 require_once ODTPHP_PATH.'odf.php';
361 try {
362 $odfHandler = new Odf(
363 $srctemplatepath,
364 array(
365 'PATH_TO_TMP' => $conf->contrat->dir_temp,
366 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
367 'DELIMITER_LEFT' => '{',
368 'DELIMITER_RIGHT' => '}'
369 )
370 );
371 } catch (Exception $e) {
372 $this->error = $e->getMessage();
373 dol_syslog($e->getMessage(), LOG_INFO);
374 return -1;
375 }
376 // After construction $odfHandler->contentXml contains content and
377 // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
378 // [!-- BEGIN lines --]*[!-- END lines --]
379 //print html_entity_decode($odfHandler->__toString());
380 //print exit;
381
382
383 // Make substitutions into odt of freetext
384 try {
385 $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
386 } catch (OdfException $e) {
387 dol_syslog($e->getMessage(), LOG_INFO);
388 }
389
390 // Call the ODTSubstitution hook
391 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
392 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
393 // retrieve the constant to apply a ratio for image size or set the ratio to 1
394 if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
395 $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
396 } else {
397 $ratio = 1;
398 }
399
400 foreach ($tmparray as $key => $value) {
401 try {
402 if (preg_match('/logo$/', $key)) {
403 // Image
404 if (file_exists($value)) {
405 $odfHandler->setImage($key, $value, $ratio);
406 } else {
407 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
408 }
409 } else {
410 // Text
411 $odfHandler->setVars($key, $value, true, 'UTF-8');
412 }
413 } catch (OdfException $e) {
414 dol_syslog($e->getMessage(), LOG_INFO);
415 }
416 }
417
418 // Replace tags of lines
419 $foundtagforlines = 1;
420 try {
421 $listlines = $odfHandler->setSegment('lines');
422 } catch (OdfExceptionSegmentNotFound $e) {
423 // We may arrive here if tags for lines not present into template
424 $foundtagforlines = 0;
425 dol_syslog($e->getMessage(), LOG_INFO);
426 }
427 if ($foundtagforlines) {
428 $linenumber = 0;
429 foreach ($object->lines as $line) {
431 $linenumber++;
432 $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
433 complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
434 // Call the ODTSubstitutionLine hook
435 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line);
436 $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
437 foreach ($tmparray as $key => $val) {
438 try {
439 $listlines->setVars($key, $val, true, 'UTF-8');
440 } catch (SegmentException $e) {
441 dol_syslog($e->getMessage(), LOG_INFO);
442 }
443 }
444 $listlines->merge();
445 }
446 try {
447 $odfHandler->mergeSegment($listlines);
448 } catch (OdfException $e) {
449 $this->error = $e->getMessage();
450 dol_syslog($this->error, LOG_WARNING);
451 return -1;
452 }
453 }
454
455 // Replace labels translated
456 $tmparray = $outputlangs->get_translations_for_substitutions();
457 foreach ($tmparray as $key => $value) {
458 try {
459 $odfHandler->setVars($key, $value, true, 'UTF-8');
460 } catch (OdfException $e) {
461 dol_syslog($e->getMessage(), LOG_INFO);
462 }
463 }
464
465 // Call the beforeODTSave hook
466 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
467 $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
468
469 // Write new file
470 if (getDolGlobalString('MAIN_ODT_AS_PDF')) {
471 try {
472 $odfHandler->exportAsAttachedPDF($file);
473 } catch (Exception $e) {
474 $this->error = $e->getMessage();
475 dol_syslog($e->getMessage(), LOG_INFO);
476 return -1;
477 }
478 } else {
479 try {
480 $odfHandler->saveToDisk($file);
481 } catch (Exception $e) {
482 $this->error = $e->getMessage();
483 dol_syslog($e->getMessage(), LOG_INFO);
484 return -1;
485 }
486 }
487
488 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
489 $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
490
491 dolChmod($file);
492
493 $odfHandler = null; // Destroy object
494
495 $this->result = array('fullpath' => $file);
496
497 return 1; // Success
498 } else {
499 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
500 }
501 }
502
503 return -1;
504 }
505}
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive=1)
Define array with couple substitution key => substitution value @phpstan-template T.
get_substitutionarray_mysoc($mysoc, $outputlangs)
Define array with couple substitution key => substitution value.
get_substitutionarray_contact($object, $outputlangs, $array_key='object')
Define array with couple substitution key => substitution value.
get_substitutionarray_other($outputlangs)
Define array with couple substitution key => substitution value.
get_substitutionarray_lines($line, $outputlangs, $linenumber=0)
Define array with couple substitution key => substitution value Note that vars into substitutions arr...
get_substitutionarray_thirdparty($object, $outputlangs, $array_key='company')
Define array with couple substitution key => substitution value For example {company_name}...
get_substitutionarray_user($user, $outputlangs)
Define array with couple substitution key => substitution value.
Class to manage generation of HTML components Only common components must be here.
Class to manage hooks.
Parent class to manage intervention document templates.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build a document on disk.
Class to build documents using ODF templates generator.
info($langs)
Return description of a module.
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:
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:64
dol_now($mode='gmt')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
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)
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
getMaxFileSizeArray()
Return the max allowed for file upload.