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

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

Replace maxCreditsExceeded by warnCreditsOOR.

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