dolibarr 25.0.0-alpha
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-2025 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
9 *
10* This program is free software; you can redistribute it and/or modify
11* it under the terms of the GNU General Public License as published by
12* the Free Software Foundation; either version 3 of the License, or
13* (at your option) any later version.
14*
15* This program is distributed in the hope that it will be useful,
16* but WITHOUT ANY WARRANTY; without even the implied warranty of
17* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18* GNU General Public License for more details.
19*
20* You should have received a copy of the GNU General Public License
21* along with this program. If not, see <https://www.gnu.org/licenses/>.
22* or see https://www.gnu.org/
23*/
24
31require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
32require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
37
38
43{
48 public $version = 'dolibarr';
49
50
56 public function __construct($db)
57 {
58 global $conf, $langs, $mysoc;
59
60 // Load translation files required by the page
61 $langs->loadLangs(array("main", "companies"));
62
63 $this->db = $db;
64 $this->name = "ODT templates";
65 $this->description = $langs->trans("DocumentModelOdt");
66 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
67 $this->scandir = 'EXPEDITION_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
68
69 // Page size for A4 format
70 $this->type = 'odt';
71 $this->page_largeur = 0;
72 $this->page_hauteur = 0;
73 $this->format = array($this->page_largeur, $this->page_hauteur);
74 $this->marge_gauche = 0;
75 $this->marge_droite = 0;
76 $this->marge_haute = 0;
77 $this->marge_basse = 0;
78
79 $this->option_logo = 1; // Display logo
80 $this->option_tva = 0; // Manage the vat option EXPEDITION_TVAOPTION
81 $this->option_modereg = 0; // Display payment mode
82 $this->option_condreg = 0; // Display payment terms
83 $this->option_multilang = 1; // Available in several languages
84 $this->option_escompte = 0; // Displays if there has been a discount
85 $this->option_credit_note = 0; // Support credit notes
86 $this->option_freetext = 1; // Support add of a personalised text
87 $this->option_draft_watermark = 0; // Support add of a watermark on drafts
88
89 if ($mysoc === null) {
90 dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
91 return;
92 }
93
94 // Get source company
95 $this->emetteur = $mysoc;
96 if (!$this->emetteur->country_code) {
97 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
98 }
99 }
100
101
108 public function info($langs)
109 {
110 global $conf, $langs;
111
112 // Load translation files required by the page
113 $langs->loadLangs(array("errors", "companies"));
114
115 $form = new Form($this->db);
116
117 $odtPath = trim(getDolGlobalString('EXPEDITION_ADDON_PDF_ODT_PATH'));
118
119 $texte = $this->description.".<br>\n";
120 $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
121 $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
122 $texte .= '<input type="hidden" name="page_y" value="">';
123 $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
124 $texte .= '<input type="hidden" name="param1" value="EXPEDITION_ADDON_PDF_ODT_PATH">';
125 $texte .= '<table class="nobordernopadding centpercent">';
126
127 // List of directories area
128 $texte .= '<tr><td>';
129 $texttitle = $langs->trans("ListOfDirectories");
130 $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath));
131 $listoffiles = array();
132 foreach ($listofdir as $key => $tmpdir) {
133 $tmpdir = trim($tmpdir);
134 $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
135 if (!$tmpdir) {
136 unset($listofdir[$key]);
137 continue;
138 }
139 if (!is_dir($tmpdir)) {
140 $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), '');
141 } else {
142 $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
143 if (count($tmpfiles)) {
144 $listoffiles = array_merge($listoffiles, $tmpfiles);
145 }
146 }
147 }
148 $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
149 $texthelp .= '<br><br><span class="opacitymedium">'.$langs->trans("ExampleOfDirectoriesForModelGen").'</span>';
150 // Add list of substitution keys
151 $texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
152 $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
153
154 // Scan directories
155 $nbofiles = count($listoffiles);
156 if (!empty($odtPath)) {
157 $texte .= '<span class="opacitylow">'.$langs->trans("NumberOfModelFilesFound").': <b>';
158 //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
159 $texte .= count($listoffiles);
160 //$texte.=$nbofiles?'</a>':'';
161 $texte .= '</b></span><br>';
162 }
163 if ($nbofiles) {
164 $texte .= '<div id="div_'.get_class($this).'" class="hiddenx opacitylow">';
165 // Show list of found files
166 foreach ($listoffiles as $file) {
167 $texte .= '- '.$file['name'];
168 $texte .= ' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=shipments/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a>';
169 $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>';
170 $texte .= '<br>';
171 }
172 $texte .= '</div>';
173 }
174
175 $texte .= '<br>';
176 // Link to show/hide the area to manage directories of ODT models and template files
177 $texte .= '<span class="classlink cursorpointer" onclick="javascript: jQuery(\'.div_odtmodelsof'.get_class($this).'\').toggle();">'.img_picto('', 'add').' '.$langs->trans("UploadNewTemplate").'...</span>';
178 $texte .= '<div class="div_odtmodelsof'.get_class($this).'" style="display: none; margin-top: 6px;">';
179 $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
180 $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
181 $texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
182 $texte .= $odtPath;
183 $texte .= '</textarea>';
184 $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
185 $texte .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.dol_escape_htmltag($langs->trans("Modify")).'">';
186 $texte .= '<br></div></div>';
187
188 // Add input to upload a new template file.
189 $texte .= '<div>';
190 $maxfilesizearray = getMaxFileSizeArray();
191 $maxmin = $maxfilesizearray['maxmin'];
192 if ($maxmin > 0) {
193 $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
194 }
195 $texte .= ' <input type="file" name="uploadfile">';
196 $texte .= '<input type="hidden" value="EXPEDITION_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
197 $texte .= '<input type="submit" class="button smallpaddingimp reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
198 $texte .= '</div>';
199 $texte .= '</div>';
200 $texte .= '</td>';
201
202 $texte .= '</tr>';
203
204 $texte .= '</table>';
205 $texte .= '</form>';
206
207 return $texte;
208 }
209
210 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
222 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
223 {
224 // phpcs:enable
225 global $user, $langs, $conf, $mysoc, $hookmanager;
226
227 if (empty($srctemplatepath)) {
228 dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
229 return -1;
230 }
231
232 // Add odtgeneration hook
233 if (!is_object($hookmanager)) {
234 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
235 $hookmanager = new HookManager($this->db);
236 }
237 $hookmanager->initHooks(array('odtgeneration'));
238 global $action;
239
240 if (!is_object($outputlangs)) {
241 $outputlangs = $langs;
242 }
243 $sav_charset_output = $outputlangs->charset_output;
244 $outputlangs->charset_output = 'UTF-8';
245
246 // Load translation files required by page
247 $outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
248
249 if ($conf->expedition->multidir_output[$object->entity ?? $conf->entity]."/sending") {
250 // If $object is id instead of object
251 if (!is_object($object)) {
252 $id = $object;
253 $object = new Expedition($this->db);
254 $result = $object->fetch($id);
255 if ($result < 0) {
256 dol_print_error($this->db, $object->error);
257 return -1;
258 }
259 }
260
261 $object->fetch_thirdparty();
262
263 $dir = $conf->expedition->multidir_output[$object->entity ?? $conf->entity]."/sending";
264 $objectref = dol_sanitizeFileName($object->ref);
265 if (!preg_match('/specimen/i', $objectref)) {
266 $dir .= "/".$objectref;
267 }
268 $file = $dir."/".$objectref.".odt";
269
270 if (!file_exists($dir)) {
271 if (dol_mkdir($dir) < 0) {
272 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
273 return -1;
274 }
275 }
276
277 if (file_exists($dir)) {
278 //print "srctemplatepath=".$srctemplatepath; // Src filename
279 $newfile = basename($srctemplatepath);
280 $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile);
281 $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
282 $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
283 $newfiletmp = $objectref . '_' . $newfiletmp;
284 //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
285 // Get extension (ods or odt)
286 $newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
287 if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
288 $format = getDolGlobalString('MAIN_DOC_USE_TIMING');
289 if ($format == '1') {
290 $format = '%Y%m%d%H%M%S';
291 }
292 $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
293 } else {
294 $filename = $newfiletmp . '.' . $newfileformat;
295 }
296 $file = $dir . '/' . $filename;
297 //print "newdir=".$dir;
298 //print "newfile=".$newfile;
299 //print "file=".$file;
300 //print "conf->societe->dir_temp=".$conf->societe->dir_temp;
301
302 dol_mkdir($conf->expedition->dir_temp);
303 if (!is_writable($conf->expedition->dir_temp)) {
304 $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->expedition->dir_temp);
305 dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
306 return -1;
307 }
308
309 // If SHIPMENT contact defined on invoice, we use it
310 $usecontact = false;
311 $arrayidcontact = $object->getIdContact('external', 'SHIPPING');
312 if (count($arrayidcontact) > 0) {
313 $usecontact = true;
314 $result = $object->fetch_contact($arrayidcontact[0]);
315 }
316
317 // Recipient name
318 $contactobject = null;
319 if (!empty($usecontact)) {
320 // We can use the company of contact instead of thirdparty company
321 if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT'))) {
322 $object->contact->fetch_thirdparty();
323 $socobject = $object->contact->thirdparty;
324 $contactobject = $object->contact;
325 } else {
326 $socobject = $object->thirdparty;
327 // if we have a SHIPPING contact and we don't use it as thirdparty recipient we store the contact object for later use
328 $contactobject = $object->contact;
329 }
330 } else {
331 $socobject = $object->thirdparty;
332 }
333
334 // Make substitution
335 $substitutionarray = array(
336 '__FROM_NAME__' => $this->emetteur->name,
337 '__FROM_EMAIL__' => $this->emetteur->email,
338 '__TOTAL_TTC__' => $object->total_ttc,
339 '__TOTAL_HT__' => $object->total_ht,
340 '__TOTAL_VAT__' => $object->total_tva
341 );
342 complete_substitutions_array($substitutionarray, $langs, $object);
343 // Call the ODTSubstitution hook
344 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray);
345 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
346
347 // Line of free text
348 $newfreetext = '';
349 $paramfreetext = 'EXPEDITION_FREE_TEXT';
350 if (getDolGlobalString($paramfreetext)) {
351 $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
352 }
353
354 // Open and load template
355 require_once ODTPHP_PATH.'odf.php';
356 try {
357 $odfHandler = new Odf(
358 $srctemplatepath,
359 array(
360 'PATH_TO_TMP' => $conf->expedition->dir_temp,
361 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
362 'DELIMITER_LEFT' => '{',
363 'DELIMITER_RIGHT' => '}'
364 )
365 );
366 } catch (Exception $e) {
367 $this->error = $e->getMessage();
368 dol_syslog($e->getMessage(), LOG_INFO);
369 return -1;
370 }
371 // After construction $odfHandler->contentXml contains content and
372 // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
373 // [!-- BEGIN lines --]*[!-- END lines --]
374 //print html_entity_decode($odfHandler->__toString());
375 //print exit;
376
377
378 // Make substitutions into odt of freetext
379 try {
380 $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
381 } catch (OdfException $e) {
382 dol_syslog($e->getMessage(), LOG_INFO);
383 }
384
385 // retrieve the constant to apply a ratio for image size or set the ratio to 1
386 if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
387 $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
388 } else {
389 $ratio = 1;
390 }
391
392 // Make substitutions into odt of user info
393 $tmparray = $this->get_substitutionarray_user($user, $outputlangs);
394 foreach ($tmparray as $key => $value) {
395 try {
396 if (preg_match('/logo$/', $key)) { // Image
397 //var_dump($value);exit;
398 if (file_exists($value)) {
399 $odfHandler->setImage($key, $value, $ratio);
400 } else {
401 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
402 }
403 } else { // Text
404 $odfHandler->setVars($key, $value, true, 'UTF-8');
405 }
406 } catch (OdfException $e) {
407 dol_syslog($e->getMessage(), LOG_INFO);
408 }
409 }
410 // Make substitutions into odt of mysoc
411 $tmparray = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
412 foreach ($tmparray as $key => $value) {
413 try {
414 if (preg_match('/logo$/', $key)) { // Image
415 //var_dump($value);exit;
416 if (file_exists($value)) {
417 $odfHandler->setImage($key, $value, $ratio);
418 } else {
419 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
420 }
421 } else { // Text
422 $odfHandler->setVars($key, $value, true, 'UTF-8');
423 }
424 } catch (OdfException $e) {
425 dol_syslog($e->getMessage(), LOG_INFO);
426 }
427 }
428 // Make substitutions into odt of thirdparty
429 if ($socobject->element == 'contact') {
431 $tmparray = $this->get_substitutionarray_contact($socobject, $outputlangs);
432 } else {
433 $tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
434 }
435 foreach ($tmparray as $key => $value) {
436 try {
437 if (preg_match('/logo$/', $key)) { // Image
438 if (file_exists($value)) {
439 $odfHandler->setImage($key, $value, $ratio);
440 } else {
441 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
442 }
443 } else { // Text
444 $odfHandler->setVars($key, $value, true, 'UTF-8');
445 }
446 } catch (OdfException $e) {
447 dol_syslog($e->getMessage(), LOG_INFO);
448 }
449 }
450
451 if ($usecontact && is_object($contactobject)) {
452 $tmparray = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
453 foreach ($tmparray as $key => $value) {
454 try {
455 if (preg_match('/logo$/', $key)) { // Image
456 if (file_exists($value)) {
457 $odfHandler->setImage($key, $value, $ratio);
458 } else {
459 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
460 }
461 } else { // Text
462 $odfHandler->setVars($key, $value, true, 'UTF-8');
463 }
464 } catch (OdfException $e) {
465 dol_syslog($e->getMessage(), LOG_INFO);
466 }
467 }
468 }
469
470 // Replace tags of object + external modules
471 $tmparray = array_merge($tmparray, $this->get_substitutionarray_shipment($object, $outputlangs));
472 $tmparray = array_merge($tmparray, $this->get_substitutionarray_other($outputlangs));
473
474 complete_substitutions_array($tmparray, $outputlangs, $object);
475 // Call the ODTSubstitution hook
476 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
477 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
478
479 foreach ($tmparray as $key => $value) {
480 try {
481 if (preg_match('/logo$/', $key)) {
482 // Image
483 if (file_exists($value)) {
484 $odfHandler->setImage($key, $value, $ratio);
485 } else {
486 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
487 }
488 } else {
489 // Text
490 $odfHandler->setVars($key, $value, true, 'UTF-8');
491 }
492 } catch (OdfException $e) {
493 dol_syslog($e->getMessage(), LOG_INFO);
494 }
495 }
496
497 // Replace tags of lines
498 $foundtagforlines = 1;
499 try {
500 $listlines = $odfHandler->setSegment('lines');
501 } catch (OdfExceptionSegmentNotFound $e) {
502 // We may arrive here if tags for lines not present into template
503 $foundtagforlines = 0;
504 dol_syslog($e->getMessage(), LOG_INFO);
505 }
506 if ($foundtagforlines) {
507 $linenumber = 0;
508 foreach ($object->lines as $line) {
509 $linenumber++;
510 $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
511 complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
512 // Call the ODTSubstitutionLine hook
513 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line);
514 $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
515 foreach ($tmparray as $key => $val) {
516 try {
517 $listlines->setVars($key, $val, true, 'UTF-8');
518 } catch (SegmentException $e) {
519 dol_syslog($e->getMessage(), LOG_INFO);
520 }
521 }
522 $listlines->merge();
523 }
524 try {
525 $odfHandler->mergeSegment($listlines);
526 } catch (OdfException $e) {
527 $this->error = $e->getMessage();
528 dol_syslog($this->error, LOG_WARNING);
529 return -1;
530 }
531 }
532
533 // Replace labels translated
534 $tmparray = $outputlangs->get_translations_for_substitutions();
535 foreach ($tmparray as $key => $value) {
536 try {
537 $odfHandler->setVars($key, $value, true, 'UTF-8');
538 } catch (OdfException $e) {
539 dol_syslog($e->getMessage(), LOG_INFO);
540 }
541 }
542
543 // Call the beforeODTSave hook
544 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
545 $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
546
547 // Write new file
548 if (getDolGlobalString('MAIN_ODT_AS_PDF')) {
549 try {
550 $odfHandler->exportAsAttachedPDF($file);
551 } catch (Exception $e) {
552 $this->error = $e->getMessage();
553 dol_syslog($e->getMessage(), LOG_INFO);
554 return -1;
555 }
556 } else {
557 try {
558 $odfHandler->saveToDisk($file);
559 } catch (Exception $e) {
560 $this->error = $e->getMessage();
561 dol_syslog($e->getMessage(), LOG_INFO);
562 return -1;
563 }
564 }
565
566 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
567 $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
568
569 dolChmod($file);
570
571 $odfHandler = null; // Destroy object
572
573 $this->result = array('fullpath' => $file);
574
575 return 1; // Success
576 } else {
577 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
578 }
579 }
580
581 return -1;
582 }
583}
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Definition propal.php:281
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage generation of HTML components Only common components must be here.
Parent class of sending receipts models.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build a document on disk using the generic odt module.
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.
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:66
getCallerInfoString()
Get caller info as a string that can be appended to a log message.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
conf($dolibarr_main_document_root, $realpathconf=null)
Load conf file (file must exists)
Definition inc.php:431
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:165
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button