dolibarr 18.0.6
doc_generic_proposal_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) 2016 Charlie Benke <charlie@patas-monkey.com>
5 * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
6 *
7* This program is free software; you can redistribute it and/or modify
8* it under the terms of the GNU General Public License as published by
9* the Free Software Foundation; either version 3 of the License, or
10* (at your option) any later version.
11*
12* This program is distributed in the hope that it will be useful,
13* but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15* GNU General Public License for more details.
16*
17* You should have received a copy of the GNU General Public License
18* along with this program. If not, see <https://www.gnu.org/licenses/>.
19* or see https://www.gnu.org/
20*/
21
28require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
29require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
35
36
41{
45 public $emetteur;
46
50 public $version = 'dolibarr';
51
52
58 public function __construct($db)
59 {
60 global $conf, $langs, $mysoc;
61
62 // Load translation files required by the page
63 $langs->loadLangs(array("main", "companies"));
64
65 $this->db = $db;
66 $this->name = "ODT templates";
67 $this->description = $langs->trans("DocumentModelOdt");
68 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
69 $this->scandir = 'PROPALE_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
70
71 // Page size for A4 format
72 $this->type = 'odt';
73 $this->page_largeur = 0;
74 $this->page_hauteur = 0;
75 $this->format = array($this->page_largeur, $this->page_hauteur);
76 $this->marge_gauche = 0;
77 $this->marge_droite = 0;
78 $this->marge_haute = 0;
79 $this->marge_basse = 0;
80
81 $this->option_logo = 1; // Display logo
82 $this->option_tva = 0; // Manage the vat option PROPALE_TVAOPTION
83 $this->option_modereg = 0; // Display payment mode
84 $this->option_condreg = 0; // Display payment terms
85 $this->option_multilang = 1; // Available in several languages
86 $this->option_escompte = 0; // Displays if there has been a discount
87 $this->option_credit_note = 0; // Support credit notes
88 $this->option_freetext = 1; // Support add of a personalised text
89 $this->option_draft_watermark = 0; // Support add of a watermark on drafts
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("errors", "companies"));
111
112 $form = new Form($this->db);
113
114 $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0;
115 $odtPath = trim(getDolGlobalString('PROPALE_ADDON_PDF_ODT_PATH'));
116
117 $texte = $this->description.".<br>\n";
118 $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
119 $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
120 $texte .= '<input type="hidden" name="page_y" value="">';
121 $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
122 $texte .= '<input type="hidden" name="param1" value="PROPALE_ADDON_PDF_ODT_PATH">';
123 if ($odtChosen) {
124 $texte .= '<input type="hidden" name="param2" value="PROPALE_ADDON_PDF_ODT_DEFAULT">';
125 $texte .= '<input type="hidden" name="param3" value="PROPALE_ADDON_PDF_ODT_TOBILL">';
126 $texte .= '<input type="hidden" name="param4" value="PROPALE_ADDON_PDF_ODT_CLOSED">';
127 }
128 $texte .= '<table class="nobordernopadding centpercent">';
129
130 // List of directories area
131 $texte .= '<tr><td>';
132 $texttitle = $langs->trans("ListOfDirectories");
133 $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath));
134 $listoffiles = array();
135 foreach ($listofdir as $key => $tmpdir) {
136 $tmpdir = trim($tmpdir);
137 $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
138 if (!$tmpdir) {
139 unset($listofdir[$key]);
140 continue;
141 }
142 if (!is_dir($tmpdir)) {
143 $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
144 } else {
145 $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
146 if (count($tmpfiles)) {
147 $listoffiles = array_merge($listoffiles, $tmpfiles);
148 }
149 }
150 }
151 $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
152 // Add list of substitution keys
153 $texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
154 $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
155
156 $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
157 $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
158 $texte .= '<textarea class="flat" cols="60" name="value1">';
159 $texte .= $odtPath;
160 $texte .= '</textarea>';
161 $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
162 $texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
163 $texte .= '<br></div></div>';
164
165 // Scan directories
166 $nbofiles = count($listoffiles);
167 if (!empty($odtPath)) {
168 $texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
169 //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
170 $texte .= count($listoffiles);
171 //$texte.=$nbofiles?'</a>':'';
172 $texte .= '</b>';
173 }
174
175 if ($nbofiles) {
176 $texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
177 // Show list of found files
178 foreach ($listoffiles as $file) {
179 $texte .= '- '.$file['name'];
180 $texte .= ' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=proposals/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a>';
181 $texte .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?modulepart=doctemplates&keyforuploaddir=PROPALE_ADDON_PDF_ODT_PATH&action=deletefile&token='.newToken().'&file='.urlencode(basename($file['name'])).'">'.img_picto('', 'delete').'</a>';
182 $texte .= '<br>';
183 }
184 $texte .= '</div>';
185
186 // Set default template for different status of proposal
187 if ($odtChosen) {
188 // Model for creation
189 $list = ModelePDFPropales::liste_modeles($this->db);
190 $texte .= '<table width="50%">';
191 $texte .= '<tr>';
192 $texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalCreate").'</td>';
193 $texte .= '<td colspan="">';
194 $texte .= $form->selectarray('value2', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT'));
195 $texte .= "</td></tr>";
196
197 $texte .= '<tr>';
198 $texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalToBill").'</td>';
199 $texte .= '<td colspan="">';
200 $texte .= $form->selectarray('value3', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL'));
201 $texte .= "</td></tr>";
202 $texte .= '<tr>';
203
204 $texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalClosed").'</td>';
205 $texte .= '<td colspan="">';
206 $texte .= $form->selectarray('value4', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED'));
207 $texte .= "</td></tr>";
208 $texte .= '</table>';
209 }
210 }
211 // Add input to upload a new template file.
212 $texte .= '<div>'.$langs->trans("UploadNewTemplate");
213 $maxfilesizearray = getMaxFileSizeArray();
214 $maxmin = $maxfilesizearray['maxmin'];
215 if ($maxmin > 0) {
216 $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
217 }
218 $texte .= ' <input type="file" name="uploadfile">';
219 $texte .= '<input type="hidden" value="PROPALE_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
220 $texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
221 $texte .= '</div>';
222 $texte .= '</td>';
223
224 $texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
225 $texte .= '<span class="opacitymedium">';
226 $texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
227 $texte .= '</span>';
228 $texte .= '</td>';
229 $texte .= '</tr>';
230
231 $texte .= '</table>';
232 $texte .= '</form>';
233
234 return $texte;
235 }
236
237 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
249 public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
250 {
251 // phpcs:enable
252 global $user, $langs, $conf, $mysoc, $hookmanager;
253
254 if (empty($srctemplatepath)) {
255 dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
256 return -1;
257 }
258
259 // Add odtgeneration hook
260 if (!is_object($hookmanager)) {
261 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
262 $hookmanager = new HookManager($this->db);
263 }
264 $hookmanager->initHooks(array('odtgeneration'));
265 global $action;
266
267 if (!is_object($outputlangs)) {
268 $outputlangs = $langs;
269 }
270 $sav_charset_output = $outputlangs->charset_output;
271 $outputlangs->charset_output = 'UTF-8';
272
273 // Load translation files required by the page
274 $outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
275
276 if ($conf->propal->multidir_output[$conf->entity]) {
277 // If $object is id instead of object
278 if (!is_object($object)) {
279 $id = $object;
280 $object = new Propal($this->db);
281 $result = $object->fetch($id);
282 if ($result < 0) {
283 dol_print_error($this->db, $object->error);
284 return -1;
285 }
286 }
287
288 $object->fetch_thirdparty();
289
290 $dir = $conf->propal->multidir_output[$object->entity];
291 $objectref = dol_sanitizeFileName($object->ref);
292 if (!preg_match('/specimen/i', $objectref)) {
293 $dir .= "/".$objectref;
294 }
295 $file = $dir."/".$objectref.".odt";
296
297 if (!file_exists($dir)) {
298 if (dol_mkdir($dir) < 0) {
299 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
300 return -1;
301 }
302 }
303
304 if (file_exists($dir)) {
305 //print "srctemplatepath=".$srctemplatepath; // Src filename
306 $newfile = basename($srctemplatepath);
307 $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile);
308 $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
309 $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
310
311 $newfiletmp = $objectref . '_' . $newfiletmp;
312
313 // Get extension (ods or odt)
314 $newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
315 if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
316 $format = getDolGlobalString('MAIN_DOC_USE_TIMING');
317 if ($format == '1') {
318 $format = '%Y%m%d%H%M%S';
319 }
320 $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
321 } else {
322 $filename = $newfiletmp . '.' . $newfileformat;
323 }
324 $file = $dir . '/' . $filename;
325 //print "newdir=".$dir;
326 //print "newfile=".$newfile;
327 //print "file=".$file;
328 //print "conf->propal->dir_temp=".$conf->propal->dir_temp;
329
330 dol_mkdir($conf->propal->multidir_temp[$object->entity]);
331 if (!is_writable($conf->propal->dir_temp)) {
332 $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->propal->dir_temp);
333 dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
334 return -1;
335 }
336
337 // If CUSTOMER contact defined on proposal, we use it
338 $usecontact = false;
339 $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
340 if (count($arrayidcontact) > 0) {
341 $usecontact = true;
342 $result = $object->fetch_contact($arrayidcontact[0]);
343 }
344
345 // Recipient name
346 $contactobject = null;
347 if (!empty($usecontact)) {
348 // We can use the company of contact instead of thirdparty company
349 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))) {
350 $object->contact->fetch_thirdparty();
351 $socobject = $object->contact->thirdparty;
352 $contactobject = $object->contact;
353 } else {
354 $socobject = $object->thirdparty;
355 // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
356 $contactobject = $object->contact;
357 }
358 } else {
359 $socobject = $object->thirdparty;
360 }
361 // Make substitution
362 $substitutionarray = array(
363 '__FROM_NAME__' => $this->emetteur->name,
364 '__FROM_EMAIL__' => $this->emetteur->email,
365 '__TOTAL_TTC__' => $object->total_ttc,
366 '__TOTAL_HT__' => $object->total_ht,
367 '__TOTAL_VAT__' => $object->total_tva
368 );
369 complete_substitutions_array($substitutionarray, $langs, $object);
370 // Call the ODTSubstitution hook
371 $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
372 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
373
374 // Line of free text
375 $newfreetext = '';
376 $paramfreetext = 'PROPOSAL_FREE_TEXT';
377 if (!empty($conf->global->$paramfreetext)) {
378 $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
379 }
380
381 // Open and load template
382 require_once ODTPHP_PATH.'odf.php';
383 try {
384 $odfHandler = new Odf(
385 $srctemplatepath,
386 array(
387 'PATH_TO_TMP' => $conf->propal->multidir_temp[$object->entity],
388 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
389 'DELIMITER_LEFT' => '{',
390 'DELIMITER_RIGHT' => '}'
391 )
392 );
393 } catch (Exception $e) {
394 $this->error = $e->getMessage();
395 dol_syslog($e->getMessage(), LOG_INFO);
396 return -1;
397 }
398 // After construction $odfHandler->contentXml contains content and
399 // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
400 // [!-- BEGIN lines --]*[!-- END lines --]
401 //print html_entity_decode($odfHandler->__toString());
402 //print exit;
403
404 $object->fetch_optionals();
405
406 // Make substitutions into odt of freetext
407 try {
408 $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
409 } catch (OdfException $e) {
410 dol_syslog($e->getMessage(), LOG_INFO);
411 }
412
413 // Define substitution array
414 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
415 $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs);
416 $array_objet = $this->get_substitutionarray_object($object, $outputlangs);
417 $array_user = $this->get_substitutionarray_user($user, $outputlangs);
418 $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
419 $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
420 $array_other = $this->get_substitutionarray_other($outputlangs);
421 // retrieve contact information for use in object as contact_xxx tags
422 $array_thirdparty_contact = array();
423 if ($usecontact && is_object($contactobject)) {
424 $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
425 }
426
427 $tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
428 complete_substitutions_array($tmparray, $outputlangs, $object);
429
430 // Call the ODTSubstitution hook
431 $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
432 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
433
434 foreach ($tmparray as $key => $value) {
435 try {
436 if (preg_match('/logo$/', $key)) { // Image
437 if (file_exists($value)) {
438 $odfHandler->setImage($key, $value);
439 } else {
440 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
441 }
442 } else // Text
443 {
444 $odfHandler->setVars($key, $value, true, 'UTF-8');
445 }
446 } catch (OdfException $e) {
447 dol_syslog($e->getMessage(), LOG_INFO);
448 }
449 }
450 // Replace tags of lines
451 try {
452 $foundtagforlines = 1;
453 try {
454 $listlines = $odfHandler->setSegment('lines');
455 } catch (OdfException $e) {
456 // We may arrive here if tags for lines not present into template
457 $foundtagforlines = 0;
458 dol_syslog($e->getMessage(), LOG_INFO);
459 }
460 if ($foundtagforlines) {
461 $linenumber = 0;
462 foreach ($object->lines as $line) {
463 $linenumber++;
464 $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
465 complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
466 // Call the ODTSubstitutionLine hook
467 $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
468 $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
469 foreach ($tmparray as $key => $val) {
470 try {
471 $listlines->setVars($key, $val, true, 'UTF-8');
472 } catch (OdfException $e) {
473 dol_syslog($e->getMessage(), LOG_INFO);
474 } catch (SegmentException $e) {
475 dol_syslog($e->getMessage(), LOG_INFO);
476 }
477 }
478 $listlines->merge();
479 }
480 $odfHandler->mergeSegment($listlines);
481 }
482 } catch (OdfException $e) {
483 $this->error = $e->getMessage();
484 dol_syslog($this->error, LOG_WARNING);
485 return -1;
486 }
487
488 // Replace labels translated
489 $tmparray = $outputlangs->get_translations_for_substitutions();
490 foreach ($tmparray as $key => $value) {
491 try {
492 $odfHandler->setVars($key, $value, true, 'UTF-8');
493 } catch (OdfException $e) {
494 dol_syslog($e->getMessage(), LOG_INFO);
495 }
496 }
497
498 // Call the beforeODTSave hook
499 $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
500 $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
501
502 // Write new file
503 if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
504 try {
505 $odfHandler->exportAsAttachedPDF($file);
506 } catch (Exception $e) {
507 $this->error = $e->getMessage();
508 dol_syslog($e->getMessage(), LOG_INFO);
509 return -1;
510 }
511 } else {
512 try {
513 $odfHandler->saveToDisk($file);
514 } catch (Exception $e) {
515 $this->error = $e->getMessage();
516 dol_syslog($e->getMessage(), LOG_INFO);
517 return -1;
518 }
519 }
520 $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
521 $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
522
523 dolChmod($file);
524
525 $odfHandler = null; // Destroy object
526
527 $this->result = array('fullpath'=>$file);
528
529 return 1; // Success
530 } else {
531 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
532 return -1;
533 }
534 }
535
536 return -1;
537 }
538}
get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive=1)
Define array with couple substitution key => substitution value.
get_substitutionarray_object($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_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.
Classe mere des modeles de propale.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage proposals.
Class to build documents using ODF templates generator.
write_file($object, $outputlangs, $srctemplatepath, $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build a document on disk using the generic odt module.
info($langs)
Return description of a 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.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
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.