Skip to content

Commit

Permalink
Merge pull request #14585 from seamuslee001/primary_mebership_label_c…
Browse files Browse the repository at this point in the history
…hagne

Update Owner Membership ID label in reports to be Primary Membership …
  • Loading branch information
yashodha authored Jun 19, 2019
2 parents 4bc4a24 + 455a0d0 commit c70f3fb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
15 changes: 11 additions & 4 deletions CRM/Report/Form/Member/ContributionDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function __construct() {
'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' => [
Expand Down Expand Up @@ -613,14 +613,21 @@ public function statistics(&$rows) {
}

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;
}

Expand Down
15 changes: 11 additions & 4 deletions CRM/Report/Form/Member/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function __construct() {
'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' => [
Expand Down Expand Up @@ -285,14 +285,21 @@ public function from() {
}

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;
}

Expand Down
15 changes: 11 additions & 4 deletions CRM/Report/Form/Member/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function __construct() {
'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,
],
Expand Down Expand Up @@ -437,14 +437,21 @@ public function postProcess() {
}

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;
}

Expand Down

0 comments on commit c70f3fb

Please sign in to comment.