Ignore:
Timestamp:
5 Jun 2015, 14:35:19 (9 years ago)
Author:
Henrik Bettermann
Message:

Activate and customize late course registration payment. Fresh students can register without restriction.

File:
1 edited

Legend:

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

    r10480 r13036  
    2121"""
    2222import grok
     23import pytz
     24from datetime import datetime
    2325from zope.component.interfaces import IFactory
    2426from zope.component import createObject
    2527from zope.interface import implementedBy
    2628from waeup.kofa.utils.helpers import attrs_to_fields
     29from waeup.kofa.interfaces import CREATED
    2730from waeup.kofa.students.studylevel import (
    2831    StudentStudyLevel, CourseTicket,
     
    5861    def gpa_params_rectified(self):
    5962        return self.gpa_params
     63
     64    @property
     65    def course_registration_allowed(self):
     66        if self.student.is_fresh:
     67            return True
     68        try:
     69            deadline = grok.getSite()['configuration'][
     70                    str(self.level_session)].coursereg_deadline
     71        except TypeError, KeyError:
     72            return True
     73        payment_made = False
     74        if len(self.student['payments']):
     75            for ticket in self.student['payments'].values():
     76                if ticket.p_category == 'late_registration' and \
     77                    ticket.p_session == self.level_session and \
     78                    ticket.p_state == 'paid':
     79                        payment_made = True
     80        if deadline and deadline < datetime.now(pytz.utc) and not payment_made:
     81            return False
     82        return True
    6083
    6184CustomStudentStudyLevel = attrs_to_fields(
Note: See TracChangeset for help on using the changeset viewer.