dolibarr  16.0.5
doc_generic_product_odt.modules.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2012 Laurent Destailleur <eldy@products.sourceforge.net>
3  * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
4  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
5  *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20 
27 require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
33 
34 
39 {
44  public $emetteur;
45 
50  public $phpmin = array(5, 6);
51 
56  public $version = 'dolibarr';
57 
58 
64  public function __construct($db)
65  {
66  global $conf, $langs, $mysoc;
67 
68  // Load translation files required by the page
69  $langs->loadLangs(array("main", "companies"));
70 
71  $this->db = $db;
72  $this->name = "ODT templates";
73  $this->description = $langs->trans("DocumentModelOdt");
74  $this->scandir = 'PRODUCT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
75 
76  // Page size for A4 format
77  $this->type = 'odt';
78  $this->page_largeur = 0;
79  $this->page_hauteur = 0;
80  $this->format = array($this->page_largeur, $this->page_hauteur);
81  $this->marge_gauche = 0;
82  $this->marge_droite = 0;
83  $this->marge_haute = 0;
84  $this->marge_basse = 0;
85 
86  $this->option_logo = 1; // Display logo
87  $this->option_tva = 0; // Manage the vat option PRODUCT_TVAOPTION
88  $this->option_modereg = 0; // Display payment mode
89  $this->option_condreg = 0; // Display payment terms
90  $this->option_multilang = 1; // Available in several languages
91  $this->option_escompte = 0; // Displays if there has been a discount
92  $this->option_credit_note = 0; // Support credit notes
93  $this->option_freetext = 1; // Support add of a personalised text
94  $this->option_draft_watermark = 0; // Support add of a watermark on drafts
95 
96  // Get source company
97  $this->emetteur = $mysoc;
98  if (!$this->emetteur->country_code) {
99  $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
100  }
101  }
102 
103 
110  public function info($langs)
111  {
112  global $conf, $langs;
113 
114  // Load translation files required by the page
115  $langs->loadLangs(array("errors", "companies"));
116 
117  $form = new Form($this->db);
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="PRODUCT_ADDON_PDF_ODT_PATH">';
125  $texte .= '<table class="nobordernopadding" width="100%">';
126 
127  // List of directories area
128  $texte .= '<tr><td>';
129  $texttitle = $langs->trans("ListOfDirectories");
130  $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PRODUCT_ADDON_PDF_ODT_PATH)));
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), 0);
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  // Add list of substitution keys
150  $texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
151  $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
152 
153  $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
154  $texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
155  $texte .= '<textarea class="flat" cols="60" name="value1">';
156  $texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH;
157  $texte .= '</textarea>';
158  $texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
159  $texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
160  $texte .= '<br></div></div>';
161 
162  // Scan directories
163  $nbofiles = count($listoffiles);
164  if (!empty($conf->global->PRODUCT_ADDON_PDF_ODT_PATH)) {
165  $texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
166  }
167 
168  if ($nbofiles) {
169  $texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
170  // Show list of found files
171  foreach ($listoffiles as $file) {
172  $texte .= '- '.$file['name'];
173  $texte .= ' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=products/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a>';
174  $texte .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?modulepart=doctemplates&keyforuploaddir=PRODUCT_ADDON_PDF_ODT_PATH&action=deletefile&token='.newToken().'&file='.urlencode(basename($file['name'])).'">'.img_picto('', 'delete').'</a>';
175  $texte .= '<br>';
176  }
177  $texte .= '</div>';
178  }
179  // Add input to upload a new template file.
180  $texte .= '<div>'.$langs->trans("UploadNewTemplate");
181  $maxfilesizearray = getMaxFileSizeArray();
182  $maxmin = $maxfilesizearray['maxmin'];
183  if ($maxmin > 0) {
184  $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
185  }
186  $texte .= ' <input type="file" name="uploadfile">';
187  $texte .= '<input type="hidden" value="PRODUCT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
188  $texte .= '<input type="submit" class="button small reposition" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
189  $texte .= '</div>';
190 
191  $texte .= '</td>';
192 
193  $texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
194  $texte .= '<span class="opacitymedium">';
195  $texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
196  $texte .= '</span>';
197  $texte .= '</td>';
198  $texte .= '</tr>';
199 
200  $texte .= '</table>';
201  $texte .= '</form>';
202 
203  return $texte;
204  }
205 
206  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
218  public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
219  {
220  // phpcs:enable
221  global $product, $langs, $conf, $mysoc, $hookmanager, $user;
222 
223  if (empty($srctemplatepath)) {
224  dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
225  return -1;
226  }
227 
228  // Add odtgeneration hook
229  if (!is_object($hookmanager)) {
230  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
231  $hookmanager = new HookManager($this->db);
232  }
233  $hookmanager->initHooks(array('odtgeneration'));
234  global $action;
235 
236  if (!is_object($outputlangs)) {
237  $outputlangs = $langs;
238  }
239  $sav_charset_output = $outputlangs->charset_output;
240  $outputlangs->charset_output = 'UTF-8';
241 
242  // Load translation files required by the page
243  $outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
244 
245  if ($conf->product->dir_output) {
246  // If $object is id instead of object
247  if (!is_object($object)) {
248  $id = $object;
249  $object = new Product($this->db);
250  $result = $object->fetch($id);
251  if ($result < 0) {
252  dol_print_error($this->db, $object->error);
253  return -1;
254  }
255  }
256  $productFournisseur = new ProductFournisseur($this->db);
257  $supplierprices = $productFournisseur->list_product_fournisseur_price($object->id);
258  $object->supplierprices = $supplierprices;
259 
260  $dir = $conf->product->dir_output;
261  $objectref = dol_sanitizeFileName($object->ref);
262  if (!preg_match('/specimen/i', $objectref)) {
263  $dir .= "/".$objectref;
264  }
265  $file = $dir."/".$objectref.".odt";
266 
267  if (!file_exists($dir)) {
268  if (dol_mkdir($dir) < 0) {
269  $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
270  return -1;
271  }
272  }
273 
274  if (file_exists($dir)) {
275  //print "srctemplatepath=".$srctemplatepath; // Src filename
276  $newfile = basename($srctemplatepath);
277  $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
278  $newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
279  $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
280 
281  $newfiletmp = $objectref.'_'.$newfiletmp;
282 
283  // Get extension (ods or odt)
284  $newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
285  if (!empty($conf->global->MAIN_DOC_USE_TIMING)) {
286  $format = $conf->global->MAIN_DOC_USE_TIMING;
287  if ($format == '1') {
288  $format = '%Y%m%d%H%M%S';
289  }
290  $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
291  } else {
292  $filename = $newfiletmp.'.'.$newfileformat;
293  }
294  $file = $dir.'/'.$filename;
295  //print "newdir=".$dir;
296  //print "newfile=".$newfile;
297  //print "file=".$file;
298  //print "conf->product->dir_temp=".$conf->product->dir_temp;
299 
300  dol_mkdir($conf->product->dir_temp);
301  if (!is_writable($conf->product->dir_temp)) {
302  $this->error = "Failed to write in temp directory ".$conf->product->dir_temp;
303  dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
304  return -1;
305  }
306 
307  // If CUSTOMER contact defined on product, we use it
308  $usecontact = false;
309  $arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
310  if (count($arrayidcontact) > 0) {
311  $usecontact = true;
312  $result = $object->fetch_contact($arrayidcontact[0]);
313  }
314 
315  // Recipient name
316  $contactobject = null;
317  if (!empty($usecontact)) {
318  // We can use the company of contact instead of thirdparty company
319  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))) {
320  $object->contact->fetch_thirdparty();
321  $socobject = $object->contact->thirdparty;
322  $contactobject = $object->contact;
323  } else {
324  $socobject = $object->thirdparty;
325  // if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
326  $contactobject = $object->contact;
327  }
328  } else {
329  $socobject = $object->thirdparty;
330  }
331  // Make substitution
332  $substitutionarray = array(
333  '__FROM_NAME__' => $this->emetteur->name,
334  '__FROM_EMAIL__' => $this->emetteur->email,
335  '__TOTAL_TTC__' => $object->total_ttc,
336  '__TOTAL_HT__' => $object->total_ht,
337  '__TOTAL_VAT__' => $object->total_vat
338  );
339  complete_substitutions_array($substitutionarray, $langs, $object);
340  // Call the ODTSubstitution hook
341  $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
342  $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
343 
344  // Line of free text
345  $newfreetext = '';
346  $paramfreetext = 'PRODUCT_FREE_TEXT';
347  if (!empty($conf->global->$paramfreetext)) {
348  $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
349  }
350 
351  // Open and load template
352  require_once ODTPHP_PATH.'odf.php';
353  try {
354  $odfHandler = new odf(
355  $srctemplatepath,
356  array(
357  'PATH_TO_TMP' => $conf->product->dir_temp,
358  'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
359  'DELIMITER_LEFT' => '{',
360  'DELIMITER_RIGHT' => '}'
361  )
362  );
363  } catch (Exception $e) {
364  $this->error = $e->getMessage();
365  dol_syslog($e->getMessage(), LOG_INFO);
366  return -1;
367  }
368  // After construction $odfHandler->contentXml contains content and
369  // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
370  // [!-- BEGIN lines --]*[!-- END lines --]
371  //print html_entity_decode($odfHandler->__toString());
372  //print exit;
373 
374 
375  // Make substitutions into odt of freetext
376  try {
377  $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
378  } catch (OdfException $e) {
379  dol_syslog($e->getMessage(), LOG_INFO);
380  }
381 
382  // Define substitution array
383  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
384  $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs);
385  //$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
386  $array_user = $this->get_substitutionarray_user($user, $outputlangs);
387  $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
388  $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
389  $array_other = $this->get_substitutionarray_other($outputlangs);
390  // retrieve contact information for use in object as contact_xxx tags
391  $array_thirdparty_contact = array();
392  if ($usecontact && is_object($contactobject)) {
393  $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
394  }
395 
396  $tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact);
397  complete_substitutions_array($tmparray, $outputlangs, $object);
398 
399  // Call the ODTSubstitution hook
400  $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
401  $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
402 
403  foreach ($tmparray as $key => $value) {
404  try {
405  if (preg_match('/logo$/', $key)) { // Image
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  // Replace tags of lines
420  try {
421  $listlines = $odfHandler->setSegment('supplierprices');
422  if (!empty($object->supplierprices)) {
423  foreach ($object->supplierprices as $supplierprice) {
424  $array_lines = $this->get_substitutionarray_each_var_object($supplierprice, $outputlangs);
425  complete_substitutions_array($array_lines, $outputlangs, $object, $supplierprice, "completesubstitutionarray_lines");
426  // Call the ODTSubstitutionLine hook
427  $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$array_lines, 'line'=>$supplierprice);
428  $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
429  foreach ($array_lines as $key => $val) {
430  try {
431  $listlines->setVars($key, $val, true, 'UTF-8');
432  } catch (OdfException $e) {
433  dol_syslog($e->getMessage(), LOG_INFO);
434  } catch (SegmentException $e) {
435  dol_syslog($e->getMessage(), LOG_INFO);
436  }
437  }
438  $listlines->merge();
439  }
440  }
441  $odfHandler->mergeSegment($listlines);
442  } catch (OdfException $e) {
443  $this->error = $e->getMessage();
444  dol_syslog($this->error, LOG_WARNING);
445  return -1;
446  }
447 
448  // Replace labels translated
449  $tmparray = $outputlangs->get_translations_for_substitutions();
450  foreach ($tmparray as $key => $value) {
451  try {
452  $odfHandler->setVars($key, $value, true, 'UTF-8');
453  } catch (OdfException $e) {
454  dol_syslog($e->getMessage(), LOG_INFO);
455  }
456  }
457 
458  // Call the beforeODTSave hook
459  $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
460  $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
461 
462  // Write new file
463  if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
464  try {
465  $odfHandler->exportAsAttachedPDF($file);
466  } catch (Exception $e) {
467  $this->error = $e->getMessage();
468  dol_syslog($e->getMessage(), LOG_INFO);
469  return -1;
470  }
471  } else {
472  try {
473  $odfHandler->saveToDisk($file);
474  } catch (Exception $e) {
475  $this->error = $e->getMessage();
476  dol_syslog($e->getMessage(), LOG_INFO);
477  return -1;
478  }
479  }
480 
481  $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
482  $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
483 
484  if (!empty($conf->global->MAIN_UMASK)) {
485  @chmod($file, octdec($conf->global->MAIN_UMASK));
486  }
487 
488  $odfHandler = null; // Destroy object
489 
490  $this->result = array('fullpath'=>$file);
491 
492  return 1; // Success
493  } else {
494  $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
495  return -1;
496  }
497  }
498 
499  return -1;
500  }
501 }
make_substitutions
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Definition: functions.lib.php:7839
doc_generic_product_odt\write_file
write_file($object, $outputlangs, $srctemplatepath, $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build a document on disk using the generic odt module.
Definition: doc_generic_product_odt.modules.php:218
db
$conf db
API class for accounts.
Definition: inc.php:41
dol_sanitizeFileName
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Definition: functions.lib.php:1226
description
print *****$script_file(".$version.") pid cd cd cd description as description
Definition: email_expire_services_to_customers.php:83
ProductFournisseur
Class to manage predefined suppliers products.
Definition: fournisseur.product.class.php:41
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
CommonDocGenerator\get_substitutionarray_user
get_substitutionarray_user($user, $outputlangs)
Define array with couple substitution key => substitution value.
Definition: commondocgenerator.class.php:108
doc_generic_product_odt\info
info($langs)
Return description of a module.
Definition: doc_generic_product_odt.modules.php:110
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4521
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
dol_dir_list
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
Definition: files.lib.php:60
name
$conf db name
Definition: repair.php:122
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
CommonDocGenerator\get_substitutionarray_contact
get_substitutionarray_contact($object, $outputlangs, $array_key='object')
Define array with couple substitution key => substitution value.
Definition: commondocgenerator.class.php:321
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
getMaxFileSizeArray
getMaxFileSizeArray()
Return the max allowed for file upload.
Definition: security.lib.php:993
Exception
CommonDocGenerator\get_substitutionarray_thirdparty
get_substitutionarray_thirdparty($object, $outputlangs, $array_key='company')
Define array with couple substitution key => substitution value For example {company_name},...
Definition: commondocgenerator.class.php:256
CommonDocGenerator\get_substitutionarray_each_var_object
get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive=1)
Define array with couple substitution key => substitution value.
Definition: commondocgenerator.class.php:841
getCommonSubstitutionArray
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
Definition: functions.lib.php:7275
doc_generic_product_odt
Class to build documents using ODF templates generator.
Definition: doc_generic_product_odt.modules.php:38
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
CommonDocGenerator\get_substitutionarray_mysoc
get_substitutionarray_mysoc($mysoc, $outputlangs)
Define array with couple substitution key => substitution value.
Definition: commondocgenerator.class.php:197
ModelePDFProduct
Parent class to manage intervention document templates.
Definition: modules_product.class.php:34
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
Product
Class to manage products or services.
Definition: product.class.php:46
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
doc_generic_product_odt\__construct
__construct($db)
Constructor.
Definition: doc_generic_product_odt.modules.php:64
dol_mkdir
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
Definition: functions.lib.php:6603
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119
HookManager
Class to manage hooks.
Definition: hookmanager.class.php:30
complete_substitutions_array
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...
Definition: functions.lib.php:7961
CommonDocGenerator\get_substitutionarray_other
get_substitutionarray_other($outputlangs)
Define array with couple substitution key => substitution value.
Definition: commondocgenerator.class.php:379