dolibarr 18.0.6
doc_generic_shipment_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) 2014 Marcos García <marcosgdf@gmail.com>
5 * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
6 * Copyright (C) 2018-2021 Philippe Grand <philippe.grand@atoo-net.com>
7 * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
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/expedition/modules_expedition.php';
31require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
36
37
42{
47 public $emetteur;
48
53 public $version = 'dolibarr';
54
55
61 public function __construct($db)
62 {
63 global $conf, $langs, $mysoc;
64
65 // Load translation files required by the page
66 $langs->loadLangs(array("main", "companies"));
67
68 $this->db = $db;
69 $this->name = "ODT templates";
70 $this->description = $langs->trans("DocumentModelOdt");
71 $this->scandir = 'EXPEDITION_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
72
73 // Page size for A4 format
74 $this->type = 'odt';
75 $this->page_largeur = 0;
76 $this->page_hauteur = 0;
77 $this->format = array($this->page_largeur, $this->page_hauteur);
78 $this->marge_gauche = 0;
79 $this->marge_droite = 0;
80 $this->marge_haute = 0;
81 $this->marge_basse = 0;
82
83 $this->option_logo = 1; // Display logo
84 $this->option_tva = 0; // Manage the vat option EXPEDITION_TVAOPTION
85 $this->option_modereg = 0; // Display payment mode
86 $this->option_condreg = 0; // Display payment terms
87 $this->option_multilang = 1; // Available in several languages
88 $this->option_escompte = 0; // Displays if there has been a discount
89 $this->option_credit_note = 0; // Support credit notes
90 $this->option_freetext = 1; // Support add of a personalised text
91 $this->option_draft_watermark = 0; // Support add of a watermark on drafts
92
93 // Recupere emetteur
94 $this->emetteur = $mysoc;
95 if (!$this->emetteur->country_code) {
96 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
97 }
98 }
99
100
107 public function info($langs)
108 {
109 global $conf, $langs;
110
111 // Load translation files required by the page
112 $langs->loadLangs(array("errors", "companies"));
113
114 $form = new Form($this->db);
115
116 $texte = $this->description.".<br>\n";
117 $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
118 $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
119 $texte .= '<input type="hidden" name="page_y" value="">';
120 $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
121 $texte .= '<input type="hidden" name="param1" value="EXPEDITION_ADDON_PDF_ODT_PATH">';
122 $texte .= '<table class="nobordernopadding" width="100%">';
123
124 // List of directories area
125 $texte .= '<tr><td>';
126 $texttitle = $langs->trans("ListOfDirectories");
127 $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->EXPEDITION_ADDON_PDF_ODT_PATH)));
128 $listoffiles = array();
129 foreach ($listofdir as $key => $tmpdir) {
130 $tmpdir = trim($tmpdir);
131 $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
132 if (!$tmpdir) {
133 unset($listofdir[$key]);
134 continue;
135 }
136 if (!is_dir($tmpdir)) {
137 $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
138 } else {
139 $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
140 if (count($tmpfiles)) {
141 $listoffiles = array_merge($listoffiles, $tmpfiles);
142 }
143 }
144 }
145 $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
146 // Add list of substitution keys
147 $texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
148 $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
149
150 $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
151 $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
152 $texte .= '<textarea class="flat" cols="60" name="value1">';
153 $texte .= $conf->global->EXPEDITION_ADDON_PDF_ODT_PATH;
154 $texte .= '</textarea>';
155 $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
156 $texte .= '<input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'">';
157 $texte .= '<br></div></div>';
158
159 // Scan directories
160 $nbofiles = count($listoffiles);
161 if (!empty($conf->global->EXPEDITION_ADDON_PDF_ODT_PATH)) {
162 $texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
163 //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
164 $texte .= count($listoffiles);
165 //$texte.=$nbofiles?'</a>':'';
166 $texte .= '</b>';
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=shipments/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a>';
173 $texte .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?modulepart=doctemplates&keyforuploaddir=EXPEDITION_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="EXPEDITION_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
187 $texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
188 $texte .= '</div>';
189 $texte .= '</td>';
190
191 $texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
192 $texte .= '<span class="opacitymedium">';
193 $texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
194 $texte .= '</span>';
195 $texte .= '</td>';
196 $texte .= '</tr>';
197
198 $texte .= '</table>';
199 $texte .= '</form>';
200
201 return $texte;
202 }
203
204 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
216 public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
217 {
218 // phpcs:enable
219 global $user, $langs, $conf, $mysoc, $hookmanager;
220
221 if (empty($srctemplatepath)) {
222 dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
223 return -1;
224 }
225
226 // Add odtgeneration hook
227 if (!is_object($hookmanager)) {
228 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
229 $hookmanager = new HookManager($this->db);
230 }
231 $hookmanager->initHooks(array('odtgeneration'));
232 global $action;
233
234 if (!is_object($outputlangs)) {
235 $outputlangs = $langs;
236 }
237 $sav_charset_output = $outputlangs->charset_output;
238 $outputlangs->charset_output = 'UTF-8';
239
240 // Load traductions files required by page
241 $outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
242
243 if ($conf->expedition->dir_output."/sending") {
244 // If $object is id instead of object
245 if (!is_object($object)) {
246 $id = $object;
247 $object = new Expedition($this->db);
248 $result = $object->fetch($id);
249 if ($result < 0) {
250 dol_print_error($this->db, $object->error);
251 return -1;
252 }
253 }
254
255 $object->fetch_thirdparty();
256
257 $dir = $conf->expedition->dir_output."/sending";
258 $objectref = dol_sanitizeFileName($object->ref);
259 if (!preg_match('/specimen/i', $objectref)) {
260 $dir .= "/".$objectref;
261 }
262 $file = $dir."/".$objectref.".odt";
263
264 if (!file_exists($dir)) {
265 if (dol_mkdir($dir) < 0) {
266 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
267 return -1;
268 }
269 }
270
271 if (file_exists($dir)) {
272 //print "srctemplatepath=".$srctemplatepath; // Src filename
273 $newfile = basename($srctemplatepath);
274 $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile);
275 $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
276 $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
277 $newfiletmp = $objectref . '_' . $newfiletmp;
278 //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
279 // Get extension (ods or odt)
280 $newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
281 if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
282 $format = getDolGlobalString('MAIN_DOC_USE_TIMING');
283 if ($format == '1') {
284 $format = '%Y%m%d%H%M%S';
285 }
286 $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
287 } else {
288 $filename = $newfiletmp . '.' . $newfileformat;
289 }
290 $file = $dir . '/' . $filename;
291 //print "newdir=".$dir;
292 //print "newfile=".$newfile;
293 //print "file=".$file;
294 //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
295
296 dol_mkdir($conf->expedition->dir_temp);
297 if (!is_writable($conf->expedition->dir_temp)) {
298 $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->expedition->dir_temp);
299 dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
300 return -1;
301 }
302
303 // If SHIPMENT contact defined on invoice, we use it
304 $usecontact = false;
305 $arrayidcontact = $object->getIdContact('external', 'SHIPPING');
306 if (count($arrayidcontact) > 0) {
307 $usecontact = true;
308 $result = $object->fetch_contact($arrayidcontact[0]);
309 }
310
311 // Recipient name
312 $contactobject = null;
313 if (!empty($usecontact)) {
314 // We can use the company of contact instead of thirdparty company
315 if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
316 $object->contact->fetch_thirdparty();
317 $socobject = $object->contact->thirdparty;
318 $contactobject = $object->contact;
319 } else {
320 $socobject = $object->thirdparty;
321 // if we have a SHIPPING contact and we dont use it as thirdparty recipient we store the contact object for later use
322 $contactobject = $object->contact;
323 }
324 } else {
325 $socobject = $object->thirdparty;
326 }
327
328 // Make substitution
329 $substitutionarray = array(
330 '__FROM_NAME__' => $this->emetteur->name,
331 '__FROM_EMAIL__' => $this->emetteur->email,
332 '__TOTAL_TTC__' => $object->total_ttc,
333 '__TOTAL_HT__' => $object->total_ht,
334 '__TOTAL_VAT__' => $object->total_tva
335 );
336 complete_substitutions_array($substitutionarray, $langs, $object);
337 // Call the ODTSubstitution hook
338 $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
339 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
340
341 // Line of free text
342 $newfreetext = '';
343 $paramfreetext = 'EXPEDITION_FREE_TEXT';
344 if (!empty($conf->global->$paramfreetext)) {
345 $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
346 }
347
348 // Open and load template
349 require_once ODTPHP_PATH.'odf.php';
350 try {
351 $odfHandler = new Odf(
352 $srctemplatepath,
353 array(
354 'PATH_TO_TMP' => $conf->expedition->dir_temp,
355 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
356 'DELIMITER_LEFT' => '{',
357 'DELIMITER_RIGHT' => '}'
358 )
359 );
360 } catch (Exception $e) {
361 $this->error = $e->getMessage();
362 dol_syslog($e->getMessage(), LOG_INFO);
363 return -1;
364 }
365 // After construction $odfHandler->contentXml contains content and
366 // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
367 // [!-- BEGIN lines --]*[!-- END lines --]
368 //print html_entity_decode($odfHandler->__toString());
369 //print exit;
370
371
372 // Make substitutions into odt of freetext
373 try {
374 $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
375 } catch (OdfException $e) {
376 dol_syslog($e->getMessage(), LOG_INFO);
377 }
378
379 // Make substitutions into odt of user info
380 $tmparray = $this->get_substitutionarray_user($user, $outputlangs);
381 //var_dump($tmparray); exit;
382 foreach ($tmparray as $key => $value) {
383 try {
384 if (preg_match('/logo$/', $key)) { // Image
385 //var_dump($value);exit;
386 if (file_exists($value)) {
387 $odfHandler->setImage($key, $value);
388 } else {
389 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
390 }
391 } else // Text
392 {
393 $odfHandler->setVars($key, $value, true, 'UTF-8');
394 }
395 } catch (OdfException $e) {
396 dol_syslog($e->getMessage(), LOG_INFO);
397 }
398 }
399 // Make substitutions into odt of mysoc
400 $tmparray = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
401 //var_dump($tmparray); exit;
402 foreach ($tmparray as $key => $value) {
403 try {
404 if (preg_match('/logo$/', $key)) { // Image
405 //var_dump($value);exit;
406 if (file_exists($value)) {
407 $odfHandler->setImage($key, $value);
408 } else {
409 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
410 }
411 } else // Text
412 {
413 $odfHandler->setVars($key, $value, true, 'UTF-8');
414 }
415 } catch (OdfException $e) {
416 dol_syslog($e->getMessage(), LOG_INFO);
417 }
418 }
419 // Make substitutions into odt of thirdparty
420 if ($socobject->element == 'contact') {
421 $tmparray = $this->get_substitutionarray_contact($socobject, $outputlangs);
422 } else {
423 $tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
424 }
425 foreach ($tmparray as $key => $value) {
426 try {
427 if (preg_match('/logo$/', $key)) { // Image
428 if (file_exists($value)) {
429 $odfHandler->setImage($key, $value);
430 } else {
431 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
432 }
433 } else // Text
434 {
435 $odfHandler->setVars($key, $value, true, 'UTF-8');
436 }
437 } catch (OdfException $e) {
438 dol_syslog($e->getMessage(), LOG_INFO);
439 }
440 }
441
442 if ($usecontact && is_object($contactobject)) {
443 $tmparray = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
444 foreach ($tmparray as $key => $value) {
445 try {
446 if (preg_match('/logo$/', $key)) { // Image
447 if (file_exists($value)) {
448 $odfHandler->setImage($key, $value);
449 } else {
450 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
451 }
452 } else // Text
453 {
454 $odfHandler->setVars($key, $value, true, 'UTF-8');
455 }
456 } catch (OdfException $e) {
457 dol_syslog($e->getMessage(), LOG_INFO);
458 }
459 }
460 }
461
462 // Replace tags of object + external modules
463 $tmparray = array_merge($tmparray, $this->get_substitutionarray_shipment($object, $outputlangs));
464
465 complete_substitutions_array($tmparray, $outputlangs, $object);
466 // Call the ODTSubstitution hook
467 $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
468 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
469 foreach ($tmparray as $key => $value) {
470 try {
471 if (preg_match('/logo$/', $key)) { // Image
472 if (file_exists($value)) {
473 $odfHandler->setImage($key, $value);
474 } else {
475 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
476 }
477 } else // Text
478 {
479 $odfHandler->setVars($key, $value, true, 'UTF-8');
480 }
481 } catch (OdfException $e) {
482 dol_syslog($e->getMessage(), LOG_INFO);
483 }
484 }
485 // Replace tags of lines
486 try {
487 $foundtagforlines = 1;
488 try {
489 $listlines = $odfHandler->setSegment('lines');
490 } catch (OdfException $e) {
491 // We may arrive here if tags for lines not present into template
492 $foundtagforlines = 0;
493 dol_syslog($e->getMessage(), LOG_INFO);
494 }
495 if ($foundtagforlines) {
496 foreach ($object->lines as $line) {
497 $tmparray = $this->get_substitutionarray_shipment_lines($line, $outputlangs);
498 complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
499 // Call the ODTSubstitutionLine hook
500 $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
501 $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
502 foreach ($tmparray as $key => $val) {
503 try {
504 $listlines->setVars($key, $val, true, 'UTF-8');
505 } catch (OdfException $e) {
506 dol_syslog($e->getMessage(), LOG_INFO);
507 } catch (SegmentException $e) {
508 dol_syslog($e->getMessage(), LOG_INFO);
509 }
510 }
511 $listlines->merge();
512 }
513 $odfHandler->mergeSegment($listlines);
514 }
515 } catch (OdfException $e) {
516 $this->error = $e->getMessage();
517 dol_syslog($this->error, LOG_WARNING);
518 return -1;
519 }
520
521 // Replace labels translated
522 $tmparray = $outputlangs->get_translations_for_substitutions();
523 foreach ($tmparray as $key => $value) {
524 try {
525 $odfHandler->setVars($key, $value, true, 'UTF-8');
526 } catch (OdfException $e) {
527 dol_syslog($e->getMessage(), LOG_INFO);
528 }
529 }
530
531 // Call the beforeODTSave hook
532 $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
533 $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
534
535 // Write new file
536 if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
537 try {
538 $odfHandler->exportAsAttachedPDF($file);
539 } catch (Exception $e) {
540 $this->error = $e->getMessage();
541 dol_syslog($e->getMessage(), LOG_INFO);
542 return -1;
543 }
544 } else {
545 try {
546 $odfHandler->saveToDisk($file);
547 } catch (Exception $e) {
548 $this->error = $e->getMessage();
549 dol_syslog($e->getMessage(), LOG_INFO);
550 return -1;
551 }
552 }
553 $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
554 $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
555
556 dolChmod($file);
557
558 $odfHandler = null; // Destroy object
559
560 $this->result = array('fullpath'=>$file);
561
562 return 1; // Success
563 } else {
564 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
565 return -1;
566 }
567 }
568
569 return -1;
570 }
571}
get_substitutionarray_shipment($object, $outputlangs, $array_key='object')
Define array with couple substitution key => substitution value Note that vars into substitutions arr...
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_shipment_lines($line, $outputlangs)
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 shipments.
Class to manage generation of HTML components Only common components must be here.
Class to manage hooks.
Parent class of sending receipts models.
Class to build documents using ODF templates generator.
info($langs)
Return description of a module.
write_file($object, $outputlangs, $srctemplatepath, $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build a document on disk using the generic odt module.
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_dir_list($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:62
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dolChmod($filepath, $newmask='')
Change mod of a file.
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return 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:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:120
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:123
getMaxFileSizeArray()
Return the max allowed for file upload.