From edcd169a597a9e078f9180fe1bf0ea39c8dbbd80 Mon Sep 17 00:00:00 2001 From: Jan Kristinus Date: Tue, 19 Mar 2024 15:05:55 +0100 Subject: [PATCH] be_table funktionierte nicht mehr #1480 --- plugins/manager/lib/yform/value/be_table.php | 48 +------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/plugins/manager/lib/yform/value/be_table.php b/plugins/manager/lib/yform/value/be_table.php index 3e3306a1..9a63bf37 100644 --- a/plugins/manager/lib/yform/value/be_table.php +++ b/plugins/manager/lib/yform/value/be_table.php @@ -1,53 +1,9 @@ www.yakamara.de - */ class rex_yform_value_be_table extends rex_yform_value_abstract { protected $fieldData = []; - public function preValidateAction(): void - { - // bc service for Version < 1.1 - if ('' != $this->getValue() && '' == json_decode($this->getValue())) { - $rows = explode(';', $this->getValue()); - foreach ($rows as $row_id => $row) { - $rows[$row_id] = explode(',', $row); - } - $this->setValue(json_encode($rows)); - } - - if ($this->getParam('send') && isset($_POST['FORM'])) { - // Cleanup Array - $table_array = []; - - $id = $this->getName(); - - $columns = preg_split('/(?<=[^\\w"]),|,(?=\\{)|(?<=[A-Za-z]),(?=[^ ][\\w,])|(?<=,\\w),/', $this->getElement('columns')); - if (0 == count($columns)) { - return; - } - - $form_data = rex_post('FORM', 'array'); - - if (isset($form_data[$id . '.0'])) { - $rowKeys = array_keys((array) $form_data[$id . '.0']); - - // Spalten durchgehen - for ($c = 0; $c < count($columns); ++$c) { - foreach ($rowKeys as $r) { - $table_array[$r][$c] = (isset($form_data[$id . '.' . $c][$r])) ? $form_data[$id . '.' . $c][$r] : ''; - } - } - } - $this->setValue(json_encode(array_values($table_array))); - } - } - public static function getColumnsByName($definition) { $valueFields = []; @@ -123,8 +79,8 @@ public function enterObject() $this->fieldData = $data; - $yfparams = \rex_yform::factory()->objparams; - $yfparams['this'] = \rex_yform::factory(); + $yfparams = rex_yform::factory()->objparams; + $yfparams['this'] = rex_yform::factory(); /* TODO * error class von validierung ans Eingabefeld übergeben