Ignore:
Timestamp:
14 Feb 2017, 08:52:06 (8 years ago)
Author:
Henrik Bettermann
Message:

Implement/activate previous session payments.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_utils.py

    r14487 r14544  
    128128        self.assertEqual(error, None)
    129129
     130        error, payment = utils.setPaymentDetails('clearance',self.student, 2004, 100)
     131        self.assertEqual(error, 'This is not a previous session.')
    130132        error, payment = utils.setPaymentDetails('schoolfee',self.student, 2004, 100)
    131         self.assertEqual(error, u'Previous session payment not yet implemented.')
     133        self.assertEqual(payment.p_level, 100)
     134        self.assertEqual(payment.p_session, 2004)
     135        self.assertEqual(payment.amount_auth, 6666.0)
     136        self.assertEqual(payment.p_item, u'CERT1')
     137        self.assertEqual(error, None)
    132138        return
    133139
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r14538 r14544  
    220220        error = u''
    221221        if previous_session:
    222             return _('Previous session payment not yet implemented.'), None
    223         p_session = student['studycourse'].current_session
    224         p_level = student['studycourse'].current_level
    225         p_current = True
     222            if previous_session < student['studycourse'].entry_session:
     223                return _('The previous session must not fall below '
     224                         'your entry session.'), None
     225            if category == 'schoolfee':
     226                # School fee is always paid for the following session
     227                if previous_session > student['studycourse'].current_session:
     228                    return _('This is not a previous session.'), None
     229            else:
     230                if previous_session > student['studycourse'].current_session - 1:
     231                    return _('This is not a previous session.'), None
     232            p_session = previous_session
     233            p_level = previous_level
     234            p_current = False
     235        else:
     236            p_session = student['studycourse'].current_session
     237            p_level = student['studycourse'].current_level
     238            p_current = True
    226239        academic_session = self._getSessionConfiguration(p_session)
    227240        if academic_session == None:
     
    305318            if student.is_postgrad and category != 'schoolfee':
    306319                return _("No additional fees required."), None
    307             if student.current_mode in (
     320            if not previous_session and student.current_mode in (
    308321                'ug_ft', 'ug_pt', 'de_ft', 'de_pt',
    309322                'transfer', 'mug_ft', 'mde_ft') \
     
    319332                    return _("You are not allowed "
    320333                             "to pay by instalments."), None
    321             if student.state == CLEARED and category != 'schoolfee_2':
     334            if previous_session:
     335                # Students can pay for previous sessions in all
     336                # workflow states.  Fresh students are excluded by the
     337                # update method of the PreviousPaymentAddFormPage.
     338                if previous_level == 100:
     339                    amount = getattr(certificate, 'school_fee_1', 0.0)
     340                else:
     341                    if student.entry_session >= 2015:
     342                        amount = getattr(certificate, 'school_fee_2', 0.0)
     343                    else:
     344                        amount = getattr(certificate, 'school_fee_3', 0.0)
     345            elif student.state == CLEARED and category != 'schoolfee_2':
    322346                amount = getattr(certificate, 'school_fee_1', 0.0)
    323347                # Cut school fee by 50%
  • main/waeup.aaue/trunk/src/waeup/aaue/students/viewlets.py

    r14315 r14544  
    3737from waeup.aaue.interfaces import MessageFactory as _
    3838
    39 class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
     39#class AddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
    4040
    41     @property
    42     def target_url(self):
    43         return ''
     41#    @property
     42#    def target_url(self):
     43#        return ''
    4444
    4545#class AddBalancePaymentActionButton(AddBalancePaymentActionButton):
  • main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py

    r14501 r14544  
    122122        'fac_dep': 'Faculty and Departmental Dues',
    123123        'restitution': 'Restitution Fee',
     124        }
     125
     126    PREVIOUS_PAYMENT_CATEGORIES = {
     127        'schoolfee': 'School Fee',
     128        'clearance': 'Acceptance Fee',
    124129        }
    125130
Note: See TracChangeset for help on using the changeset viewer.