Skip to content

Commit

Permalink
Merge pull request #13432 from francescbassas/patch-16
Browse files Browse the repository at this point in the history
dev/core#657 - Add filter for country on Repeat Contributions Report
  • Loading branch information
yashodha authored Feb 15, 2019
2 parents 45e44c3 + 8c0f07c commit 7716b56
Showing 1 changed file with 51 additions and 53 deletions.
104 changes: 51 additions & 53 deletions CRM/Report/Form/Contribute/Repeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,41 +99,27 @@ public function __construct() {
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
'grouping' => 'contact-fields',
'fields' => array(
'sort_name' => array(
'title' => ts('Contact Name'),
'no_repeat' => TRUE,
'default' => TRUE,
),
'display_name' => array(
'title' => ts('Display Name'),
'no_repeat' => TRUE,
),
'addressee_display' => array(
'title' => ts('Addressee Name'),
'no_repeat' => TRUE,
),
'id' => array(
'no_display' => TRUE,
'required' => TRUE,
),
'contact_type' => array(
'title' => ts('Contact Type'),
'no_repeat' => TRUE,
),
'contact_sub_type' => array(
'title' => ts('Contact Subtype'),
'no_repeat' => TRUE,
),
'fields' => array_merge(
$this->getBasicContactFields(),
array(
'sort_name' => array(
'title' => ts('Contact Name'),
'no_repeat' => TRUE,
'default' => TRUE,
),
)
),
'filters' => array(
'percentage_change' => array(
'title' => ts('Percentage Change'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_INT,
'name' => 'percentage_change',
'dbAlias' => '( ( contribution_civireport2.total_amount_sum - contribution_civireport1.total_amount_sum ) * 100 / contribution_civireport1.total_amount_sum )',
),
'filters' => array_merge(
$this->getBasicContactFilters(array('deceased' => NULL)),
array(
'percentage_change' => array(
'title' => ts('Percentage Change'),
'type' => CRM_Utils_Type::T_INT,
'operatorType' => CRM_Report_Form::OP_INT,
'name' => 'percentage_change',
'dbAlias' => '( ( contribution_civireport2.total_amount_sum - contribution_civireport1.total_amount_sum ) * 100 / contribution_civireport1.total_amount_sum )',
),
)
),
'group_bys' => array(
'id' => array(
Expand Down Expand Up @@ -187,24 +173,6 @@ public function __construct() {
),
'grouping' => 'contact-fields',
),
'civicrm_address' => array(
'dao' => 'CRM_Core_DAO_Address',
'grouping' => 'contact-fields',
'fields' => array(
'street_address' => array('title' => ts('Street Address')),
'supplemental_address_1' => array('title' => ts('Supplemental Address 1')),
'city' => array('title' => ts('City')),
'country_id' => array('title' => ts('Country')),
'state_province_id' => array('title' => ts('State/Province')),
'postal_code' => array('title' => ts('Postal Code')),
),
'group_bys' => array(
'country_id' => array('title' => ts('Country')),
'state_province_id' => array(
'title' => ts('State/Province'),
),
),
),
'civicrm_financial_type' => array(
'dao' => 'CRM_Financial_DAO_FinancialType',
'fields' => array('financial_type' => array('title' => ts('Financial Type'))),
Expand Down Expand Up @@ -280,7 +248,7 @@ public function __construct() {
),
'group_bys' => array('contribution_source' => NULL),
),
);
) + $this->addAddressFields(TRUE, FALSE, TRUE, array('country_id' => FALSE));

$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
Expand Down Expand Up @@ -531,6 +499,7 @@ public static function formRule($fields, $files, $self) {
$rules = array(
'id' => array(
'sort_name',
'exposed_id',
'display_name',
'addressee_display',
'contact_type',
Expand All @@ -540,9 +509,38 @@ public static function formRule($fields, $files, $self) {
'state_province_id',
'country_id',
'city',
'county_id',
'street_address',
'supplemental_address_1',
'supplemental_address_2',
'supplemental_address_3',
'street_number',
'street_name',
'street_unit',
'postal_code',
'postal_code_suffix',
'prefix_id',
'first_name',
'nick_name',
'middle_name',
'last_name',
'suffix_id',
'postal_greeting_display',
'email_greeting_display',
'addressee_display',
'gender_id',
'birth_date',
'age',
'job_title',
'organization_name',
'external_identifier',
'do_not_email',
'do_not_phone',
'do_not_mail',
'do_not_sms',
'is_opt_out',
'is_deceased',
'preferred_language',
),
'country_id' => array('country_id'),
'state_province_id' => array('country_id', 'state_province_id'),
Expand Down

0 comments on commit 7716b56

Please sign in to comment.