From: Dave Greenberg Date: Mon, 5 Oct 2015 17:58:23 +0000 (-0700) Subject: CRM-17175 - Support passing of custom field value in force mode to Activity Search. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2c8d02770076ebf0a1c83becfccbafe810b7b42f;p=civicrm-core.git 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 --- 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);