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

Last change on this file since 16045 was 15998, checked in by Henrik Bettermann, 5 years ago

Add UpdateCourseTicketsView.

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