aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-26 11:40:35 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-26 11:40:35 +0000
commitb362b74a92512c3986927c25c0be1c4341702829 (patch)
treeca1a76b7b83b387cce39623abec47c6042dd2fdb /engine
parent36e4c5548ac36a67048706bf9c17f6eece082666 (diff)
downloadelgg-b362b74a92512c3986927c25c0be1c4341702829.tar.gz
elgg-b362b74a92512c3986927c25c0be1c4341702829.tar.bz2
Fixed pagination issue with count annotations function.
git-svn-id: https://code.elgg.org/elgg/trunk@2616 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/annotations.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 630c33b40..8c177ffff 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -661,7 +661,7 @@
if (!$count) {
$query = "SELECT distinct e.*, $sum(ms.string) as sum ";
} else {
- $query = "SELECT count(e.guid) as num, $sum(ms.string) as sum ";
+ $query = "SELECT count(distinct e.guid) as num, $sum(ms.string) as sum ";
}
$query .= " from {$CONFIG->dbprefix}entities e JOIN {$CONFIG->dbprefix}annotations a on a.entity_guid = e.guid JOIN {$CONFIG->dbprefix}metastrings ms on a.value_id=ms.id ";
@@ -674,7 +674,7 @@
$query .= " $w and ";
$query .= get_access_sql_suffix("a"); // now add access
$query .= ' and ' . get_access_sql_suffix("e"); // now add access
- $query .= ' group by e.guid';
+ if (!$count) $query .= ' group by e.guid';
if (!$count) {
$query .= ' order by sum ' . $orderdir;