Ignore:
Timestamp:
5 Nov 2016, 05:59:51 (8 years ago)
Author:
Henrik Bettermann
Message:

Add _coursePaymentsMade.

File:
1 edited

Legend:

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

    r14252 r14259  
    182182        return False
    183183
     184    def _coursePaymentsMade(self, course):
     185        if not course.code[:3] in ('GST', 'ENT'):
     186            return True
     187        if len(self.student['payments']):
     188            paid_cats = list()
     189            for pticket in self.student['payments'].values():
     190                if pticket.p_state == 'paid':
     191                    paid_cats.append(pticket.p_category)
     192            if course.code in ('GST101', 'GST102', 'GST111', 'GST112') and \
     193                not 'gst_registration_1' in paid_cats:
     194                return False
     195            if course.code in ('GST222',) and \
     196                not 'gst_registration_2' in paid_cats:
     197                return False
     198            if course.code in ('ENT201',) and \
     199                not 'gst_registration_3' in paid_cats:
     200                return False
     201            if course.code in ('GST101', 'GST102') and \
     202                not 'gst_text_book_1' in paid_cats:
     203                return False
     204            if course.code in ('GST111', 'GST112') and \
     205                not 'gst_text_book_2' in paid_cats:
     206                return False
     207            if course.code in ('GST222',) and \
     208                not 'gst_text_book_3' in paid_cats:
     209                return False
     210            if course.code in ('ENT201',) and \
     211                not 'gst_text_book_4' in paid_cats:
     212                return False
     213            return True
     214        return False
     215
    184216    def addCourseTicket(self, ticket, course):
    185217        """Add a course ticket object.
     
    194226                _('%s is a 2nd semester course which can only be added '
    195227                  'if school fees have been fully paid.' % course.code))
     228        # Raise TicketError if registration fee or text
     229        # book fee haven't been paid.
     230        if not self._coursePaymentsMade(course):
     231            raise TicketError(
     232                _('%s can only be added if both registration fee and text '
     233                  'book fee have been paid.'
     234                  % course.code))
    196235        ticket.code = course.code
    197236        ticket.title = course.title
Note: See TracChangeset for help on using the changeset viewer.