+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | 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
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
protected $_selfService = FALSE;
/**
- * Set variables up before form is built
+ * Set variables up before form is built.
*
* @return void
*/
public function preProcess() {
- $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
+ $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
$this->_crid = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
if ($this->_crid) {
$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
+ * Build the form object.
*
* @return void
*/
// Determine if we can cancel recurring contribution via API with this processor
$cancelSupported = $this->_paymentProcessorObj->isSupported('cancelSubscription');
if ($cancelSupported) {
- $searchRange = array();
+ $searchRange = array();
$searchRange[] = $this->createElement('radio', NULL, NULL, ts('Yes'), '1');
$searchRange[] = $this->createElement('radio', NULL, NULL, ts('No'), '0');
}
$type = 'next';
- if ( $this->_selfService ) {
+ if ($this->_selfService) {
$type = 'submit';
}
* 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
+ * @return array
+ * array of default values
*/
public function setDefaultValues() {
$defaults = array('is_notify' => 1);
}
/**
- * Process the form submission
+ * Process the form submission.
*
*
* @return void
*/
public function postProcess() {
- $status = $message = NULL;
+ $status = $message = NULL;
$cancelSubscription = TRUE;
- $params = $this->controller->exportValues($this->_name);
+ $params = $this->controller->exportValues($this->_name);
if ($this->_selfService) {
// for self service force sending-request & notify
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';
array(
1 => $this->_subscriptionDetails->amount,
2 => $this->_subscriptionDetails->frequency_interval,
- 3 => $this->_subscriptionDetails->frequency_unit
+ 3 => $this->_subscriptionDetails->frequency_unit,
)
);
$msgTitle = 'Contribution Cancelled';
$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(
- '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,
- 'tplParams' => $tplParams,
- //'isTest' => $isTest, set this from _objects
- 'PDFFilename' => 'receipt.pdf',
- 'from' => $receiptFrom,
- 'toName' => $this->_donorDisplayName,
- 'toEmail' => $this->_donorEmail,
- );
+ $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,
+ 'tplParams' => $tplParams,
+ //'isTest' => $isTest, set this from _objects
+ 'PDFFilename' => 'receipt.pdf',
+ 'from' => $receiptFrom,
+ 'toName' => $this->_donorDisplayName,
+ 'toEmail' => $this->_donorEmail,
+ );
list($sent) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
}
}
}
$session = CRM_Core_Session::singleton();
- $userID = $session->get('userID');
- if ( $userID && $status) {
+ $userID = $session->get('userID');
+ if ($userID && $status) {
$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',
- "reset=1&task=cancel&result=1"));
+ // 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"));
+ }
}
}
+
}