Index: main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 13252)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 13283)
@@ -907,4 +907,10 @@
 
     def test_student_accommodation(self):
+        bed = Bed()
+        bed.bed_id = u'hall-1_A_101_C'
+        bed.bed_number = 3
+        bed.owner = NOT_OCCUPIED
+        bed.bed_type = u'regular_male_fi'
+        self.app['hostels']['hall-1'].addBed(bed)
         self.browser.open(self.login_path)
         self.browser.getControl(name="form.login").value = self.student_id
@@ -941,6 +947,14 @@
         self.assertMatches('...Your data are incomplete...',
             self.browser.contents)
-        self.student['studycourse'].current_level = 100
+        self.student['studycourse'].current_level = 200
+        # ... or student is not the an allowed state ...
+        self.browser.getLink("Book accommodation").click()
+        self.assertMatches('...You are in the wrong...',
+                           self.browser.contents)
+        self.app['hostels'].accommodation_states = ['admitted', 'school fee paid']
+        IWorkflowState(self.student).setState('school fee paid')
         # ... or student has not appropriate verdict (Uniben only!)
+        self.student['studycourse'].entry_session = 2000 # non-fresh
+        self.student['studycourse'].current_level = 500 # final-year
         self.student['studycourse'].current_verdict = 'C'
         self.browser.getLink("Book accommodation").click()
@@ -948,9 +962,4 @@
             self.browser.contents)
         self.student['studycourse'].current_verdict = 'A'
-        # ... or student is not the an allowed state ...
-        self.browser.getLink("Book accommodation").click()
-        self.assertMatches('...You are in the wrong...',
-                           self.browser.contents)
-        IWorkflowInfo(self.student).fireTransition('admit')
         self.browser.getLink("Book accommodation").click()
         self.assertMatches('...Activation Code:...',
@@ -970,5 +979,5 @@
                            self.browser.contents)
         # The bed remains empty.
-        bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
+        bed = self.app['hostels']['hall-1']['hall-1_A_101_C']
         self.assertTrue(bed.owner == NOT_OCCUPIED)
         ac.owner = self.student_id
@@ -976,5 +985,5 @@
         self.browser.getControl(name="ac_number").value = sfenumber
         self.browser.getControl("Create bed ticket").click()
-        self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',
+        self.assertMatches('...Hall 1, Block A, Room 101, Bed C...',
                            self.browser.contents)
         # Bed has been allocated.
@@ -986,8 +995,8 @@
         # The bed ticket displays the data correctly.
         self.browser.open(self.acco_path + '/2004')
-        self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',
+        self.assertMatches('...Hall 1, Block A, Room 101, Bed C...',
                            self.browser.contents)
         self.assertMatches('...2004/2005...', self.browser.contents)
-        self.assertMatches('...regular_male_fr...', self.browser.contents)
+        self.assertMatches('...regular_male_fi...', self.browser.contents)
         self.assertMatches('...%s...' % pin, self.browser.contents)
         # Students can open the pdf slip.
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 13252)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 13283)
@@ -65,7 +65,6 @@
             else:
                 return _("Outside booking period.")
-        if not student.current_verdict in ('A', 'B'):
-            return _("Your are not eligible to book accommodation.")
-        if not acc_details.get('bt'):
+        bt = acc_details.get('bt')
+        if not bt:
             return _("Your data are incomplete.")
         if not student.state in acc_details['allowed_states']:
@@ -75,4 +74,9 @@
             return _('Your current session does not '
                      'match accommodation session.')
+        stage = bt.split('_')[2]
+        if stage not in ('fr', 'fi'):
+            return _("Only fresh and final year students are allowed to book accommodation.")
+        if stage != 'fr' and not student.current_verdict in ('A', 'B'):
+            return _("Your are not eligible to book accommodation.")
         if str(acc_details['booking_session']) in student['accommodation'].keys():
             return _('You already booked a bed space in '
@@ -137,4 +141,11 @@
             p_item = self.getAccommodationDetails(student)['bt']
             amount = academic_session.booking_fee
+            # Add student union dues
+            stage = self.getAccommodationDetails(student)['bt']
+            stage = stage.split('_')[2]
+            if stage == 'fr':
+                amount += 500.0
+            else:
+                amount += 300.0
         elif category == 'hostel_maintenance':
             amount = 0.0
