Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Duplicate
-
Affects Version/s: 3.2.3, 3.2.4, 3.2.5, 3.3.0, 3.3.1
-
Fix Version/s: 4.1.0
-
Component/s: Drupal Integration Modules
-
Labels:None
Description
In CiviCRM prior to version 2.3.x, I could create a Drupal view on CiviEvents, which had a custom field defined. The custom field ( called event category ) is defined as a checkbox, which had about 15 choices. In the view definition, the filter was defined to include all events with the check value of "young families" In versions before 2.3.x, this view worked correctly in that it picked up all events with the checkbox value of "young families." ( No matter if the event had one category checked off or multiple categories checked off. )
After upgrading, to 2.3.x ( and now version 3.3.1 ) the view will only return events with ONLY the "young families" checkbox selected. If the custom field has "young families" as well as any other checkbox selected, then the view does NOT include that event.
SELECT civicrm_event.id AS id,
civicrm_event.title AS civicrm_event_title,
civicrm_event.start_date AS civicrm_event_start_date
FROM civicrm_event civicrm_event
LEFT JOIN civicrm_value_extra_event_info_8 civicrm_value_extra_event_info_8 ON civicrm_event.id = civicrm_value_extra_event_info_8.entity_id
WHERE ((civicrm_event.is_active <> 0) AND (civicrm_event.is_public <> 0) AND (civicrm_value_extra_event_info_8.event_category_16 in ('Young Families')))
AND ((DATE_FORMAT(ADDTIME(civicrm_event.start_date, SEC_TO_TIME(18000)), '%Y%m') <= '2011-2' AND DATE_FORMAT(ADDTIME(civicrm_event.start_date, SEC_TO_TIME(18000)), '%Y%m') >= '2010-12'))
ORDER BY civicrm_event_start_date ASC
------------------------------------------------------------------------------------------------
Notice the use of the syntax "in ('Young Families')" within the SQL where clause. This means the SQL will only get rows that are an exact match. If I change the syntax to "like ('%Young Families%') then the SQL will get all rows, including events with multiple categories. At this point, I do not see a standard mechanism in the Views module to force it to use the "like" syntax.