You are here

function bat_booking_edit_form_submit in Booking and Availability Management Tools for Drupal 7

Form API submit callback for the booking form.

1 string reference to 'bat_booking_edit_form_submit'
bat_booking_edit_form in modules/bat_booking/bat_booking.admin.inc
Generates the booking editing form.

File

modules/bat_booking/bat_booking.admin.inc, line 333
BatBooking editing UI.

Code

function bat_booking_edit_form_submit(&$form, &$form_state) {
  $booking = entity_ui_controller('bat_booking')
    ->entityFormSubmitBuildEntity($form, $form_state);
  $booking->created = !empty($booking->date) ? strtotime($booking->date) : REQUEST_TIME;
  $booking->changed = time();
  if (isset($booking->author_name)) {
    if ($account = user_load_by_name($booking->author_name)) {
      $booking->uid = $account->uid;
    }
    else {
      $booking->uid = 0;
    }
  }
  $booking
    ->save();
  drupal_set_message(t('Booking @label saved', array(
    '@label' => $booking->label,
  )));
  $form_state['redirect'] = 'admin/bat/config/booking';
}