Index: /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/browser.py
===================================================================
--- /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/browser.py	(revision 16154)
+++ /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/browser.py	(revision 16155)
@@ -42,4 +42,5 @@
     NigeriaExportPDFClearanceSlip,
     NigeriaAccommodationManageFormPage,
+    NigeriaAccommodationDisplayFormPage,
     NigeriaBedTicketAddPage,
     )
@@ -172,4 +173,9 @@
         return pdfstream
 
+class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage):
+    """ Page to view bed tickets.
+    """
+    with_hostel_selection = True
+
 class CustomAccommodationManageFormPage(NigeriaAccommodationManageFormPage):
     """ Page to manage bed tickets.
Index: /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/tests/test_browser.py
===================================================================
--- /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/tests/test_browser.py	(revision 16154)
+++ /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/tests/test_browser.py	(revision 16155)
@@ -74,2 +74,27 @@
         open(path, 'wb').write(self.browser.contents)
         print "Sample PDF admission_slip.pdf written to %s" % path
+
+    def test_student_course_registration(self):
+        IWorkflowState(self.student).setState('school fee paid')
+        self.student['studycourse'].current_level = 200
+        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.student_path + '/studycourse/add')
+        self.browser.getControl("Create course list now").click()
+        # A level with one course ticket was created
+        self.assertEqual(self.student['studycourse']['200'].number_of_tickets, 0)
+        self.browser.getLink("200").click()
+        self.browser.getLink("Edit course list").click()
+        self.browser.getLink("here").click()
+        self.browser.getControl(name="form.course").value = ['COURSE1']
+        self.course.credits = 41
+        self.browser.getControl("Add course ticket").click()
+        self.assertTrue(
+            'Maximum credits (40) in 1st semester exceeded.' in self.browser.contents)
+        self.course.credits = 39
+        self.browser.getControl("Add course ticket").click()
+        self.assertTrue(
+            'Successfully added COURSE1.' in self.browser.contents)
+        return
Index: /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py
===================================================================
--- /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py	(revision 16154)
+++ /main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py	(revision 16155)
@@ -278,11 +278,25 @@
 
     def warnCreditsOOR(self, studylevel, course=None):
-        """Return message if credits are out of range. In the base
-        package only maximum credits is set.
-        """
-        if course and studylevel.total_credits + course.credits > 80:
-            return _('Maximum credits exceeded.')
-        elif studylevel.total_credits > 80:
-            return _('Maximum credits exceeded.')
+        """DSPG requires total credits on semester
+        basis.
+        """
+        total = [0, 0, 0]
+        for ticket in studylevel.values():
+            if ticket.outstanding:
+                continue
+            if not ticket.semester in (1, 2):
+                total[ticket.semester] += ticket.credits
+            else:
+                total[0] += ticket.credits
+        if course:
+            if course.semester == 1 and total[1] + course.credits > 40:
+                return _('Maximum credits (40) in 1st semester exceeded.')
+            if course.semester == 2 and total[2] + course.credits > 40:
+                return _('Maximum credits (40) in 2nd semester exceeded.')
+        else:
+            if total[1] > 40:
+                return _('Maximum credits (40) in 1st semester exceeded.')
+            if total[2] > 40:
+                return _('Maximum credits (40) in 2nd semester exceeded.')
         return
 
