Code to cleanup room allocations
This commit is contained in:
@@ -422,6 +422,42 @@ function _booking_assign_attendee_group($nid, $session_id, $gender, $age, &$atte
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function for cleaning up room allocations for people that have withdrawn their registration
|
||||
* @param $nid - the node id for the person
|
||||
* @return nothing
|
||||
*/
|
||||
function _booking_rooms_cleanup($nid)
|
||||
{
|
||||
global $event;
|
||||
|
||||
|
||||
//first of all make sure we need to do anything
|
||||
if (variable_get('booking_enable_roomallocations', 0) == 1)
|
||||
{
|
||||
//should only be one room allocation per person, so no need to loop over the results
|
||||
$room_mapping = db_query("SELECT * FROM {booking_room_mapping} WHERE booking_eventid = :eid AND booking_nodeid = :nid",
|
||||
array(':eid' => $event->eid, ':nid' => $nid))
|
||||
->fetchObject();
|
||||
|
||||
if ($room_mapping)
|
||||
{
|
||||
$message = t("Removing id !nid from room id !room.",
|
||||
array('!nid' => $nid, '!room' => $room_mapping->booking_roomid)
|
||||
);
|
||||
watchdog('booking', $message);
|
||||
drupal_set_message($message, 'status', FALSE);
|
||||
|
||||
db_delete('booking_room_mapping')
|
||||
->condition('booking_eventid', $event->eid)
|
||||
->condition('booking_nodeid', $nid)
|
||||
->execute();
|
||||
|
||||
|
||||
} //for each room
|
||||
} //end check for room allocations enabled
|
||||
} //end function
|
||||
|
||||
/**
|
||||
* Function for cleaning up study groups for people that have withdrawn their registration
|
||||
* @param $nid - the node id for the person who has withdrawn their registration
|
||||
@@ -472,10 +508,9 @@ function _booking_studygroups_cleanup($nid)
|
||||
->condition('booking_node_id', $nid)
|
||||
->condition('booking_studygroup_id', $group->booking_studygroup_id)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} //for each group
|
||||
} //end check for study groups enabled
|
||||
} //end function
|
||||
|
||||
/**
|
||||
* Function for calculating statistics of attendees
|
||||
|
Reference in New Issue
Block a user