<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
+ * @copyright CiviCRM LLC (c) 2004-2015
*/
/**
- * This class provides support for canceling recurring subscriptions
- *
+ * This class provides support for canceling recurring subscriptions.
*/
class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form {
protected $_paymentProcessorObj = NULL;
protected $_selfService = FALSE;
/**
- * Set variables up before form is built
- *
- * @return void
+ * Set variables up before form is built.
*/
public function preProcess() {
$this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
$this->assign('mode', $this->_mode);
if ($this->_subscriptionDetails->contact_id) {
- list($this->_donorDisplayName, $this->_donorEmail) =
- CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
+ list($this->_donorDisplayName, $this->_donorEmail)
+ = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
}
}
/**
- * Build the form object
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
// Determine if we can cancel recurring contribution via API with this processor
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @param null
- *
* @return array
* array of default values
*/
}
/**
- * Process the form submission
- *
- *
- * @return void
+ * Process the form submission.
*/
public function postProcess() {
$status = $message = NULL;
CRM_Core_Error::displaySessionError($cancelSubscription);
}
elseif ($cancelSubscription) {
- $activityParams =
- array(
+ $activityParams
+ = array(
'subject' => $this->_mid ? ts('Auto-renewal membership cancelled') : ts('Recurring contribution cancelled'),
'details' => $message,
);
$inputParams = array('id' => $this->_mid);
CRM_Member_BAO_Membership::getValues($inputParams, $tplParams);
$tplParams = $tplParams[$this->_mid];
- $tplParams['membership_status'] =
- CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $tplParams['status_id']);
- $tplParams['membershipType'] =
- CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $tplParams['membership_type_id']);
+ $tplParams['membership_status']
+ = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $tplParams['status_id']);
+ $tplParams['membershipType']
+ = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $tplParams['membership_type_id']);
$status = ts('The automatic renewal of your %1 membership has been cancelled as requested. This does not affect the status of your membership - you will receive a separate notification when your membership is up for renewal.', array(1 => $tplParams['membershipType']));
$msgTitle = 'Membership Renewal Cancelled';
$msgType = 'info';
$value,
array('title', 'receipt_from_name', 'receipt_from_email')
);
- $receiptFrom =
- '"' .
- CRM_Utils_Array::value('receipt_from_name', $value[$this->_subscriptionDetails->contribution_page_id]) .
+ $receiptFrom
+ = '"' . CRM_Utils_Array::value('receipt_from_name', $value[$this->_subscriptionDetails->contribution_page_id]) .
'" <' .
$value[$this->_subscriptionDetails->contribution_page_id]['receipt_from_email'] .
'>';
}
// send notification
- $sendTemplateParams =
- array(
+ $sendTemplateParams
+ = array(
'groupName' => $this->_mode == 'auto_renew' ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
'valueName' => $this->_mode == 'auto_renew' ? 'membership_autorenew_cancelled' : 'contribution_recurring_cancelled',
'contactId' => $this->_subscriptionDetails->contact_id,
$session->setStatus($status, $msgTitle, $msgType);
}
elseif (!$userID) {
- if ($status)
+ if ($status) {
CRM_Utils_System::setUFMessage($status);
- // keep result as 1, since we not displaying anything on the redirected page anyway
- return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus',
+ // keep result as 1, since we not displaying anything on the redirected page anyway
+ return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus',
"reset=1&task=cancel&result=1"));
+ }
}
}
+
}