Changeset 9006


Ignore:
Timestamp:
16 Jul 2012, 07:36:13 (12 years ago)
Author:
Henrik Bettermann
Message:

Add special school fee regulations for staff members and foreign students.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py

    r8960 r9006  
    3333    INigeriaUGApplicant, INigeriaPGApplicant,
    3434    INigeriaApplicantOnlinePayment,
     35    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
     36    INigeriaApplicantUpdateByRegNo,
     37    IPUTMEApplicantEdit,
    3538    UG_OMIT_DISPLAY_FIELDS,
    3639    UG_OMIT_PDF_FIELDS,
  • main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py

    r8526 r9006  
    4949        self.browser.open(self.payments_path)
    5050        IWorkflowState(self.student).setState('cleared')
     51        self.student.nationality = u'NG'
    5152        self.browser.open(self.payments_path + '/addop')
    5253        self.browser.getControl("Create ticket").click()
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r8959 r9006  
    8686                           self.browser.contents)
    8787        IWorkflowState(self.student).setState('cleared')
     88        self.student.nationality = u'NG'
    8889        self.browser.open(self.payments_path + '/addop')
    8990        self.browser.getControl("Create ticket").click()
     
    190191        return
    191192
     193    def test_set_returning_data(self):
     194        # Student is in level 100, session 2004 with verdict A
     195        utils = getUtility(IStudentsUtils)
     196
     197        utils.setReturningData(self.student)
     198        self.assertEqual(self.student['studycourse'].current_session, 2005)
     199        self.assertEqual(self.student['studycourse'].current_level, 200)
     200
     201        self.student['studycourse'].current_session = 2004
     202        self.student['studycourse'].current_level = 100
     203        self.student['studycourse'].current_verdict = 'C'
     204        utils.setReturningData(self.student)
     205        self.assertEqual(self.student['studycourse'].current_session, 2005)
     206        self.assertEqual(self.student['studycourse'].current_level, 110)
     207
     208        self.student['studycourse'].current_session = 2004
     209        self.student['studycourse'].current_level = 100
     210        self.student['studycourse'].current_verdict = 'D'
     211        utils.setReturningData(self.student)
     212        self.assertEqual(self.student['studycourse'].current_session, 2005)
     213        self.assertEqual(self.student['studycourse'].current_level, 100)
     214        return
     215
    192216    def test_set_payment_details(self):
    193217        self.app['configuration']['2004'].gown_fee = 150.0
     
    206230
    207231        IWorkflowState(self.student).setState('cleared')
     232        self.student.nationality = u'NG'
    208233        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    209234        self.assertEqual(payment.p_level, 100)
     
    229254        self.assertEqual(error, None)
    230255
     256        self.student.is_staff = True
     257        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     258        self.assertEqual(payment.p_level, 200)
     259        self.assertEqual(payment.p_session, 2005)
     260        self.assertEqual(payment.amount_auth, 10088.0)
     261        self.assertEqual(payment.p_item, u'CERT1')
     262        self.assertEqual(error, None)
     263
     264        IWorkflowState(self.student).setState('cleared')
     265        self.student.is_staff = False
     266        self.student.nationality = u'DE'
     267        self.certificate.school_fee_3 = 60000.0
     268        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     269        self.assertEqual(payment.p_level, 100)
     270        self.assertEqual(payment.p_session, 2004)
     271        self.assertEqual(payment.amount_auth, 60099.0)
     272        self.assertEqual(payment.p_item, u'CERT1')
     273        self.assertEqual(error, None)
     274
     275        IWorkflowState(self.student).setState('returning')
     276        self.student.is_staff = False
     277        self.student.nationality = u'DE'
     278        self.certificate.school_fee_4 = 20000.0
     279        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     280        self.assertEqual(payment.p_level, 200)
     281        self.assertEqual(payment.p_session, 2005)
     282        self.assertEqual(payment.amount_auth, 20088.0)
     283        self.assertEqual(payment.p_item, u'CERT1')
     284        self.assertEqual(error, None)
     285
    231286        error, payment = utils.setPaymentDetails('clearance',self.student)
    232287        self.assertEqual(payment.p_level, 100)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r8959 r9006  
    9090                return _('Study course data are incomplete.'), None
    9191            if student.state == CLEARED:
    92                 amount = getattr(certificate, 'school_fee_1', 0.0)
     92                if student.is_foreigner:
     93                    amount = getattr(certificate, 'school_fee_3', 0.0)
     94                else:
     95                    amount = getattr(certificate, 'school_fee_1', 0.0)
    9396            elif student.state == RETURNING:
    9497                # In case of returning school fee payment the payment session
     
    9699                # has paid for.
    97100                p_session, p_level = self.getReturningData(student)
    98                 amount = getattr(certificate, 'school_fee_2', 0.0)
     101                if student.is_foreigner:
     102                    amount = getattr(certificate, 'school_fee_4', 0.0)
     103                else:
     104                    amount = getattr(certificate, 'school_fee_2', 0.0)
    99105                try:
    100106                    academic_session = grok.getSite()[
     
    106112                # but their level always remains the same.
    107113                p_session += 1
    108                 amount = getattr(certificate, 'school_fee_2', 0.0)
     114                if student.is_foreigner:
     115                    amount = getattr(certificate, 'school_fee_4', 0.0)
     116                else:
     117                    amount = getattr(certificate, 'school_fee_2', 0.0)
    109118                try:
    110119                    academic_session = grok.getSite()[
     
    112121                except KeyError:
    113122                    return _(u'Session configuration object is not available.'), None
     123            # Give 50% school fee discount to staff members.
     124            if student.is_staff:
     125                amount /= 2
    114126        if amount in (0.0, None):
    115127            return _(u'Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.