Skip to content

Commit

Permalink
CRM_17474 standardise address field addition to other reports
Browse files Browse the repository at this point in the history
This also adds add extra address fields to participant listing such as
address_name & county

Conflicts:
	CRM/Report/Form/Event/ParticipantListing.php

Conflicts:
	CRM/Report/Form/Event/ParticipantListing.php
  • Loading branch information
eileenmcnaughton committed Dec 16, 2015
1 parent 047a686 commit 4596546
Showing 1 changed file with 5 additions and 53 deletions.
58 changes: 5 additions & 53 deletions CRM/Report/Form/Event/ParticipantListing.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,9 @@ public function __construct() {
),
),
),
'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
'fields' => array(
'street_address' => NULL,
'city' => NULL,
'postal_code' => NULL,
'state_province_id' => array(
'title' => ts('State/Province'),
),
'country_id' => array(
'title' => ts('Country'),
),
),
'grouping' => 'contact-fields',
),
);
$this->_columns += $this->getAddressColumns();
$this->_columns += array(
'civicrm_participant' => array(
'dao' => 'CRM_Event_DAO_Participant',
'fields' => array(
Expand Down Expand Up @@ -614,28 +602,9 @@ public function groupBy() {
}

public function postProcess() {

// get ready with post process params
$this->beginPostProcess();

// get the acl clauses built before we assemble the query
$this->buildACLClause($this->_aliases['civicrm_contact']);
// build query
$sql = $this->buildQuery(TRUE);

// build array of result based on column headers. This method also allows
// modifying column headers before using it to build result set i.e $rows.
$rows = array();
$this->buildRows($sql, $rows);

// format result set.
$this->formatDisplay($rows);

// assign variables to templates
$this->doTemplateAssignment($rows);

// do print / pdf / instance stuff if needed
$this->endPostProcess($rows);
parent::postProcess();
}

/**
Expand Down Expand Up @@ -758,24 +727,6 @@ public function alterDisplay(&$rows) {
$entryFound = TRUE;
}

// Handle country id
if (array_key_exists('civicrm_address_country_id', $row)) {
$countryId = $row['civicrm_address_country_id'];
if ($countryId) {
$rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($countryId, TRUE);
}
$entryFound = TRUE;
}

// Handle state/province id
if (array_key_exists('civicrm_address_state_province_id', $row)) {
$provinceId = $row['civicrm_address_state_province_id'];
if ($provinceId) {
$rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($provinceId, TRUE);
}
$entryFound = TRUE;
}

// Handle employer id
if (array_key_exists('civicrm_contact_employer_id', $row)) {
$employerId = $row['civicrm_contact_employer_id'];
Expand Down Expand Up @@ -811,6 +762,7 @@ public function alterDisplay(&$rows) {
}
$entryFound = TRUE;
}
$entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'event/ParticipantListing', 'List all participant(s) for this ') ? TRUE : $entryFound;

// skip looking further in rows, if first row itself doesn't
// have the column we need
Expand Down

0 comments on commit 4596546

Please sign in to comment.