33 public $items = array();
38 public $setupNotEmpty = 0;
47 protected $maxItemRank;
53 public $htmlBeforeOutputForm =
'';
59 public $htmlAfterOutputForm =
'';
65 public $htmlOutputMoreButton =
'';
72 public $formAttributes = array(
81 public $formHiddenInputs = array();
86 public $errors = array();
101 $this->form =
new Form($this->db);
102 $this->formAttributes[
'action'] = $_SERVER[
"PHP_SELF"];
104 $this->formHiddenInputs[
'token'] =
newToken();
105 $this->formHiddenInputs[
'action'] =
'update';
107 $this->entity = (is_null($this->entity) ?
$conf->entity : $this->entity);
110 $this->langs = $outputLangs;
112 $this->langs = $langs;
125 if (is_array($attributes)) {
126 foreach ($attributes as $attribute => $value) {
127 if (is_array($value) || is_object($value)) {
134 return !empty($Aattr) ? implode(
' ', $Aattr) :
'';
147 global $hookmanager, $action;
149 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
152 'editMode' => $editMode
154 $reshook = $hookmanager->executeHooks(
'formSetupBeforeGenerateOutput', $parameters, $this, $action);
160 return $hookmanager->resPrint;
162 $out =
'<!-- Start generateOutput from FormSetup class -->';
163 $out .= $this->htmlBeforeOutputForm;
169 if (!empty($this->formHiddenInputs) && is_array($this->formHiddenInputs)) {
170 foreach ($this->formHiddenInputs as $hiddenKey => $hiddenValue) {
171 $out .=
'<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).
'" value="' .
dol_escape_htmltag($hiddenValue) .
'">';
180 $reshook = $hookmanager->executeHooks(
'formSetupBeforeGenerateOutputButton', $parameters, $this, $action);
186 return $hookmanager->resPrint;
187 } elseif ($editMode) {
188 $out .=
'<div class="form-setup-button-container center">';
189 $out .= $this->htmlOutputMoreButton;
190 $out .=
'<input class="button button-save" type="submit" value="' . $this->langs->trans(
"Save") .
'">';
201 $out .= $this->htmlAfterOutputForm;
216 global $hookmanager, $action;
217 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
220 'editMode' => $editMode
222 $reshook = $hookmanager->executeHooks(
'formSetupBeforeGenerateTableOutput', $parameters, $this, $action);
228 return $hookmanager->resPrint;
230 $out =
'<table class="noborder centpercent">';
231 if (empty($hideTitle)) {
233 $out .=
'<tr class="liste_titre">';
234 $out .=
' <td>' . $this->langs->trans(
"Parameter") .
'</td>';
235 $out .=
' <td>' . $this->langs->trans(
"Value") .
'</td>';
244 foreach ($this->items as $item) {
262 global $hookmanager,
$conf;
264 $parameters = array();
265 $reshook = $hookmanager->executeHooks(
'formSetupBeforeSaveConfFromPost', $parameters, $this);
267 $this->errors = $hookmanager->errors;
275 if (empty($this->items)) {
281 foreach ($this->items as $item) {
282 if ($item->getType() ==
'yesno' && !empty(
$conf->use_javascript_ajax)) {
286 $res = $item->setValueFromPost();
288 $item->saveConfValue();
289 } elseif ($res < 0) {
297 if (empty($noMessageInUpdate)) {
302 $this->db->rollback();
303 if (empty($noMessageInUpdate)) {
320 if ($item->enabled == 1) {
321 $trClass =
'oddeven';
322 if ($item->getType() ==
'title') {
323 $trClass =
'liste_titre';
325 if (!empty($item->fieldParams[
'trClass'])) {
326 $trClass .=
' '.$item->fieldParams[
'trClass'];
329 $this->setupNotEmpty++;
330 $out .=
'<tr class="'.$trClass.
'">';
332 $out .=
'<td class="col-setup-title">';
333 $out .=
'<span id="helplink'.$item->confKey.
'" class="spanforparamtooltip">';
334 $out .= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1,
'info',
'', 0, 3,
'tootips'.$item->confKey);
341 $out .= $item->generateInputField();
343 $out .= $item->generateOutputField();
346 if (!empty($item->errors)) {
367 if (!is_array($params) || empty($params)) {
370 foreach ($params as $confKey => $param) {
387 if (empty($confKey) || empty($params[
'type'])) {
406 $item->setTypeFromTypeString($params['type']);
408 if (!empty($params[
'enabled']) && is_numeric($params[
'enabled'])) {
409 $item->enabled = (int) $params[
'enabled'];
412 if (!empty($params[
'css'])) {
413 $item->cssClass = (string) $params[
'css'];
416 $this->items[$item->confKey] = $item;
429 $arrayofparameters = array();
430 foreach ($this->items as $item) {
431 $arrayofparameters[$item->confKey] = array(
432 'type' => $item->getType(),
433 'enabled' => $item->enabled
437 return $arrayofparameters;
448 if (!array($this->items)) {
451 foreach ($this->items as $item) {
452 $item->loadValueFromConf();
468 public function newItem($confKey, $targetItemKey =
'', $insertAfterTarget =
false)
472 $item->entity = $this->entity;
475 if (empty($item->rank)) {
481 if (!empty($targetItemKey)) {
482 if (isset($this->items[$targetItemKey])) {
483 $targetItem = $this->items[$targetItemKey];
484 $item->rank = $targetItem->rank;
485 if ($targetItem->rank >= 0 && $insertAfterTarget) {
491 foreach ($this->items as $fItem) {
492 if ($item->rank <= $fItem->rank) {
499 $this->items[$item->confKey] = $item;
500 return $this->items[$item->confKey];
511 return uasort($this->items, array($this,
'itemSort'));
522 if (empty($this->items)) {
526 if ($cache && $this->maxItemRank > 0) {
527 return $this->maxItemRank;
530 $this->maxItemRank = 0;
531 foreach ($this->items as $item) {
532 $this->maxItemRank = max($this->maxItemRank, $item->rank);
535 return $this->maxItemRank;
547 $this->maxItemRank = max($this->maxItemRank, $rank);
559 if (!isset($this->items[$itemKey]->rank)) {
562 return $this->items[$itemKey]->rank;
575 if (empty($a->rank)) {
578 if (empty($b->rank)) {
581 if ($a->rank == $b->rank) {
584 return ($a->rank < $b->rank) ? -1 : 1;
613 public $nameText =
false;
616 public $helpText =
'';
625 public $defaultFieldValue =
null;
628 public $fieldAttr = array();
631 public $fieldOverride =
false;
634 public $fieldInputOverride =
false;
637 public $fieldOutputOverride =
false;
643 public $fieldOptions = array();
646 public $fieldParams = array();
657 public $errors = array();
665 protected $type =
'string';
674 public $cssClass =
'';
684 global $langs, $db,
$conf, $form;
687 if (!empty($form) && is_object($form) && get_class($form) ==
'Form') {
690 $this->form =
new Form($this->db);
693 $this->langs = $langs;
694 $this->entity = (is_null($this->entity) ?
$conf->entity : ((int) $this->entity));
696 $this->confKey = $confKey;
708 if (isset(
$conf->global->{$this->confKey})) {
712 $this->fieldValue =
'';
725 return $this->loadValueFromConf();
738 $parameters = array();
739 $reshook = $hookmanager->executeHooks(
'formSetupBeforeSaveConfValue', $parameters, $this);
741 $this->setErrors($hookmanager->errors);
750 if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) {
751 return call_user_func($this->saveCallBack, $this);
755 if ($this->
type !=
'title') {
756 $result =
dolibarr_set_const($this->db, $this->confKey, $this->fieldValue,
'chaine', 0,
'', $this->entity);
775 $this->saveCallBack = $callBack;
786 $this->setValueFromPostCallBack = $callBack;
796 if (!empty($this->setValueFromPostCallBack) && is_callable($this->setValueFromPostCallBack)) {
797 return call_user_func($this->setValueFromPostCallBack);
801 if ($this->
type !=
'title') {
802 if (preg_match(
'/category:/', $this->
type)) {
808 } elseif ($this->
type ==
'multiselect') {
809 $val =
GETPOST($this->confKey,
'array');
810 if ($val && is_array($val)) {
811 $val_const = implode(
',', $val);
815 } elseif ($this->
type ==
'html') {
816 $val_const =
GETPOST($this->confKey,
'restricthtml');
818 $val_const =
GETPOST($this->confKey,
'alpha');
822 $this->fieldValue = $val_const;
837 if (!empty($this->helpText)) {
838 return $this->helpText;
840 return (($this->langs->trans($this->confKey .
'Tooltip') != $this->confKey .
'Tooltip') ? $this->langs->trans($this->confKey .
'Tooltip') :
'');
850 if (!empty($this->nameText)) {
851 return $this->nameText;
853 $out = (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans(
'MissingTranslationForConfKey', $this->confKey));
856 if (isModEnabled(
'multicompany') && $this->entity == 0) {
857 $out =
img_picto($this->langs->trans(
'AllEntities'),
'fa-globe-americas em088 opacityhigh') .
' ' . $out;
872 if (!empty($this->fieldOverride)) {
873 return $this->fieldOverride;
876 if (!empty($this->fieldInputOverride)) {
877 return $this->fieldInputOverride;
881 if (is_null($this->fieldValue)) {
882 $this->fieldValue = $this->defaultFieldValue;
886 $this->fieldAttr[
'name'] = $this->confKey;
887 $this->fieldAttr[
'id'] =
'setup-'.$this->confKey;
888 $this->fieldAttr[
'value'] = $this->fieldValue;
892 if ($this->
type ==
'title') {
893 $out .= $this->generateOutputField();
894 } elseif ($this->
type ==
'multiselect') {
895 $out .= $this->generateInputFieldMultiSelect();
896 } elseif ($this->
type ==
'select') {
897 $out .= $this->generateInputFieldSelect();
898 } elseif ($this->
type ==
'selectUser') {
899 $out .= $this->generateInputFieldSelectUser();
900 } elseif ($this->
type ==
'textarea') {
901 $out .= $this->generateInputFieldTextarea();
902 } elseif ($this->
type ==
'html') {
903 $out .= $this->generateInputFieldHtml();
904 } elseif ($this->
type ==
'color') {
905 $out .= $this->generateInputFieldColor();
906 } elseif ($this->
type ==
'yesno') {
907 if (!empty(
$conf->use_javascript_ajax)) {
908 $input = $this->fieldParams[
'input'] ?? array();
909 $revertonoff = $this->fieldParams[
'revertonoff'] ? 1 : 0;
910 $forcereload = $this->fieldParams[
'forcereload'] ? 1 : 0;
912 $out .= ajax_constantonoff($this->confKey, $input, $this->entity, $revertonoff, 0, $forcereload);
914 $out .= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
916 } elseif (preg_match(
'/emailtemplate:/', $this->
type)) {
917 $out .= $this->generateInputFieldEmailTemplate();
918 } elseif (preg_match(
'/category:/', $this->
type)) {
919 $out .= $this->generateInputFieldCategories();
920 } elseif (preg_match(
'/thirdparty_type/', $this->
type)) {
921 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
923 $out .= $formcompany->selectProspectCustomerType($this->fieldValue, $this->confKey);
924 } elseif ($this->
type ==
'securekey') {
925 $out .= $this->generateInputFieldSecureKey();
926 } elseif ($this->
type ==
'product') {
927 if (isModEnabled(
"product") || isModEnabled(
"service")) {
928 $selected = (empty($this->fieldValue) ?
'' : $this->fieldValue);
929 $out .= $this->form->select_produits($selected, $this->confKey,
'', 0, 0, 1, 2,
'', 0, array(), 0,
'1', 0, $this->cssClass, 0,
'',
null, 1);
931 } elseif ($this->
type ==
'selectBankAccount') {
932 if (isModEnabled(
"bank")) {
933 $selected = (empty($this->fieldValue) ?
'' : $this->fieldValue);
934 $out .= $this->form->select_comptes($selected, $this->confKey, 0,
'', 0,
'', 0,
'', 1);
936 } elseif ($this->
type ==
'password') {
937 $out .= $this->generateInputFieldPassword(
'dolibarr');
938 } elseif ($this->
type ==
'genericpassword') {
939 $out .= $this->generateInputFieldPassword(
'generic');
941 $out .= $this->generateInputFieldText();
954 if (empty($this->fieldAttr) || empty($this->fieldAttr[
'class'])) {
955 $this->fieldAttr[
'class'] =
'flat '.(empty($this->cssClass) ?
'minwidth200' : $this->cssClass);
957 return '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).
' />';
967 $out =
'<textarea class="flat" name="'.$this->confKey.
'" id="'.$this->confKey.
'" cols="50" rows="5" wrap="soft">' .
"\n";
969 $out .=
"</textarea>\n";
981 require_once DOL_DOCUMENT_ROOT .
'/core/class/doleditor.class.php';
982 $doleditor =
new DolEditor($this->confKey, $this->fieldValue,
'', 160,
'dolibarr_notes',
'',
false,
false, isModEnabled(
'fckeditor'), ROWS_5,
'90%');
983 return $doleditor->Create(1);
993 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
994 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
997 $tmp = explode(
':', $this->
type);
998 $out =
img_picto(
'',
'category',
'class="pictofixedwidth"');
1000 $label =
'Categories';
1001 if ($this->
type ==
'customer') {
1002 $label =
'CustomersProspectsCategoriesShort';
1004 $out .= $formother->select_categories($tmp[1], $this->fieldValue, $this->confKey, 0, $this->langs->trans($label));
1018 if (preg_match(
'/emailtemplate:/', $this->
type)) {
1019 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formmail.class.php';
1020 $formmail =
new FormMail($this->db);
1022 $tmp = explode(
':', $this->
type);
1023 $nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user,
null, 1);
1024 $arrayOfMessageName = array();
1025 if (is_array($formmail->lines_model)) {
1026 foreach ($formmail->lines_model as $modelMail) {
1028 if (!empty($arrayOfMessageName[$modelMail->label])) {
1029 $moreonlabel =
' <span class="opacitymedium">(' . $this->langs->trans(
"SeveralLangugeVariatFound") .
')</span>';
1032 $arrayOfMessageName[$modelMail->id] = $this->langs->trans(preg_replace(
'/\(|\)/',
'', $modelMail->label)) . $moreonlabel;
1035 $out .= $this->form->selectarray($this->confKey, $arrayOfMessageName, $this->fieldValue,
'None', 0, 0,
'', 0, 0, 0,
'',
'', 1);
1050 $out =
'<input type="text" class="flat minwidth150'.($this->cssClass ?
' '.$this->cssClass :
'').
'" id="'.$this->confKey.
'" name="'.$this->confKey.
'" value="'.(
GETPOST($this->confKey,
'alpha') ?
GETPOST($this->confKey,
'alpha') : $this->fieldValue).
'">';
1052 if (!empty(
$conf->use_javascript_ajax) && empty($this->fieldParams[
'hideGenerateButton'])) {
1053 $out .=
' '.img_picto($this->langs->trans(
'Generate'),
'refresh',
'id="generate_token'.$this->confKey.
'" class="linkobject"');
1056 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
1073 global
$conf, $langs, $user;
1077 if ($type ==
'dolibarr') {
1079 if ($gen ==
'none') {
1082 $nomclass =
"modGeneratePass".ucfirst($gen);
1083 $nomfichier = $nomclass.
".class.php";
1084 require_once DOL_DOCUMENT_ROOT.
"/core/modules/security/generate/".$nomfichier;
1085 $genhandler =
new $nomclass($this->db,
$conf, $langs, $user);
1086 $min = $genhandler->length;
1087 $max = $genhandler->length2;
1089 $out =
'<input required="required" type="password" class="flat" id="'.$this->confKey.
'" name="'.$this->confKey.
'" value="'.(
GETPOST($this->confKey,
'alpha') ?
GETPOST($this->confKey,
'alpha') : $this->fieldValue).
'"';
1091 $out .=
' minlength="' . $min .
'"';
1094 $out .=
' maxlength="' . $max .
'"';
1109 $TSelected = array();
1110 if ($this->fieldValue) {
1111 $TSelected = explode(
',', $this->fieldValue);
1114 return $this->form->multiselectarray($this->confKey, $this->fieldOptions, $TSelected, 0, 0,
'', 0, 0,
'style="min-width:100px"');
1127 $s .=
img_picto(
'', $this->picto,
'class="pictofixedwidth"');
1130 $s .= $this->form->selectarray($this->confKey, $this->fieldOptions, $this->fieldValue, 0, 0, 0,
'', 0, 0, 0,
'', $this->cssClass);
1140 return $this->form->select_dolusers($this->fieldValue, $this->confKey);
1166 $this->
type = $type;
1179 if (is_array($errors)) {
1180 if (!empty($errors)) {
1181 foreach ($errors as $error) {
1182 $this->setErrors($error);
1185 } elseif (!empty($errors)) {
1186 $this->errors[] = $errors;
1198 global
$conf, $user, $langs;
1200 if (!empty($this->fieldOverride)) {
1201 return $this->fieldOverride;
1204 if (!empty($this->fieldOutputOverride)) {
1205 return $this->fieldOutputOverride;
1210 if ($this->
type ==
'title') {
1212 } elseif ($this->
type ==
'textarea') {
1214 } elseif ($this->
type ==
'multiselect') {
1215 $out .= $this->generateOutputFieldMultiSelect();
1216 } elseif ($this->
type ==
'select') {
1217 $out .= $this->generateOutputFieldSelect();
1218 } elseif ($this->
type ==
'selectUser') {
1219 $out .= $this->generateOutputFieldSelectUser();
1220 } elseif ($this->
type ==
'html') {
1221 $out .= $this->fieldValue;
1222 } elseif ($this->
type ==
'color') {
1223 $out .= $this->generateOutputFieldColor();
1224 } elseif ($this->
type ==
'yesno') {
1225 if (!empty(
$conf->use_javascript_ajax)) {
1226 $revertonoff = $this->fieldParams[
'revertonoff'] ? 1 : 0;
1227 $forcereload = $this->fieldParams[
'forcereload'] ? 1 : 0;
1229 $out .= ajax_constantonoff($this->confKey, array(), $this->entity, $revertonoff, 0, $forcereload);
1231 if ($this->fieldValue == 1) {
1232 $out .= $langs->trans(
'yes');
1234 $out .= $langs->trans(
'no');
1237 } elseif (preg_match(
'/emailtemplate:/', $this->
type)) {
1238 if ($this->fieldValue > 0) {
1239 include_once DOL_DOCUMENT_ROOT .
'/core/class/html.formmail.class.php';
1240 $formmail =
new FormMail($this->db);
1242 $tmp = explode(
':', $this->
type);
1244 $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
1245 if (is_numeric($template) && $template < 0) {
1246 $this->setErrors($formmail->errors);
1248 $out .= $this->langs->trans($template->label);
1250 } elseif (preg_match(
'/category:/', $this->
type)) {
1251 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1253 $result = $c->fetch($this->fieldValue);
1255 $this->setErrors($c->errors);
1257 $ways = $c->print_all_ways(
' >> ',
'none', 0, 1);
1259 foreach ($ways as $way) {
1260 $toprint[] =
'<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ?
' style="background: #' . $c->color .
';"' :
' style="background: #bbb"') .
'>' . $way .
'</li>';
1262 $out .=
'<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(
' ', $toprint) .
'</ul></div>';
1263 } elseif (preg_match(
'/thirdparty_type/', $this->
type)) {
1264 if ($this->fieldValue == 2) {
1265 $out .= $this->langs->trans(
"Prospect");
1266 } elseif ($this->fieldValue == 3) {
1267 $out .= $this->langs->trans(
"ProspectCustomer");
1268 } elseif ($this->fieldValue == 1) {
1269 $out .= $this->langs->trans(
"Customer");
1270 } elseif ($this->fieldValue == 0) {
1271 $out .= $this->langs->trans(
"NorProspectNorCustomer");
1273 } elseif ($this->
type ==
'product') {
1274 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
1276 $product =
new Product($this->db);
1277 $resprod = $product->fetch($this->fieldValue);
1279 $out .= $product->ref;
1280 } elseif ($resprod < 0) {
1281 $this->setErrors($product->errors);
1283 } elseif ($this->
type ==
'selectBankAccount') {
1284 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1286 $bankaccount =
new Account($this->db);
1287 $resbank = $bankaccount->fetch($this->fieldValue);
1289 $out .= $bankaccount->label;
1290 } elseif ($resbank < 0) {
1291 $this->setErrors($bankaccount->errors);
1293 } elseif ($this->
type ==
'password' || $this->
type ==
'genericpassword') {
1294 $out .= str_repeat(
'*', strlen($this->fieldValue));
1296 $out .= $this->fieldValue;
1311 $TSelected = array();
1312 if (!empty($this->fieldValue)) {
1313 $TSelected = explode(
',', $this->fieldValue);
1316 if (!empty($TSelected)) {
1317 foreach ($TSelected as $selected) {
1318 if (!empty($this->fieldOptions[$selected])) {
1319 $outPut .=
dolGetBadge(
'', $this->fieldOptions[$selected],
'info').
' ';
1334 $this->fieldAttr[
'disabled'] =
null;
1337 return '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.
'" value="'.$color.
'">';
1339 return $langs->trans(
"Default");
1348 $this->fieldAttr[
'type'] =
'color';
1349 $default = $this->defaultFieldValue;
1350 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
1352 return $formother->selectColor(
colorArrayToHex(
colorStringToArray($this->fieldAttr[
'value'], array()),
''), $this->fieldAttr[
'name'],
'', 1, array(),
'',
'', $default).
' ';
1363 if (!empty($this->fieldOptions[$this->fieldValue])) {
1364 $outPut = $this->fieldOptions[$this->fieldValue];
1378 $user =
new User($this->db);
1379 $user->fetch($this->fieldValue);
1380 $outPut = $user->firstname .
" " . $user->lastname;
1395 $this->
type =
'string';
1406 $this->
type =
'color';
1417 $this->
type =
'textarea';
1428 $this->
type =
'html';
1440 $this->
type =
'emailtemplate:'.$templateType;
1451 $this->
type =
'thirdparty_type';
1462 $this->
type =
'yesno';
1473 $this->
type =
'securekey';
1484 $this->
type =
'product';
1497 $this->
type =
'category:'.$catType;
1508 $this->
type =
'title';
1521 if (is_array($fieldOptions)) {
1522 $this->fieldOptions = $fieldOptions;
1525 $this->
type =
'multiselect';
1537 if (is_array($fieldOptions)) {
1538 $this->fieldOptions = $fieldOptions;
1541 $this->
type =
'select';
1552 $this->
type =
'selectUser';
1563 $this->
type =
'selectBankAccount';
1575 $this->
type =
'password';
1587 $this->
type =
'genericpassword';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Class to manage bank accounts.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage products or services.
Class to manage Dolibarr users.
colorArrayToHex($arraycolor, $colorifnotfound='888888')
Convert an array with RGB value into hex RGB value.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dolGetBadge($label, $html='', $type='primary', $mode='', $url='', $params=array())
Function dolGetBadge.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.