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
*/
function canBeGenerated() {
if (function_exists($this -> config['generate_function'])) {
return true;
}
else if (isset($this -> config['generate_value_format'])) {
return true;
}
else {
return ;
}
return (
(function_exists($this -> config['generate_function']))
||
(isset($this -> config['generate_value_format']))
||
(
(is_string($this -> config['default_value']))
&&
(strlen($this -> config['default_value'])>0)
)
);
}
/**
@ -476,6 +478,9 @@ class LSattribute {
else if (isset($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)) {
//$this -> setValue($value); // pas nécéssaire ??
$this -> updateData=array($value);