bulk comment fix
[civicrm-core.git] / CRM / Activity / BAO / Query.php
index 24ff055b14fb40ceacc48cc16c6ae2410505116a..39dca577a9e6e83846cc54493f2ddfd1e10304fb 100644 (file)
@@ -38,6 +38,8 @@ class CRM_Activity_BAO_Query {
   /**
    * build select for Case
    *
+   * @param $query
+   *
    * @return void
    * @access public
    */
@@ -58,7 +60,8 @@ class CRM_Activity_BAO_Query {
     }
 
     if (!empty($query->_returnProperties['activity_type'])) {
-      $query->_select['activity_type'] = "activity_type.label as activity_type";
+      $query->_select['activity_type'] = "activity_type.label as activity_type,
+        civicrm_activity.activity_type_id as activity_type_id";
       $query->_element['activity_type'] = 1;
       $query->_tables['civicrm_activity'] = 1;
       $query->_tables['activity_type'] = 1;
@@ -155,6 +158,8 @@ class CRM_Activity_BAO_Query {
    * Given a list of conditions in query generate the required
    * where clause
    *
+   * @param $query
+   *
    * @return void
    * @access public
    */
@@ -174,6 +179,8 @@ class CRM_Activity_BAO_Query {
   /**
    * where clause for a single field
    *
+   * @param $values
+   * @param $query
    * @return void
    * @access public
    */
@@ -193,7 +200,7 @@ class CRM_Activity_BAO_Query {
         //get the component activity types.
         $compActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, TRUE);
         $activityTypeIds = self::buildWhereAndQill($query, $value, $types, $op, $grouping, array('Activity Type', 'civicrm_activity.activity_type_id'));
-        
+
         foreach ($activityTypeIds as $activityTypeId) {
           if (array_key_exists($activityTypeId, $compActTypes)) {
             CRM_Contact_BAO_Query::$_considerCompActivities = TRUE;
@@ -247,7 +254,7 @@ class CRM_Activity_BAO_Query {
 
       case 'activity_status':
         $status = CRM_Core_PseudoConstant::activityStatus();
-        
+
         $activityTypeIds = self::buildWhereAndQill($query, $value, $status, $op, $grouping, array('Activity Status', 'civicrm_activity.status_id'));
         break;
 
@@ -465,7 +472,7 @@ class CRM_Activity_BAO_Query {
     }
 
     $parentNames = CRM_Core_BAO_Tag::getTagSet('civicrm_activity');
-    CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_activity', NULL, TRUE, FALSE, TRUE);
+    CRM_Core_Form_Tag::buildQuickForm($form, $parentNames, 'civicrm_activity', NULL, TRUE, TRUE);
 
     $surveys = CRM_Campaign_BAO_Survey::getSurveys(TRUE, FALSE, FALSE, TRUE);
     if ($surveys) $form->add('select', 'activity_survey_id', ts('Survey / Petition'),
@@ -522,7 +529,7 @@ class CRM_Activity_BAO_Query {
         );
       }
     }
-     
+
     $form->assign('buildEngagementLevel', $buildEngagementLevel);
     $form->assign('buildSurveyResult', $buildSurveyResult);
     $form->setDefaults(array('activity_test' => 0));
@@ -538,6 +545,7 @@ class CRM_Activity_BAO_Query {
         'sort_name' => 1,
         'display_name' => 1,
         'activity_type' => 1,
+        'activity_type_id' => 1,
         'activity_subject' => 1,
         'activity_date_time' => 1,
         'activity_duration' => 1,
@@ -565,17 +573,17 @@ class CRM_Activity_BAO_Query {
 
     return $properties;
   }
-  
+
   static function buildWhereAndQill(&$query, $value, $pseudoconstantType, $op, $grouping, $params) {
     $matches = $val = $clause = array();
-    
+
     if (is_array($value)) {
       foreach ($value as $k => $v) {
         if ($k) {
           $val[] = $k;
         }
       }
-      
+
       if (count($val) > 0) {
         // Overwrite $op so it works with an IN where statement.
         $op = 'IN';
@@ -592,7 +600,7 @@ class CRM_Activity_BAO_Query {
     foreach ($matches[0] as $qill) {
       $clause[] = CRM_Utils_Array::value($qill, $pseudoconstantType);
     }
-    
+
     $query->_qill[$grouping][] = ts($params[0] . ' %1 ', array(1 => $op)) . implode(' ' . ts('or') . ' ', $clause);
     $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($params[1],
       $op, $value, "Integer"