Remove non working code that makes event cart behave differently if you are an admini...
authorMatthew Wire <mjw@mjwconsult.co.uk>
Thu, 5 Mar 2020 21:53:58 +0000 (21:53 +0000)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Thu, 5 Mar 2020 22:13:05 +0000 (22:13 +0000)
CRM/Event/Cart/Form/Cart.php
CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php
CRM/Event/Cart/Form/Checkout/Payment.php

index 475c88ffbce83fa3e35e0fd9ac5f4d26d3ec6502..3b7bee6931efb6cd152af277953f8627a5834111 100644 (file)
@@ -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');
index 408478e436a0889413b777b4a0c33b7aea97fb85..c9b2d90ea587e44f8cd17454f5e7bc314b752780 100644 (file)
@@ -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)
       ) {
index 15f8499e932c81b2e147d97fa2aeb4b9b381c455..5fc0f880977111a41523ba07d3f94c04c21ca8cd 100644 (file)
@@ -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);