LSattribute / generate_value : the default_value is now used to generate the value of the attribute if the generate function or LSformat is not defined.

This commit is contained in:
Benjamin Renard 2010-01-06 15:21:37 +01:00
parent ee0d7b82fd
commit c05741a489

View file

@ -451,15 +451,17 @@ class LSattribute {
* @retval boolean true si la valeur de l'attribut peut être générée, false sinon * @retval boolean true si la valeur de l'attribut peut être générée, false sinon
*/ */
function canBeGenerated() { function canBeGenerated() {
if (function_exists($this -> config['generate_function'])) { return (
return true; (function_exists($this -> config['generate_function']))
} ||
else if (isset($this -> config['generate_value_format'])) { (isset($this -> config['generate_value_format']))
return true; ||
} (
else { (is_string($this -> config['default_value']))
return ; &&
} (strlen($this -> config['default_value'])>0)
)
);
} }
/** /**
@ -476,6 +478,9 @@ class LSattribute {
else if (isset($this -> config['generate_value_format'])) { else if (isset($this -> config['generate_value_format'])) {
$value = $this -> ldapObject -> getFData($this -> config['generate_value_format']); $value = $this -> ldapObject -> getFData($this -> config['generate_value_format']);
} }
else if (is_string($this -> config['default_value']) && strlen($this -> config['default_value'])>0) {
$value = $this -> config['default_value'];
}
if (!empty($value)) { if (!empty($value)) {
//$this -> setValue($value); // pas nécéssaire ?? //$this -> setValue($value); // pas nécéssaire ??
$this -> updateData=array($value); $this -> updateData=array($value);