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

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

Update IStudentsUtils.

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