CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Showing Custom data in report criteria problem
Pages: [1]

Author Topic: Showing Custom data in report criteria problem  (Read 306 times)

vsharma012

  • I’m new here
  • *
  • Posts: 20
  • Karma: -2
    • Adaptive IT
  • CiviCRM version: 4.1
  • CMS version: Drupal
Showing Custom data in report criteria problem
December 06, 2014, 04:05:16 am
Hi,

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 the report criteria form should also call the same hook. to populate the custom field dynamic option value as it works in advance search.

thanks
Vikas Sharma
Adaptive IT
http://www.adaptiveitsystems.com

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Showing Custom data in report criteria problem

This forum was archived on 2017-11-26.