additional fixes
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Mon, 16 Nov 2015 06:18:34 +0000 (11:48 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Mon, 16 Nov 2015 06:18:34 +0000 (11:48 +0530)
CRM/Report/Form/Activity.php

index 250dd48c89fbc4bf863b92a5f73b03fe11127be2..ed9e2386cc5e4c412a236a7d8bba2e66d16fa4c1 100644 (file)
@@ -591,6 +591,9 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
               if ($fieldName == 'activity_type_id' &&
                 empty($this->_params['activity_type_id_value'])
               ) {
+                if (empty($this->_params['include_case_activities_value'])) {
+                  $this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'label', TRUE);
+                }
                 $actTypes = array_flip($this->activityTypes);
                 $clause = "( {$this->_aliases['civicrm_activity']}.activity_type_id IN (" .
                   implode(',', $actTypes) . ") )";
@@ -723,12 +726,15 @@ GROUP BY civicrm_activity_id $having {$this->_orderBy}";
    */
   public static function formRule($fields, $files, $self) {
     $errors = array();
-    $componentId = CRM_Core_Component::getComponentID('CiviCase');
-    $caseActivityTypes = CRM_Core_OptionGroup::values('activity_type', TRUE, FALSE, FALSE, " AND v.component_id={$componentId}");
-    if (!empty($fields['activity_type_id_value']) && is_array($fields['activity_type_id_value']) && empty($fields['include_case_activities_value'])) {
-      foreach ($fields['activity_type_id_value'] as $activityTypeId) {
-        if (in_array($activityTypeId, $caseActivityTypes)) {
-          $errors['fields'] = ts("Please enable 'Include Case Activities' to filter with Case Activity types.");
+    $config = CRM_Core_Config::singleton();
+    if (in_array("CiviCase", $config->enableComponents)) {
+      $componentId = CRM_Core_Component::getComponentID('CiviCase');
+      $caseActivityTypes = CRM_Core_OptionGroup::values('activity_type', TRUE, FALSE, FALSE, " AND v.component_id={$componentId}");
+      if (!empty($fields['activity_type_id_value']) && is_array($fields['activity_type_id_value']) && empty($fields['include_case_activities_value'])) {
+        foreach ($fields['activity_type_id_value'] as $activityTypeId) {
+          if (in_array($activityTypeId, $caseActivityTypes)) {
+            $errors['fields'] = ts("Please enable 'Include Case Activities' to filter with Case Activity types.");
+          }
         }
       }
     }