Index: main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py	(revision 9386)
+++ main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py	(revision 9402)
@@ -25,4 +25,6 @@
 from zope.interface import verify
 from waeup.kofa.app import University
+from waeup.kofa.university.faculty import Faculty
+from waeup.kofa.university.department import Department
 from waeup.kofa.students.tests.test_browser import StudentsFullSetup
 from waeup.kofa.testing import FunctionalTestCase
@@ -70,4 +72,25 @@
     layer = FunctionalLayer
 
+    def setUp(self):
+        super(StudentUITests, self).setUp()
+
+        # Create SSE faculty with certificate
+        self.app['faculties']['SSE'] = Faculty(code='SSE')
+        self.app['faculties']['SSE']['dep1'] = Department(code='dep1')
+        self.certificate2 = createObject('waeup.Certificate')
+        self.certificate2.code = u'CERT2'
+        self.certificate2.application_category = 'basic'
+        self.certificate2.study_mode = 'ug_ft'
+        self.certificate2.start_level = 100
+        self.certificate2.end_level = 300
+        self.app['faculties']['SSE']['dep1'].certificates.addCertificate(
+            self.certificate2)
+        # Set study course attributes of test student
+        self.student['studycourse'].certificate = self.certificate2
+        self.student['studycourse'].current_session = 2004
+        self.student['studycourse'].entry_session = 2004
+        self.student['studycourse'].current_verdict = 'A'
+        self.student['studycourse'].current_level = 100
+
     def test_get_returning_data(self):
         # Student is in level 100, session 2004 with verdict A
@@ -99,8 +122,8 @@
         self.assertEqual(payment.p_session, 2004)
         self.assertEqual(payment.amount_auth, 37000.0)
-        self.assertEqual(payment.p_item, u'CERT1')
+        self.assertEqual(payment.p_item, u'CERT2')
         self.assertEqual(error, None)
 
-        self.certificate.study_mode = 'jm_ft'
+        self.certificate2.study_mode = 'jm_ft'
         error, payment = utils.setPaymentDetails('schoolfee',self.student)
         self.assertEqual(payment.amount_auth, 72700.0)
@@ -111,11 +134,10 @@
         self.assertEqual(payment.p_session, 2005)
         self.assertEqual(payment.amount_auth, 37000.0)
-        self.assertEqual(payment.p_item, u'CERT1')
+        self.assertEqual(payment.p_item, u'CERT2')
         self.assertEqual(error, None)
 
-        self.certificate.study_mode = 'ug_ft'
+        self.certificate2.study_mode = 'ug_ft'
         error, payment = utils.setPaymentDetails('schoolfee',self.student)
         self.assertEqual(payment.amount_auth, 20000.0)
-
 
         error, payment = utils.setPaymentDetails('clearance',self.student)
@@ -123,5 +145,5 @@
         self.assertEqual(payment.p_session, 2004)
         self.assertEqual(payment.amount_auth, 20000.0)
-        self.assertEqual(payment.p_item, u'CERT1')
+        self.assertEqual(payment.p_item, u'CERT2')
         self.assertEqual(error, None)
 
@@ -129,2 +151,13 @@
         self.assertEqual(error, u'Previous session payment not yet implemented.')
         return
+
+    def test_get_accommodation_details(self):
+        self.app['configuration']['2004'].gown_fee = 150.0
+        self.app['configuration']['2004'].transfer_fee = 90.0
+        self.app['configuration']['2004'].booking_fee = 150.0
+        self.app['configuration']['2004'].maint_fee = 180.0
+        self.app['configuration']['2004'].clearance_fee = 120.0
+        utils = getUtility(IStudentsUtils)
+
+        details = utils.getAccommodationDetails(self.student)
+        self.assertEqual(details['bt'], u'sse_male_fr')
Index: main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py	(revision 9386)
+++ main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py	(revision 9402)
@@ -131,4 +131,40 @@
         return None, payment
 
+    def getAccommodationDetails(self, student):
+        """Determine the accommodation data of a student.
+        """
+        d = {}
+        d['error'] = u''
+        hostels = grok.getSite()['hostels']
+        d['booking_session'] = hostels.accommodation_session
+        d['allowed_states'] = hostels.accommodation_states
+        d['startdate'] = hostels.startdate
+        d['enddate'] = hostels.enddate
+        d['expired'] = hostels.expired
+        # Determine bed type
+        studycourse = student['studycourse']
+        certificate = getattr(studycourse,'certificate',None)
+        entry_session = studycourse.entry_session
+        current_level = studycourse.current_level
+        if None in (entry_session, current_level, certificate):
+            return d
+        end_level = certificate.end_level
+        if current_level == 10:
+            bt = 'pr'
+        elif entry_session == grok.getSite()['hostels'].accommodation_session:
+            bt = 'fr'
+        elif current_level >= end_level:
+            bt = 'fi'
+        else:
+            bt = 're'
+        sex = 'male'
+        if student.sex == 'f':
+            sex = 'female'
+        special_handling = 'regular'
+        if student.faccode == 'SSE':
+            special_handling = 'sse'
+        d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt)
+        return d
+
 
     # FUTMinna prefix
Index: main/waeup.futminna/trunk/src/waeup/futminna/utils/utils.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/utils/utils.py	(revision 9386)
+++ main/waeup.futminna/trunk/src/waeup/futminna/utils/utils.py	(revision 9402)
@@ -26,2 +26,8 @@
     PREFERRED_LANGUAGES_DICT = {
         }
+
+    SPECIAL_HANDLING_DICT = {
+        'regular': 'Regular Hostel',
+        'blocked': 'Blocked Hostel',
+        'sse': 'SSE Hostel'
+        }
