From 59adcdd959c7f2ea77125c61da75698559d2baf0 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Tue, 28 May 2013 20:24:12 -0700 Subject: [PATCH] CRM-12714 Add is_test to params passed to CRM_Event_BAO_Event::eventTotalSeats to prevent erroneous display of Actual participant count in Find Participants search results summary. ---------------------------------------- * CRM-12714: Actual Participants count on Find Participants is mistakenly displayed when search test participant records are present http://issues.civicrm.org/jira/browse/CRM-12714 --- CRM/Event/Form/Search.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index df577e26d1..9d87f1b774 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -271,20 +271,23 @@ class CRM_Event_Form_Search extends CRM_Core_Form { if (count($eventIds) == 1) { //convert form values to clause. $seatClause = array(); - $clauseParams = array('participant_status_id', 'participant_role_id'); + // Filter on is_test if specified in search form + if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0' ) { + $seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )"; + } if (CRM_Utils_Array::value('participant_status_id', $this->_formValues)) { $statuses = array_keys($this->_formValues['participant_status_id']); - $seatClause[] = '( participant.status_id IN ( ' . implode(' , ', $statuses) . ' ) )'; } if (CRM_Utils_Array::value('participant_role_id', $this->_formValues)) { $roles = array_keys($this->_formValues['participant_role_id']); - $seatClause[] = '( participant.status_id IN ( ' . implode(' , ', $roles) . ' ) )'; + $seatClause[] = '( participant.role_id IN ( ' . implode(' , ', $roles) . ' ) )'; } $clause = NULL; if (!empty($seatClause)) { $clause = implode(' AND ', $seatClause); } + $participantCount = CRM_Event_BAO_Event::eventTotalSeats(array_pop($eventIds), $clause); } $this->assign('participantCount', $participantCount); -- 2.25.1