$activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
asort($activityOptions);
- $this->add('select', 'activity_type_filter_id', ts('Include'), array('' => ts('- all activity type(s) -')) + $activityOptions);
- $this->add('select', 'activity_type_exclude_filter_id', ts('Exclude'), array('' => ts('- select activity type -')) + $activityOptions);
+ $this->add('select', 'activity_type_filter_id', ts('Include'), $activityOptions, FALSE, ['class' => 'crm-select2', 'multiple' => TRUE, 'placeholder' => ts('- all activity type(s) -')]);
+ $this->add('select', 'activity_type_exclude_filter_id', ts('Exclude'), $activityOptions, FALSE, ['class' => 'crm-select2', 'multiple' => TRUE, 'placeholder' => ts('- no types excluded -')]);
$this->addDatePickerRange('activity_date_time', ts('Date'));
$this->addSelect('status_id',
array('entity' => 'activity', 'multiple' => 'multiple', 'option_url' => NULL, 'placeholder' => ts('- any -'))
$formSearchField = 'activity_type_exclude_filter_id';
}
if (!empty($params[$searchField])) {
- $activityFilter[$formSearchField] = CRM_Utils_Type::escape($params[$searchField], $dataType);
+ $activityFilter[$formSearchField] = $params[$searchField];
if (in_array($searchField, array('activity_date_time_low', 'activity_date_time_high'))) {
$activityFilter['activity_date_time_relative'] = 0;
}
$activityFilter['status_id'] = explode(',', $activityFilter[$searchField]);
}
}
- elseif (in_array($searchField, array('activity_type_id', 'activity_type_exclude_id'))) {
- $activityFilter[$formSearchField] = '';
- }
}
Civi::contactSettings()->set('activity_tab_filter', $activityFilter);
foreach ($optionalParams as $param => $type) {
if (CRM_Utils_Array::value($param, $_GET)) {
- $params[$param] = CRM_Utils_Type::validate(CRM_Utils_Array::value($param, $_GET), $type);
+ if (!is_array($_GET[$param])) {
+ $params[$param] = CRM_Utils_Type::validate(CRM_Utils_Array::value($param, $_GET), $type);
+ }
+ else {
+ foreach ($_GET[$param] as $index => $value) {
+ $params[$param][$index] = CRM_Utils_Type::validate($value, $type);
+ }
+ }
}
}
);
$expectedFilters = array(
'activity_type_filter_id' => 1,
- 'activity_type_exclude_filter_id' => '',
);
list($activities, $activityFilter) = CRM_Activity_Page_AJAX::getContactActivity();
$this->assertContains('Meeting', $value['activity_type']);
}
unset($_GET['activity_type_id']);
- $expectedFilters['activity_type_filter_id'] = '';
$_GET['activity_type_exclude_id'] = $expectedFilters['activity_type_exclude_filter_id'] = 1;
list($activities, $activityFilter) = CRM_Activity_Page_AJAX::getContactActivity();
- $this->checkArrayEquals($expectedFilters, $activityFilter);
+ $this->assertEquals(['activity_type_exclude_filter_id' => 1], $activityFilter);
// None of the activities should be of type Meeting.
foreach ($activities['data'] as $value) {
$this->assertNotContains('Meeting', $value['activity_type']);