47 public $array_export_icon;
52 public $array_export_perms;
71 public $array_export_code = array();
75 public $array_export_code_for_sort = array();
79 public $array_export_module = array();
83 public $array_export_label = array();
87 public $array_export_sql_start = array();
91 public $array_export_sql_end = array();
95 public $array_export_sql_order = array();
100 public $array_export_fields = array();
104 public $array_export_TypeFields = array();
108 public $array_export_FilterValue = array();
112 public $array_export_entities = array();
116 public $array_export_dependencies = array();
120 public $array_export_special = array();
124 public $array_export_examplevalues = array();
128 public $array_export_help = array();
138 public $hexafiltervalue;
142 public $datatoexport;
155 public $sqlusedforexport;
180 global $langs,
$conf, $mysoc;
182 dol_syslog(get_class($this).
"::load_arrays user=".$user->id.
" filter=".$filter);
187 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
191 foreach ($modulesdir as $dir) {
194 if (is_resource($handle)) {
196 while (($file = readdir($handle)) !==
false) {
198 if (preg_match(
'/\.back$/i', $file)) {
203 if (is_readable($dir.$file) && preg_match(
"/^(mod.*)\.class\.php$/i", $file, $reg)) {
204 $modulename = $reg[1];
208 $part = strtolower(preg_replace(
'/^mod/i',
'', $modulename));
209 if ($part ==
'propale') {
212 if (empty(
$conf->$part->enabled)) {
218 $file = $dir.$modulename.
".class.php";
219 $classname = $modulename;
221 $module =
new $classname($this->db);
222 '@phan-var-force DolibarrModules $module';
224 if (isset($module->export_code) && is_array($module->export_code)) {
225 foreach ($module->export_code as $r => $value) {
227 if ($filter && ($filter != $module->export_code[$r])) {
232 if (!empty($module->export_enabled[$r]) && !
verifCond($module->export_enabled[$r])) {
238 if (isset($module->export_permission)) {
239 foreach ($module->export_permission[$r] as $val) {
242 if (!empty($perm[2])) {
243 $bool = isset($user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]}) ? $user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]} :
false;
244 } elseif (!empty($perm[1])) {
245 $bool = isset($user->rights->{$perm[0]}->{$perm[1]}) ? $user->rights->{$perm[0]}->{$perm[1]} :
false;
249 if ($perm[0] ==
'user' && $user->admin) {
263 $langtoload = $module->getLangFilesArray();
264 if (is_array($langtoload)) {
265 foreach ($langtoload as $key) {
272 $this->array_export_module[$i] = $module;
274 $this->array_export_perms[$i] = $bool;
276 $this->array_export_icon[$i] = (isset($module->export_icon[$r]) ? $module->export_icon[$r] : $module->picto);
278 $this->array_export_code[$i] = $module->export_code[$r];
280 $this->array_export_code_for_sort[$i] = $module->module_position.
'_'.$module->export_code[$r];
282 $this->array_export_label[$i] = $module->getExportDatasetLabel($r);
284 $this->array_export_fields[$i] = $module->export_fields_array[$r];
286 $this->array_export_TypeFields[$i] = (isset($module->export_TypeFields_array[$r]) ? $module->export_TypeFields_array[$r] :
'');
288 $this->array_export_entities[$i] = $module->export_entities_array[$r];
290 $this->array_export_dependencies[$i] = (!empty($module->export_dependencies_array[$r]) ? $module->export_dependencies_array[$r] :
'');
292 $this->array_export_special[$i] = (!empty($module->export_special_array[$r]) ? $module->export_special_array[$r] :
'');
294 $this->array_export_examplevalues[$i] = (!empty($module->export_examplevalues_array[$r]) ? $module->export_examplevalues_array[$r] :
null);
296 $this->array_export_help[$i] = (!empty($module->export_help_array[$r]) ? $module->export_help_array[$r] :
'');
299 $this->array_export_sql_start[$i] = $module->export_sql_start[$r];
300 $this->array_export_sql_end[$i] = $module->export_sql_end[$r];
301 $this->array_export_sql_order[$i] = (!empty($module->export_sql_order[$r]) ? $module->export_sql_order[$r] :
null);
305 dol_syslog(get_class($this).
"::load_arrays loaded for module ".$modulename.
" with index ".$i.
", dataset=".$module->export_code[$r].
", nb of fields=".(property_exists($module,
'export_fields_code') && !empty($module->export_fields_code[$r]) ? count($module->export_fields_code[$r]) :
''));
331 public function build_sql($indice, $array_selected, $array_filterValue)
335 $sql = $this->array_export_sql_start[$indice];
339 foreach ($this->array_export_fields[$indice] as $key => $value) {
340 if (!array_key_exists($key, $array_selected)) {
343 if (preg_match(
'/^none\./', $key)) {
352 if (strpos($key,
' as ') ===
false) {
353 $newfield = $key.
' as '.str_replace(array(
'.',
'-',
'(',
')'),
'_', $key);
360 $sql .= $this->array_export_sql_end[$indice];
363 if (is_array($array_filterValue) && !empty($array_filterValue)) {
366 foreach ($array_filterValue as $key => $value) {
367 if (preg_match(
'/GROUP_CONCAT/i', $key)) {
371 $sqlWhere .=
" AND ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]);
378 $sql .= $this->array_export_sql_order[$indice];
381 if (is_array($array_filterValue) && !empty($array_filterValue)) {
383 foreach ($array_filterValue as $key => $value) {
384 if (preg_match(
'/GROUP_CONCAT/i', $key) and $value !=
'') {
385 $sql .=
" HAVING ".$this->build_filterQuery($this->array_export_TypeFields[$indice][$key], $key, $array_filterValue[$key]);
409 $InfoFieldList = explode(
":", $TypeField);
411 switch ($InfoFieldList[0]) {
413 if (!(strpos($ValueField,
'%') ===
false)) {
414 $szFilterQuery =
" ".$this->db->sanitize($NameField).
" LIKE '".$this->db->escape($ValueField).
"'";
416 $szFilterQuery =
" ".$this->db->sanitize($NameField).
" = '".$this->db->escape($ValueField).
"'";
420 if (strpos($ValueField,
"+") > 0) {
422 $ValueArray = explode(
"+", $ValueField);
423 $szFilterQuery =
"(".$this->conditionDate($NameField, trim($ValueArray[0]),
">=");
424 $szFilterQuery .=
" AND ".$this->conditionDate($NameField, trim($ValueArray[1]),
"<=").
")";
426 if (is_numeric(substr($ValueField, 0, 1))) {
427 $szFilterQuery = $this->conditionDate($NameField, trim($ValueField),
"=");
429 $szFilterQuery = $this->conditionDate($NameField, trim(substr($ValueField, 1)), substr($ValueField, 0, 1));
436 if (strpos($ValueField,
"+") > 0) {
438 $ValueArray = explode(
"+", $ValueField);
439 $szFilterQuery =
"(".$NameField.
" >= ".((float) $ValueArray[0]);
440 $szFilterQuery .=
" AND ".$NameField.
" <= ".((float) $ValueArray[1]).
")";
442 if (is_numeric(substr($ValueField, 0, 1))) {
443 $szFilterQuery =
" ".$NameField.
" = ".((float) $ValueField);
445 $szFilterQuery =
" ".$NameField.substr($ValueField, 0, 1).((float) substr($ValueField, 1));
450 $szFilterQuery =
" ".$NameField.
"=".(is_numeric($ValueField) ? $ValueField : ($ValueField ==
'yes' ? 1 : 0));
453 if (is_numeric($ValueField) && $ValueField > 0) {
454 $szFilterQuery =
" ".$NameField.
" = ".((float) $ValueField);
456 $szFilterQuery =
" 1=1";
461 if (is_numeric($ValueField)) {
462 $szFilterQuery =
" ".$NameField.
" = ".((float) $ValueField);
464 if (!(strpos($ValueField,
'%') ===
false)) {
465 $szFilterQuery =
" ".$NameField.
" LIKE '".$this->db->escape($ValueField).
"'";
467 $szFilterQuery =
" ".$NameField.
" = '".$this->db->escape($ValueField).
"'";
472 dol_syslog(
"Error we try to forge an sql export request with a condition on a field with type ".$InfoFieldList[0].
" (defined into module descriptor) but this type is unknown/not supported. It looks like a bug into module descriptor.", LOG_ERR);
475 return $szFilterQuery;
489 if (strlen($Value) == 4) {
490 $Condition =
" date_format(".$Field.
",'%Y') ".$Sens.
" '".$this->db->escape($Value).
"'";
491 } elseif (strlen($Value) == 6) {
492 $Condition =
" date_format(".$Field.
",'%Y%m') ".$Sens.
" '".$this->db->escape($Value).
"'";
494 $Condition =
" date_format(".$Field.
",'%Y%m%d') ".$Sens.
" '".$this->db->escape($Value).
"'";
511 global $langs, $form;
514 $InfoFieldList = explode(
":", $TypeField);
517 switch ($InfoFieldList[0]) {
520 $szFilterField =
'<input type="text" name="'.$NameField.
'" value="'.$ValueField.
'">';
526 $szFilterField =
'<input type="text" size="6" name="'.$NameField.
'" value="'.$ValueField.
'">';
529 $szFilterField =
'<input type="number" size="6" name="'.$NameField.
'" value="'.$ValueField.
'">';
532 $szFilterField =
'<select name="'.$NameField.
'" id="'.
dol_escape_all($NameField).
'" class="flat width75 maxwidth75">';
533 $szFilterField .=
'<option ';
534 if ($ValueField ==
'') {
535 $szFilterField .=
' selected ';
537 $szFilterField .=
' value=""> </option>';
539 $szFilterField .=
'<option ';
540 if ($ValueField ==
'yes' || $ValueField ==
'1') {
541 $szFilterField .=
' selected ';
543 $szFilterField .=
' value="1">'.yn(1).
'</option>';
545 $szFilterField .=
'<option ';
546 if ($ValueField ==
'no' || $ValueField ==
'0') {
547 $szFilterField .=
' selected ';
549 $szFilterField .=
' value="0">'.yn(0).
'</option>';
550 $szFilterField .=
"</select>";
555 if ($InfoFieldList[1] ==
'select_company') {
556 $szFilterField .= $form->select_company(
'', $NameField,
'', 1, 0, 0, [], 0,
'maxwidth200');
557 } elseif ($InfoFieldList[1] ==
'selectcontacts') {
559 $szFilterField .= $form->select_contact(0,
'', $NameField,
' ',
'',
'', 0,
'minwidth100imp maxwidth200',
true);
560 } elseif ($InfoFieldList[1] ==
'select_dolusers') {
561 $szFilterField .= $form->select_dolusers(
'', $NameField, 1,
null, 0,
'',
'',
'', 0, 0,
"", 0,
"",
"maxwidth200");
571 if (!empty($InfoFieldList[3])) {
572 $keyList = $InfoFieldList[3];
576 $sql =
"SELECT ".$keyList.
" as rowid, ".$InfoFieldList[2].
" as label".(empty($InfoFieldList[3]) ?
"" :
", ".$InfoFieldList[3].
" as code");
577 if ($InfoFieldList[1] ==
'c_stcomm') {
578 $sql =
"SELECT id as id, ".$keyList.
" as rowid, ".$InfoFieldList[2].
" as label".(empty($InfoFieldList[3]) ?
"" :
", ".$InfoFieldList[3].
' as code');
580 if ($InfoFieldList[1] ==
'c_country') {
581 $sql =
"SELECT ".$keyList.
" as rowid, ".$InfoFieldList[2].
" as label, code as code";
583 $sql .=
" FROM ".MAIN_DB_PREFIX.$InfoFieldList[1];
584 if (!empty($InfoFieldList[4])) {
585 $sql .=
' WHERE entity IN ('.getEntity($InfoFieldList[4]).
')';
588 $resql = $this->db->query($sql);
590 $szFilterField =
'<select class="minwidth300 maxwidth500" name="'.$NameField.
'" id="'.
dol_escape_all($NameField).
'">';
591 $szFilterField .=
'<option value="0"> </option>';
592 $num = $this->db->num_rows($resql);
597 $obj = $this->db->fetch_object($resql);
598 if ($obj->label ==
'-') {
604 $labeltoshow = $obj->label;
605 if ($InfoFieldList[1] ==
'c_stcomm') {
606 $langs->load(
"companies");
607 $labeltoshow = (($langs->trans(
"StatusProspect".$obj->id) !=
"StatusProspect".$obj->id) ? $langs->trans(
"StatusProspect".$obj->id) : $obj->label);
609 if ($InfoFieldList[1] ==
'c_country') {
611 $langs->load(
"dict");
612 $labeltoshow = (($langs->trans(
"Country".$obj->code) !=
"Country".$obj->code) ? $langs->trans(
"Country".$obj->code) : $obj->label);
614 if (!empty($ValueField) && $ValueField == $obj->rowid) {
617 $szFilterField .=
'<option value="'.$obj->rowid.
'" data-html="'.
dolPrintHTMLForAttribute($labeltoshow).
'">'.$labeltoshow.
'</option>';
622 $szFilterField .=
"</select>";
625 $this->db->free($resql);
632 return $szFilterField;
646 $InfoFieldList = explode(
":", $TypeField);
648 switch ($InfoFieldList[0]) {
650 $szMsg = $langs->trans(
'ExportStringFilter');
653 $szMsg = $langs->trans(
'ExportDateFilter');
657 $szMsg = $langs->trans(
'ExportNumericFilter');
682 public function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery =
'', $separator =
'')
685 global
$conf, $langs, $mysoc;
688 asort($array_selected);
690 dol_syslog(__METHOD__.
" ".$model.
", ".$datatoexport.
", ".implode(
",", $array_selected));
693 if (empty($this->array_export_fields) || !is_array($this->array_export_fields)) {
694 $this->error =
"ErrorBadParameter";
700 $dir = DOL_DOCUMENT_ROOT.
"/core/modules/export/";
701 $file =
"export_".$model.
".modules.php";
702 $classname =
"Export".$model;
703 require_once $dir.$file;
704 $objmodel =
new $classname($this->db);
705 '@phan-var-force ModeleExports $objmodel';
707 if (in_array($model, array(
'csvutf8',
'csviso')) && !empty($separator) && property_exists($objmodel,
'separator')) {
709 $objmodel->separator = $separator;
712 if (!empty($sqlquery)) {
717 foreach ($this->array_export_code as $key => $dataset) {
718 if ($datatoexport == $dataset) {
725 if (empty($foundindice)) {
726 $this->error =
"ErrorBadParameter can't find dataset ".$datatoexport.
" into preload arrays this->array_export_code";
729 $sql = $this->build_sql($indice, $array_selected, $array_filterValue);
733 $this->sqlusedforexport = $sql;
735 $resql = $this->db->query($sql);
741 $filename =
"export_".$datatoexport;
746 $filename .=
'.'.$objmodel->getDriverExtension();
747 $dirname =
$conf->export->dir_temp.
'/'.$user->id;
749 $outputlangs = clone $langs;
753 $result = $objmodel->open_file($dirname.
"/".$filename, $outputlangs);
757 $objmodel->write_header($outputlangs);
760 $objmodel->write_title($this->array_export_fields[$indice], $array_selected, $outputlangs, isset($this->array_export_TypeFields[$indice]) ? $this->array_export_TypeFields[$indice] :
null);
762 while ($obj = $this->db->fetch_object($resql)) {
764 if (!empty($this->array_export_special[$indice])) {
765 foreach ($this->array_export_special[$indice] as $key => $value) {
766 if (!array_key_exists($key, $array_selected)) {
771 $item = $this->array_export_special[$indice][$key];
773 if (is_string($item) && $item ==
'NULLIFNEG') {
775 $alias = str_replace(array(
'.',
'-',
'(',
')'),
'_', $key);
776 if ($obj->$alias < 0) {
779 } elseif (is_string($item) && $item ==
'ZEROIFNEG') {
782 $alias = str_replace(array(
'.',
'-',
'(',
')'),
'_', $key);
783 if ($obj->$alias < 0) {
786 } elseif (is_string($item) && $item ==
'getNumOpenDays') {
788 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
790 $alias = str_replace(array(
'.',
'-',
'(',
')'),
'_', $key);
792 } elseif (is_string($item) && $item ==
'getRemainToPay') {
795 $alias = str_replace(array(
'.',
'-',
'(',
')'),
'_', $key);
797 if ($obj->f_rowid > 0) {
798 global $tmpobjforcomputecall;
799 if (!is_object($tmpobjforcomputecall)) {
800 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
801 $tmpobjforcomputecall =
new Facture($this->db);
803 $tmpobjforcomputecall->id = $obj->f_rowid;
804 $tmpobjforcomputecall->total_ttc = $obj->f_total_ttc;
805 $tmpobjforcomputecall->close_code = $obj->f_close_code;
806 $remaintopay = $tmpobjforcomputecall->getRemainToPay();
808 $obj->$alias = $remaintopay;
809 } elseif (is_array($item) && array_key_exists(
'rule', $item) && $item[
'rule'] ==
'compute') {
811 $alias = str_replace(array(
'.',
'-',
'(',
')'),
'_', $key);
813 if (!empty($item[
'class']) &&
814 !empty($item[
'classfile']) &&
815 !empty($item[
'method'])
818 $this->error =
"Computed field bad configuration: {$item['classfile']} not found";
822 if (!class_exists($item[
'class'])) {
823 $this->error =
"Computed field bad configuration: {$item['class']} class doesn't exist";
827 $className = $item[
'class'];
828 $tmpObject =
new $className($this->db);
829 '@phan-var-force CommonObject $tmpObject';
831 if (!method_exists($tmpObject, $item[
'method'])) {
832 $this->error =
"Computed field bad configuration: {$item['method']} method doesn't exist";
838 if (!empty($item[
'method_params'])) {
840 foreach ($item[
'method_params'] as $paramName) {
841 if (property_exists($obj, $paramName)) {
842 $params[] = $obj->$paramName;
844 $params[] = $paramName;
849 $value = $tmpObject->$methodName(...$params);
851 $obj->$alias = $value;
860 $this->error =
"ERRORNOTSUPPORTED. Operation not supported. Export of ".var_export($key,
true).
' '.var_export($item,
true).
" extrafields is not yet supported, please remove field.";
866 $objmodel->write_record($array_selected, $obj, $outputlangs, isset($this->array_export_TypeFields[$indice]) ? $this->array_export_TypeFields[$indice] :
null);
870 $objmodel->write_footer($outputlangs);
873 $objmodel->close_file();
877 $this->error = $objmodel->error;
878 dol_syslog(
"Export::build_file Error: ".$this->error, LOG_ERR);
882 $this->error = $this->db->error().
" - sql=".$sql;
899 $sql =
'INSERT INTO '.MAIN_DB_PREFIX.
'export_model (';
905 $sql .=
') VALUES (';
906 $sql .=
"'".$this->db->escape($this->model_name).
"',";
907 $sql .=
" '".$this->db->escape($this->datatoexport).
"',";
908 $sql .=
" '".$this->db->escape($this->hexa).
"',";
909 $sql .=
' '.(isset($this->fk_user) ? (int) $this->fk_user :
'null').
",";
910 $sql .=
" '".$this->db->escape($this->hexafiltervalue).
"'";
913 $resql = $this->db->query($sql);
918 $this->error = $this->db->lasterror();
919 $this->errno = $this->db->lasterrno();
920 $this->db->rollback();
933 $sql =
'SELECT em.rowid, em.label, em.type, em.field, em.filter';
934 $sql .=
' FROM '.MAIN_DB_PREFIX.
'export_model as em';
935 $sql .=
' WHERE em.rowid = '.((int)
$id);
938 $result = $this->db->query($sql);
940 $obj = $this->db->fetch_object($result);
942 $this->
id = $obj->rowid;
943 $this->model_name = $obj->label;
944 $this->datatoexport = $obj->type;
946 $this->hexa = $obj->field;
947 $this->hexafiltervalue = $obj->filter;
951 $this->error =
"ModelNotFound";
968 public function delete($user, $notrigger = 0)
972 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"export_model";
973 $sql .=
" WHERE rowid=".((int) $this->
id);
977 dol_syslog(get_class($this).
"::delete", LOG_DEBUG);
978 $resql = $this->db->query($sql);
981 $this->errors[] =
"Error ".$this->db->lasterror();
986 foreach ($this->errors as $errmsg) {
987 dol_syslog(get_class($this).
"::delete ".$errmsg, LOG_ERR);
988 $this->error .= ($this->error ?
', '.$errmsg : $errmsg);
990 $this->db->rollback();
1010 $sql =
"SELECT em.rowid, em.field, em.label, em.type, em.filter";
1011 $sql .=
" FROM ".MAIN_DB_PREFIX.
"export_model as em";
1012 $sql .=
" ORDER BY rowid";
1014 $result = $this->db->query($sql);
1016 $num = $this->db->num_rows($result);
1019 $obj = $this->db->fetch_object($result);
1020 $keyModel = array_search($obj->type, $this->array_export_code);
1022 print
'<td><a href=export.php?step=2&action=select_model&exportmodelid='.$obj->rowid.
'&datatoexport='.$obj->type.
'>'.$obj->label.
'</a></td>';
1024 print
img_object($this->array_export_module[$keyModel]->getName(), $this->array_export_icon[$keyModel]).
' ';
1025 print $this->array_export_module[$keyModel]->getName().
' - ';
1028 $string = $langs->trans($this->array_export_label[$keyModel]);
1029 print($string != $this->array_export_label[$keyModel] ? $string : $this->array_export_label[$keyModel]);
1032 print
'<td>'.str_replace(
',',
' , ', $obj->field).
'</td>';
1033 if (!empty($obj->filter)) {
1034 $filter = json_decode($obj->filter,
true);
1035 print
'<td>'.str_replace(
',',
' , ', $filter[
'field']).
'</td>';
1036 print
'<td>'.str_replace(
',',
' , ', $filter[
'value']).
'</td>';
1039 print
'<td class="right">';
1040 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=deleteprof&token='.
newToken().
'&id='.$obj->rowid.
'">';
$id
Support class for third parties, contacts, members, users or resources.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
fetch($id)
Load an export profil from database.
build_sql($indice, $array_selected, $array_filterValue)
Build the sql export request.
build_filterField($TypeField, $NameField, $ValueField)
Build an input field used to filter the query.
build_filterQuery($TypeField, $NameField, $ValueField)
Build the conditional string from filter the query.
conditionDate($Field, $Value, $Sens)
conditionDate
list_export_model()
Output list all export models –TODO Move this into a class htmlxxx.class.php–.
create($user)
Save an export model in database.
__construct($db)
Constructor.
load_arrays($user, $filter='')
Load an exportable dataset.
build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery='', $separator='')
Build export file.
genDocFilter($TypeField)
Build an input field used to filter the query.
Class to manage invoices.
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
verifCond($strToEvaluate, $onlysimplestring='1')
Verify if condition in string is ok or not.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolPrintHTMLForAttribute($s, $escapeonlyhtmltags=0, $allowothertags=array())
Return a string ready to be output into an HTML attribute (alt, title, data-html, ....
dol_escape_all($stringtoescape)
Returns text escaped for all protocols (so only alpha chars and numbers)
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.
sanitizeVal($out='', $check='alphanohtml', $filter=null, $options=null)
Return a sanitized or empty value after checking value against a rule.
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)
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...