You are here

function book_units_per_type_form_validate in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Validate callback for book_units_per_type_form form.

1 string reference to 'book_units_per_type_form_validate'
book_units_per_type_form in modules/rooms_booking_manager/rooms_booking_manager.module
Book units per type booking form callback.

File

modules/rooms_booking_manager/rooms_booking_manager.module, line 1919
Rooms Booking Manager brings together all the pieces required to find a room and book it - including the DrupalCommerce integration

Code

function book_units_per_type_form_validate(&$form, &$form_state) {
  if (isset($form_state['storage']['values'])) {
    $form_state['values'] = $form_state['storage']['values'];
    unset($form_state['storage']['values']);
  }
  if (isset($form_state['complete form']['comments'])) {
    return;
  }
  foreach ($form_state['values'] as $type) {
    if (is_array($type)) {
      foreach ($type as $price_level) {
        if (isset($price_level['quantity'])) {
          if ($price_level['quantity'] != 0) {
            return;
          }
        }
      }
    }
  }
  form_set_error('', variable_get_value('rooms_booking_manager_error_select_unit'));
}