From f980b1e76aeb599d253b4f7e4e6a980d16efaf4e Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Tue, 19 Jul 2016 16:14:41 +0900 Subject: [PATCH] Bug fix: did not add new sub data entries if there are no entries If we load data that has no sub data referenced the list was not created --- www/libs/Class.Form.Generate.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/libs/Class.Form.Generate.inc b/www/libs/Class.Form.Generate.inc index ad7a7a3b..e7bc9a3a 100644 --- a/www/libs/Class.Form.Generate.inc +++ b/www/libs/Class.Form.Generate.inc @@ -1765,8 +1765,9 @@ $this->debug('edit', "Pos[$i] => ".$type[$i]." Q: ".$q."
"); // check if we need to fill fields $element_count = count($data['content']); $missing_empty_count = $this->element_list[$table_name]['max_empty'] - count($data['content']); -// $this->debug('CFG MAX', 'Max empty: '.$this->element_list[$table_name]['max_empty'].', Missing: '.$missing_empty_count.', Has: '.$element_count); - if ($missing_empty_count < $this->element_list[$table_name]['max_empty']) + $this->debug('CFG MAX', 'Max empty: '.$this->element_list[$table_name]['max_empty'].', Missing: '.$missing_empty_count.', Has: '.$element_count); + // set if we need more open entries or if we do not have any entries yet + if (($missing_empty_count < $this->element_list[$table_name]['max_empty']) || $element_count == 0) { for ($pos = count($data['content']); $pos <= ($this->element_list[$table_name]['max_empty'] + $element_count); $pos ++) {