Skip to content

Commit

Permalink
Merge pull request #8667 from JKingsnorth/CRM-18186
Browse files Browse the repository at this point in the history
[WIP] CRM-18186: Participant API: registered by id fixes
  • Loading branch information
Yashodha Chaku authored Jul 8, 2016
2 parents 6419695 + 9da1057 commit f4516f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CRM/Event/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ public static function whereClauseSingle(&$values, &$query) {
case 'participant_fee_amount':
case 'participant_fee_level':
case 'participant_campaign_id':
case 'participant_registered_by_id':

$qillName = $name;
if (in_array($name, array(
Expand All @@ -379,6 +380,7 @@ public static function whereClauseSingle(&$values, &$query) {
'participant_fee_level',
'participant_is_pay_later',
'participant_campaign_id',
'participant_registered_by_id',
))
) {
$name = str_replace('participant_', '', $name);
Expand Down
14 changes: 14 additions & 0 deletions tests/phpunit/api/v3/ParticipantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function setUp() {
$this->_participantID2 = $this->participantCreate(array(
'contact_id' => $this->_contactID2,
'event_id' => $this->_eventID,
'registered_by_id' => $this->_participantID,
));
$this->_participantID3 = $this->participantCreate(array(
'contact_id' => $this->_contactID2,
Expand Down Expand Up @@ -343,6 +344,19 @@ public function testSearchByEventWithLimit() {
$this->assertEquals($participant['count'], 2);
}

/**
* Test search by lead booker (registered by ID)
*/
public function testSearchByRegisteredById() {
$params = array(
'registered_by_id' => $this->_participantID,
);
$participant = $this->callAPISuccess('participant', 'get', $params);

$this->assertEquals($participant['count'], 1);
$this->assertEquals($participant['id'], $this->_participantID2);
}

///////////////// civicrm_participant_create methods

/**
Expand Down

0 comments on commit f4516f0

Please sign in to comment.