Unverified Commit cd6fae5f authored by eileen's avatar eileen 🎱 Committed by GitHub

Merge pull request #12821 from mattwire/updatesubscription_fix

Show recurring contribution links based on payment processor capabilities
parents d65bdcb2 c6d558dc
......@@ -81,13 +81,18 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
if ($recurID) {
$links = self::$_links;
$paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recurID, 'recur', 'obj');
if (is_object($paymentProcessorObj) && $paymentProcessorObj->supports('cancelRecurring')) {
if (!is_object($paymentProcessorObj)) {
unset($links[CRM_Core_Action::DISABLE]);
unset($links[CRM_Core_Action::UPDATE]);
return $links;
}
if ($paymentProcessorObj->supports('cancelRecurring')) {
unset($links[CRM_Core_Action::DISABLE]['extra'], $links[CRM_Core_Action::DISABLE]['ref']);
$links[CRM_Core_Action::DISABLE]['url'] = "civicrm/contribute/unsubscribe";
$links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}";
}
if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) {
if ($paymentProcessorObj->supports('UpdateSubscriptionBillingInfo')) {
$links[CRM_Core_Action::RENEW] = array(
'name' => ts('Change Billing Details'),
'title' => ts('Change Billing Details'),
......@@ -95,6 +100,10 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}",
);
}
if (!$paymentProcessorObj->supports('ChangeSubscriptionAmount') && !$paymentProcessorObj->supports('EditRecurringContribution')) {
unset($links[CRM_Core_Action::UPDATE]);
}
return $links;
}
......@@ -251,13 +260,6 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
}
if ($recurContributions[$recurId]['is_active']) {
$details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recurContributions[$recurId]['id'], 'recur');
$hideUpdate = $details->membership_id & $details->auto_renew;
if ($hideUpdate) {
$action -= CRM_Core_Action::UPDATE;
}
$recurContributions[$recurId]['action'] = CRM_Core_Action::formLink(self::recurLinks($recurId), $action,
array(
'cid' => $this->_contactId,
......
......@@ -28,7 +28,7 @@
<div class="help">
{$changeHelpText}
{if $recurMembership}
<br/><strong> {ts}'WARNING: This recurring contribution is linked to membership:{/ts}
<br/><strong> {ts}WARNING: This recurring contribution is linked to membership:{/ts}
<a class="crm-hover-button" href='{crmURL p="civicrm/contact/view/membership" q="action=view&reset=1&cid=`$contactId`&id=`$recurMembership.membership_id`&context=membership&selectedChild=member"}'>{$recurMembership.membership_name}</a>
</strong>
{/if}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment