From 00903a2661d56096d487533c40ad88d5c30cc1bd Mon Sep 17 00:00:00 2001 From: Mattias Michaux Date: Tue, 3 Nov 2015 13:43:59 +0100 Subject: [PATCH] Fixed participant role filtering for non numeric participant role values. --- CRM/Event/BAO/Event.php | 6 ++++-- CRM/Event/BAO/Participant.php | 2 +- CRM/Event/Form/Search.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index cce8709032..eb8f1933d9 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -632,8 +632,10 @@ $event_summary_limit if ($role) { $roleClause = 'IN'; } - $roles = implode(',', array_keys($roleTypes)); - if (empty($roles)) { + if (array_keys($roleTypes)) { + $roles = '"' . implode("','", array_keys($roleTypes)) . '"'; + } + else { $roles = 0; } $clause[] = "participant.role_id {$roleClause} ( $roles )"; diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 6e54464185..7e6cb9be15 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -383,7 +383,7 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant { $where[] = ' ( participant.is_test = 0 OR participant.is_test IS NULL ) '; } if (!empty($participantRoles)) { - $where[] = ' participant.role_id IN ( ' . implode(', ', array_keys($participantRoles)) . ' ) '; + $where[] = ' participant.role_id IN ( "' . implode("', '", array_keys($participantRoles)) . '" ) '; } $eventParams = array(1 => array($eventId, 'Positive')); diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index a2ed549ac5..894b7478a5 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -201,7 +201,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { } } if (!empty($this->_formValues['participant_role_id'])) { - $seatClause[] = '( participant.role_id IN ( ' . implode(' , ', (array) $this->_formValues['participant_role_id']) . ' ) )'; + $seatClause[] = '( participant.role_id IN ( "' . implode('" , "', (array) $this->_formValues['participant_role_id']) . '" ) )'; } // CRM-15379 -- 2.25.1