Index: core/kernel/db/dblist.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- core/kernel/db/dblist.php (revision 15892) +++ core/kernel/db/dblist.php (revision ) @@ -182,7 +182,7 @@ /** * WHERE filter objects * - * @var Array + * @var kMultipleFilter[] * @access protected */ protected $WhereFilter = Array (); @@ -190,7 +190,7 @@ /** * HAVING filter objects * - * @var Array + * @var kMultipleFilter[] * @access protected */ protected $HavingFilter = Array (); @@ -198,7 +198,7 @@ /** * AGGREGATED filter objects * - * @var Array + * @var kMultipleFilter[] * @access protected */ protected $AggregateFilter = Array (); @@ -698,7 +698,7 @@ if ( $for_counting ) { $usage_string = $where . '|' . $having . '|' . $order . '|' . $group . '|' . $keep_clause; - $optimizer = new LeftJoinOptimizer($q, str_replace('%1$s', $this->TableName, $usage_string)); + $optimizer = new LeftJoinOptimizer($q, $this->replaceModePrefix( str_replace('%1$s', $this->TableName, $usage_string) )); $q = $optimizer->simplify(); } @@ -746,7 +746,12 @@ $where = $this->Application->makeClass('kMultipleFilter'); /* @var $where kMultipleFilter */ + if ( $for_counting ) { + $where->addFilter('system_where', $this->extractCalculatedFields($this->WhereFilter[self::FLT_SYSTEM]->getSQL()) ); + } + else { - $where->addFilter('system_where', $this->WhereFilter[self::FLT_SYSTEM] ); + $where->addFilter('system_where', $this->WhereFilter[self::FLT_SYSTEM] ); + } if (!$system_filters_only) { $where->addFilter('view_where', $this->WhereFilter[self::FLT_VIEW] ); \ No newline at end of file