You are here

function bat_event_states_form_set_default in Booking and Availability Management Tools for Drupal 7

Sets the default value for the event. @TODO - this may no longer be required.

1 string reference to 'bat_event_states_form_set_default'
bat_event_states_form in modules/bat_event/bat_event.module
Implements form that handles the definition of states for fixed state events.

File

modules/bat_event/bat_event.module, line 528
Manage Events - Events store the EventValue of a Unit over a period of time.

Code

function bat_event_states_form_set_default($form, &$form_state) {
  $state = $form_state['values']['states'];
  db_update('bat_event_state')
    ->fields(array(
    'default_state' => 0,
  ))
    ->condition('event_type', $form['event_type']['#value'])
    ->execute();
  db_update('bat_event_state')
    ->fields(array(
    'default_state' => 1,
  ))
    ->condition('id', $form['states']['#options'][$state][0])
    ->execute();
  drupal_set_message(t('Default state set!'));
  return $form['states'];
}