Skip to content

Commit

Permalink
[PHP8.2] Remove undeclared property
Browse files Browse the repository at this point in the history
It appears to be copy & paste cos it is set but never used
  • Loading branch information
eileenmcnaughton committed Jul 27, 2023
1 parent bfdeab6 commit 8f036c3
Showing 1 changed file with 16 additions and 26 deletions.
42 changes: 16 additions & 26 deletions CRM/Report/Form/Event/IncomeCountSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
class CRM_Report_Form_Event_IncomeCountSummary extends CRM_Report_Form {

protected $_summary = NULL;

protected $_add2groupSupported = FALSE;

protected $_customGroupExtends = [
Expand Down Expand Up @@ -114,7 +112,7 @@ public function __construct() {
'title' => ts('Participant Status'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, "label"),
'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'),
],
'rid' => [
'name' => 'role_id',
Expand All @@ -141,11 +139,8 @@ public function __construct() {
parent::__construct();
}

public function preProcess() {
parent::preProcess();
}

public function select() {
public function select(): void {
$select = [];
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
Expand Down Expand Up @@ -190,10 +185,10 @@ public function select() {
}
$this->_selectClauses = $select;

$this->_select = "SELECT " . implode(', ', $select);
$this->_select = 'SELECT ' . implode(', ', $select);
}

public function from() {
public function from(): void {
$this->_from = "
FROM civicrm_event {$this->_aliases['civicrm_event']}
LEFT JOIN civicrm_participant {$this->_aliases['civicrm_participant']}
Expand All @@ -204,10 +199,9 @@ public function from() {
{$this->_aliases['civicrm_line_item']}.entity_table = 'civicrm_participant' ";
}

public function where() {
public function where(): void {
$clauses = [];
$this->_participantWhere = "";
foreach ($this->_columns as $tableName => $table) {
foreach ($this->_columns as $table) {
if (array_key_exists('filters', $table)) {
foreach ($table['filters'] as $fieldName => $field) {
$clause = NULL;
Expand All @@ -231,10 +225,6 @@ public function where() {
);
}
}
if (!empty($this->_params['id_value'])) {
$idValue = is_array($this->_params['id_value']) ? implode(',', $this->_params['id_value']) : $this->_params['id_value'];
$this->_participantWhere = " AND civicrm_participant.event_id IN ( $idValue ) ";
}

if (!empty($clause)) {
$clauses[] = $clause;
Expand All @@ -243,15 +233,16 @@ public function where() {
}
}
$clauses[] = "{$this->_aliases['civicrm_event']}.is_template = 0";
$this->_where = "WHERE " . implode(' AND ', $clauses);
$this->_where = 'WHERE ' . implode(' AND ', $clauses);
}

/**
* @param array $rows
*
* @return array
* @throws \Civi\Core\Exception\DBQueryException
*/
public function statistics(&$rows) {
public function statistics(&$rows): array {
$statistics = parent::statistics($rows);
$select = "
SELECT SUM( {$this->_aliases['civicrm_line_item']}.participant_count ) as count,
Expand Down Expand Up @@ -287,7 +278,7 @@ public function statistics(&$rows) {

public function groupBy() {
$this->assign('chartSupported', TRUE);
$this->_rollup = " WITH ROLLUP";
$this->_rollup = ' WITH ROLLUP';
$this->_select = CRM_Contact_BAO_Query::appendAnyValueToSelect($this->_selectClauses, "{$this->_aliases['civicrm_event']}.id");
$this->_groupBy = " GROUP BY {$this->_aliases['civicrm_event']}.id {$this->_rollup}";
}
Expand All @@ -303,27 +294,26 @@ public function postProcess() {
//set pager before execution of query in function participantInfo()
$this->setPager();

$rows = $graphRows = [];
$count = 0;
$rows = [];

while ($dao->fetch()) {
$row = [];
foreach ($this->_columnHeaders as $key => $value) {
if (($key == 'civicrm_event_start_date') ||
($key == 'civicrm_event_end_date')
if (($key === 'civicrm_event_start_date') ||
($key === 'civicrm_event_end_date')
) {
//get event start date and end date in custom datetime format
$row[$key] = CRM_Utils_Date::customFormat($dao->$key);
}
elseif ($key == 'civicrm_participant_fee_amount_avg') {
elseif ($key === 'civicrm_participant_fee_amount_avg') {
if ($dao->civicrm_participant_fee_amount_sum &&
$dao->civicrm_line_item_participant_count_count
) {
$row[$key] = $dao->civicrm_participant_fee_amount_sum /
$dao->civicrm_line_item_participant_count_count;
}
}
elseif ($key == 'civicrm_line_item_line_total_avg') {
elseif ($key === 'civicrm_line_item_line_total_avg') {
if ($dao->civicrm_line_item_line_total_sum &&
$dao->civicrm_line_item_participant_count_count
) {
Expand Down Expand Up @@ -360,7 +350,7 @@ public function buildChart(&$rows) {
foreach ($rows as $key => $value) {
if ($value['civicrm_event_id']) {
$graphRows['totalParticipants'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
$graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
$graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . '..(' .
$rows[$key]['civicrm_event_id'] . ") ";
$graphRows['value'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
}
Expand Down

0 comments on commit 8f036c3

Please sign in to comment.