dolibarr 23.0.3
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-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/propale/modules_propale.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';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
36
37
42{
47 public $emetteur;
48
53 public $phpmin = array(7, 0);
54
58 public $version = 'dolibarr';
59
60
66 public function __construct($db)
67 {
68 global $langs, $mysoc;
69
70 // Load translation files required by the page
71 $langs->loadLangs(array("main", "companies"));
72
73 $this->db = $db;
74 $this->name = "ODT templates";
75 $this->description = $langs->trans("DocumentModelOdt");
76 $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
77 $this->scandir = 'PROPALE_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
78
79 // Page size for A4 format
80 $this->type = 'odt';
81 $this->page_largeur = 0;
82 $this->page_hauteur = 0;
83 $this->format = array($this->page_largeur, $this->page_hauteur);
84 $this->marge_gauche = 0;
85 $this->marge_droite = 0;
86 $this->marge_haute = 0;
87 $this->marge_basse = 0;
88
89 $this->option_logo = 1; // Display logo
90 $this->option_tva = 0; // Manage the vat option PROPALE_TVAOPTION
91 $this->option_modereg = 0; // Display payment mode
92 $this->option_condreg = 0; // Display payment terms
93 $this->option_multilang = 1; // Available in several languages
94 $this->option_escompte = 0; // Displays if there has been a discount
95 $this->option_credit_note = 0; // Support credit notes
96 $this->option_freetext = 1; // Support add of a personalised text
97 $this->option_draft_watermark = 0; // Support add of a watermark on drafts
98
99 if ($mysoc === null) {
100 dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR);
101 return;
102 }
103
104 // Get source company
105 $this->emetteur = $mysoc;
106 if (!$this->emetteur->country_code) {
107 $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
108 }
109 }
110
111
118 public function info($langs)
119 {
120 global $langs;
121
122 // Load translation files required by the page
123 $langs->loadLangs(array("errors", "companies"));
124
125 $form = new Form($this->db);
126
127 $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0;
128 $odtPath = trim(getDolGlobalString('PROPALE_ADDON_PDF_ODT_PATH'));
129
130 $texte = $this->description.".<br>\n";
131 $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
132 $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
133 $texte .= '<input type="hidden" name="page_y" value="">';
134 $texte .= '<input type="hidden" name="action" value="setModuleOptions">';
135 $texte .= '<input type="hidden" name="param1" value="PROPALE_ADDON_PDF_ODT_PATH">';
136 if ($odtChosen) {
137 $texte .= '<input type="hidden" name="param2" value="PROPALE_ADDON_PDF_ODT_DEFAULT">';
138 $texte .= '<input type="hidden" name="param3" value="PROPALE_ADDON_PDF_ODT_TOBILL">';
139 $texte .= '<input type="hidden" name="param4" value="PROPALE_ADDON_PDF_ODT_CLOSED">';
140 }
141 $texte .= '<table class="nobordernopadding centpercent">';
142
143 // List of directories area
144 $texte .= '<tr><td>';
145 $texttitle = $langs->trans("ListOfDirectories");
146 $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath));
147 $listoffiles = array();
148 foreach ($listofdir as $key => $tmpdir) {
149 $tmpdir = trim($tmpdir);
150 $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
151 if (!$tmpdir) {
152 unset($listofdir[$key]);
153 continue;
154 }
155 if (!is_dir($tmpdir)) {
156 $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), '');
157 } else {
158 $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
159 if (count($tmpfiles)) {
160 $listoffiles = array_merge($listoffiles, $tmpfiles);
161 }
162 }
163 }
164 $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
165 $texthelp .= '<br><br><span class="opacitymedium">'.$langs->trans("ExampleOfDirectoriesForModelGen").'</span>';
166 // Add list of substitution keys
167 $texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
168 $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
169
170 // Scan directories
171 $nbofiles = count($listoffiles);
172 if (!empty($odtPath)) {
173 $texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
174 //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
175 $texte .= count($listoffiles);
176 //$texte.=$nbofiles?'</a>':'';
177 $texte .= '</b><br>';
178 }
179
180 if ($nbofiles) {
181 $texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
182 // Show list of found files
183 foreach ($listoffiles as $file) {
184 $texte .= '- '.$file['name'];
185 $texte .= ' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=proposals/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a>';
186 $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>';
187 $texte .= '<br>';
188 }
189 $texte .= '</div>';
190
191 // Set default template for different status of proposal
192 if ($odtChosen) {
193 // Model for creation
194 $list = ModelePDFPropales::liste_modeles($this->db);
195 $texte .= '<table width="50%">';
196 $texte .= '<tr>';
197 $texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalCreate").'</td>';
198 $texte .= '<td colspan="">';
199 $texte .= $form->selectarray('value2', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT'));
200 $texte .= "</td></tr>";
201
202 $texte .= '<tr>';
203 $texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalToBill").'</td>';
204 $texte .= '<td colspan="">';
205 $texte .= $form->selectarray('value3', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL'));
206 $texte .= "</td></tr>";
207 $texte .= '<tr>';
208
209 $texte .= '<td width="60%">'.$langs->trans("DefaultModelPropalClosed").'</td>';
210 $texte .= '<td colspan="">';
211 $texte .= $form->selectarray('value4', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED'));
212 $texte .= "</td></tr>";
213 $texte .= '</table>';
214 }
215 }
216
217 $texte .= '<br>';
218 $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
219 $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
220 $texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
221 $texte .= $odtPath;
222 $texte .= '</textarea>';
223 $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
224 $texte .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.dolPrintHTMLForAttribute($langs->trans("Modify")).'">';
225 $texte .= '<br></div></div>';
226
227 // Add input to upload a new template file.
228 $texte .= '<div>'.$langs->trans("UploadNewTemplate");
229 $maxfilesizearray = getMaxFileSizeArray();
230 $maxmin = $maxfilesizearray['maxmin'];
231 if ($maxmin > 0) {
232 $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
233 }
234 $texte .= ' <input type="file" name="uploadfile">';
235 $texte .= '<input type="hidden" value="PROPALE_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
236 $texte .= '<input type="submit" class="button smallpaddingimp reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
237 $texte .= '</div>';
238 $texte .= '</td>';
239
240 $texte .= '</tr>';
241
242 $texte .= '</table>';
243 $texte .= '</form>';
244
245 return $texte;
246 }
247
248 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
260 public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
261 {
262 // phpcs:enable
263 global $user, $langs, $conf, $mysoc, $hookmanager;
264
265 if (empty($srctemplatepath)) {
266 dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
267 return -1;
268 }
269
270 // Add odtgeneration hook
271 if (!is_object($hookmanager)) {
272 include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
273 $hookmanager = new HookManager($this->db);
274 }
275 $hookmanager->initHooks(array('odtgeneration'));
276 global $action;
277
278 if (!is_object($outputlangs)) {
279 $outputlangs = $langs;
280 }
281 $sav_charset_output = $outputlangs->charset_output;
282 $outputlangs->charset_output = 'UTF-8';
283
284 // Load translation files required by the page
285 $outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
286
287 if ($conf->propal->multidir_output[$conf->entity]) {
288 // If $object is id instead of object
289 if (!is_object($object)) {
290 $id = $object;
291 $object = new Propal($this->db);
292 $result = $object->fetch($id);
293 if ($result < 0) {
294 dol_print_error($this->db, $object->error);
295 return -1;
296 }
297 }
298
299 $object->fetch_thirdparty();
300
301 $dir = $conf->propal->multidir_output[$object->entity ?? $conf->entity];
302 $objectref = dol_sanitizeFileName($object->ref);
303 if (!preg_match('/specimen/i', $objectref)) {
304 $dir .= "/".$objectref;
305 }
306 $file = $dir."/".$objectref.".odt";
307
308 if (!file_exists($dir)) {
309 if (dol_mkdir($dir) < 0) {
310 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
311 return -1;
312 }
313 }
314
315 if (file_exists($dir)) {
316 //print "srctemplatepath=".$srctemplatepath; // Src filename
317 $newfile = basename($srctemplatepath);
318 $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile);
319 $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
320 $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
321
322 $newfiletmp = $objectref . '_' . $newfiletmp;
323
324 // Get extension (ods or odt)
325 $newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
326 if (getDolGlobalString('MAIN_DOC_USE_TIMING')) {
327 $format = getDolGlobalString('MAIN_DOC_USE_TIMING');
328 if ($format == '1') {
329 $format = '%Y%m%d%H%M%S';
330 }
331 $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
332 } else {
333 $filename = $newfiletmp . '.' . $newfileformat;
334 }
335 $file = $dir . '/' . $filename;
336 //print "newdir=".$dir;
337 //print "newfile=".$newfile;
338 //print "file=".$file;
339 //print "conf->propal->dir_temp=".$conf->propal->dir_temp;
340
341 dol_mkdir($conf->propal->multidir_temp[$object->entity]);
342 if (!is_writable($conf->propal->dir_temp)) {
343 $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->propal->dir_temp);
344 dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
345 return -1;
346 }
347
348 // If CUSTOMER contact defined on proposal, we use it
349 $usecontact = false;
350 $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
351 if (count($arrayidcontact) > 0) {
352 $usecontact = true;
353 $result = $object->fetch_contact($arrayidcontact[0]);
354 }
355
356 // Recipient name
357 $contactobject = null;
358 if (!empty($usecontact)) {
359 // We can use the company of contact instead of thirdparty company
360 if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT'))) {
361 $object->contact->fetch_thirdparty();
362 $socobject = $object->contact->thirdparty;
363 $contactobject = $object->contact;
364 } else {
365 $socobject = $object->thirdparty;
366 // if we have a CUSTOMER contact and we don't use it as thirdparty recipient we store the contact object for later use
367 $contactobject = $object->contact;
368 }
369 } else {
370 $socobject = $object->thirdparty;
371 }
372 // Make substitution
373 $substitutionarray = array(
374 '__FROM_NAME__' => $this->emetteur->name,
375 '__FROM_EMAIL__' => $this->emetteur->email,
376 '__TOTAL_TTC__' => $object->total_ttc,
377 '__TOTAL_HT__' => $object->total_ht,
378 '__TOTAL_VAT__' => $object->total_tva
379 );
380 complete_substitutions_array($substitutionarray, $langs, $object);
381 // Call the ODTSubstitution hook
382 $parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray);
383 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
384
385 // Line of free text
386 $newfreetext = '';
387 $paramfreetext = 'PROPOSAL_FREE_TEXT';
388 if (getDolGlobalString($paramfreetext)) {
389 $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
390 }
391
392 // Open and load template
393 require_once ODTPHP_PATH.'odf.php';
394 try {
395 $odfHandler = new Odf(
396 $srctemplatepath,
397 array(
398 'PATH_TO_TMP' => $conf->propal->multidir_temp[$object->entity],
399 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
400 'DELIMITER_LEFT' => '{',
401 'DELIMITER_RIGHT' => '}'
402 )
403 );
404 } catch (Exception $e) {
405 $this->error = $e->getMessage();
406 dol_syslog($e->getMessage(), LOG_INFO);
407 return -1;
408 }
409 // After construction $odfHandler->contentXml contains content and
410 // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
411 // [!-- BEGIN lines --]*[!-- END lines --]
412 //print html_entity_decode($odfHandler->__toString());
413 //print exit;
414
415 $object->fetch_optionals();
416
417 // Make substitutions into odt of freetext
418 try {
419 $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
420 } catch (OdfException $e) {
421 dol_syslog($e->getMessage(), LOG_INFO);
422 }
423
424 // Define substitution array
425 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
426 $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs);
427 $array_objet = $this->get_substitutionarray_object($object, $outputlangs);
428 $array_user = $this->get_substitutionarray_user($user, $outputlangs);
429 $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
430 $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
431 $array_other = $this->get_substitutionarray_other($outputlangs);
432
433 include_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
434 $companybankaccount = new CompanyBankAccount($this->db);
435 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
436 $companybankaccount->fetch(0, '', $object->thirdparty->id);
437 $array_objet['company_default_bank_iban'] = $companybankaccount->iban;
438 $array_objet['company_default_bank_bic'] = $companybankaccount->bic;
439
440 // retrieve contact information for use in object as contact_xxx tags
441 $array_thirdparty_contact = array();
442 if ($usecontact && is_object($contactobject)) {
443 $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
444 }
445
446 $tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
447 complete_substitutions_array($tmparray, $outputlangs, $object);
448
449 // Call the ODTSubstitution hook
450 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
451 $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
452
453 // retrieve the constant to apply a ratio for image size or set the ratio to 1
454 if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
455 $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
456 } else {
457 $ratio = 1;
458 }
459
460 foreach ($tmparray as $key => $value) {
461 try {
462 if (preg_match('/logo$/', $key)) {
463 // Image
464 if (file_exists($value)) {
465 $odfHandler->setImage($key, $value, $ratio);
466 } else {
467 $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
468 }
469 } else {
470 // Text
471 $odfHandler->setVars($key, $value, true, 'UTF-8');
472 }
473 } catch (OdfException $e) {
474 dol_syslog($e->getMessage(), LOG_INFO);
475 }
476 }
477 // Replace tags of lines
478 $foundtagforlines = 1;
479 try {
480 $listlines = $odfHandler->setSegment('lines');
481 } catch (OdfExceptionSegmentNotFound $e) {
482 // We may arrive here if tags for lines not present into template
483 $foundtagforlines = 0;
484 dol_syslog($e->getMessage(), LOG_INFO);
485 }
486 if ($foundtagforlines) {
487 $linenumber = 0;
488 foreach ($object->lines as $line) {
490 $linenumber++;
491 $tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
492 complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
493 // Call the ODTSubstitutionLine hook
494 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line);
495 $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
496 foreach ($tmparray as $key => $val) {
497 try {
498 $listlines->setVars($key, $val, true, 'UTF-8');
499 } catch (SegmentException $e) {
500 dol_syslog($e->getMessage(), LOG_INFO);
501 }
502 }
503 $listlines->merge();
504 }
505 try {
506 $odfHandler->mergeSegment($listlines);
507 } catch (OdfException $e) {
508 $this->error = $e->getMessage();
509 dol_syslog($this->error, LOG_WARNING);
510 return -1;
511 }
512 }
513
514 // Replace labels translated
515 $tmparray = $outputlangs->get_translations_for_substitutions();
516 foreach ($tmparray as $key => $value) {
517 try {
518 $odfHandler->setVars($key, $value, true, 'UTF-8');
519 } catch (OdfException $e) {
520 dol_syslog($e->getMessage(), LOG_INFO);
521 }
522 }
523
524 // Call the beforeODTSave hook
525 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
526 $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
527
528 // Write new file
529 if (getDolGlobalString('MAIN_ODT_AS_PDF')) {
530 try {
531 $odfHandler->exportAsAttachedPDF($file);
532 } catch (Exception $e) {
533 $this->error = $e->getMessage();
534 dol_syslog($e->getMessage(), LOG_INFO);
535 return -1;
536 }
537 } else {
538 try {
539 $odfHandler->saveToDisk($file);
540 } catch (Exception $e) {
541 $this->error = $e->getMessage();
542 dol_syslog($e->getMessage(), LOG_INFO);
543 return -1;
544 }
545 }
546 $parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
547 $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
548
549 dolChmod($file);
550
551 $odfHandler = null; // Destroy object
552
553 $this->result = array('fullpath' => $file);
554
555 return 1; // Success
556 } else {
557 $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
558 return -1;
559 }
560 }
561
562 return -1;
563 }
564}
$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 bank accounts description of third parties.
Class to manage generation of HTML components Only common components must be here.
Class to manage hooks.
Class mere des modeles de propale.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build document.
Class to manage proposals.
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: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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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:125
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:128
getMaxFileSizeArray()
Return the max allowed for file upload.