Merge pull request #15757 from yashodha/participant_edit
[civicrm-core.git] / CRM / Contribute / Form / CancelSubscription.php
index 1f32d308bae380b59ebf3193a0ea9a139f963911..f8be875bd1297b84c85ec0907aebea40faa440ff 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
+ | Copyright CiviCRM LLC (c) 2004-2020                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC (c) 2004-2020
  */
 
 /**
@@ -53,13 +53,6 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Contribute_Form_Contrib
     return TRUE;
   }
 
-  /**
-   * Is the from being accessed by a front end user to update their own recurring.
-   *
-   * @var bool
-   */
-  protected $selfService;
-
   /**
    * Set variables up before form is built.
    *
@@ -83,10 +76,6 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Contribute_Form_Contrib
       $this->_mode = 'auto_renew';
       // CRM-18468: crid is more accurate than mid for getting
       // subscriptionDetails, so don't get them again.
-      if (!$this->_crid) {
-        $this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_mid, 'membership', 'obj');
-        $this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_mid, 'membership');
-      }
 
       $membershipTypes = CRM_Member_PseudoConstant::membershipType();
       $membershipTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $this->_mid, 'membership_type_id');
@@ -136,7 +125,7 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Contribute_Form_Contrib
       'cancel_reason' => ['name' => 'cancel_reason'],
     ];
     $this->entityFields['send_cancel_request'] = [
-      'title' => ts('Send cancellation request to %1 ?', [1 => $this->_paymentProcessorObj->_processorName]),
+      'title' => ts('Send cancellation request?'),
       'name' => 'send_cancel_request',
       'not-auto-addable' => TRUE,
     ];
@@ -343,23 +332,4 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Contribute_Form_Contrib
     }
   }
 
-  /**
-   * Is this being used by a front end user to update their own recurring.
-   *
-   * @return bool
-   */
-  protected function isSelfService() {
-    if (!is_null($this->selfService)) {
-      return $this->selfService;
-    }
-    $this->selfService = FALSE;
-    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 this recurring contribution.'));
-      }
-      $this->selfService = TRUE;
-    }
-    return $this->selfService;
-  }
-
 }