Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.4
-
Fix Version/s: 4.6
-
Component/s: CiviReport
-
Labels:None
-
Documentation Required?:None
Description
We wrote a hook_civicrm_customFieldOptions to fill a custom data of "select" type dynamically with some values based on a query. We found that the custom data we created was not appearing in the report criteria section even if we check "Is this Field Searchable?" in the custom item field property. After looking in the code we came to know that hook_civicrm_customFieldOptionsis not getting used on report criteria form when building custom field.
We modify function name addCustomData ToColumns($addFields = TRUE, $permCustomGroupIds = array()) in file CRM/Report/Form.php. to call hook_civicrm_customFieldOptions to populate the custom field option values in the report criteria. Following modification were done
=======================
Line 2897 +$options=array();
Line 2900 $curFilters[$fieldName]['options'][$ogDAO->value] = $ogDAO>label;
Line 2900 +$options[$ogDAO->value] = $ogDAO->label;
Line 2901 +CRM_Utils_Hook::customFieldOptions($customDAO->cf_id, $options, FALSE);(after While Block)
Line 2901 +$curFilters[$fieldName]['options']=$options;
==================================
We think this a generic requirement and improve the report criteria form should also call the same hook. to populate the custom field dynamic option value as it works in advance search.