From 1cc4e4435339f65996cdfa3d3e99a77ac8c6c0bd Mon Sep 17 00:00:00 2001 From: Christoph Wiechert Date: Fri, 4 May 2012 15:10:20 +0200 Subject: [PATCH] Fixed: Wrong implementation of flatArray eval option --- .../multicolumnwizard/MultiColumnWizard.php | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/system/modules/multicolumnwizard/MultiColumnWizard.php b/system/modules/multicolumnwizard/MultiColumnWizard.php index 63433aa..a1f480c 100644 --- a/system/modules/multicolumnwizard/MultiColumnWizard.php +++ b/system/modules/multicolumnwizard/MultiColumnWizard.php @@ -202,6 +202,41 @@ public function __set($strKey, $varValue) } + public function __get($strKey) + { + switch ($strKey) + { + case 'value': + /** + * reformat array if we have only one field + * from array[]['fieldname'] = value + * to array[] = value + * so we have the same behavoir like multiple-checkbox fields + */ + if ($this->flatArray) + { + $arrNew = array(); + + foreach ($this->varValue as $val) + { + $arrNew[] = $val[key($this->columnFields)]; + } + + return $arrNew; + } + else + { + return parent::__get($strKey); + } + break; + + default: + return parent::__get($strKey); + break; + } + } + + protected function validator($varInput) { for ($i = 0; $i < count($varInput); $i++) @@ -274,24 +309,6 @@ protected function validator($varInput) $this->addError($GLOBALS['TL_LANG']['ERR']['general']); } - /** - * reformat array if we have only one field - * from array[]['fieldname'] = value - * to array[] = value - * so we have the same behavoir like multiple-checkbox fields - */ - if ($this->flatArray) - { - $arrNew = array(); - - foreach ($varInput as $val) - { - $arrNew[] = $val[key($this->columnFields)]; - } - - $varInput = $arrNew; - } - return $varInput; }