CRM-16719: stats fixes
authorKurund Jalmi <kurund@yahoo.com>
Mon, 17 Aug 2015 07:47:22 +0000 (13:17 +0530)
committerKurund Jalmi <kurund@yahoo.com>
Wed, 19 Aug 2015 17:46:07 +0000 (23:16 +0530)
CRM/Report/Form/ActivitySummary.php

index b851dbd7d9fcfcef97be8957f2734beba615c911..c73202e4795448a02492e3586001d02c2d8731ba 100644 (file)
@@ -458,10 +458,14 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
     $statistics = parent::statistics($rows);
     $totalType = $totalActivity = $totalDuration = 0;
 
+    $query = "SELECT SUM(activity_civireport.duration)
+    FROM civicrm_activity activity_civireport
+    {$this->_where} {$this->_groupBy}";
+
     $actSQL = "SELECT
       COUNT(DISTINCT {$this->_aliases['civicrm_activity']}.activity_type_id ) as civicrm_activity_activity_type_id_count,
       COUNT(DISTINCT {$this->_aliases['civicrm_activity']}.id ) as civicrm_activity_activity_id_count,
-      SUM({$this->_aliases['civicrm_activity']}.duration ) as civicrm_activity_activity_duration
+      ($query) as civicrm_activity_activity_duration
       {$this->_from} {$this->_where} {$this->_groupBy}";
 
     $actDAO = CRM_Core_DAO::executeQuery($actSQL);