Ignore:
Timestamp:
26 Sep 2022, 11:11:14 (2 years ago)
Author:
Henrik Bettermann
Message:

Rewrite setPaymentDetails for school fees.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/utils.py

    r17095 r17107  
    8080                # workflow states.  Fresh students are excluded by the
    8181                # update method of the PreviousPaymentAddFormPage.
    82                 amount = getattr(certificate, 'school_fee_1', 0.0)
     82                amount = getattr(certificate, 'school_fee_2', 0.0)
    8383            else:
     84                if student.state == CLEARED:
     85                    amount = getattr(certificate, 'school_fee_1', 0.0)
     86                elif student.state == RETURNING:   
     87                    amount = getattr(certificate, 'school_fee_2', 0.0)       
     88                    # In case of returning school fee payment the
     89                    # payment session and level contain the values of
     90                    # the session the student has paid for. Payment
     91                    # session is always next session.
     92                    p_session, p_level = self.getReturningData(student)
     93                    academic_session = self._getSessionConfiguration(p_session)
     94                    if academic_session == None:
     95                        return _(
     96                            u'Session configuration object is not available.'
     97                            ), None
     98                elif student.is_postgrad and student.state == PAID:
     99                    amount = getattr(certificate, 'school_fee_2', 0.0)
     100                    # Returning postgraduate students also pay for the
     101                    # next session but their level always remains the
     102                    # same.
     103                    p_session += 1
     104                    academic_session = self._getSessionConfiguration(p_session)
     105                    if academic_session == None:
     106                        return _(
     107                            u'Session configuration object is not available.'
     108                            ), None                   
     109                   
    84110                if category == 'secondinstal':
    85                     amount = 0.34 * getattr(certificate, 'school_fee_1', 0.0)
    86                 else:
    87                     if student.state == CLEARED:
    88                         amount = getattr(certificate, 'school_fee_1', 0.0)
    89                     elif student.state == RETURNING:
    90                         # In case of returning school fee payment the
    91                         # payment session and level contain the values of
    92                         # the session the student has paid for. Payment
    93                         # session is always next session.
    94                         p_session, p_level = self.getReturningData(student)
    95                         academic_session = self._getSessionConfiguration(p_session)
    96                         if academic_session == None:
    97                             return _(
    98                                 u'Session configuration object is not available.'
    99                                 ), None
    100                         amount = getattr(certificate, 'school_fee_1', 0.0)
    101                     elif student.is_postgrad and student.state == PAID:
    102                         # Returning postgraduate students also pay for the
    103                         # next session but their level always remains the
    104                         # same.
    105                         p_session += 1
    106                         academic_session = self._getSessionConfiguration(p_session)
    107                         if academic_session == None:
    108                             return _(
    109                                 u'Session configuration object is not available.'
    110                                 ), None
    111                         amount = getattr(certificate, 'school_fee_1', 0.0)
    112                     if category == 'schoolfee_1':
    113                         amount *= 0.66
     111                    amount *= 0.34
     112                elif category == 'schoolfee_1':
     113                    amount *= 0.66
    114114        elif category == 'clearance':
    115115            try:
Note: See TracChangeset for help on using the changeset viewer.