Index: trunk/core/kernel/kbase.php =================================================================== diff -u -r4758 -r6093 --- trunk/core/kernel/kbase.php (.../kbase.php) (revision 4758) +++ trunk/core/kernel/kbase.php (.../kbase.php) (revision 6093) @@ -467,7 +467,7 @@ { foreach($this->Fields as $field => $options) { - if( getArrayValue($options, 'default') === '#NOW#') + if( isset($options['default']) && $options['default'] === '#NOW#') { $this->Fields[$field]['default'] = adodb_mktime(); } @@ -544,7 +544,7 @@ if( isset($field_options['options_sql']) ) { // replace with query result - $select_clause = $field_options['option_title_field'].','.$field_options['option_key_field']; + $select_clause = '`'.$field_options['option_title_field'].'`,`'.$field_options['option_key_field'].'`'; $sql = sprintf($field_options['options_sql'], $select_clause, $this->Application->GetVar('m_lang')); $options_hash = getArrayValue($field_options,'options'); @@ -559,9 +559,9 @@ function PrepareOptions($field_name) { - if( $formatter_class = getArrayValue($this->Fields[$field_name], 'formatter') ) + if ( isset($this->Fields[$field_name]['formatter']) ) { - $formatter =& $this->Application->recallObject($formatter_class); + $formatter =& $this->Application->recallObject( $this->Fields[$field_name]['formatter'] ); $formatter->PrepareOptions($field_name, $this->Fields[$field_name], $this); } } @@ -590,6 +590,16 @@ } /** + * Allows kDBTagProcessor.SectionTitle to detect if it's editing or new item creation + * + * @return bool + */ + function IsNewItem() + { + return $this->GetID() ? false : true; + } + + /** * Returns parent table information * * @param bool $from_temp load parent item from temp table