Ignore:
Timestamp:
1 Sep 2020, 17:52:36 (4 years ago)
Author:
Henrik Bettermann
Message:

Puuh, there are different municipal fees for fresh and returning students.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_utils.py

    r16222 r16223  
    5151        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    5252        self.assertEqual(error,
    53             'Registration Fee, Book Deposit, Development Fee, Municipal Fee, '
     53            'Registration Fee, Book Deposit, Development Fee, Fresh Students Municipal Fee, '
    5454            'Parents Consultative Forum (PCF) Fee must be paid before Tution Fee. '
    5555            'Make either single payments or make a \'Required Combi Payment\'.')
     
    6767        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    6868        self.assertEqual(error,
    69             'Book Deposit, Development Fee, Municipal Fee, Parents Consultative '
     69            'Book Deposit, Development Fee, Fresh Students Municipal Fee, Parents Consultative '
    7070            'Forum (PCF) Fee must be paid before Tution Fee. '
    7171            'Make either single payments or make a \'Required Combi Payment\'.')
     
    7777        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    7878        self.assertEqual(error,
    79             'Registration Fee, Book Deposit, Development Fee, Municipal Fee, '
     79            'Registration Fee, Book Deposit, Development Fee, Fresh Students Municipal Fee, '
    8080            'Parents Consultative Forum (PCF) Fee must be paid before Tution Fee. '
    8181            'Make either single payments or make a \'Required Combi Payment\'.')
     
    8383        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    8484        self.assertEqual(error,
    85             'Book Deposit, Development Fee, Municipal Fee, Parents Consultative '
     85            'Book Deposit, Development Fee, Fresh Students Municipal Fee, Parents Consultative '
    8686            'Forum (PCF) Fee must be paid before Tution Fee. '
    8787            'Make either single payments or make a \'Required Combi Payment\'.')
     
    9494        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    9595        self.assertEqual(error,
    96             'Book Deposit, Development Fee, Municipal Fee must be paid before Tution Fee. '
     96            'Book Deposit, Development Fee, Fresh Students Municipal Fee must be paid before Tution Fee. '
    9797            'Make either single payments or make a \'Required Combi Payment\'.')
    9898        munic_payment = createObject('waeup.StudentOnlinePayment')
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py

    r16222 r16223  
    4545    PORTRAIT_CHANGE_STATES = (ADMITTED, CLEARANCE,)
    4646
    47     REQUIRED_PAYMENTS = {
     47    REQUIRED_PAYMENTS_FRESH = {
    4848        'registration': 'Registration Fee',
    4949        'book': 'Book Deposit',
    5050        'develop': 'Development Fee',
    5151        'parentsconsult': 'Parents Consultative Forum (PCF) Fee',
    52         'municipal': 'Municipal Fee',
     52        'municipal_fresh': 'Fresh Students Municipal Fee',
     53        }
     54
     55    REQUIRED_PAYMENTS_RETURNING = {
     56        'registration': 'Registration Fee',
     57        'book': 'Book Deposit',
     58        'develop': 'Development Fee',
     59        'parentsconsult': 'Parents Consultative Forum (PCF) Fee',
     60        'municipal_returning': 'Returning Students Municipal Fee',
    5361        }
    5462
     
    6472
    6573    def _requiredPaymentsMissing(self, student, session):
    66         cats_missing = deepcopy(self.REQUIRED_PAYMENTS)
     74        if student.is_fresh:
     75            rp = self.REQUIRED_PAYMENTS_FRESH
     76        else:
     77            rp = self.REQUIRED_PAYMENTS_RETURNING
     78        for ticket in student['payments'].values():
     79            if ticket.p_category == 'required_combi'and \
     80                ticket.p_session == session and \
     81                ticket.p_state == 'paid':
     82                return
     83        cats_missing = deepcopy(rp)
    6784        if len(student['payments']):
    68             for category in self.REQUIRED_PAYMENTS.keys():
     85            for category in rp.keys():
    6986                for ticket in student['payments'].values():
    70                     if ticket.p_category == 'required_combi' and \
    71                         ticket.p_session == session and \
    72                         ticket.p_state == 'paid':
    73                         cats_missing = None
    74                         break
    7587                    if ticket.p_state == 'paid' and \
    76                         ticket.p_category.startswith(category) and \
     88                        ticket.p_category == category and \
    7789                        ticket.p_session == session:
    7890                        del cats_missing[category]
     
    107119            p_level = student['studycourse'].current_level
    108120            p_current = True
    109             if category in self.REQUIRED_PAYMENTS.keys() + [
    110                 'schoolfee','schoolfee40','secondinstal'] \
     121            if category in self.REQUIRED_PAYMENTS_FRESH.keys() \
     122                + self.REQUIRED_PAYMENTS_RETURNING.keys() \
     123                + ['schoolfee','schoolfee40','secondinstal'] \
    111124                and student.state == RETURNING:
    112125                # In case of school fee or required sundry fee payments the
     
    200213            p_item = p_item.strip(' + ')
    201214        elif category == 'required_combi':
    202             rp = deepcopy(self.REQUIRED_PAYMENTS)
     215            if student.is_fresh:
     216                rp = deepcopy(self.REQUIRED_PAYMENTS_FRESH)
     217            else:
     218                rp = deepcopy(self.REQUIRED_PAYMENTS_RETURNING)
    203219            for cat in rp:
    204220                fee_name = cat + '_fee'
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/utils/utils.py

    r16222 r16223  
    4646        'clinical': 'Clinical Fee (Medical Students)',
    4747        'develop': 'Development Fee',
    48         'municipal_fresh': 'Municipal Fee Fresh)',
    49         'municipal_returning': 'Municipal Fee Returning)',
     48        'municipal_fresh': 'Municipal Fee (Fresh Students)',
     49        'municipal_returning': 'Municipal Fee (Returning Students)',
    5050        'alumni': 'Alumni Fee',
    5151        'conv': 'Convocation Fee',
Note: See TracChangeset for help on using the changeset viewer.