Debug v20

This commit is contained in:
Laurent Destailleur
2024-06-06 00:32:43 +02:00
parent ff2bd03584
commit 0371ffefd0
5 changed files with 35 additions and 16 deletions

View File

@@ -640,6 +640,9 @@ class FormSetupItem
/** @var array set this var for options on select and multiselect items */
public $fieldOptions = array();
/** @var array set this var to add more parameters */
public $fieldParams = array();
/** @var callable $saveCallBack */
public $saveCallBack;
@@ -1035,14 +1038,15 @@ class FormSetupItem
public function generateInputFieldSecureKey()
{
global $conf;
$out = '<input required="required" type="text" class="flat" id="'.$this->confKey.'" name="'.$this->confKey.'" value="'.(GETPOST($this->confKey, 'alpha') ? GETPOST($this->confKey, 'alpha') : $this->fieldValue).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
$out .= '&nbsp;'.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"');
}
$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).'">';
// Add button to autosuggest a key
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$out .= dolJSToSetRandomPassword($this->confKey, 'generate_token'.$this->confKey);
if (!empty($conf->use_javascript_ajax) && empty($this->fieldParams['hideGenerateButton'])) {
$out .= '&nbsp;'.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"');
// Add button to autosuggest a key
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$out .= dolJSToSetRandomPassword($this->confKey, 'generate_token'.$this->confKey);
}
return $out;
}
@@ -1059,7 +1063,7 @@ class FormSetupItem
{
global $conf, $langs, $user;
$min = 8;
$min = 6;
$max = 50;
if ($type == 'dolibarr') {
$gen = getDolGlobalString('USER_PASSWORD_GENERATED', 'standard');
@@ -1073,7 +1077,14 @@ class FormSetupItem
$min = $genhandler->length;
$max = $genhandler->length2;
}
$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).'" minlength="' . $min . '" maxlength="' . $max . '">';
$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).'"';
if ($min){
$out .= ' minlength="' . $min . '"';
}
if ($max) {
$out .= ' maxlength="' . $max . '"';
}
$out .= '>';
return $out;
}
@@ -1136,9 +1147,9 @@ class FormSetupItem
* because this two class will quickly evolve it's important to not set directly $this->type (will be protected) so this method exist
* to be sure we can manage evolution easily
*
* @param string $type possible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
* @deprecated yes this setTypeFromTypeString came deprecated because it exists only for manage setup conversion
* @return bool
* @param string $type Possible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
* @deprecated this setTypeFromTypeString came deprecated because it exists only for manage setup conversion
* @return bool
*/
public function setTypeFromTypeString($type)
{