From 455a0d0e5964f7b04f335491de426f7f47fd2b75 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 19 Jun 2019 09:25:11 +1000 Subject: [PATCH] Update Owner Membership ID label in reports to be Primary Membership to be more consistant with rest of system Re-order owner_membership_id field options so that primary members only and non-primary-members-only filters are at the top --- CRM/Report/Form/Member/ContributionDetail.php | 15 +++++++++++---- CRM/Report/Form/Member/Detail.php | 15 +++++++++++---- CRM/Report/Form/Member/Summary.php | 15 +++++++++++---- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/CRM/Report/Form/Member/ContributionDetail.php b/CRM/Report/Form/Member/ContributionDetail.php index e3dd884f8d..3b92f9b633 100644 --- a/CRM/Report/Form/Member/ContributionDetail.php +++ b/CRM/Report/Form/Member/ContributionDetail.php @@ -315,7 +315,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { 'membership_start_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_end_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'owner_membership_id' => [ - 'title' => ts('Membership Owner ID'), + 'title' => ts('Primary Membership'), 'operatorType' => CRM_Report_Form::OP_INT, ], 'tid' => [ @@ -613,14 +613,21 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { } public function getOperationPair($type = "string", $fieldName = NULL) { - $result = parent::getOperationPair($type, $fieldName); - //re-name IS NULL/IS NOT NULL for clarity if ($fieldName == 'owner_membership_id') { + $result = []; $result['nll'] = ts('Primary members only'); $result['nnll'] = ts('Non-primary members only'); + $options = parent::getOperationPair($type, $fieldName); + foreach ($options as $key => $label) { + if (!array_key_exists($key, $result)) { + $result[$key] = $label; + } + } + } + else { + $result = parent::getOperationPair($type, $fieldName); } - return $result; } diff --git a/CRM/Report/Form/Member/Detail.php b/CRM/Report/Form/Member/Detail.php index 93a64ce21c..cdb100c8f2 100644 --- a/CRM/Report/Form/Member/Detail.php +++ b/CRM/Report/Form/Member/Detail.php @@ -119,7 +119,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { 'membership_start_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_end_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'owner_membership_id' => [ - 'title' => ts('Membership Owner ID'), + 'title' => ts('Primary Membership'), 'operatorType' => CRM_Report_Form::OP_INT, ], 'tid' => [ @@ -285,14 +285,21 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { } public function getOperationPair($type = "string", $fieldName = NULL) { - $result = parent::getOperationPair($type, $fieldName); - //re-name IS NULL/IS NOT NULL for clarity if ($fieldName == 'owner_membership_id') { + $result = []; $result['nll'] = ts('Primary members only'); $result['nnll'] = ts('Non-primary members only'); + $options = parent::getOperationPair($type, $fieldName); + foreach ($options as $key => $label) { + if (!array_key_exists($key, $result)) { + $result[$key] = $label; + } + } + } + else { + $result = parent::getOperationPair($type, $fieldName); } - return $result; } diff --git a/CRM/Report/Form/Member/Summary.php b/CRM/Report/Form/Member/Summary.php index cc390e7c2e..e4fb27ac9b 100644 --- a/CRM/Report/Form/Member/Summary.php +++ b/CRM/Report/Form/Member/Summary.php @@ -91,7 +91,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { 'operatorType' => CRM_Report_Form::OP_DATE, ], 'owner_membership_id' => [ - 'title' => ts('Membership Owner ID'), + 'title' => ts('Primary Membership'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_INT, ], @@ -437,14 +437,21 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency } public function getOperationPair($type = "string", $fieldName = NULL) { - $result = parent::getOperationPair($type, $fieldName); - //re-name IS NULL/IS NOT NULL for clarity if ($fieldName == 'owner_membership_id') { + $result = []; $result['nll'] = ts('Primary members only'); $result['nnll'] = ts('Non-primary members only'); + $options = parent::getOperationPair($type, $fieldName); + foreach ($options as $key => $label) { + if (!array_key_exists($key, $result)) { + $result[$key] = $label; + } + } + } + else { + $result = parent::getOperationPair($type, $fieldName); } - return $result; } -- 2.25.1