Ignore:
Timestamp:
1 Sep 2020, 06:11:13 (4 years ago)
Author:
Henrik Bettermann
Message:

Implement Required Combi Payment.

File:
1 edited

Legend:

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

    r16140 r16222  
    6868            for category in self.REQUIRED_PAYMENTS.keys():
    6969                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
    7075                    if ticket.p_state == 'paid' and \
    7176                        ticket.p_category.startswith(category) and \
    7277                        ticket.p_session == session:
    7378                        del cats_missing[category]
    74         if cats_missing:
    75             return "%s must be paid before Tution Fee." % ', '.join(
    76                 cats_missing.values())
    77         return
     79                if not cats_missing:
     80                    return
     81        return "%s must be paid before Tution Fee. Make either single payments or make a 'Required Combi Payment'." % ', '.join(
     82            cats_missing.values())
    7883
    7984    def setPaymentDetails(self, category, student,
     
    194199                p_item += u'%s + ' % categories[cat]
    195200            p_item = p_item.strip(' + ')
     201        elif category == 'required_combi':
     202            rp = deepcopy(self.REQUIRED_PAYMENTS)
     203            for cat in rp:
     204                fee_name = cat + '_fee'
     205                cat_amount = getattr(academic_session, fee_name, 0.0)
     206                if not cat_amount:
     207                    return _('%s undefined.' % rp[cat]), None
     208                amount += cat_amount
     209                p_item += u'%s + ' % rp[cat]
     210            p_item = p_item.strip(' + ')
    196211        else:
    197212            fee_name = category + '_fee'
Note: See TracChangeset for help on using the changeset viewer.