From 6fc4bef7a09965b8585b1e4d27bccce6099985e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Wed, 6 Jul 2016 10:33:23 +0200 Subject: [PATCH] Fixes #4982 Added choices to base serialization to fix CSV import base field behavior --- include/class_baseSelector.inc | 10 ++++++++++ include/simpleplugin/class_attribute.inc | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/include/class_baseSelector.inc b/include/class_baseSelector.inc index e5e113fad..7a4a758a2 100644 --- a/include/class_baseSelector.inc +++ b/include/class_baseSelector.inc @@ -299,5 +299,15 @@ class baseSelector { { return $this->base; } + + /*! + * \brief Accessor of the bases + * + * \return Array containts the bases and their display text + */ + function getBases() + { + return $this->pathMapping; + } } ?> diff --git a/include/simpleplugin/class_attribute.inc b/include/simpleplugin/class_attribute.inc index a0d090ab0..b1d0e7631 100644 --- a/include/simpleplugin/class_attribute.inc +++ b/include/simpleplugin/class_attribute.inc @@ -1998,6 +1998,15 @@ class BaseSelectorAttribute extends Attribute return ''; } } + + function serializeAttribute(&$attributes, $form = TRUE) + { + if (!$form || $this->visible) { + parent::serializeAttribute($attributes, $form); + + $attributes[$this->getLdapName()]['choices'] = $this->baseSelector->getBases(); + } + } } /*! \brief This class allow to handle easily a multi-valuated attribute -- GitLab