Index: branches/unlabeled/unlabeled-1.6.2/admin/category/permcacheupdate.php =================================================================== diff -u -N -r4382 -r4416 --- branches/unlabeled/unlabeled-1.6.2/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 4382) +++ branches/unlabeled/unlabeled-1.6.2/admin/category/permcacheupdate.php (.../permcacheupdate.php) (revision 4416) @@ -135,6 +135,8 @@ var $doneCats; var $table; + var $root_prefixes = Array(); + /** * Kernel Application * @@ -153,6 +155,10 @@ $this->Application =& kApplication::Instance(); $this->Conn =& $this->Application->GetADODBConnection(); + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { + $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var']; + } + $this->conn =& GetADODBConnection(); $this->iteration = 0; $this->table=$GLOBALS['objSession']->GetEditTable('permCacheUpdate'); @@ -285,9 +291,11 @@ function QueryTitle(&$data) { + $category_id = $data['current_id']; + $sql = 'SELECT Name, Filename, CategoryTemplate, ItemTemplate FROM '.GetTablePrefix().'Category - WHERE CategoryId = '.$data['current_id']; + WHERE CategoryId = '.$category_id; $rs = $this->conn->Execute($sql); @@ -296,10 +304,28 @@ $data['title'][] = $rs->fields['Name']; $data['named_path'][] = $rs->fields['Filename']; + // it is one of the modules root category + $root_prefix = isset($this->root_prefixes[$category_id]) ? $this->root_prefixes[$category_id] : false; + if ($root_prefix) { + $fields_hash = Array(); + if (!$rs->fields['CategoryTemplate']) { + $rs->fields['CategoryTemplate'] = $this->Application->ConfigValue($root_prefix.'_CategoryTemplate'); + $fields_hash['CategoryTemplate'] = $rs->fields['CategoryTemplate']; + } + + if (!$rs->fields['ItemTemplate']) { + $rs->fields['ItemTemplate'] = $this->Application->ConfigValue($root_prefix.'_ItemTemplate'); + $fields_hash['ItemTemplate'] = $rs->fields['ItemTemplate']; + } + + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$category_id); + } + // if explicitly set, then use it; use parent template otherwise if ($rs->fields['CategoryTemplate']) { $data['category_template'] = $rs->fields['CategoryTemplate']; } + if ($rs->fields['ItemTemplate']) { $data['item_template'] = $rs->fields['ItemTemplate']; } Index: branches/unlabeled/unlabeled-1.75.2/admin/install/langpacks/english.lang =================================================================== diff -u -N -r4297 -r4416 --- branches/unlabeled/unlabeled-1.75.2/admin/install/langpacks/english.lang (.../english.lang) (revision 4297) +++ branches/unlabeled/unlabeled-1.75.2/admin/install/langpacks/english.lang (.../english.lang) (revision 4416) @@ -873,6 +873,7 @@ TWVzc2FnZQ== U2VjdGlvbiBPdmVydmlldw== UHJvcGVydGllcw== + VGVtcGxhdGVz VHJhbnNsYXRpb24= U2VsZWN0aW5nIENhdGVnb3JpZXM= RW1wdHkgc2VsZWN0aW9u Index: branches/unlabeled/unlabeled-1.8.2/core/kernel/db/db_connection.php =================================================================== diff -u -N -r4044 -r4416 --- branches/unlabeled/unlabeled-1.8.2/core/kernel/db/db_connection.php (.../db_connection.php) (revision 4044) +++ branches/unlabeled/unlabeled-1.8.2/core/kernel/db/db_connection.php (.../db_connection.php) (revision 4416) @@ -565,6 +565,8 @@ function doUpdate($fields_hash, $table, $key_clause) { + if (!$fields_hash) return true; + $fields_sql = ''; foreach ($fields_hash as $field_name => $field_value) { $fields_sql .= '`'.$field_name.'` = '.$this->qstr($field_value).',';