Tidy up some edge cases
This commit is contained in:
@@ -969,7 +969,7 @@ function booking_rooms_allocate_form_submit($form, &$form_state) {
|
||||
//remove any person previously defined here that doesn't match what is now defined
|
||||
if ($previous_nid > 0 && $nid != $previous_nid)
|
||||
{
|
||||
$message = t('Bed allocation for room !room and bed index !index has changed. Removing !person from this location.',
|
||||
$message = t('Bed allocation for room !room and bed index !index has changed. Removing previous !person from this location.',
|
||||
array('!room' => $room, '!index' => $index, '!person' => $previous_nid));
|
||||
watchdog('booking', $message);
|
||||
drupal_set_message($message);
|
||||
@@ -977,6 +977,8 @@ function booking_rooms_allocate_form_submit($form, &$form_state) {
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -1057,21 +1059,26 @@ function booking_rooms_allocate_form_submit($form, &$form_state) {
|
||||
->execute();
|
||||
|
||||
}
|
||||
//log the result
|
||||
watchdog('booking', $message);
|
||||
drupal_set_message($message);
|
||||
//log the result if there was one
|
||||
if ($message !== "")
|
||||
{
|
||||
watchdog('booking', $message);
|
||||
drupal_set_message($message);
|
||||
}
|
||||
}
|
||||
//this bed has no ID assigned now, but did it have something before?
|
||||
elseif ($nid == 0 && $previous_nid > 0)
|
||||
{
|
||||
$message = t('Removing person !person previously in room id !room with bed index !index.',
|
||||
array('!room' => $room, '!index' => $index, '!person' => $option[$type]['data']['#value']));
|
||||
$message = t('Removing person !person previously in room id !room with bed index !index and bed type !type.',
|
||||
array('!room' => $room, '!index' => $index, '!person' => $previous_nid, '!type' => $type_id));
|
||||
watchdog('booking', $message);
|
||||
drupal_set_message($message);
|
||||
|
||||
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();
|
||||
|
||||
} //end node checking
|
||||
|
Reference in New Issue
Block a user