From: Coleman Watts Date: Wed, 17 Sep 2014 18:24:31 +0000 (-0400) Subject: CRM-15294 - Fix multiple bugs in event location form X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=62a0f5a1bb7132177c3c94421fde2b0f1e42e771;p=civicrm-core.git CRM-15294 - Fix multiple bugs in event location form --- diff --git a/CRM/Core/Page/AJAX/Location.php b/CRM/Core/Page/AJAX/Location.php index 3ffdf59cde..831b590d2e 100644 --- a/CRM/Core/Page/AJAX/Location.php +++ b/CRM/Core/Page/AJAX/Location.php @@ -213,8 +213,8 @@ class CRM_Core_Page_AJAX_Location { static function getLocBlock() { // i wish i could retrieve loc block info based on loc_block_id, // Anyway, lets retrieve an event which has loc_block_id set to 'lbid'. - if ($_POST['lbid']) { - $params = array('1' => array($_POST['lbid'], 'Integer')); + if ($_REQUEST['lbid']) { + $params = array('1' => array($_REQUEST['lbid'], 'Integer')); $eventId = CRM_Core_DAO::singleValueQuery('SELECT id FROM civicrm_event WHERE loc_block_id=%1 LIMIT 1', $params); } // now lets use the event-id obtained above, to retrieve loc block information. @@ -260,7 +260,7 @@ class CRM_Core_Page_AJAX_Location { } // set the message if loc block is being used by more than one event. - $result['count_loc_used'] = CRM_Event_BAO_Event::countEventsUsingLocBlockId($_POST['lbid']); + $result['count_loc_used'] = CRM_Event_BAO_Event::countEventsUsingLocBlockId($_REQUEST['lbid']); CRM_Utils_JSON::output($result); } diff --git a/CRM/Event/Form/ManageEvent/Location.php b/CRM/Event/Form/ManageEvent/Location.php index c105eccaf8..c5cc678f44 100644 --- a/CRM/Event/Form/ManageEvent/Location.php +++ b/CRM/Event/Form/ManageEvent/Location.php @@ -110,9 +110,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent { if (!empty($defaults['loc_block_id'])) { $defaults['loc_event_id'] = $defaults['loc_block_id']; $countLocUsed = CRM_Event_BAO_Event::countEventsUsingLocBlockId($defaults['loc_block_id']); - if ($countLocUsed > 1) { - $this->assign('locUsed', TRUE); - } + $this->assign('locUsed', $countLocUsed); } $config = CRM_Core_Config::singleton(); @@ -207,10 +205,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent { '2' => ts('Use existing location'), ); - $this->addRadio('location_option', ts("Choose Location"), $optionTypes, - array( - 'onclick' => "showLocFields();"), '
', FALSE - ); + $this->addRadio('location_option', ts("Choose Location"), $optionTypes); if (!isset($locationEvents[$this->_oldLocBlockId]) || (!$this->_oldLocBlockId)) { $locationEvents = array( diff --git a/templates/CRM/Event/Form/ManageEvent/Location.tpl b/templates/CRM/Event/Form/ManageEvent/Location.tpl index d5741974b6..4a32041df5 100644 --- a/templates/CRM/Event/Form/ManageEvent/Location.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Location.tpl @@ -59,7 +59,6 @@ - {assign var=locUsedMsgTxt value="Note: This location is used by multiple events. Modifying location information will change values for all events."} @@ -101,19 +100,17 @@ {/if}