Add contributor email address to cancelSubscription form so it is clear where it...
authorMatthew Wire <mjw@mjwconsult.co.uk>
Mon, 9 Mar 2020 12:35:28 +0000 (12:35 +0000)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Tue, 21 Apr 2020 15:05:12 +0000 (16:05 +0100)
CRM/Contribute/Form/CancelSubscription.php
CRM/Core/Form.php

index 7afbe299d9e0cb48be3f6ed2d3b2fd0b74ca2b3d..831b5e9b551960e24e1ada70ca21bbc3e1574781 100644 (file)
@@ -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;
       }
     }
index 1ab3ccc8764006c25b06e0260421eefc8fb5b8fd..f19c4c317a413aa0fb1c63f4278263a69d66d422 100644 (file)
@@ -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));
     }