Skip to content
Snippets Groups Projects
Commit 456fcdd2 authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

Merge pull request #1727 from davecivicrm/CRM-13279a

CRM-13279 Adding filters for Age, Age at Event and Birth Date. Also addi...
parents e693c767 28ac0bbe
No related branches found
No related tags found
No related merge requests found
......@@ -38,10 +38,12 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
protected $_contribField = FALSE;
protected $_customGroupExtends = array('Participant');
protected $_customGroupExtends = array('Participant', 'Contact', 'Individual',);
public $_drilldownReport = array('event/income' => 'Link to Detail Report');
function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
// Check if CiviCampaign is a) enabled and b) has active campaigns
$config = CRM_Core_Config::singleton();
......@@ -73,11 +75,19 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
'no_display' => TRUE,
'required' => TRUE,
),
'gender_id' =>
array('title' => ts('Gender'),
),
'birth_date' =>
array('title' => ts('Birth Date'),
),
'gender_id' =>
array('title' => ts('Gender'),
'age' => array(
'title' => ts('Age'),
'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())',
),
'age_at_event' => array(
'title' => ts('Age at Event'),
'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)',
),
'employer_id' =>
array('title' => ts('Organization'),
......@@ -92,6 +102,21 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
'default_weight' => '0',
'default_order' => 'ASC',
),
'gender_id' =>
array(
'name' => 'gender_id',
'title' => ts('Gender'),
),
'birth_date' =>
array(
'name' => 'birth_date',
'title' => ts('Birth Date'),
),
'age_at_event' =>
array(
'name' => 'age_at_event',
'title' => ts('Age at Event'),
),
),
'filters' =>
array(
......@@ -99,6 +124,16 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
array('title' => ts('Participant Name'),
'operator' => 'like',
),
'gender_id' =>
array('title' => ts('Gender'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
),
'birth_date' => array(
'title' => 'Birth Date',
'operatorType' => CRM_Report_Form::OP_DATE,
'type' => CRM_Utils_Type::T_DATE
),
),
),
'civicrm_email' =>
......@@ -656,6 +691,14 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
$entryFound = TRUE;
}
// display birthday in the configured custom format
if (array_key_exists('civicrm_contact_birth_date', $row)) {
if ($value = $row['civicrm_contact_birth_date']) {
$rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($row['civicrm_contact_birth_date'], '%Y%m%d');
}
$entryFound = TRUE;
}
// skip looking further in rows, if first row itself doesn't
// have the column we need
if (!$entryFound) {
......@@ -663,4 +706,4 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event {
}
}
}
}
}
\ No newline at end of file
......@@ -23,4 +23,16 @@
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{literal}
<script type="text/javascript">
cj(document).ready(function(){
cj('#birth_date_from').attr('startOffset',200);
cj('#birth_date_from').attr('endoffset',0);
cj('#birth_date_to').attr('startOffset',200);
cj('#birth_date_to').attr('endoffset',0);
});
</script>
{/literal}
{include file="CRM/Report/Form.tpl"}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment