CRM-18972: more translation fixes
[civicrm-core.git] / CRM / Report / Form / ActivitySummary.php
index d31d5d80281ab896e03ca376b51cd6fdb7196d43..fc83ff1e51fd448863013478682a0d790c8bab6c 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$
  *
  */
@@ -79,7 +79,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
         'dao' => 'CRM_Core_DAO_Email',
         'fields' => array(
           'email' => array(
-            'title' => 'Email',
+            'title' => ts('Email'),
           ),
         ),
         'order_bys' => array(
@@ -93,7 +93,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
         'dao' => 'CRM_Core_DAO_Email',
         'fields' => array(
           'phone' => array(
-            'title' => 'Phone',
+            'title' => ts('Phone'),
           ),
         ),
         'grouping' => 'contact-fields',
@@ -135,11 +135,13 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
           ),
           'status_id' => array(
             'title' => ts('Activity Status'),
+            'type' => CRM_Utils_Type::T_STRING,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::activityStatus(),
           ),
           'priority_id' => array(
             'title' => ts('Priority'),
+            'type' => CRM_Utils_Type::T_INT,
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'),
           ),
@@ -273,6 +275,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
         }
       }
     }
+    $this->_selectClauses = $select;
 
     $this->_select = "SELECT " . implode(', ', $select) . " ";
   }
@@ -398,7 +401,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
     }
   }
 
-  public function groupBy() {
+  public function groupBy($includeSelectCol = TRUE) {
     $this->_groupBy = array();
     if (!empty($this->_params['group_bys']) &&
       is_array($this->_params['group_bys'])) {
@@ -429,12 +432,16 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
           }
         }
       }
-
+      $groupBy = $this->_groupBy;
       $this->_groupBy = "GROUP BY " . implode(', ', $this->_groupBy);
     }
     else {
+      $groupBy = "{$this->_aliases['civicrm_activity']}.id";
       $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_activity']}.id ";
     }
+    if ($includeSelectCol) {
+      $this->_groupBy = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, $groupBy);
+    }
   }
 
   /**
@@ -535,6 +542,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
     // now build the query for duration sum
     $this->from(TRUE);
     $this->where(TRUE);
+    $this->groupBy(FALSE);
 
     // build the query to calulate duration sum
     $sql = "SELECT SUM(activity_civireport.duration) as civicrm_activity_duration_total {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy} {$this->_limit}";
@@ -624,7 +632,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
   public function modifyColumnHeaders() {
     //CRM-16719 modify name of column
     if (!empty($this->_columnHeaders['civicrm_activity_status_id'])) {
-      $this->_columnHeaders['civicrm_activity_status_id']['title'] = "Status";
+      $this->_columnHeaders['civicrm_activity_status_id']['title'] = ts('Status');
     }
   }
 
@@ -670,6 +678,8 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
             break;
           }
         }
+        // reset date filter on activity reports.
+        $url[] = "resetDateFilter=1";
         $url = implode('&', $url);
         $url = CRM_Report_Utils_Report::getNextUrl('activity', "reset=1&force=1&{$url}",
                  $this->_absoluteUrl,