$eventID = implode(',', $eventIDs);
- $participantStatus = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1", "label");
$participantRole = CRM_Event_PseudoConstant::participantRole();
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
if ($optionGroupDAO->find(TRUE)) {
$optionGroupId = $optionGroupDAO->id;
}
- //show the income of active participant status (Counted = filter = 1)
- $activeParticipantStatusIDArray = $activeParticipantStatusLabelArray = [];
- foreach ($participantStatus as $id => $label) {
- $activeParticipantStatusIDArray[] = $id;
- $activeParticipantStatusLabelArray[] = $label;
- }
- $activeParticipantStatus = implode(',', $activeParticipantStatusIDArray);
- $activeparticipnatStutusLabel = implode(', ', $activeParticipantStatusLabelArray);
- $activeParticipantClause = " AND civicrm_participant.status_id IN ( $activeParticipantStatus ) ";
+
+ $activeParticipantClause = " AND civicrm_participant.status_id IN ( " . implode(',', array_keys($this->getActiveParticipantStatuses())) . " ) ";
$select = [
"civicrm_event.id as event_id",
"civicrm_event.title as event_title",
$eventSummary[$eventDAO->event_id][ts('End Date')] = CRM_Utils_Date::customFormat($eventDAO->end_date);
$eventSummary[$eventDAO->event_id][ts('Event Type')] = $eventDAO->event_type;
$eventSummary[$eventDAO->event_id][ts('Event Income')] = CRM_Utils_Money::format($eventDAO->total, $eventDAO->currency);
- $eventSummary[$eventDAO->event_id][ts('Registered Participant')] = "{$eventDAO->participant} ({$activeparticipnatStutusLabel})";
+ $eventSummary[$eventDAO->event_id][ts('Registered Participant')] = "{$eventDAO->participant} ({" . implode(', ', $this->getActiveParticipantStatuses()) . ")";
$currency[$eventDAO->event_id] = $eventDAO->currency;
}
$this->assign_by_ref('summary', $eventSummary);
$statusDAO = $this->executeReportQuery($status);
+ $participantStatus = $this->getActiveParticipantStatuses();
while ($statusDAO->fetch()) {
$statusRows[$statusDAO->event_id][$participantStatus[$statusDAO->STATUSID]]['total'] = $statusDAO->participant;
$statusRows[$statusDAO->event_id][$participantStatus[$statusDAO->STATUSID]]['round'] = round(($statusDAO->participant / $count[$statusDAO->event_id]) * 100, 2);
parent::endPostProcess();
}
+ /**
+ * Get statuses with the counted filter set to TRUE.
+ *
+ * @return array
+ */
+ protected function getActiveParticipantStatuses() {
+ return CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1", "label");
+ }
+
}