From c953775a3e9ec1e50f96c70c7586372047784bff Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Thu, 5 Mar 2020 21:53:58 +0000 Subject: [PATCH] Remove non working code that makes event cart behave differently if you are an administrator --- CRM/Event/Cart/Form/Cart.php | 11 ++-------- .../Form/Checkout/ParticipantsAndPrices.php | 1 - CRM/Event/Cart/Form/Checkout/Payment.php | 21 +------------------ 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/CRM/Event/Cart/Form/Cart.php b/CRM/Event/Cart/Form/Cart.php index 475c88ffbc..3b7bee6931 100644 --- a/CRM/Event/Cart/Form/Cart.php +++ b/CRM/Event/Cart/Form/Cart.php @@ -97,15 +97,8 @@ class CRM_Event_Cart_Form_Cart extends CRM_Core_Form { } /** - * @return bool - */ - public static function is_administrator() { - global $user; - return CRM_Core_Permission::check('administer CiviCRM'); - } - - /** - * @return mixed + * @return int + * @throws \CRM_Core_Exception */ public function getContactID() { $tempID = CRM_Utils_Request::retrieveValue('cid', 'Positive'); diff --git a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php b/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php index 408478e436..c9b2d90ea5 100644 --- a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php +++ b/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php @@ -195,7 +195,6 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ foreach ($this->cart->get_main_event_participants() as $participant) { $form = $participant->get_form(); if (empty($participant->email) - && !CRM_Event_Cart_Form_Cart::is_administrator() && ($participant->get_participant_index() == 1) && ($this->cid != 0) ) { diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index 15f8499e93..5fc0f88097 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -202,23 +202,8 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $this->add('text', 'billing_contact_email', 'Billing Email', '', TRUE); $this->assign('collect_billing_email', TRUE); } - if (self::is_administrator()) { - $this->add('textarea', 'note', 'Note'); - $this->add('text', 'source', 'Source', ['size' => 80]); - $instruments = []; - CRM_Core_OptionGroup::getAssoc('payment_instrument', $instruments, TRUE); - $options = []; - foreach ($instruments as $type) { - $options[] = $this->createElement('radio', NULL, '', $type['label'], $type['value']); - } - $this->addGroup($options, 'payment_type', ts("Alternative Payment Type")); - $this->add('text', 'check_number', ts('Check No.'), ['size' => 20]); - $this->addElement('checkbox', 'is_pending', ts('Create a pending registration')); - $this->assign('administrator', TRUE); - } $this->addButtons($buttons); - $this->addFormRule(['CRM_Event_Cart_Form_Checkout_Payment', 'formRule'], $this); if ($this->payment_required) { @@ -595,10 +580,6 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { * @throws Exception */ public function record_contribution(&$mer_participant, &$params, $event) { - if (self::is_administrator() && !empty($params['payment_type'])) { - $params['payment_instrument_id'] = $params['payment_type']; - } - if ($this->payer_contact_id) { $payer = $this->payer_contact_id; } @@ -672,7 +653,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $default_country->find(TRUE); $defaults["billing_country_id-{$this->_bltID}"] = $default_country->id; - if (self::getContactID() && !self::is_administrator()) { + if (self::getContactID()) { $params = ['id' => self::getContactID()]; $contact = CRM_Contact_BAO_Contact::retrieve($params, $defaults); -- 2.25.1