Ignore:
Timestamp:
2 Nov 2012, 06:13:11 (12 years ago)
Author:
Henrik Bettermann
Message:

Customize addCertCourseTickets. Add ticket only if student has paid for the course.semester. Tests will follow.

File:
1 edited

Legend:

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

    r8867 r9502  
    2222import grok
    2323from zope.component.interfaces import IFactory
     24from zope.component import createObject
    2425from zope.interface import implementedBy
    2526from waeup.kofa.utils.helpers import attrs_to_fields
     
    3738    grok.implements(ICustomStudentStudyLevel, IStudentNavigation)
    3839    grok.provides(ICustomStudentStudyLevel)
     40
     41    def addCertCourseTickets(self, cert):
     42        """Collect all certificate courses and create course
     43        tickets automatically.
     44
     45        Add ticket only if student has paid for the course.semester.
     46        """
     47        payments = self.student.getPaymentTuples()
     48        if cert is not None:
     49            for key, val in cert.items():
     50                if val.level != self.level:
     51                    continue
     52                if val.course.semester == 2 and \
     53                    not (self.student.current_session,
     54                    'schoolfee_2', 'paid') in payments:
     55                    continue
     56                ticket = createObject(u'waeup.CourseTicket')
     57                ticket.automatic = True
     58                ticket.mandatory = val.mandatory
     59                ticket.carry_over = False
     60                self.addCourseTicket(ticket, val.course)
     61        return
    3962
    4063CustomStudentStudyLevel = attrs_to_fields(CustomStudentStudyLevel)
Note: See TracChangeset for help on using the changeset viewer.