comments updated

This commit is contained in:
2014-06-25 23:04:47 +10:00
parent 473a432944
commit a61520b72d

View File

@@ -974,15 +974,15 @@ function booking_rooms_allocate_form_submit($form, &$form_state) {
watchdog('booking', $message); watchdog('booking', $message);
drupal_set_message($message); drupal_set_message($message);
//look for an exact match,
//in case this person has moved to a different bed type during this form submission
db_delete('booking_room_mapping') db_delete('booking_room_mapping')
->condition('booking_eventid', $event->eid) ->condition('booking_eventid', $event->eid)
->condition('booking_nodeid', $previous_nid) ->condition('booking_nodeid', $previous_nid)
->condition('booking_room_bedtype', $type_id) ->condition('booking_room_bedtype', $type_id)
->condition('booking_roomid', $room) ->condition('booking_roomid', $room)
->execute(); ->execute();
} }
//if this person didn't previously have a room/bed mapping //if this person didn't previously have a room/bed mapping
if (empty($room_mapping[$nid])) if (empty($room_mapping[$nid]))
{ {
@@ -1011,6 +1011,8 @@ function booking_rooms_allocate_form_submit($form, &$form_state) {
)) ))
->execute(); ->execute();
} }
//this person has already been inserted during this form submission
//so don't add them in twice
else else
{ {
$message .= t(' Except this person already exists.'); $message .= t(' Except this person already exists.');
@@ -1040,7 +1042,6 @@ function booking_rooms_allocate_form_submit($form, &$form_state) {
->condition('booking_eventid', $event->eid) ->condition('booking_eventid', $event->eid)
->condition('booking_nodeid', $nid) ->condition('booking_nodeid', $nid)
->execute(); ->execute();
} }
//this person previously had a room mapping but to a different bed type in the same room //this person previously had a room mapping but to a different bed type in the same room
elseif ((!empty($room_mapping[$nid])) && $room_mapping[$nid]->booking_room_bedtype != $type_id) elseif ((!empty($room_mapping[$nid])) && $room_mapping[$nid]->booking_room_bedtype != $type_id)