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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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'
Note: See TracChangeset for help on using the changeset viewer.