From 6305d9b18df02f329c0a1a3ee3910dbb4134c3ba Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Fri, 22 Mar 2019 12:54:13 -0400 Subject: [PATCH] Grant detail report use getColumns, allow order by --- CRM/Report/Form/Grant/Detail.php | 75 ++++++++++++-------------------- 1 file changed, 27 insertions(+), 48 deletions(-) diff --git a/CRM/Report/Form/Grant/Detail.php b/CRM/Report/Form/Grant/Detail.php index 35d42279ce..6061d1d2e0 100644 --- a/CRM/Report/Form/Grant/Detail.php +++ b/CRM/Report/Form/Grant/Detail.php @@ -40,54 +40,13 @@ class CRM_Report_Form_Grant_Detail extends CRM_Report_Form { * Class constructor. */ public function __construct() { - $this->_columns = array( - 'civicrm_contact' => array( - 'dao' => 'CRM_Contact_DAO_Contact', - 'fields' => array( - 'sort_name' => array( - 'title' => ts('Contact Name'), - 'required' => TRUE, - 'no_repeat' => TRUE, - ), - 'id' => array( - 'no_display' => TRUE, - 'required' => TRUE, - ), - ), - 'grouping' => 'contact-fields', - 'filters' => array( - 'sort_name' => array( - 'title' => ts('Contact 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'), - ), - 'id' => array( - 'title' => ts('Contact ID'), - 'no_display' => TRUE, - ), - ), - ), - 'civicrm_address' => array( - 'dao' => 'CRM_Core_DAO_Address', - 'filters' => array( - 'country_id' => array( - 'title' => ts('Country'), - 'type' => CRM_Utils_Type::T_INT, - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::country(), - ), - 'state_province_id' => array( - 'title' => ts('State/Province'), - 'type' => CRM_Utils_Type::T_INT, - 'operatorType' => CRM_Report_Form::OP_MULTISELECT, - 'options' => CRM_Core_PseudoConstant::stateProvince(), - ), - ), - ), + $contactCols = $this->getColumns('Contact', array( + 'order_bys_defaults' => array('sort_name' => 'ASC '), + 'fields_defaults' => ['sort_name'], + 'filters_defaults' => array('is_deleted' => 0), + 'no_field_disambiguation' => TRUE, + )); + $specificCols = array( 'civicrm_grant' => array( 'dao' => 'CRM_Grant_DAO_Grant', 'fields' => array( @@ -112,6 +71,7 @@ class CRM_Report_Form_Grant_Detail extends CRM_Report_Form { 'name' => 'application_received_date', 'title' => ts('Application Received'), 'default' => TRUE, + 'type' => CRM_Utils_Type::T_DATE, ), 'money_transfer_date' => array( 'name' => 'money_transfer_date', @@ -181,6 +141,23 @@ class CRM_Report_Form_Grant_Detail extends CRM_Report_Form { ), ), 'group_bys' => array( + 'grant_type_id' => array( + 'title' => ts('Grant Type'), + ), + 'status_id' => array( + 'title' => ts('Grant Status'), + ), + 'application_received_date' => array( + 'title' => ts('Application Received Date'), + ), + 'money_transfer_date' => array( + 'title' => ts('Money Transfer Date'), + ), + 'decision_date' => array( + 'title' => ts('Grant Decision Date'), + ), + ), + 'order_bys' => array( 'grant_type_id' => array( 'title' => ts('Grant Type'), ), @@ -206,6 +183,8 @@ class CRM_Report_Form_Grant_Detail extends CRM_Report_Form { ), ); + $this->_columns = array_merge($contactCols, $specificCols, $this->addAddressFields(FALSE)); + parent::__construct(); } -- 2.25.1