Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#2115 prep - Remove silly if, silly rename #20762

Merged
merged 1 commit into from
Jul 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove silly if, silly rename
This removes an if which would only be true if civicrm_membership_type table had the
field is_reserved and it was set to true. Given condition 1 is not met, 2
cannot be met.

Also - we rename max_related to maxRelated for no-good-reason
eileenmcnaughton committed Jul 4, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 8f90bd14cd0427d0d30a11df2ff744bce0865af6
33 changes: 15 additions & 18 deletions CRM/Member/Page/MembershipType.php
Original file line number Diff line number Diff line change
@@ -123,7 +123,6 @@ public function browse() {
$value, $relationshipName
);
}
$membershipType[$dao->id]['maxRelated'] = $membershipType[$dao->id]['max_related'] ?? NULL;
}
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('edit contributions of type ' . CRM_Contribute_PseudoConstant::financialType($dao->financial_type_id))) {
unset($links[CRM_Core_Action::UPDATE], $links[CRM_Core_Action::ENABLE], $links[CRM_Core_Action::DISABLE]);
@@ -134,24 +133,22 @@ public function browse() {
// form all action links
$action = array_sum(array_keys($this->links()));

// update enable/disable links depending on if it is is_reserved or is_active
if (!isset($dao->is_reserved)) {
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
}
else {
$action -= CRM_Core_Action::DISABLE;
}
$membershipType[$dao->id]['order'] = $membershipType[$dao->id]['weight'];
$membershipType[$dao->id]['action'] = CRM_Core_Action::formLink($links, $action,
['id' => $dao->id],
ts('more'),
FALSE,
'membershipType.manage.action',
'MembershipType',
$dao->id
);
// update enable/disable links depending on if it is_active
if ($dao->is_active) {
$action -= CRM_Core_Action::ENABLE;
}
else {
$action -= CRM_Core_Action::DISABLE;
}
$membershipType[$dao->id]['order'] = $membershipType[$dao->id]['weight'];
$membershipType[$dao->id]['action'] = CRM_Core_Action::formLink($links, $action,
['id' => $dao->id],
ts('more'),
FALSE,
'membershipType.manage.action',
'MembershipType',
$dao->id
);
}

$returnURL = CRM_Utils_System::url('civicrm/admin/member/membershipType', "reset=1&action=browse");
2 changes: 1 addition & 1 deletion templates/CRM/Member/Page/MembershipType.tpl
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
<td class="crmf-duration_interval_unit">{$row.duration_interval} {$row.duration_unit}</td>
<td class="crmf-auto_renew">{if $row.auto_renew EQ 2}{ts}Required{/ts}{elseif $row.auto_renew EQ 1}{ts}Optional{/ts}{else}{ts}No{/ts}{/if}</td>
<td class="crmf-relationship_type">{$row.relationshipTypeName}</td>
<td class="crmf-max_related" align="right">{$row.maxRelated}</td>
<td class="crmf-max_related" align="right">{$row.max_related}</td>
<td class="crmf-visibility crm-editable" data-type="select">{$row.visibility}</td>
<td class="nowrap crmf-weight">{$row.weight}</td>
<td class="crmf-is_active">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>