From 2c8d02770076ebf0a1c83becfccbafe810b7b42f Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Mon, 5 Oct 2015 10:58:23 -0700 Subject: [PATCH] CRM-17175 - Support passing of custom field value in force mode to Activity Search. ---------------------------------------- * CRM-17175: Enable search activity by custom fields in force mode https://issues.civicrm.org/jira/browse/CRM-17175 --- CRM/Activity/Form/Search.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index 1836d3197e..38127d3936 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -378,6 +378,22 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { $this->_formValues['activity_date_high'] = $dateHigh; $this->_defaults['activity_date_high'] = $dateHigh; } + + // Enable search activity by custom value + $requestParams = CRM_Utils_Request::exportValues(); + foreach (array_keys($requestParams) as $key) { + if (substr($key, 0, 7) != 'custom_') { + continue; + } + elseif (empty($requestParams[$key])) { + continue; + } + $customValue = CRM_Utils_Request::retrieve($key, 'String', $this); + if ($customValue) { + $this->_formValues[$key] = $customValue; + $this->_defaults[$key] = $customValue; + } + } if (!empty($this->_defaults)) { $this->setDefaults($this->_defaults); -- 2.25.1