From a61520b72d332725e501b9ace42a870bec8c33e4 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Wed, 25 Jun 2014 23:04:47 +1000 Subject: [PATCH] comments updated --- booking.rooms.inc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/booking.rooms.inc b/booking.rooms.inc index 08e1d5c..2842d1d 100644 --- a/booking.rooms.inc +++ b/booking.rooms.inc @@ -973,16 +973,16 @@ function booking_rooms_allocate_form_submit($form, &$form_state) { array('!room' => $room, '!index' => $index, '!person' => $previous_nid)); watchdog('booking', $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') ->condition('booking_eventid', $event->eid) ->condition('booking_nodeid', $previous_nid) ->condition('booking_room_bedtype', $type_id) ->condition('booking_roomid', $room) ->execute(); - } - //if this person didn't previously have a room/bed mapping if (empty($room_mapping[$nid])) { @@ -1011,6 +1011,8 @@ function booking_rooms_allocate_form_submit($form, &$form_state) { )) ->execute(); } + //this person has already been inserted during this form submission + //so don't add them in twice else { $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_nodeid', $nid) ->execute(); - } //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)