Index: /main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py
===================================================================
--- /main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py	(revision 18180)
+++ /main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py	(revision 18181)
@@ -84,4 +84,14 @@
     with_ac = False
 
+    def update(self, SUBMIT=None):
+        if getattr(self.request.principal, 'user_type', None) == 'student':
+            entry_session = self.context.student['studycourse'].entry_session
+            if entry_session != grok.getSite()['hostels'].accommodation_session:
+                error_message = 'Only newly admitted students can book accommodation.'
+                self.flash(error_message, type="warning")
+                self.redirect(self.url(self.context))
+                return
+        return super(CustomBedTicketAddPage, self).update(SUBMIT)
+
 class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage):
     """ Page to view bed tickets.
@@ -94,4 +104,28 @@
     """
     with_hostel_selection = True
+
+    @property
+    def booking_allowed(self):
+        if getattr(self.request.principal, 'user_type', None) == 'student':
+            entry_session = self.context.student['studycourse'].entry_session
+            if entry_session != grok.getSite()['hostels'].accommodation_session:
+                return False
+        students_utils = getUtility(IStudentsUtils)
+        acc_details  = students_utils.getAccommodationDetails(self.context.student)
+        error_message = students_utils.checkAccommodationRequirements(
+            self.context.student, acc_details)
+        if error_message:
+            return False
+        return True
+        
+    @property
+    def actionsgroup2(self):
+        if getattr(self.request.principal, 'user_type', None) == 'student':
+            ## Book button can be disabled in custom packages by
+            ## uncommenting the following lines.
+            if not self.booking_allowed:
+                return []
+            return [_('Book accommodation')]
+        return [_('Book accommodation'), _('Remove selected')]
 
 class CustomPaymentsManageFormPage(PaymentsManageFormPage):
Index: /main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/utils.py
===================================================================
--- /main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/utils.py	(revision 18180)
+++ /main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/utils.py	(revision 18181)
@@ -263,5 +263,5 @@
         return None, payment
 
-    def checkAccommodationRequirements(self, student, acc_details):
+    def disabled_checkAccommodationRequirements(self, student, acc_details):
         msg = super(CustomStudentsUtils, self).checkAccommodationRequirements(
             student, acc_details)
