protected $_subscriptionDetails = NULL;
- protected $_selfService = FALSE;
-
public $_bltID = NULL;
/**
* Set variables up before form is built.
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
parent::preProcess();
if ($this->_crid) {
- $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_crid);
-
// Are we cancelling a recurring contribution that is linked to an auto-renew membership?
if ($this->_subscriptionDetails->membership_id) {
$this->_mid = $this->_subscriptionDetails->membership_id;
if ($this->_coid) {
$this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'info');
$this->_paymentProcessor['object'] = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj');
- $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution');
}
if ($this->_mid) {
if ((!$this->_crid && !$this->_coid && !$this->_mid) || (!$this->_subscriptionDetails)) {
CRM_Core_Error::fatal('Required information missing.');
}
- if (!CRM_Core_Permission::check('edit contributions')) {
- if ($this->_subscriptionDetails->contact_id != $this->getContactID()) {
- CRM_Core_Error::statusBounce(ts('You do not have permission to cancel subscription.'));
- }
- $this->_selfService = TRUE;
- }
if (!$this->_paymentProcessor['object']->supports('updateSubscriptionBillingInfo')) {
CRM_Core_Error::fatal(ts("%1 processor doesn't support updating subscription billing details.",
*/
public function buildQuickForm() {
$type = 'next';
- if ($this->_selfService) {
+ if ($this->isSelfService()) {
$type = 'submit';
}