source: main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py @ 14699

Last change on this file since 14699 was 14684, checked in by Henrik Bettermann, 8 years ago

Add 'Update all tickets' button to StudyLevelEditFormPage?.

  • Property svn:keywords set to Id
File size: 27.6 KB
RevLine 
[7191]1## $Id: interfaces.py 14684 2017-05-13 16:50:36Z henrik $
[6621]2##
[7191]3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
[8409]18#from datetime import datetime
[7620]19from zope.component import getUtility
[7256]20from zope.interface import Attribute, Interface
[6621]21from zope import schema
[7620]22from zc.sourcefactory.contextual import BasicContextualSourceFactory
[9217]23from waeup.kofa.browser.interfaces import IStudentNavigationBase
[7811]24from waeup.kofa.interfaces import (
[11450]25    IKofaObject, academic_sessions_vocab, validate_email, ICSVExporter,
[13125]26    ContextualDictSourceFactoryBase, IKofaUtils)
[7811]27from waeup.kofa.interfaces import MessageFactory as _
[8176]28from waeup.kofa.schema import TextLineChoice, FormattedDate, PhoneNumber
[7811]29from waeup.kofa.students.vocabularies import (
[7915]30    StudyLevelSource, contextual_reg_num_source, contextual_mat_num_source,
[9420]31    GenderSource, nats_vocab
[7915]32    )
[8160]33from waeup.kofa.payments.interfaces import (
[8174]34    IPaymentsContainer, IOnlinePayment)
[7915]35from waeup.kofa.university.vocabularies import (
[14642]36    CourseSource, StudyModeSource, CertificateSource,
37    SemesterSource, CourseCategorySource
[11450]38    )
[6621]39
[9864]40class PreviousPaymentCategorySource(ContextualDictSourceFactoryBase):
41    """A source that delivers all selectable categories of previous session
42    payments.
43    """
44    #: name of dict to deliver from kofa utils.
45    DICT_NAME = 'PREVIOUS_PAYMENT_CATEGORIES'
46
[9868]47class BalancePaymentCategorySource(ContextualDictSourceFactoryBase):
[9864]48    """A source that delivers all selectable items of balance payments.
49    """
50    #: name of dict to deliver from kofa utils.
[9868]51    DICT_NAME = 'BALANCE_PAYMENT_CATEGORIES'
[9864]52
[7620]53# VerdictSource can't be placed into the vocabularies module because it
54# requires importing IStudentsUtils which then leads to circular imports.
55class VerdictSource(BasicContextualSourceFactory):
56    """A verdicts source delivers all verdicts provided
57    in the portal.
58    """
59    def getValues(self, context):
[13125]60        verdicts_dict = getUtility(IKofaUtils).VERDICTS_DICT
[8820]61        return sorted(verdicts_dict.keys())
[7620]62
63    def getToken(self, context, value):
64        return value
65
66    def getTitle(self, context, value):
[13125]67        verdicts_dict = getUtility(IKofaUtils).VERDICTS_DICT
[8820]68        if value != '0':
69            return verdicts_dict[value] + ' (%s)' % value
[7688]70        return verdicts_dict[value]
[7620]71
[7681]72
[7150]73class IStudentsUtils(Interface):
74    """A collection of methods which are subject to customization.
75    """
[7841]76    def setReturningData(student):
77        """ This method defines what happens after school fee payment
78        depending on the student's senate verdict.
79
80        In the base configuration current level is always increased
81        by 100 no matter which verdict has been assigned.
82        """
83
[9148]84    def setPaymentDetails(category, student, previous_session=None,
85            previous_level=None,):
[8595]86        """Create Payment object and set the payment data of a student for
87        the payment category specified.
[12902]88        """
[7150]89
[12902]90    def increaseMatricInteger(student):
91        """Increase counter for matric numbers.
92
93        This counter can be a centrally stored attribute or an attribute of
94        faculties, departments or certificates. In the base package the counter
95        is as an attribute of the site configuration object.
[7150]96        """
97
[12902]98    def constructMatricNumber(student):
99        """Fetch the matric number counter which fits the student and
100        construct the new matric number of the student.
101
102        In the base package the counter is returned which is as an attribute
103        of the site configuration object.
104        """
105
[11589]106    def setMatricNumber(student):
107        """Set matriculation number of student.
108
109        If the student's matric number is unset a new matric number is
[12902]110        constructed according to the matriculation number construction rules
111        defined in the constructMatricNumber method. The new matric number is
112        set, the students catalog updated. The corresponding matric number
113        counter is increased by one.
[11589]114
115        This method is tested but not used in the base package. It can
116        be used in custom packages by adding respective views
[12902]117        and by customizing increaseMatricInteger and constructMatricNumber
118        according to the university's matriculation number construction rules.
[11589]119
[12902]120        The method can be disabled by setting the counter to zero.
[11589]121        """
122
[7186]123    def getAccommodation_details(student):
[7150]124        """Determine the accommodation dates of a student.
125        """
126
[7186]127    def selectBed(available_beds):
[7150]128        """Select a bed from a list of available beds.
129        In the standard configuration we select the first bed found,
130        but can also randomize the selection if we like.
131        """
132
[14655]133    def getDegreeClassNumber(level_obj):
134        """Get degree class number (used for SessionResultsPresentation
135        reports).
136        """
137
[9949]138    def getPDFCreator(context):
139        """Get some IPDFCreator instance suitable for use with `context`.
140        """
141
[7186]142    def renderPDF(view, subject='', filename='slip.pdf',):
[7150]143        """Render pdf slips for various pages.
144        """
145
[14655]146    def renderPDFAdmissionLetter(view, student=None, omit_fields=(),
147                                 pre_text=None, post_text=None,):
148        """Render pdf admission letter.
[14157]149        """
150
[14583]151    def renderPDFTranscript(view, filename, student,
152                  studentview, note, signatures, sigs_in_footer,
153                  show_scans, topMargin, omit_fields,
154                  tableheader, no_passport):
155        """Render pdf slip of a transcripts.
156        """
157
158    def renderPDFCourseticketsOverview(view, session, data, lecturers):
159        """Render pdf slip of course tickets for a lecturer.
160        """
161
[14584]162    def warnCreditsOOR(studylevel, course=None):
163        """Return message if credits are out of range. In the base
164        package only maximum credits is set.
[14583]165        """
166
167    def getBedCoordinates(bedticket):
168        """Return descriptive bed coordinates.
169        This method can be used to customize the `display_coordinates`
170        property method in order to  display a
171        customary description of the bed space.
172        """
173
174    def clearance_disabled_message(student):
175        """Render message if clearance is disabled.
176        """
177
[7819]178class IStudentsContainer(IKofaObject):
[7096]179    """A students container contains university students.
[6692]180    """
181    def addStudent(student):
182        """Add an IStudent object and subcontainers.
183        """
184
[13736]185    unique_student_id = Attribute('A unique student id')
[8408]186
[9217]187class IStudentNavigation(IStudentNavigationBase):
[13003]188    """Interface needed for navigation and logging. This interface is
[13076]189    implemented by all content classes in the students section.
[6642]190    """
[13003]191    student = Attribute('Student object of context')
[7150]192
[8735]193    def writeLogMessage(view, message):
[13167]194        """Add an INFO message to students.log.
[8735]195        """
196
[7819]197class IStudentBase(IKofaObject):
[6631]198    """Representation of student base data.
[6621]199    """
[12997]200    history = Attribute('Object history, a list of messages')
201    state = Attribute('Registration state')
[13080]202    translated_state = Attribute('Real name of the registration state')
[12997]203    certcode = Attribute('Certificate code of any chosen study course')
204    depcode = Attribute('Department code of any chosen study course')
205    faccode = Attribute('Faculty code of any chosen study course')
206    entry_session = Attribute('Entry session')
207    current_session = Attribute('Current session')
208    current_level = Attribute('Current level')
209    current_mode = Attribute('Current mode')
210    current_verdict = Attribute('Current verdict')
[7364]211    fullname = Attribute('All name parts separated by hyphens')
[12997]212    display_fullname = Attribute('Fullname as displayed on pages')
[8969]213    is_postgrad = Attribute('True if postgraduate student')
[12997]214    is_special_postgrad = Attribute('True if special postgraduate student')
215    is_fresh = Attribute('True if fresh student')
216    before_payment = Attribute('True if no previous payment has to be made')
217    personal_data_expired = Attribute('True if personal data expired')
218    transcript_enabled = Attribute('True if transcript processing is enabled')
[13103]219    clearance_locked = Attribute('True if clearance form is locked')
[6637]220
[13003]221    password = Attribute('Encrypted password')
222    temp_password = Attribute('Dictionary with user name, timestamp and encrypted password')
223
[8983]224    suspended = schema.Bool(
225        title = _(u'Account suspended'),
226        default = False,
[9035]227        required = False,
[8983]228        )
229
[9702]230    suspended_comment = schema.Text(
231        title = _(u"Reasons for Deactivation"),
232        required = False,
233        description = _(
234            u'This message will be shown if and only if deactivated '
235            'students try to login.'),
236        )
237
[13711]238    flash_notice = schema.TextLine(
239        title = _(u'Flash Notice'),
240        required = False,
241        readonly = False,
242        description = _(
243            u'This single-line message will be shown in a flash box.'),
244        )
245
[6665]246    student_id = schema.TextLine(
[7723]247        title = _(u'Student Id'),
[6849]248        required = False,
[6665]249        )
250
[7357]251    firstname = schema.TextLine(
[7723]252        title = _(u'First Name'),
[6621]253        required = True,
254        )
255
[7357]256    middlename = schema.TextLine(
[7723]257        title = _(u'Middle Name'),
[7357]258        required = False,
259        )
260
261    lastname = schema.TextLine(
[7723]262        title = _(u'Last Name (Surname)'),
[7357]263        required = True,
264        )
265
[6996]266    sex = schema.Choice(
[7723]267        title = _(u'Sex'),
[6996]268        source = GenderSource(),
269        required = True,
270        )
271
[6788]272    reg_number = TextLineChoice(
[7723]273        title = _(u'Registration Number'),
[6696]274        required = True,
275        readonly = False,
[6788]276        source = contextual_reg_num_source,
[6696]277        )
278
[6788]279    matric_number = TextLineChoice(
[7723]280        title = _(u'Matriculation Number'),
[6750]281        required = False,
282        readonly = False,
[6788]283        source = contextual_mat_num_source,
[6750]284        )
285
[6769]286    adm_code = schema.TextLine(
[7723]287        title = _(u'PWD Activation Code'),
[6769]288        required = False,
[8977]289        readonly = False,
[6769]290        )
291
[7133]292    email = schema.ASCIILine(
[7723]293        title = _(u'Email'),
[13345]294        required = False,
[7133]295        constraint=validate_email,
296        )
[8176]297    phone = PhoneNumber(
[7723]298        title = _(u'Phone'),
[7133]299        required = False,
300        )
301
[9334]302    def setTempPassword(user, password):
303        """Set a temporary password (LDAP-compatible) SSHA encoded for
304        officers.
305        """
306
307    def getTempPassword():
308        """Check if a temporary password has been set and if it
[12997]309        is not expired. Return the temporary password if valid,
[9334]310        None otherwise. Unset the temporary password if expired.
311        """
312
[9131]313    def transfer(certificate, current_session,
314        current_level, current_verdict):
315        """ Creates a new studycourse and backups the old one.
[12997]316        """
[9131]317
[12997]318    def revert_transfer():
319        """ Revert previous transfer.
[9131]320        """
321
[7993]322class IUGStudentClearance(IKofaObject):
323    """Representation of undergraduate student clearance data.
[6631]324    """
[9543]325    officer_comment = schema.Text(
326        title = _(u"Officer's Comment"),
327        required = False,
[6631]328        )
329
[6769]330    clr_code = schema.TextLine(
[7723]331        title = _(u'CLR Activation Code'),
[6769]332        required = False,
[8977]333        readonly = False,
[6769]334        )
335
[9543]336    date_of_birth = FormattedDate(
337        title = _(u'Date of Birth'),
338        required = True,
339        show_year = True,
340        )
341
[7523]342    nationality = schema.Choice(
[8069]343        vocabulary = nats_vocab,
[7723]344        title = _(u'Nationality'),
[7983]345        required = False,
[7523]346        )
347
[7993]348class IPGStudentClearance(IUGStudentClearance):
349    """Representation of postgraduate student clearance data.
350    """
351    employer = schema.TextLine(
352        title = _(u'Employer'),
353        required = False,
354        readonly = False,
355        )
356
[7819]357class IStudentPersonal(IKofaObject):
[6631]358    """Representation of student personal data.
359    """
[9543]360    personal_updated = schema.Datetime(
361        title = _(u'Updated'),
362        required = False,
363        readonly = False,
364        )
365
[6651]366    perm_address = schema.Text(
[7723]367        title = _(u'Permanent Address'),
[6631]368        required = False,
369        )
370
[10447]371class IStudentTranscript(IKofaObject):
372    """Representation of student transcript data.
373    """
374
[10458]375    transcript_comment = schema.Text(
376        title = _(u'Comment'),
[10447]377        required = False,
378        )
379
380
[8008]381class IStudent(IStudentBase,IUGStudentClearance,IPGStudentClearance,
[10447]382    IStudentPersonal, IStudentTranscript):
[6631]383    """Representation of a student.
384    """
385
[9563]386class IStudentPersonalEdit(IStudentPersonal):
387    """Interface for editing personal data by students.
388    Here we can repeat the fields from IStudentPersonal and set the
389    `required` if necessary.
390    """
391
392    perm_address = schema.Text(
393        title = _(u'Permanent Address'),
394        required = True,
395        )
396
[6849]397class IStudentUpdateByRegNo(IStudent):
398    """Representation of a student. Skip regular reg_number validation.
399    """
400    reg_number = schema.TextLine(
[7723]401        title = _(u'Registration Number'),
[6849]402        required = False,
403        )
404
405class IStudentUpdateByMatricNo(IStudent):
406    """Representation of a student. Skip regular matric_number validation.
407    """
408    matric_number = schema.TextLine(
[7723]409        title = _(u'Matriculation Number'),
[6849]410        required = False,
411        )
412
[8779]413class IStudentRequestPW(IStudent):
[12999]414    """Representation of a student for first-time password request.
[8779]415    This interface is used when students use the requestpw page to
416    login for the the first time.
417    """
[8854]418    number = schema.TextLine(
419        title = _(u'Registr. or Matric. Number'),
[8779]420        required = True,
421        )
422
423    firstname = schema.TextLine(
424        title = _(u'First Name'),
425        required = True,
426        )
427
428    email = schema.ASCIILine(
429        title = _(u'Email Address'),
430        required = True,
431        constraint=validate_email,
432        )
433
[7819]434class IStudentStudyCourse(IKofaObject):
[12999]435    """Representation of student study course data.
[6633]436    """
[13002]437    next_session_allowed = Attribute('True if the student can proceed to next session')
438    is_postgrad = Attribute('True if student is postgraduate student')
439    is_current = Attribute('True if the study course is the current course of studies')
440    is_previous = Attribute('True if the study course is the previous course of studies')
441
[6648]442    certificate = schema.Choice(
[7723]443        title = _(u'Certificate'),
[6648]444        source = CertificateSource(),
[7209]445        required = False,
[6633]446        )
[6635]447
[6996]448    entry_mode = schema.Choice(
[7723]449        title = _(u'Entry Mode'),
[7681]450        source = StudyModeSource(),
[6996]451        required = True,
452        readonly = False,
453        )
454
455    entry_session = schema.Choice(
[7723]456        title = _(u'Entry Session'),
[6996]457        source = academic_sessions_vocab,
[7425]458        #default = datetime.now().year,
[6996]459        required = True,
460        readonly = False,
461        )
462
[6724]463    current_session = schema.Choice(
[7723]464        title = _(u'Current Session'),
[6744]465        source = academic_sessions_vocab,
[6724]466        required = True,
[6996]467        readonly = False,
[6724]468        )
469
470    current_level = schema.Choice(
[7723]471        title = _(u'Current Level'),
[6725]472        source = StudyLevelSource(),
473        required = False,
[6996]474        readonly = False,
[6724]475        )
476
477    current_verdict = schema.Choice(
[7723]478        title = _(u'Current Verdict'),
[7619]479        source = VerdictSource(),
[8820]480        default = '0',
[6725]481        required = False,
[6724]482        )
483
484    previous_verdict = schema.Choice(
[7723]485        title = _(u'Previous Verdict'),
[7619]486        source = VerdictSource(),
[8820]487        default = '0',
[6725]488        required = False,
[6724]489        )
490
[13002]491    def addStudentStudyLevel(cert, studylevel):
492        """Add a study level object.
493        """
494
495    def getTranscriptData():
496        """Get a sorted list of dicts with level and course ticket data.
497        This method is used for transcripts.
498        """
499
[9138]500class IStudentStudyCourseTransfer(IStudentStudyCourse):
[12999]501    """An interface used for student transfers.
[9138]502    """
503    certificate = schema.Choice(
504        title = _(u'Certificate'),
505        source = CertificateSource(),
506        required = True,
507        )
508
509    current_level = schema.Choice(
510        title = _(u'Current Level'),
511        source = StudyLevelSource(),
512        required = True,
513        readonly = False,
514        )
515
[9960]516    entry_session = schema.Choice(
517        title = _(u'Entry Session'),
518        source = academic_sessions_vocab,
519        #default = datetime.now().year,
520        required = False,
521        readonly = False,
522        )
523
524
[9138]525IStudentStudyCourseTransfer['certificate'].order = IStudentStudyCourse[
526    'certificate'].order
527IStudentStudyCourseTransfer['current_level'].order = IStudentStudyCourse[
528    'current_level'].order
529
[10250]530class IStudentStudyCourseTranscript(IKofaObject):
531    """An interface for student transcripts.
532    """
533    entry_mode = schema.Choice(
534        title = _(u'Entry Mode'),
535        source = StudyModeSource(),
536        required = True,
537        readonly = False,
538        )
539
540    entry_session = schema.Choice(
541        title = _(u'Entry Session'),
542        source = academic_sessions_vocab,
543        #default = datetime.now().year,
544        required = True,
545        readonly = False,
546        )
547
[7951]548class IStudentVerdictUpdate(IKofaObject):
549    """A interface for verdict imports.
550    """
551    current_verdict = schema.Choice(
552        title = _(u'Current Verdict'),
553        source = VerdictSource(),
554        required = True,
555        )
556
557    current_session = schema.Choice(
558        title = _(u'Current Session'),
559        source = academic_sessions_vocab,
560        required = True,
561        )
562
563    current_level = schema.Choice(
564        title = _(u'Current Level'),
565        source = StudyLevelSource(),
566        required = True,
567        )
568
[9296]569    bypass_validation = schema.Bool(
570        title = _(u'Bypass validation'),
571        required = False,
572        )
573
574    validated_by = schema.TextLine(
575        title = _(u'Validated by'),
576        required = False,
577        )
578
[7819]579class IStudentStudyLevel(IKofaObject):
[12999]580    """A representation of student study level data.
[6774]581    """
[13002]582    certcode = Attribute('The certificate code of the study course')
583    is_current_level = Attribute('True if level is current level of the student')
584    level_title = Attribute('Level title from source')
585    getSessionString = Attribute('Session title from source')
[9235]586    number_of_tickets = Attribute('Number of tickets contained in this level')
[10553]587    passed_params = Attribute('Information about passed and failed courses')
[13002]588    gpa_params_rectified = Attribute('Corrected sessional GPA parameters')
589    gpa_params = Attribute('GPA parameters for this level.')
[14247]590    cumulative_params = Attribute(
591        'Cumulative GPA and other cumulative parameters for this level')
592    course_registration_forbidden = Attribute(
593        'Return error message if course registration is forbidden')
[6774]594
[12873]595    level = schema.Choice(
596        title = _(u'Level'),
597        source = StudyLevelSource(),
598        required = True,
599        readonly = False,
600        )
601
[6793]602    level_session = schema.Choice(
[7723]603        title = _(u'Session'),
[6793]604        source = academic_sessions_vocab,
[9437]605        required = True,
[6793]606        )
[6781]607
[6793]608    level_verdict = schema.Choice(
[7723]609        title = _(u'Verdict'),
[7619]610        source = VerdictSource(),
[8820]611        default = '0',
[6793]612        required = False,
613        )
614
[9161]615    validated_by = schema.TextLine(
616        title = _(u'Validated by'),
617        default = None,
618        required = False,
619        )
620
621    validation_date = schema.Datetime(
622        title = _(u'Validation Date'),
623        required = False,
624        readonly = False,
625        )
626
[9690]627    total_credits = schema.Int(
628        title = _(u'Total Credits'),
629        required = False,
630        readonly = True,
631        )
632
[14574]633    gpa = schema.TextLine(
[10479]634        title = _(u'Unrectified GPA'),
635        required = False,
636        readonly = True,
637        )
[9690]638
[8920]639    def addCourseTicket(ticket, course):
[8182]640        """Add a course ticket object.
641        """
642
[9501]643    def addCertCourseTickets(cert):
644        """Collect all certificate courses and create course
645        tickets automatically.
646        """
647
[14684]648    def updateCourseTicket(ticket, course):
649        """Updates a course ticket object and return code
650        if ticket has been invalidated.
651        """
652
[7819]653class ICourseTicket(IKofaObject):
[12999]654    """A representation of course ticket data.
[6781]655    """
[13003]656    certcode = Attribute('Certificate code of the study course')
657    level_session = Attribute('Session of the study level the ticket has been added to')
658    level = Attribute('Level value of the study level the ticket has been added to')
[14133]659    total_score = Attribute('Score')
660    grade = Attribute('Grade calculated from total score')
661    weight = Attribute('Weight calculated from total score')
[13003]662    removable_by_student = Attribute('True if student is allowed to remove the ticket')
663    editable_by_lecturer = Attribute('True if lecturer is allowed to edit the ticket')
[6781]664
[13003]665    code = Attribute('Code of the original course')
666
[9420]667    title = schema.TextLine(
668        title = _(u'Title'),
669        required = False,
670        )
671
672    fcode = schema.TextLine(
673        title = _(u'Faculty Code'),
674        required = False,
675        )
676
677    dcode = schema.TextLine(
678        title = _(u'Department Code'),
679        required = False,
680        )
681
682    semester = schema.Choice(
683        title = _(u'Semester/Term'),
684        source = SemesterSource(),
685        required = False,
686        )
687
688    passmark = schema.Int(
689        title = _(u'Passmark'),
690        required = False,
691        )
692
693    credits = schema.Int(
694        title = _(u'Credits'),
695        required = False,
696        )
697
[7665]698    mandatory = schema.Bool(
[9320]699        title = _(u'Required'),
[6795]700        default = False,
701        required = False,
702        )
703
[14574]704    outstanding = schema.Bool(
705        title = _(u'Outstanding Course'),
706        default = False,
707        required = False,
708        )
709
[14642]710    course_category = schema.Choice(
711        title = _(u'Course Category'),
712        source = CourseCategorySource(),
713        required = False,
714        )
715
[6781]716    score = schema.Int(
[7723]717        title = _(u'Score'),
[9684]718        default = None,
[6781]719        required = False,
[10637]720        missing_value = None,
[6781]721        )
722
[7661]723    carry_over = schema.Bool(
[7723]724        title = _(u'Carry-over Course'),
[7661]725        default = False,
726        required = False,
727        )
728
[9420]729    automatic = schema.Bool(
730        title = _(u'Automatical Creation'),
731        default = False,
[9316]732        required = False,
733        )
734
[9420]735class ICourseTicketAdd(IKofaObject):
[7150]736    """An interface for adding course tickets.
[6795]737    """
738    course = schema.Choice(
[7723]739        title = _(u'Course'),
[6795]740        source = CourseSource(),
741        readonly = False,
742        )
743
[9420]744class ICourseTicketImport(ICourseTicket):
745    """An interface for importing course results and nothing more.
746    """
747    score = schema.Int(
748        title = _(u'Score'),
749        required = False,
750        readonly = False,
751        )
752
753    level_session = schema.Choice(
754        title = _(u'Level Session'),
755        source = academic_sessions_vocab,
756        required = False,
757        readonly = False,
758        )
759
[7819]760class IStudentAccommodation(IKofaObject):
[6635]761    """A container for student accommodation objects.
762    """
763
[13457]764    desired_hostel = schema.TextLine(
765        title = _(u'Desired Hostel'),
766        required = False,
767        )
768
[9423]769    def addBedTicket(bedticket):
770        """Add a bed ticket object.
771        """
772
773
[7819]774class IBedTicket(IKofaObject):
[12999]775    """A representation of accommodation booking data.
[6989]776    """
[13314]777    bed = Attribute('The bed object')
778    maint_payment_made = Attribute('True if maintenance payment is made')
[6996]779
[13012]780    display_coordinates = schema.TextLine(
781        title = _(u'Allocated Bed'),
782        required = False,
783        readonly = True,
784        )
785
[6996]786    bed_coordinates = schema.TextLine(
[9984]787        title = u'',
[9423]788        required = True,
[7014]789        readonly = False,
[6992]790        )
791
[6996]792    bed_type = schema.TextLine(
[9424]793        title = _(u'Requested Bed Type'),
[9423]794        required = True,
[7014]795        readonly = False,
[6996]796        )
797
[6992]798    booking_session = schema.Choice(
[7723]799        title = _(u'Session'),
[6992]800        source = academic_sessions_vocab,
801        required = True,
[13316]802        readonly = False
[6992]803        )
804
[8170]805    booking_date = schema.Datetime(
[7723]806        title = _(u'Booking Date'),
[6992]807        required = False,
[13316]808        readonly = False,
[6992]809        )
810
811    booking_code = schema.TextLine(
[7723]812        title = _(u'Booking Activation Code'),
[6992]813        required = False,
[13316]814        readonly = False,
[6992]815        )
816
[6994]817    def getSessionString():
[13012]818        """Returns the title of academic_sessions_vocab term of the session
819        when the bed was booked.
[6994]820        """
[6992]821
[6860]822class IStudentPaymentsContainer(IPaymentsContainer):
[6635]823    """A container for student payment objects.
824    """
825
[13736]826    certificate = Attribute('Certificate to determine the correct p_level value')
827
[6877]828class IStudentOnlinePayment(IOnlinePayment):
829    """A student payment via payment gateways.
830    """
831
[13736]832    certificate = Attribute('Certificate to determine the correct p_level value')
[13871]833    student = Attribute('Student')
[13736]834
[9148]835    p_current = schema.Bool(
836        title = _(u'Current Session Payment'),
837        default = True,
838        required = False,
839        )
840
[13733]841    p_level = schema.Choice(
[8268]842        title = _(u'Payment Level'),
[13733]843        source = StudyLevelSource(),
[8268]844        required = False,
845        )
[6877]846
[13871]847    def redeemTicket():
848        """Either create an appropriate access code or trigger an action
849        directly.
850        """
851
[8422]852    def doAfterStudentPayment():
853        """Process student after payment was made.
854        """
855
[8453]856    def doAfterStudentPaymentApproval():
857        """Process student after payment was approved.
858        """
859
[8420]860    def approveStudentPayment():
[8422]861        """Approve payment and process student.
[8420]862        """
863
[8268]864IStudentOnlinePayment['p_level'].order = IStudentOnlinePayment[
865    'p_session'].order
[8408]866
[9864]867class IStudentPreviousPayment(IKofaObject):
[9148]868    """An interface for adding previous session payments.
869    """
870
[9864]871    p_category = schema.Choice(
872        title = _(u'Payment Category'),
873        default = u'schoolfee',
874        source = PreviousPaymentCategorySource(),
875        required = True,
876        )
877
[9148]878    p_session = schema.Choice(
879        title = _(u'Payment Session'),
880        source = academic_sessions_vocab,
881        required = True,
882        )
883
884    p_level = schema.Choice(
885        title = _(u'Payment Level'),
886        source = StudyLevelSource(),
887        required = True,
888        )
889
[9864]890class IStudentBalancePayment(IKofaObject):
891    """An interface for adding balances.
892    """
893
[9868]894    p_category = schema.Choice(
[9864]895        title = _(u'Payment Category'),
896        default = u'schoolfee',
897        required = True,
[9868]898        source = BalancePaymentCategorySource(),
[9864]899        )
900
901    balance_session = schema.Choice(
902        title = _(u'Payment Session'),
903        source = academic_sessions_vocab,
904        required = True,
905        )
906
907    balance_level = schema.Choice(
908        title = _(u'Payment Level'),
909        source = StudyLevelSource(),
910        required = True,
911        )
912
913    balance_amount = schema.Float(
914        title = _(u'Balance Amount'),
[9874]915        default = None,
[9864]916        required = True,
917        readonly = False,
918        description = _(
919            u'Balance in Naira '),
920        )
921
[8408]922class ICSVStudentExporter(ICSVExporter):
923    """A regular ICSVExporter that additionally supports exporting
924      data from a given student object.
925    """
[9801]926    def get_filtered(site, **kw):
[9797]927        """Get a filtered set of students.
928        """
[8408]929
[12518]930    def get_selected(site, selected):
931        """Get set of selected students.
932        """
933
[8408]934    def export_student(student, filepath=None):
935        """Export data for a given student.
936        """
[9734]937
[9797]938    def export_filtered(site, filepath=None, **kw):
[12518]939        """Export data for filtered set of students.
[9734]940        """
[12518]941
942    def export_selected(site, filepath=None, **kw):
943        """Export data for selected set of students.
944        """
Note: See TracBrowser for help on using the repository browser.