CRM-18439 - Report Fixes to include Full Group by clause
[civicrm-core.git] / CRM / Report / Form / Case / Detail.php
index c3982af1ea76cfbbab628025a2980b6d038d788e..0a5715d53ca8953e35d4a6517383c91659e20d14 100644 (file)
@@ -336,6 +336,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
         }
       }
     }
+    $this->_selectClauses = $select;
 
     $this->_select = 'SELECT ' . implode(', ', $select) . ' ';
   }
@@ -452,6 +453,7 @@ class CRM_Report_Form_Case_Detail extends CRM_Report_Form {
 
   public function groupBy() {
     $this->_groupBy = " GROUP BY {$this->_aliases['civicrm_case']}.id";
+    $this->_groupBy .= CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, "{$this->_aliases['civicrm_case']}.id");
   }
 
   /**