Index: branches/5.2.x/core/kernel/db/cat_dbitem.php =================================================================== diff -u -N -r15541 -r15594 --- branches/5.2.x/core/kernel/db/cat_dbitem.php (.../cat_dbitem.php) (revision 15541) +++ branches/5.2.x/core/kernel/db/cat_dbitem.php (.../cat_dbitem.php) (revision 15594) @@ -1,6 +1,6 @@ IsTempTable()) { + if ( $this->IsTempTable() ) { $ci_table = $this->Application->GetTempName($ci_table, 'prefix:' . $this->Prefix); } - $primary_category_clause = Array ('`' . $ci_table . '`.`PrimaryCat`' => 1); - - if (!isset($keys_hash)) { - $keys_hash = Array ($this->IDField => $this->ID); - } - - // merge primary category clause in any case to be sure, that - // CategoryId field will always contain primary category of item - $keys_hash = array_merge($keys_hash, $primary_category_clause); + // ensures, that CategoryId calculated field has primary category id in it + $keys_hash = Array ( + $this->IDField => $this->ID, + '`' . $ci_table . '`.`PrimaryCat`' => 1 + ); } return parent::GetKeyClause($method, $keys_hash); } - } \ No newline at end of file