Index: main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/utils.py
===================================================================
--- main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/utils.py	(revision 17029)
+++ main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/utils.py	(revision 17031)
@@ -60,34 +60,46 @@
             return _(u'Session configuration object is not available.'), None
         # Determine fee.
-        if category in ('schoolfee_1', 'secondinstal'):
-            if student.state == CLEARED:
-                pass
-            elif student.state == RETURNING:
-                # In case of returning school fee payment the
-                # payment session and level contain the values of
-                # the session the student has paid for. Payment
-                # session is always next session.
-                p_session, p_level = self.getReturningData(student)
-                academic_session = self._getSessionConfiguration(p_session)
-                if academic_session == None:
-                    return _(
-                        u'Session configuration object is not available.'
-                        ), None
-            elif student.is_postgrad and student.state == PAID:
-                # Returning postgraduate students also pay for the
-                # next session but their level always remains the
-                # same.
-                p_session += 1
-                academic_session = self._getSessionConfiguration(p_session)
-                if academic_session == None:
-                    return _(
-                        u'Session configuration object is not available.'
-                        ), None
+        if category in ('schoolfee', 'schoolfee_1', 'secondinstal'):
+            try:
+                certificate = student['studycourse'].certificate
+                p_item = certificate.code
+            except (AttributeError, TypeError):
+                return _('Study course data are incomplete.'), None
+            if previous_session:
+                # Students can pay for previous sessions in all
+                # workflow states.  Fresh students are excluded by the
+                # update method of the PreviousPaymentAddFormPage.
+                amount = getattr(certificate, 'school_fee_1', 0.0)
             else:
-                return _('School fee payment not allowed. Wrong state.'), None
-            if category == 'schoolfee_1':
-                amount = 220000.0
-            elif category == 'secondinstal':
-                amount = 100000.0
+                if category == 'secondinstal':
+                    amount = 0.34 * getattr(certificate, 'school_fee_1', 0.0)
+                else:
+                    if student.state == CLEARED:
+                        amount = getattr(certificate, 'school_fee_1', 0.0)
+                    elif student.state == RETURNING:
+                        # In case of returning school fee payment the
+                        # payment session and level contain the values of
+                        # the session the student has paid for. Payment
+                        # session is always next session.
+                        p_session, p_level = self.getReturningData(student)
+                        academic_session = self._getSessionConfiguration(p_session)
+                        if academic_session == None:
+                            return _(
+                                u'Session configuration object is not available.'
+                                ), None
+                        amount = getattr(certificate, 'school_fee_1', 0.0)
+                    elif student.is_postgrad and student.state == PAID:
+                        # Returning postgraduate students also pay for the
+                        # next session but their level always remains the
+                        # same.
+                        p_session += 1
+                        academic_session = self._getSessionConfiguration(p_session)
+                        if academic_session == None:
+                            return _(
+                                u'Session configuration object is not available.'
+                                ), None
+                        amount = getattr(certificate, 'school_fee_1', 0.0)
+                    if category == 'schoolfee_1':
+                        amount *= 0.66
         elif category == 'clearance':
             try:
