From: magnolia61 Date: Mon, 9 Mar 2015 10:06:29 +0000 (+0100) Subject: fields added to contact, contribute and event forms X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=70bea8e27e9cc022950ecda0e8b6488ec65a37f4;p=civicrm-core.git fields added to contact, contribute and event forms Middle name, birth date, gender, contact (sub)type added to fields, sorting and filters --- diff --git a/CRM/Report/Form/Contact/CurrentEmployer.php b/CRM/Report/Form/Contact/CurrentEmployer.php index 2e8bee6b16..798720adb6 100644 --- a/CRM/Report/Form/Contact/CurrentEmployer.php +++ b/CRM/Report/Form/Contact/CurrentEmployer.php @@ -80,9 +80,16 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form { 'first_name' => array( 'title' => ts('First Name'), ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), 'last_name' => array( 'title' => ts('Last Name'), ), + 'id' => array( + 'no_display' => TRUE, + 'required' => TRUE, + ), 'job_title' => array( 'title' => ts('Job Title'), 'default' => TRUE, @@ -90,9 +97,12 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form { 'gender_id' => array( 'title' => ts('Gender'), ), - 'id' => array( - 'no_display' => TRUE, - 'required' => TRUE, + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', ), 'contact_type' => array( 'title' => ts('Contact Type'), @@ -103,7 +113,29 @@ class CRM_Report_Form_Contact_CurrentEmployer extends CRM_Report_Form { ), 'filters' => array( 'sort_name' => array('title' => ts('Employee Name')), - 'id' => array('no_display' => TRUE), + 'source' => array( + 'title' => ts('Contact Source'), + 'type' => CRM_Utils_Type::T_STRING, + ), + 'id' => array( + 'title' => ts('Contact ID'), + 'no_display' => TRUE, + ), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), 'grouping' => 'contact-fields', ), @@ -354,6 +386,15 @@ FROM civicrm_contact {$this->_aliases['civicrm_contact']} $entryFound = TRUE; } + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + // convert employee name to links if (array_key_exists('civicrm_contact_display_name', $row) && array_key_exists('civicrm_contact_id', $row) diff --git a/CRM/Report/Form/Contact/Detail.php b/CRM/Report/Form/Contact/Detail.php index c2dbff45cd..98e016da00 100644 --- a/CRM/Report/Form/Contact/Detail.php +++ b/CRM/Report/Form/Contact/Detail.php @@ -62,6 +62,9 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { 'first_name' => array( 'title' => ts('First Name'), ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), 'last_name' => array( 'title' => ts('Last Name'), ), @@ -69,15 +72,22 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { 'no_display' => TRUE, 'required' => TRUE, ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), 'contact_type' => array( 'title' => ts('Contact Type'), ), 'contact_sub_type' => array( 'title' => ts('Contact Subtype'), ), - 'birth_date' => array( - 'title' => ts('Birth Date'), - ), ), 'filters' => array( 'id' => array( @@ -87,10 +97,21 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { 'sort_name' => array( 'title' => ts('Contact Name'), ), + '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' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE, ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), 'grouping' => 'contact-fields', 'order_bys' => array( @@ -100,6 +121,23 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { 'default_weight' => '0', 'default_order' => 'ASC', ), + 'first_name' => array( + 'title' => ts('First Name'), + ), + 'gender_id' => array( + 'name' => 'gender_id', + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'name' => 'birth_date', + 'title' => ts('Birth Date'), + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), ), 'civicrm_address' => array( @@ -833,6 +871,24 @@ class CRM_Report_Form_Contact_Detail extends CRM_Report_Form { $entryFound = TRUE; } + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + if (array_key_exists('civicrm_address_state_province_id', $row)) { if ($value = $row['civicrm_address_state_province_id']) { $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value, FALSE); diff --git a/CRM/Report/Form/Contact/Relationship.php b/CRM/Report/Form/Contact/Relationship.php index 8e6bcb46ae..97e49c6760 100644 --- a/CRM/Report/Form/Contact/Relationship.php +++ b/CRM/Report/Form/Contact/Relationship.php @@ -44,9 +44,6 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { ); public $_drilldownReport = array('contact/detail' => 'Link to Detail Report'); - /** - * Class constructor. - */ public function __construct() { $contact_type = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, '_'); @@ -88,7 +85,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'type' => CRM_Utils_Type::T_STRING, ), ), - 'grouping' => 'conact_a_fields', + 'grouping' => 'contact_a_fields', ), 'civicrm_contact_b' => array( 'dao' => 'CRM_Contact_DAO_Contact', @@ -127,7 +124,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'type' => CRM_Utils_Type::T_STRING, ), ), - 'grouping' => 'conact_b_fields', + 'grouping' => 'contact_b_fields', ), 'civicrm_email' => array( 'dao' => 'CRM_Core_DAO_Email', @@ -137,7 +134,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'name' => 'email', ), ), - 'grouping' => 'conact_a_fields', + 'grouping' => 'contact_a_fields', ), 'civicrm_email_b' => array( 'dao' => 'CRM_Core_DAO_Email', @@ -148,7 +145,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'name' => 'email', ), ), - 'grouping' => 'conact_b_fields', + 'grouping' => 'contact_b_fields', ), 'civicrm_phone' => array( 'dao' => 'CRM_Core_DAO_Phone', @@ -163,7 +160,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'name' => 'phone_ext', ), ), - 'grouping' => 'conact_a_fields', + 'grouping' => 'contact_a_fields', ), 'civicrm_phone_b' => array( 'dao' => 'CRM_Core_DAO_Phone', @@ -178,7 +175,7 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { 'name' => 'phone_ext', ), ), - 'grouping' => 'conact_b_fields', + 'grouping' => 'contact_b_fields', ), 'civicrm_relationship_type' => array( 'dao' => 'CRM_Contact_DAO_RelationshipType', @@ -560,15 +557,10 @@ class CRM_Report_Form_Contact_Relationship extends CRM_Report_Form { } /** - * Alter display of rows. - * - * Iterate through the rows retrieved via SQL and make changes for display purposes, - * such as rendering contacts as links. - * - * @param array $rows - * Rows generated by SQL, with an array for each row. + * @param $rows */ public function alterDisplay(&$rows) { + // custom code to alter rows $entryFound = FALSE; foreach ($rows as $rowNum => $row) { diff --git a/CRM/Report/Form/Contact/Summary.php b/CRM/Report/Form/Contact/Summary.php index 3452c43388..962de2524b 100644 --- a/CRM/Report/Form/Contact/Summary.php +++ b/CRM/Report/Form/Contact/Summary.php @@ -75,12 +75,6 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { 'no_display' => TRUE, 'required' => TRUE, ), - 'contact_type' => array( - 'title' => ts('Contact Type'), - ), - 'contact_sub_type' => array( - 'title' => ts('Contact Subtype'), - ), 'gender_id' => array( 'title' => ts('Gender'), ), @@ -91,6 +85,12 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { 'title' => ts('Age'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), 'filters' => array( 'sort_name' => array('title' => ts('Contact Name')), @@ -111,6 +111,12 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { 'title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE, ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), 'grouping' => 'contact-fields', 'order_bys' => array( @@ -120,6 +126,10 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { 'default_weight' => '0', 'default_order' => 'ASC', ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), 'gender_id' => array( 'name' => 'gender_id', 'title' => ts('Gender'), @@ -128,6 +138,12 @@ class CRM_Report_Form_Contact_Summary extends CRM_Report_Form { 'name' => 'birth_date', 'title' => ts('Birth Date'), ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), ), 'civicrm_email' => array( diff --git a/CRM/Report/Form/Contribute/Bookkeeping.php b/CRM/Report/Form/Contribute/Bookkeeping.php index e4e722db54..f116e2cd73 100644 --- a/CRM/Report/Form/Contribute/Bookkeeping.php +++ b/CRM/Report/Form/Contribute/Bookkeeping.php @@ -40,14 +40,16 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { protected $_summary = NULL; protected $_customGroupExtends = array( + 'Contact', + 'Individual', + 'Contribution', 'Membership', ); - /** - */ /** */ public function __construct() { + $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $this->_columns = array( 'civicrm_contact' => array( 'dao' => 'CRM_Contact_DAO_Contact', @@ -57,10 +59,56 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { 'required' => TRUE, 'no_repeat' => TRUE, ), + 'first_name' => array( + 'title' => ts('First Name'), + ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), + 'last_name' => array( + 'title' => ts('Last Name'), + ), 'id' => array( 'no_display' => TRUE, 'required' => TRUE, ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), + ), + 'grouping' => 'contact-fields', + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', + ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), + 'gender_id' => array( + 'name' => 'gender_id', + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'name' => 'birth_date', + 'title' => ts('Birth Date'), + ), 'contact_type' => array( 'title' => ts('Contact Type'), ), @@ -77,13 +125,22 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { 'title' => ts('Contact ID'), 'no_display' => TRUE, ), - ), - 'order_bys' => array( - 'sort_name' => array( - 'title' => ts('Last Name, First Name'), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), ), ), - 'grouping' => 'contact-fields', ), 'civicrm_membership' => array( 'dao' => 'CRM_Member_DAO_Membership', @@ -511,6 +568,25 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form { if ($value = CRM_Utils_Array::value('civicrm_entity_financial_trxn_amount', $row)) { $rows[$rowNum]['civicrm_entity_financial_trxn_amount'] = CRM_Utils_Money::format($rows[$rowNum]['civicrm_entity_financial_trxn_amount'], $rows[$rowNum]['civicrm_financial_trxn_currency']); } + + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + } } diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php index 805bd1627e..f4413d26ad 100644 --- a/CRM/Report/Form/Contribute/Detail.php +++ b/CRM/Report/Form/Contribute/Detail.php @@ -42,14 +42,16 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { protected $_softFrom = NULL; - protected $_customGroupExtends = array('Contribution'); + protected $_customGroupExtends = array( + 'Contact', + 'Individual', + 'Contribution' + ); - /** - */ /** */ public function __construct() { - + $this->_autoIncludeIndexedFieldsAsOrderBys = 1; // Check if CiviCampaign is a) enabled and b) has active campaigns $config = CRM_Core_Config::singleton(); $campaignEnabled = in_array("CiviCampaign", $config->enableComponents); @@ -69,6 +71,9 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { 'first_name' => array( 'title' => ts('First Name'), ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), 'last_name' => array( 'title' => ts('Last Name'), ), @@ -76,6 +81,16 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { 'no_display' => TRUE, 'required' => TRUE, ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), 'contact_type' => array( 'title' => ts('Contact Type'), ), @@ -93,7 +108,23 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { 'no_display' => TRUE, 'type' => CRM_Utils_Type::T_INT, ), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), + 'grouping' => 'contact-fields', 'order_bys' => array( 'sort_name' => array( 'title' => ts('Last Name, First Name'), @@ -101,8 +132,26 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { 'default_weight' => '0', 'default_order' => 'ASC', ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), + 'gender_id' => array( + 'name' => 'gender_id', + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'name' => 'birth_date', + 'title' => ts('Birth Date'), + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), - 'grouping' => 'contact-fields', + ), 'civicrm_email' => array( 'dao' => 'CRM_Core_DAO_Email', @@ -798,6 +847,24 @@ WHERE civicrm_contribution_contribution_id={$row['civicrm_contribution_contribu $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s) for this ') ? TRUE : $entryFound; + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { diff --git a/CRM/Report/Form/Contribute/History.php b/CRM/Report/Form/Contribute/History.php index 26ef1c3a1a..18177be4cd 100644 --- a/CRM/Report/Form/Contribute/History.php +++ b/CRM/Report/Form/Contribute/History.php @@ -40,7 +40,11 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { protected $_phoneField = FALSE; protected $_relationshipColumns = array(); - protected $_customGroupExtends = array('Contribution'); + protected $_customGroupExtends = array( + 'Contact', + 'Individual', + 'Contribution' + ); protected $_referenceYear = array( 'this_year' => '', @@ -50,11 +54,10 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { protected $_yearStatisticsTo = ''; - /** - */ /** */ public function __construct() { + $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $yearsInPast = 4; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, 0); $count = $date['maxYear']; @@ -89,11 +92,30 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { 'required' => TRUE, 'no_repeat' => TRUE, ), + 'first_name' => array( + 'title' => ts('First Name'), + ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), + 'last_name' => array( + 'title' => ts('Last Name'), + ), 'id' => array( 'no_display' => TRUE, 'default' => TRUE, 'required' => TRUE, ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), 'contact_type' => array( 'title' => ts('Contact Type'), ), @@ -102,12 +124,53 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { ), ), 'grouping' => 'contact-fields', + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', + ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), + 'gender_id' => array( + 'name' => 'gender_id', + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'name' => 'birth_date', + 'title' => ts('Birth Date'), + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), + ), 'filters' => array( 'sort_name' => array('title' => ts('Contact Name')), 'id' => array( 'title' => ts('Contact ID'), 'no_display' => TRUE, ), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), ), 'civicrm_email' => array( @@ -780,6 +843,25 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form { $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url; $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contribution Details for this Contact."); } + + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + } } diff --git a/CRM/Report/Form/Contribute/Lybunt.php b/CRM/Report/Form/Contribute/Lybunt.php index 95569ffa78..c5c223e02a 100644 --- a/CRM/Report/Form/Contribute/Lybunt.php +++ b/CRM/Report/Form/Contribute/Lybunt.php @@ -34,23 +34,27 @@ */ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { - protected $_charts = array( '' => 'Tabular', 'barChart' => 'Bar Chart', 'pieChart' => 'Pie Chart', ); + protected $_customGroupExtends = array( + 'Contact', + 'Individual', + 'Contribution' + ); + public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); protected $lifeTime_from = NULL; protected $lifeTime_where = NULL; - /** - */ /** */ public function __construct() { + $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $yearsInPast = 10; $yearsInFuture = 1; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture); @@ -82,9 +86,53 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { 'first_name' => array( 'title' => ts('First Name'), ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), 'last_name' => array( 'title' => ts('Last Name'), ), + 'id' => array( + 'no_display' => TRUE, + 'required' => TRUE, + ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), + ), + 'grouping' => 'contact-fields', + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', + ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), + 'gender_id' => array( + 'name' => 'gender_id', + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'name' => 'birth_date', + 'title' => ts('Birth Date'), + ), 'contact_type' => array( 'title' => ts('Contact Type'), ), @@ -97,6 +145,25 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { 'title' => ts('Donor Name'), 'operator' => 'like', ), + 'id' => array( + 'title' => ts('Contact ID'), + 'no_display' => TRUE, + ), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), ), 'civicrm_email' => array( @@ -267,7 +334,12 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { foreach ($table['filters'] as $fieldName => $field) { $clause = NULL; if ($fieldName == 'yid') { - $clause = self::fiscalYearOffset('contribution_civireport.receive_date') . " = $previous_year"; + $clause = "contribution_civireport.contact_id NOT IN +(SELECT distinct contri.contact_id FROM civicrm_contribution contri + WHERE contri.is_test = 0 AND " . + self::fiscalYearOffset('contri.receive_date') . " = $current_year) AND contribution_civireport.contact_id IN (SELECT distinct contri.contact_id FROM civicrm_contribution contri + WHERE " . self::fiscalYearOffset('contri.receive_date') . + " = $previous_year AND contri.is_test = 0)"; } elseif (CRM_Utils_Array::value('type', $field) & CRM_Utils_Type::T_DATE ) { @@ -488,6 +560,24 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form { $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s)') ? TRUE : $entryFound; + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { diff --git a/CRM/Report/Form/Contribute/Repeat.php b/CRM/Report/Form/Contribute/Repeat.php index f6f007d184..31e8edd589 100644 --- a/CRM/Report/Form/Contribute/Repeat.php +++ b/CRM/Report/Form/Contribute/Repeat.php @@ -35,10 +35,13 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form { protected $_amountClauseWithAND = NULL; + protected $_customGroupExtends = array( + 'Contact', + 'Individual', + ); + public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); - /** - */ /** */ public function __construct() { @@ -98,6 +101,31 @@ class CRM_Report_Form_Contribute_Repeat extends CRM_Report_Form { ), ), 'grouping' => 'contact-fields', + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', + ), + 'first_name' => array( + 'title' => ts('First Name'), + ), + 'gender_id' => array( + 'name' => 'gender_id', + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'name' => 'birth_date', + 'title' => ts('Birth Date'), + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), + ), ), 'civicrm_phone' => array( 'dao' => 'CRM_Core_DAO_Phone', diff --git a/CRM/Report/Form/Contribute/SoftCredit.php b/CRM/Report/Form/Contribute/SoftCredit.php index f3616d0a50..4720350560 100644 --- a/CRM/Report/Form/Contribute/SoftCredit.php +++ b/CRM/Report/Form/Contribute/SoftCredit.php @@ -43,10 +43,15 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form { 'barChart' => 'Bar Chart', 'pieChart' => 'Pie Chart', ); + + protected $_customGroupExtends = array( + 'Contact', + 'Individual', + 'Contribution' + ); + public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); - /** - */ /** */ public function __construct() { @@ -91,6 +96,56 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form { 'no_display' => TRUE, 'required' => TRUE, ), + 'first_name' => array( + 'title' => ts('First Name'), + ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), + 'last_name' => array( + 'title' => ts('Last Name'), + ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), + ), + 'grouping' => 'contact-fields', + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', + ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), + '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'), + ), 'contact_type' => array( 'title' => ts('Contact Type'), ), @@ -103,8 +158,26 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form { 'name' => 'sort_name', 'title' => ts('Soft Credit Name'), ), + 'id' => array( + 'title' => ts('Contact ID'), + 'no_display' => TRUE, + ), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), - 'grouping' => 'contact-fields', ), 'civicrm_email' => array( 'dao' => 'CRM_Core_DAO_Email', @@ -534,6 +607,24 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency $row['civicrm_contribution_soft_soft_credit_type_id']); } + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { diff --git a/CRM/Report/Form/Contribute/Sybunt.php b/CRM/Report/Form/Contribute/Sybunt.php index e875dea8cc..17edcabaae 100644 --- a/CRM/Report/Form/Contribute/Sybunt.php +++ b/CRM/Report/Form/Contribute/Sybunt.php @@ -39,11 +39,19 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { 'barChart' => 'Bar Chart', 'pieChart' => 'Pie Chart', ); + + protected $_customGroupExtends = array( + 'Contact', + 'Individual', + 'Contribution' + ); + public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); /** */ public function __construct() { + $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $yearsInPast = 10; $yearsInFuture = 1; $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture); @@ -74,9 +82,57 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { 'first_name' => array( 'title' => ts('First Name'), ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), 'last_name' => array( 'title' => ts('Last Name'), ), + 'id' => array( + 'no_display' => TRUE, + 'required' => TRUE, + ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), + ), + 'grouping' => 'contact-fields', + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', + ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), + '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'), + ), 'contact_type' => array( 'title' => ts('Contact Type'), ), @@ -89,6 +145,25 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { 'title' => ts('Donor Name'), 'operator' => 'like', ), + 'id' => array( + 'title' => ts('Contact ID'), + 'no_display' => TRUE, + ), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), ), 'civicrm_email' => array( @@ -512,6 +587,24 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form { $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s)') ? TRUE : $entryFound; + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { diff --git a/CRM/Report/Form/Contribute/TopDonor.php b/CRM/Report/Form/Contribute/TopDonor.php index 3e811a6104..1cd591000e 100644 --- a/CRM/Report/Form/Contribute/TopDonor.php +++ b/CRM/Report/Form/Contribute/TopDonor.php @@ -35,6 +35,11 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { protected $_summary = NULL; + protected $_customGroupExtends = array( + 'Contact', + 'Individual', + 'Contribution' + ); public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report'); @@ -47,14 +52,11 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { /** */ public function __construct() { + $this->_autoIncludeIndexedFieldsAsOrderBys = 1; $this->_columns = array( 'civicrm_contact' => array( 'dao' => 'CRM_Contact_DAO_Contact', 'fields' => array( - 'id' => array( - 'no_display' => TRUE, - 'required' => TRUE, - ), 'display_name' => array( 'title' => ts('Contact Name'), 'required' => TRUE, @@ -63,9 +65,26 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { 'first_name' => array( 'title' => ts('First Name'), ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), 'last_name' => array( 'title' => ts('Last Name'), ), + 'id' => array( + 'no_display' => TRUE, + 'required' => TRUE, + ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), 'contact_type' => array( 'title' => ts('Contact Type'), ), @@ -95,6 +114,29 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { ), ), 'filters' => array( + 'sort_name' => array( + 'title' => ts('Participant Name'), + 'operator' => 'like', + ), + 'id' => array( + 'title' => ts('Contact ID'), + 'no_display' => TRUE, + ), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), 'receive_date' => array( 'default' => 'this.year', 'operatorType' => CRM_Report_Form::OP_DATE, @@ -447,6 +489,24 @@ ORDER BY civicrm_contribution_total_amount_sum DESC } $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s)') ? TRUE : $entryFound; + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { diff --git a/CRM/Report/Form/Event/ParticipantListCount.php b/CRM/Report/Form/Event/ParticipantListCount.php index 30498cd31b..a5ce9d476e 100644 --- a/CRM/Report/Form/Event/ParticipantListCount.php +++ b/CRM/Report/Form/Event/ParticipantListCount.php @@ -44,8 +44,6 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event { public $_drilldownReport = array('event/income' => 'Link to Detail Report'); - /** - */ /** */ public function __construct() { @@ -59,17 +57,87 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event { 'no_repeat' => TRUE, 'required' => TRUE, ), + 'first_name' => array( + 'title' => ts('First Name'), + ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), + 'last_name' => array( + 'title' => ts('Last Name'), + ), 'id' => array( 'no_display' => TRUE, 'required' => TRUE, ), + 'gender_id' => array( + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'title' => ts('Birth Date'), + ), + 'age' => array( + 'title' => ts('Age'), + 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())', + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), - 'grouping' => 'contact-fields', 'filters' => array( 'sort_name' => array( 'title' => ts('Participant Name'), 'operator' => 'like', ), + 'id' => array( + 'title' => ts('Contact ID'), + 'no_display' => TRUE, + ), + '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' => ts('Birth Date'), + 'operatorType' => CRM_Report_Form::OP_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), + ), + 'grouping' => 'contact-fields', + 'order_bys' => array( + 'sort_name' => array( + 'title' => ts('Last Name, First Name'), + 'default' => '1', + 'default_weight' => '0', + 'default_order' => 'ASC', + ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), + 'gender_id' => array( + 'name' => 'gender_id', + 'title' => ts('Gender'), + ), + 'birth_date' => array( + 'name' => 'birth_date', + 'title' => ts('Birth Date'), + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), ), 'civicrm_employer' => array( @@ -539,6 +607,24 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event { $entryFound = TRUE; } + //handle gender + if (array_key_exists('civicrm_contact_gender_id', $row)) { + if ($value = $row['civicrm_contact_gender_id']) { + $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'); + $rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value]; + } + $entryFound = TRUE; + } + + // display birthday in the configured custom format + if (array_key_exists('civicrm_contact_birth_date', $row)) { + $birthDate = $row['civicrm_contact_birth_date']; + if ($birthDate) { + $rows[$rowNum]['civicrm_contact_birth_date'] = CRM_Utils_Date::customFormat($birthDate, '%Y%m%d'); + } + $entryFound = TRUE; + } + // skip looking further in rows, if first row itself doesn't // have the column we need if (!$entryFound) { diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php index 7863ea057c..4822876e3a 100644 --- a/CRM/Report/Form/Event/ParticipantListing.php +++ b/CRM/Report/Form/Event/ParticipantListing.php @@ -81,6 +81,9 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { 'first_name' => array( 'title' => ts('First Name'), ), + 'middle_name' => array( + 'title' => ts('Middle Name'), + ), 'last_name' => array( 'title' => ts('Last Name'), ), @@ -88,6 +91,9 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { 'no_display' => TRUE, 'required' => TRUE, ), + 'employer_id' => array( + 'title' => ts('Organization'), + ), 'gender_id' => array( 'title' => ts('Gender'), ), @@ -102,8 +108,11 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { 'title' => ts('Age at Event'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)', ), - 'employer_id' => array( - 'title' => ts('Organization'), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), ), ), 'grouping' => 'contact-fields', @@ -114,6 +123,10 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { 'default_weight' => '0', 'default_order' => 'ASC', ), + 'first_name' => array( + 'name' => 'first_name', + 'title' => ts('First Name'), + ), 'gender_id' => array( 'name' => 'gender_id', 'title' => ts('Gender'), @@ -126,6 +139,12 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { 'name' => 'age_at_event', 'title' => ts('Age at Event'), ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), + ), ), 'filters' => array( 'sort_name' => array( @@ -138,9 +157,14 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form_Event { 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), ), 'birth_date' => array( - 'title' => 'Birth Date', + 'title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE, - 'type' => CRM_Utils_Type::T_DATE, + ), + 'contact_type' => array( + 'title' => ts('Contact Type'), + ), + 'contact_sub_type' => array( + 'title' => ts('Contact Subtype'), ), ), ),