From d0397ec41eff92f67baa5387558ed1e7910b4712 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 23 Mar 2021 14:27:27 +0100 Subject: [PATCH] LSattribute & LSattr_html: fix handling current/provided data --- src/includes/class/class.LSattr_html.php | 2 +- src/includes/class/class.LSattribute.php | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/includes/class/class.LSattr_html.php b/src/includes/class/class.LSattr_html.php index fba6eb06..494335d7 100644 --- a/src/includes/class/class.LSattr_html.php +++ b/src/includes/class/class.LSattr_html.php @@ -118,7 +118,7 @@ class LSattr_html extends LSlog_staticLoggerClass { * @retval array The values to be displayed in the LSform **/ public function getFormVal($data) { - return $this -> attribute -> getDisplayValue(); + return $this -> attribute -> getDisplayValue($data); } /** diff --git a/src/includes/class/class.LSattribute.php b/src/includes/class/class.LSattribute.php index 0aa7b2eb..1e2f8db4 100644 --- a/src/includes/class/class.LSattribute.php +++ b/src/includes/class/class.LSattribute.php @@ -410,14 +410,19 @@ class LSattribute extends LSlog_staticLoggerClass { } /** - * Retourne la valeur a afficher dans le formulaire + * Return the form display value + * + * @param[in] $data mixed Custom attribute data (optional, default: current attribute data) * * @author Benjamin Renard * - * @retval string La valeur a afficher dans le formulaire. + * @retval string The form display value */ - public function getFormVal() { - return ensureIsArray($this -> html -> getFormVal($this -> data)); + public function getFormVal($data=null) { + if (is_null($data)) { + $data = ($this -> isUpdate()?$this -> updateData:$this -> data); + } + return ensureIsArray($this -> html -> getFormVal($data)); } /**