|
From: <du...@us...> - 2012-11-29 13:39:29
|
Revision: 10287
http://sourceforge.net/p/xoops/svn/10287
Author: dugris
Date: 2012-11-29 13:39:27 +0000 (Thu, 29 Nov 2012)
Log Message:
-----------
BUG Fix : model/class/stats function getcount & getcounts
Modified Paths:
--------------
XoopsCore/branches/2.6.x/2.6.0/htdocs/class/criteria.php
XoopsCore/branches/2.6.x/2.6.0/htdocs/class/model/stats.php
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/criteria.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/criteria.php 2012-11-29 13:36:07 UTC (rev 10286)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/criteria.php 2012-11-29 13:39:27 UTC (rev 10287)
@@ -163,6 +163,14 @@
{
return $this->groupby ? " GROUP BY {$this->groupby}" : "";
}
+
+ /**
+ * @return string
+ */
+ public function getGroupbyField()
+ {
+ return $this->groupby ? $this->groupby : "";
+ }
}
/**
Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/model/stats.php
===================================================================
--- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/model/stats.php 2012-11-29 13:36:07 UTC (rev 10286)
+++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/model/stats.php 2012-11-29 13:39:27 UTC (rev 10287)
@@ -44,9 +44,9 @@
$field = '';
$groupby = false;
if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
- if ($criteria->getGroupby() != '') {
+ if ($criteria->getGroupbyField() != '') {
$groupby = true;
- $field = $criteria->getGroupby() . ", ";
+ $field = $criteria->getGroupbyField() . ", ";
}
}
$sql = "SELECT {$field} COUNT(*) FROM `{$this->handler->table}`";
@@ -87,7 +87,7 @@
$sql_where = $criteria->renderWhere();
$limit = $criteria->getLimit();
$start = $criteria->getStart();
- if ($groupby = $criteria->getGroupby()) {
+ if ($groupby = $criteria->getGroupbyField()) {
$groupby_key = $groupby;
}
}
|