From 2f1b95277e284ac21f2bf90d2ed8c42af419bc07 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Fri, 27 Apr 2012 22:41:25 -0400
Subject: [PATCH] Syntax error fix

---
 include/class.template.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/class.template.php b/include/class.template.php
index ef53d7ed5..36d9b2f48 100644
--- a/include/class.template.php
+++ b/include/class.template.php
@@ -28,11 +28,12 @@ class Template {
 
         if(!$id && !($id=$this->getId()))
             return false;
-
+           
         $sql='SELECT tpl.*,count(dept.tpl_id) as depts '
             .' FROM '.EMAIL_TEMPLATE_TABLE.' tpl '
             .' LEFT JOIN '.DEPT_TABLE.' dept USING(tpl_id) '
-            .' WHERE tpl_id='.db_input($id);
+            .' WHERE tpl.tpl_id='.db_input($id)
+            .' GROUP BY tpl.tpl_id';
 
         if(!($res=db_query($sql))|| !db_num_rows($res))
             return false;
-- 
GitLab