Index: main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py	(revision 14374)
+++ main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py	(revision 14375)
@@ -127,4 +127,16 @@
         if not fac_dep_paid:
             return _("Please pay faculty and departmental dues first.")
+        restitution_paid = True
+        if self.student.entry_session < 2016 \
+            and self.student.current_mode == 'ug_ft':
+            restitution_paid = False
+            for ticket in self.student['payments'].values():
+                if ticket.p_category == 'restitution' and \
+                    ticket.p_session == self.level_session and \
+                    ticket.p_state == 'paid':
+                        restitution_paid = True
+                        continue
+        if not restitution_paid:
+            return _("Please pay restitution fee first.")
         if self.student.is_fresh:
             return
Index: main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 14374)
+++ main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 14375)
@@ -588,5 +588,5 @@
 
     def test_late_registration(self):
-        # Login
+        self.app['configuration']['2004'].restitution_fee = 9999.0
         delta = timedelta(days=10)
         self.app['configuration'][
@@ -596,9 +596,15 @@
         # returning students.
         self.student['studycourse'].entry_session = 2003
-        self.browser.open(self.login_path)
-        self.browser.getControl(name="form.login").value = self.student_id
-        self.browser.getControl(name="form.password").value = 'spwd'
-        self.browser.getControl("Login").click()
-        self.browser.open(self.payments_path)
+        # Login
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        # Make restitution fee payment
+        self.browser.open(self.payments_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['restitution']
+        self.browser.getControl("Create ticket").click()
+        self.student['payments'].values()[0].approveStudentPayment()
+        # Make late registration fee fee payment
         self.browser.open(self.payments_path + '/addop')
         self.browser.getControl(name="form.p_category").value = ['late_registration']
@@ -619,5 +625,5 @@
         self.browser.getControl("Register course list").click()
         self.assertTrue('Course registration has ended. Please pay' in self.browser.contents)
-        self.student['payments'].values()[0].approve()
+        self.student['payments'].values()[1].approve()
         self.browser.getControl("Register course list").click()
         self.assertTrue('Course list has been registered' in self.browser.contents)
@@ -626,5 +632,5 @@
         # register courses.
         self.student['studycourse'].entry_session = 2004
-        del self.student['payments'][self.student['payments'].keys()[0]]
+        del self.student['payments'][self.student['payments'].keys()[1]]
         IWorkflowState(self.student).setState('school fee paid')
         self.browser.open(self.studycourse_path + '/100/edit')
@@ -932,12 +938,36 @@
         self.assertTrue('Please pay faculty and departmental dues first'
             in self.browser.contents)
-
         configuration_1 = createObject('waeup.SessionConfiguration')
         configuration_1.academic_session = 2016
         configuration_1.fac_dep_fee = 9999.0
         self.app['configuration'].addSessionConfiguration(configuration_1)
-
         self.browser.open(self.payments_path + '/addop')
         self.browser.getControl(name="form.p_category").value = ['fac_dep']
+        self.browser.getControl("Create ticket").click()
+        self.student['payments'].values()[0].approveStudentPayment()
+        self.browser.open(self.studycourse_path + '/100/edit')
+        self.browser.getControl("Register course list").click()
+        self.assertTrue('Course list has been registered'
+            in self.browser.contents)
+        return
+
+    def test_course_registration_forbidden_2(self):
+        IWorkflowState(self.student).setState('school fee paid')
+        self.student['studycourse'].entry_session = 2004
+        self.student['studycourse'].current_session = 2004
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        self.browser.getLink("Study Course").click()
+        self.browser.getLink("Add course list").click()
+        self.browser.getControl("Create course list now").click()
+        self.browser.getLink("Edit course list").click()
+        self.browser.getControl("Register course list").click()
+        self.assertTrue('Please pay restitution fee first'
+            in self.browser.contents)
+        self.app['configuration']['2004'].restitution_fee = 9999.0
+        self.browser.open(self.payments_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['restitution']
         self.browser.getControl("Create ticket").click()
         self.student['payments'].values()[0].approveStudentPayment()
