Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix activity_date_time_relative filter when `preserve_activity_tab_fi… #20602

Merged
merged 1 commit into from
Jul 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CRM/Activity/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ public static function getContactActivity() {

$params = CRM_Core_Page_AJAX::defaultSortAndPagerParams();
$params += CRM_Core_Page_AJAX::validateParams($requiredParameters, $optionalParameters);
// $params will be modified later on, need to save original filters
$filterParams = $params;

// To be consistent, the cid parameter should be renamed to contact_id in
// the template file, see templates/CRM/Activity/Selector/Selector.tpl
Expand All @@ -416,6 +418,7 @@ public static function getContactActivity() {

// store the activity filter preference CRM-11761
if (Civi::settings()->get('preserve_activity_tab_filter') && ($userID = CRM_Core_Session::getLoggedInContactID())) {
$activityFilter = [];
unset($optionalParameters['context']);
foreach ($optionalParameters as $searchField => $dataType) {
$formSearchField = $searchField;
Expand All @@ -425,8 +428,8 @@ public static function getContactActivity() {
elseif ($searchField === 'activity_type_exclude_id') {
$formSearchField = 'activity_type_exclude_filter_id';
}
if (!empty($params[$searchField])) {
$activityFilter[$formSearchField] = $params[$searchField];
if (!empty($filterParams[$searchField])) {
$activityFilter[$formSearchField] = $filterParams[$searchField];
if (in_array($searchField, ['activity_date_time_low', 'activity_date_time_high'])) {
$activityFilter['activity_date_time_relative'] = 0;
}
Expand Down