Merge pull request #8516 from mlutfy/master-crm18756-2
[civicrm-core.git] / CRM / Report / Form / Case / Summary.php
index 2c7eb1fe9df57691a4e45a29e244f00bcb01b75f..ea39d69d3635704b88e81682319db8ecc8aeb173 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
  * $Id$
  *
  */
@@ -126,12 +126,13 @@ class CRM_Report_Form_Case_Summary extends CRM_Report_Form {
           'case_type_id' => array(
             'title' => ts('Case Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => $this->case_types,
+            'options' => CRM_Case_BAO_Case::buildOptions('case_type_id', 'search'),
           ),
           'status_id' => array(
             'title' => ts('Status'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => $this->case_statuses,
+            'options' => CRM_Case_BAO_Case::buildOptions('status_id', 'search'),
           ),
           'is_deleted' => array(
             'title' => ts('Deleted?'),
@@ -161,6 +162,7 @@ class CRM_Report_Form_Case_Summary extends CRM_Report_Form {
         'filters' => array(
           'relationship_type_id' => array(
             'title' => ts('Staff Relationship'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => $this->rel_types,
           ),
@@ -213,6 +215,7 @@ class CRM_Report_Form_Case_Summary extends CRM_Report_Form {
         }
       }
     }
+    $this->_selectClauses = $select;
 
     $this->_select = "SELECT " . implode(', ', $select) . " ";
   }
@@ -263,7 +266,7 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id
     }
     else {
       $this->_from = "
-            FROM civicrm_contact $c, civicrm_case $cc
+            FROM civicrm_case $cc
 inner join civicrm_case_contact $ccc on ${ccc}.case_id = ${cc}.id
 inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id
 ";
@@ -330,7 +333,7 @@ inner join civicrm_contact $c2 on ${c2}.id=${ccc}.contact_id
   }
 
   public function groupBy() {
-    $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_c2']}.id";
+    $this->_groupBy = "";
   }
 
   public function postProcess() {