Commit ac6c008a authored by Côme Chilliet's avatar Côme Chilliet

Merge branch '6083-improve-objectsattribute' into '1.4-dev'

Resolve "Improve ObjectsAttribute"

See merge request fusiondirectory/fd!768
parents 30c39b5e 90c55cf7
......@@ -71,8 +71,12 @@ class ObjectSelectAttribute extends SelectAttribute
$realDisplayAttr => (($realDisplayAttr == 'dn') ? 'raw' : '1'),
];
$objects = objects::ls($objectType, $attributes, NULL, $this->objectFilter);
array_push($choices, ...array_column($objects, $realStoreAttr));
array_push($outputs, ...array_column($objects, $realDisplayAttr));
foreach (array_column($objects, $realStoreAttr) as $choice) {
$choices[] = $choice;
}
foreach (array_column($objects, $realDisplayAttr) as $output) {
$outputs[] = $output;
}
} catch (NonExistingObjectTypeException $e) {
continue;
}
......
......@@ -91,10 +91,14 @@ class ObjectsAttribute extends GenericDialogAttribute
protected function fillDisplayValue ($i)
{
$value = $this->value[$i];
if ($this->store_attr == 'dn') {
$objects = objects::ls($this->selectManagementParameters[0], $this->selectManagementParameters[2], $value, '', FALSE, 'base');
} else {
$objects = objects::ls($this->selectManagementParameters[0], $this->selectManagementParameters[2], NULL, '('.$this->store_attr.'='.ldap_escape_f($value).')');
try {
if ($this->store_attr == 'dn') {
$objects = objects::ls($this->selectManagementParameters[0], $this->selectManagementParameters[2], $value, '', FALSE, 'base');
} else {
$objects = objects::ls($this->selectManagementParameters[0], $this->selectManagementParameters[2], NULL, '('.$this->store_attr.'='.ldap_escape_f($value).')');
}
} catch (EmptyFilterException $e) {
$objects = [];
}
if (empty($objects) && $this->isTemplate()) {
$this->fillDisplayValueFrom($i, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment