From 32f99430766b9d61c68880246efe9394283766c7 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 1 May 2008 16:00:05 +0000 Subject: Fixed a bug in countAnnotations git-svn-id: https://code.elgg.org/elgg/trunk@610 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/annotations.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engine') diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 86d6dde17..7df18e3a7 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -360,8 +360,9 @@ $where[] = "e.subtype=$entity_subtype"; if ($name!="") $where[] = "a.name_id='$name'"; - - $where[] = "a.value_type='integer'"; // Limit on integer types + + if ($sum != "count") + $where[] = "a.value_type='integer'"; // Limit on integer types $query = "SELECT $sum(ms.string) as sum from {$CONFIG->dbprefix}annotations a JOIN {$CONFIG->dbprefix}entities e on a.entity_guid = e.guid JOIN {$CONFIG->dbprefix}metastrings ms on a.value_id=ms.id WHERE "; foreach ($where as $w) @@ -369,7 +370,6 @@ $query .= " (a.access_id in {$access} or (a.access_id = 0 and a.owner_guid = {$_SESSION['id']}))"; // now add access $row = get_data_row($query); - if ($row) return $row->sum; -- cgit v1.2.3