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

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

Add property attribute total_score in order to make provision
for additional scores (like contineous assessments) in custom
packages.

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