From 4f9ebda2c684bae1b21739dace8a2aea879bf656 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sat, 30 Dec 2023 20:16:42 +0000 Subject: [PATCH] [REF][PHP8.2] Cleanup discounts property in eventcart ext --- ext/eventcart/CRM/Event/Cart/Form/Cart.php | 15 +++++++++++---- .../CRM/Event/Cart/Form/Checkout/Payment.php | 1 - 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ext/eventcart/CRM/Event/Cart/Form/Cart.php b/ext/eventcart/CRM/Event/Cart/Form/Cart.php index f585cd92cf..58fb238de6 100644 --- a/ext/eventcart/CRM/Event/Cart/Form/Cart.php +++ b/ext/eventcart/CRM/Event/Cart/Form/Cart.php @@ -16,6 +16,17 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form { public $_mode; public $participants; + /** + * Provides way for extensions to add discounts to the event_registration_receipt emails. + * + * Todo: Do any extensions actually use this, + * or can it be removed, and the email templates cleaned up? + * + * @var array + * @deprecated Not recommended for new extensions. + */ + public $discounts = []; + public function preProcess() { $this->_action = CRM_Utils_Request::retrieveValue('action', 'String'); $this->_mode = 'live'; @@ -27,10 +38,6 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form { foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) { $event_titles[] = $event_in_cart->event->title; } - - if (!isset($this->discounts)) { - $this->discounts = []; - } } public function loadCart() { diff --git a/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php b/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php index 5fd08a1116..175f7bd253 100644 --- a/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php @@ -340,7 +340,6 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { 'credit_card_exp_date' => $params['credit_card_exp_date'], 'credit_card_type' => $params['credit_card_type'], 'credit_card_number' => "************" . substr($params['credit_card_number'], -4, 4), - // XXX cart->get_discounts 'discounts' => $this->discounts, 'email' => $contact_details[1], 'events_in_cart' => $events_in_cart, -- 2.25.1