From b05572f8772dbb5c88434ce9c29a3badc884c286 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Mon, 23 May 2016 10:51:59 +1200 Subject: [PATCH] Style fixes --- .../Form/Checkout/ParticipantsAndPrices.php | 42 ++++++++++++------- CRM/Event/Cart/Form/Checkout/Payment.php | 2 +- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php b/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php index 2de18fbccc..536f9f7cad 100644 --- a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php +++ b/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php @@ -74,7 +74,9 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ } /** - * @param $event + * Build price options. + * + * @param CRM_Event_BAO_Event $event * * @return array */ @@ -83,9 +85,9 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ $base_field_name = "event_{$event->id}_amount"; $price_set_id = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $event->id); //CRM-14492 display admin fields only if user is admin - $admin_field_visible = false; - if (CRM_Core_Permission::check('administer CiviCRM')){ - $admin_field_visible = true; + $adminFieldVisible = FALSE; + if (CRM_Core_Permission::check('administer CiviCRM')) { + $adminFieldVisible = TRUE; } if ($price_set_id) { $price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE, TRUE); @@ -94,7 +96,7 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ foreach ($price_set['fields'] as $field) { $index++; if (CRM_Utils_Array::value('visibility', $field) == 'public' || - (CRM_Utils_Array::value('visibility', $field) == 'admin' && $adminFieldVisible == true) ){ + (CRM_Utils_Array::value('visibility', $field) == 'admin' && $adminFieldVisible == TRUE)) { $field_name = "event_{$event->id}_price_{$field['id']}"; CRM_Price_BAO_PriceField::addQuickFormElement($this, $field_name, $field['id'], FALSE); $price_fields_for_event[] = $field_name; @@ -105,6 +107,8 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ } /** + * Validate values. + * * @return bool */ public function validate() { @@ -173,6 +177,8 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ } /** + * Set default values. + * * @return array */ public function setDefaultValues() { @@ -204,19 +210,20 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) { $price_set_id = CRM_Event_BAO_Event::usesPriceSet($event_in_cart->event_id); if ($price_set_id) { - $price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE, TRUE); - $price_set = $price_sets[$price_set_id]; - foreach ($price_set['fields'] as $field){ + $price_sets = CRM_Price_BAO_PriceSet::getSetDetail($price_set_id, TRUE, TRUE); + $price_set = $price_sets[$price_set_id]; + foreach ($price_set['fields'] as $field) { $options = CRM_Utils_Array::value('options', $field); if (!is_array($options)) { - continue; + continue; } $field_name = "event_{$event_id}_price_{$field['id']}"; - foreach ($options as $value){ - if ( $value['is_default'] ){ - if ($field['html_type'] == 'Checkbox'){ + foreach ($options as $value) { + if ($value['is_default']) { + if ($field['html_type'] == 'Checkbox') { $defaults[$field_name] = 1; - } else { + } + else { $defaults[$field_name] = $value['id']; } } @@ -228,6 +235,9 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ return $defaults; } + /** + * Post process function. + */ public function postProcess() { if (!array_key_exists('event', $this->_submitValues)) { return; @@ -259,9 +269,9 @@ class CRM_Event_Cart_Form_Checkout_ParticipantsAndPrices extends CRM_Event_Cart_ $participant->save(); if ($temporary_contact->is_deleted) { - #ARGH a permissions check prevents us from using skipUndelete, - #so we potentially leave records pointing to this contact for now - #CRM_Contact_BAO_Contact::deleteContact($temporary_contact->id); + // ARGH a permissions check prevents us from using skipUndelete, + // so we potentially leave records pointing to this contact for now + // CRM_Contact_BAO_Contact::deleteContact($temporary_contact->id); $temporary_contact->delete(); } } diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index 3c8d8050cf..a41bec3ad4 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -744,7 +744,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { * @param array &$price_set_amount * @param &$cost */ - function apply_discount($discountCode, &$price_set_amount, &$cost) { + protected function apply_discount($discountCode, &$price_set_amount, &$cost) { //need better way to determine if cividiscount installed $autoDiscount = array(); $sql = "select is_active from civicrm_extension where name like 'CiviDiscount%'"; -- 2.25.1