optimization
[civicrm-core.git] / CRM / Event / Page / EventInfo.php
index 014fd512bb2c74da636f96e85f0695c9559d5067..507d23ead656da8522f899f9f41c96a135234269 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -79,7 +79,8 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
 
     if (!$values['event']['is_active']) {
       // form is inactive, die a fatal death
-      CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
+      CRM_Utils_System::setUFMessage(ts('The event you requested is currently unavailable (contact the site administrator for assistance).'));
+      return CRM_Utils_System::permissionDenied();
     }
 
     if (!empty($values['event']['is_template'])) {
@@ -145,7 +146,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
               $labelClass = 'price_set_field-label';
             }
             // show tax rate with amount
-            $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
+            $invoiceSettings = Civi::settings()->get('contribution_invoice_settings');
             $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings);
             $displayOpt = CRM_Utils_Array::value('tax_display_settings', $invoiceSettings);
             $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
@@ -185,7 +186,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
 
     //retrieve custom field information
     $groupTree = CRM_Core_BAO_CustomGroup::getTree('Event', $this, $this->_id, 0, $values['event']['event_type_id']);
-    CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
+    CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_id);
     $this->assign('action', CRM_Core_Action::VIEW);
     //To show the event location on maps directly on event info page
     $locations = CRM_Event_BAO_Event::getMapInfo($this->_id);
@@ -286,10 +287,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
           }
 
           // check if we're in shopping cart mode for events
-          $enable_cart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME,
-            'enable_cart'
-          );
-
+          $enable_cart = Civi::settings()->get('enable_cart');
           if ($enable_cart) {
             $link = CRM_Event_Cart_BAO_EventInCart::get_registration_link($this->_id);
             $registerText = $link['label'];
@@ -356,7 +354,7 @@ class CRM_Event_Page_EventInfo extends CRM_Core_Page {
     $this->assign('location', $values['location']);
 
     if (CRM_Core_Permission::check('access CiviEvent')) {
-      $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
+      $enableCart = Civi::settings()->get('enable_cart');
       $this->assign('manageEventLinks', CRM_Event_Page_ManageEvent::tabs($enableCart));
     }