diff --git a/CRM/Contribute/Page/Tab.php b/CRM/Contribute/Page/Tab.php index fac5a250bc7b..f29a390042fc 100644 --- a/CRM/Contribute/Page/Tab.php +++ b/CRM/Contribute/Page/Tab.php @@ -73,15 +73,18 @@ public static function recurLinks($recurID = FALSE, $context = 'contribution') { if ($paymentProcessorObj) { 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]['url'] = $paymentProcessorObj->subscriptionURL(NULL, NULL, 'cancel'); $links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}"; } + else { + unset($links[CRM_Core_Action::DISABLE]); + } if ($paymentProcessorObj->supports('UpdateSubscriptionBillingInfo')) { $links[CRM_Core_Action::RENEW] = [ 'name' => ts('Change Billing Details'), 'title' => ts('Change Billing Details'), - 'url' => 'civicrm/contribute/updatebilling', + 'url' => $paymentProcessorObj->subscriptionURL(NULL, NULL, 'billing'), 'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}", ]; } @@ -98,6 +101,10 @@ public static function recurLinks($recurID = FALSE, $context = 'contribution') { unset($links[CRM_Core_Action::DISABLE]); unset($links[CRM_Core_Action::UPDATE]); } + + if (!CRM_Core_Permission::check('view my contact') && $context === 'dashboard') { + unset($links[CRM_Core_Action::VIEW]); + } } return $links; diff --git a/CRM/Contribute/Page/UserDashboard.php b/CRM/Contribute/Page/UserDashboard.php index dc8707155ce5..74cd54de93cf 100644 --- a/CRM/Contribute/Page/UserDashboard.php +++ b/CRM/Contribute/Page/UserDashboard.php @@ -48,6 +48,7 @@ public function listContribution() { // This is required for tpl logic. We should move away from hard-code this to adding an array of actions to the row // which the tpl can iterate through - this should allow us to cope with competing attempts to add new buttons // and allow extensions to assign new ones through the pageRun hook + // ALSO: Should 'id' be set to the contribution page of the original transaction? if ('Pending' === CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $row['contribution_status_id'])) { $row['buttons']['pay'] = [ 'class' => 'button', @@ -124,11 +125,17 @@ public function listContribution() { } if (is_array($recurIDs) && !empty($recurIDs)) { $getCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurIDs); + $isLinked = CRM_Core_Permission::check('access CiviContribute'); foreach ($getCount as $key => $val) { $recurRow[$key]['completed'] = $val; - $recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', - "reset=1&force=1&recur=$key" - ); + if ($isLinked) { + $recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', + "reset=1&force=1&recur=$key" + ); + } + else { + $recurRow[$key]['link'] = ''; + } } } diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 839702f1d004..905734328510 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -106,6 +106,22 @@ protected function supportsBackOffice() { return FALSE; } + /** + * Does this processor support cancelling recurring contributions through code. + * + * If the processor returns true it must be possible to take action from within CiviCRM + * that will result in no further payments being processed. In the case of token processors (e.g + * IATS, eWay) updating the contribution_recur table is probably sufficient. + * + * @return bool + */ + protected function supportsCancelRecurring() { + if ($this->isPayPalType($this::PAYPAL_STANDARD)) { + return FALSE; + } + return parent::supportsCancelRecurring(); + } + /** * Does this processor support pre-approval. * @@ -125,6 +141,36 @@ protected function supportsPreApproval() { return FALSE; } + /** + * Does this processor support updating billing info for recurring contributions through code. + * + * If the processor returns true then it must be possible to update billing info from within CiviCRM + * that will be updated at the payment processor. + * + * @return bool + */ + protected function supportsUpdateSubscriptionBillingInfo() { + if (!$this->isPayPalType($this::PAYPAL_PRO)) { + return FALSE; + } + return parent::supportsUpdateSubscriptionBillingInfo(); + } + + /** + * Does this processor support changing the amount for recurring contributions through code. + * + * If the processor returns true then it must be possible to update the amount from within CiviCRM + * that will be updated at the payment processor. + * + * @return bool + */ + protected function supportsChangeSubscriptionAmount() { + if (!$this->isPayPalType($this::PAYPAL_PRO)) { + return FALSE; + } + return parent::supportsChangeSubscriptionAmount(); + } + /** * Opportunity for the payment processor to override the entire form build. * diff --git a/templates/CRM/Contribute/Page/UserDashboard.tpl b/templates/CRM/Contribute/Page/UserDashboard.tpl index 0520ebc1a300..070df34eedfe 100644 --- a/templates/CRM/Contribute/Page/UserDashboard.tpl +++ b/templates/CRM/Contribute/Page/UserDashboard.tpl @@ -23,6 +23,7 @@
{ts}Terms:{/ts} | -{ts}Status{/ts} | +{ts}Amount{/ts} | +{ts}Interval{/ts} | {ts}Installments{/ts} | +{ts}Status{/ts} | {ts}Created{/ts} | |
---|---|---|---|---|---|---|---|
- every {$recurRows.$id.frequency_interval} {$recurRows.$id.frequency_unit} - for {$recurRows.$id.installments} installments - | +{$recurRows.$id.amount|crmMoney} | +{$recurRows.$id.frequency_interval} {$recurRows.$id.frequency_unit} | +{if $recurRows.$id.link}{/if}{if $recurRows.$id.completed}{$recurRows.$id.completed}{else}0{/if} / {if $recurRows.$id.installments}{$recurRows.$id.installments}{else}{ts}(Open-ended){/ts}{/if}{if $recurRows.$id.link}{/if} | {$recurRows.$id.recur_status} | -{if $recurRows.$id.completed}{$recurRows.$id.completed} - /{$recurRows.$id.installments} - {else}0/{$recurRows.$id.installments} {/if} | {$recurRows.$id.create_date|crmDate} | {$recurRows.$id.action|replace:'xx':$recurRows.id} |