Use database for room description instead of constant array lookup

This commit is contained in:
2016-05-04 10:36:47 +10:00
parent f405089911
commit 262eb07915

View File

@@ -58,7 +58,10 @@ function booking_rooms_allocate_test_form($node, &$form_state, $location_id) {
$room_mapping = $query->execute()->fetchAllAssoc('booking_nodeid'); $room_mapping = $query->execute()->fetchAllAssoc('booking_nodeid');
//query for room definitions //query for room definitions
$room_query = db_query("SELECT * FROM {booking_room_definition} WHERE booking_room_location_id = :lid ORDER BY CAST(booking_room_number as SIGNED INTEGER) ASC", $room_query = db_query("SELECT r.*, l.* FROM {booking_room_definition} r " .
"INNER JOIN {booking_room_locations} l on r.booking_room_location_id = l.lid " .
"WHERE booking_room_location_id = :lid " .
"ORDER BY CAST(booking_room_number as SIGNED INTEGER) ASC",
array(':lid' => $location_id)); array(':lid' => $location_id));
//define the table header //define the table header
@@ -116,7 +119,8 @@ function booking_rooms_allocate_test_form($node, &$form_state, $location_id) {
//create a row that contains just the room location and number and the custom css id for a separating line between the rooms //create a row that contains just the room location and number and the custom css id for a separating line between the rooms
$new_row = _booking_clone_array($default_row); $new_row = _booking_clone_array($default_row);
$new_row['booking_room_location'] = _booking_room_location_lookup($data->booking_room_location_id); //$new_row['booking_room_location'] = _booking_room_location_lookup($data->booking_room_location_id);
$new_row['booking_room_location'] = $data->booking_roomlocation_descrip;
$new_row['booking_room_number'] = $data->booking_room_number; $new_row['booking_room_number'] = $data->booking_room_number;
$form['rooms']['#rows'][$counter++] = array( $form['rooms']['#rows'][$counter++] = array(
'data' => $new_row, 'data' => $new_row,