From d6ae85acf150a2cd1253db6c60c999fb1b1e5d8d Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Mon, 9 Mar 2020 12:35:28 +0000 Subject: [PATCH] Add contributor email address to cancelSubscription form so it is clear where it will be sent --- CRM/Contribute/Form/CancelSubscription.php | 20 +++++++++++--------- CRM/Core/Form.php | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CRM/Contribute/Form/CancelSubscription.php b/CRM/Contribute/Form/CancelSubscription.php index 7afbe299d9..831b5e9b55 100644 --- a/CRM/Contribute/Form/CancelSubscription.php +++ b/CRM/Contribute/Form/CancelSubscription.php @@ -8,13 +8,8 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ */ -use Civi\Payment\PropertyBag; -/** - * - * @package CRM - * @copyright CiviCRM LLC https://civicrm.org/licensing - */ +use Civi\Payment\PropertyBag; /** * This class provides support for canceling recurring subscriptions. @@ -25,6 +20,13 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Contribute_Form_Contrib protected $_mode = NULL; + /** + * The contributor email + * + * @var string + */ + protected $_donorEmail = ''; + /** * Should custom data be suppressed on this form. * @@ -149,8 +151,8 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Contribute_Form_Contrib } $this->assign('cancelSupported', $cancelSupported); - if ($this->_donorEmail) { - $this->add('checkbox', 'is_notify', ts('Notify Contributor?')); + if (!empty($this->_donorEmail)) { + $this->add('checkbox', 'is_notify', ts('Notify Contributor?') . " ({$this->_donorEmail})"); } if ($this->_mid) { $cancelButton = ts('Cancel Automatic Membership Renewal'); @@ -205,7 +207,7 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Contribute_Form_Contrib $params['send_cancel_request'] = 1; } - if ($this->_donorEmail) { + if (!empty($this->_donorEmail)) { $params['is_notify'] = 1; } } diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 1ab3ccc876..f19c4c317a 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -419,7 +419,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page { unset($extra['option_context']); } - $element = $this->addElement($type, $name, $label, $attributes, $extra); + $element = $this->addElement($type, $name, CRM_Utils_String::purifyHTML($label), $attributes, $extra); if (HTML_QuickForm::isError($element)) { CRM_Core_Error::fatal(HTML_QuickForm::errorMessage($element)); } -- 2.25.1