source: main/waeup.aaue/trunk/src/waeup/aaue/students/interfaces.py @ 13741

Last change on this file since 13741 was 13735, checked in by Henrik Bettermann, 9 years ago

Show p_level value on payment pages.

  • Property svn:keywords set to Id
File size: 7.7 KB
RevLine 
[7505]1## $Id: interfaces.py 13735 2016-02-26 07:23:29Z henrik $
2##
3## Copyright (C) 2012 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##
[8867]18
[7505]19from zope import schema
[9496]20from zc.sourcefactory.contextual import BasicContextualSourceFactory
21from zope.catalog.interfaces import ICatalog
22from zope.component import getUtility
23from waeup.kofa.interfaces import IKofaObject
[13735]24from waeup.kofa.students.vocabularies import StudyLevelSource
[13362]25from waeup.kofa.schema import PhoneNumber, FormattedDate
26from kofacustom.nigeria.interfaces import LGASource
[8867]27from kofacustom.nigeria.students.interfaces import (
28    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
29    INigeriaStudentPersonal, INigeriaStudentStudyLevel,
30    INigeriaStudentStudyCourse, INigeriaCourseTicket,
31    INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo,
[7505]32    )
[8867]33from waeup.aaue.payments.interfaces import ICustomOnlinePayment
[8444]34from waeup.aaue.interfaces import MessageFactory as _
[7505]35
[8867]36class ICustomStudentBase(INigeriaStudentBase):
[7618]37    """Representation of student base data.
[7505]38
39    """
[7618]40
[8867]41class ICustomStudentPersonal(INigeriaStudentPersonal):
[7618]42    """Student personal data.
43
44    """
45
[13351]46    father_name = schema.TextLine(
47        title = _(u'Father\'s Name'),
48        required = False,
49        readonly = False,
50        )
51
52    father_address = schema.Text(
53        title = _(u'Father\'s Permanent Address'),
54        required = False,
55        readonly = False,
56        )
57
58    father_work = schema.TextLine(
59        title = _(u'Father\'s Place of Work'),
60        required = False,
61        readonly = False,
62        )
63
64    father_phone = PhoneNumber(
65        title = _(u'Father\'s Phone'),
66        required = False,
67        readonly = False,
68        )
69
70    mother_name = schema.TextLine(
71        title = _(u'Mother\'s Name'),
72        required = False,
73        readonly = False,
74        )
75
76    mother_address = schema.Text(
77        title = _(u'Mother\'s Permanent Address'),
78        required = False,
79        readonly = False,
80        )
81
82    mother_work = schema.TextLine(
83        title = _(u'Mother\'s Place of Work'),
84        required = False,
85        readonly = False,
86        )
87
88    mother_phone = PhoneNumber(
89        title = _(u'Mother\'s Phone'),
90        required = False,
91        readonly = False,
92        )
93
94    phone_personal = PhoneNumber(
95        title = _(u'Student\'s Personal Phone'),
96        description = u'',
[13573]97        required = False,
[13351]98        readonly = False,
99        )
100
101class ICustomStudentPersonalEdit(ICustomStudentPersonal):
102    """Interface for editing personal data by students.
103
104    Here we can repeat the fields from IStudentPersonal and set the
105    `required` if necessary.
106    """
107
108    perm_address = schema.Text(
109        title = _(u'Permanent Address'),
110        required = True,
111        )
112
113    next_kin_name = schema.TextLine(
114        title = _(u'Next of Kin Name'),
115        required = True,
116        readonly = False,
117        )
118
119    next_kin_relation = schema.TextLine(
120        title = _(u'Next of Kin Relationship'),
121        required = True,
122        readonly = False,
123        )
124
125    next_kin_address = schema.Text(
126        title = _(u'Next of Kin Address'),
127        required = True,
128        readonly = False,
129        )
130
131    next_kin_phone = PhoneNumber(
132        title = _(u'Next of Kin Phone'),
133        description = u'',
134        required = True,
135        readonly = False,
136        )
137
138    father_name = schema.TextLine(
139        title = _(u'Father\'s Name'),
140        required = True,
141        readonly = False,
142        )
143
144    father_address = schema.Text(
145        title = _(u'Father\'s Permanent Address'),
146        required = True,
147        readonly = False,
148        )
149
150    father_work = schema.TextLine(
151        title = _(u'Father\'s Place of Work'),
152        required = True,
153        readonly = False,
154        )
155
156    father_phone = PhoneNumber(
157        title = _(u'Father\'s Phone'),
158        required = True,
159        readonly = False,
160        )
161
162    mother_name = schema.TextLine(
163        title = _(u'Mother\'s Name'),
164        required = True,
165        readonly = False,
166        )
167
168    mother_address = schema.Text(
169        title = _(u'Mother\'s Permanent Address'),
170        required = True,
171        readonly = False,
172        )
173
174    mother_work = schema.TextLine(
175        title = _(u'Mother\'s Place of Work'),
176        required = True,
177        readonly = False,
178        )
179
180    mother_phone = PhoneNumber(
181        title = _(u'Mother\'s Phone'),
182        required = True,
183        readonly = False,
184        )
185
186    phone_personal = PhoneNumber(
187        title = _(u'Student\'s Personal Phone'),
188        description = u'',
189        required = True,
190        readonly = False,
191        )
192
[8867]193class ICustomUGStudentClearance(INigeriaUGStudentClearance):
[7995]194    """Representation of ug student clearance data.
[7505]195
196    """
197
[13368]198    #date_of_birth = FormattedDate(
199    #    title = _(u'Date of Birth'),
200    #    required = True,
201    #    show_year = True,
202    #    )
[13362]203
204    lga = schema.Choice(
205        source = LGASource(),
206        title = _(u'State / LGA'),
207        required = True,
208        )
209
210ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[
211    'lga'].order
[13368]212#ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[
213#    'date_of_birth'].order
[13362]214
215
[8867]216class ICustomPGStudentClearance(INigeriaPGStudentClearance):
[7995]217    """Representation of pg student clearance data.
[7505]218
219    """
220
[8101]221
[8204]222class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
223    ICustomPGStudentClearance,ICustomStudentPersonal):
[7995]224    """Representation of a student.
[7505]225
226    """
[8247]227
[8867]228class ICustomStudentStudyCourse(INigeriaStudentStudyCourse):
[8326]229    """A container for student study levels.
230
231    """
232
[8867]233class ICustomStudentStudyLevel(INigeriaStudentStudyLevel):
[8326]234    """A container for course tickets.
235
236    """
237
[9914]238    total_credits_s1 = schema.Int(
239        title = _(u'1st Semester Units'),
240        required = False,
241        readonly = True,
242        )
243
244    total_credits_s2 = schema.Int(
245        title = _(u'2nd Semester Units'),
246        required = False,
247        readonly = True,
248        )
249
[10102]250    total_credits = schema.Int(
251        title = _(u'Total Units'),
252        required = False,
253        readonly = True,
254        )
255
[8247]256class ICustomStudentOnlinePayment(ICustomOnlinePayment):
257    """A student payment via payment gateways.
258
[8270]259    This Interface does not inherit from IStudentOnlinePayment.
260    Thus all fields from IStudentOnlinePayment have to be repeated here.
261    """
262
[9154]263    p_current = schema.Bool(
264        title = _(u'Current Session Payment'),
265        default = True,
266        required = False,
267        )
268
[13735]269    p_level = schema.Choice(
[8270]270        title = _(u'Payment Level'),
[13735]271        source = StudyLevelSource(),
[8270]272        required = False,
273        )
[8430]274
[8270]275ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[
[8326]276    'p_session'].order
277
[8867]278class ICustomCourseTicket(INigeriaCourseTicket):
[8326]279    """A course ticket.
280
[8583]281    """
282
[8867]283class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
[8583]284    """Representation of a student. Skip regular reg_number validation.
285
286    """
287
[8867]288class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo):
[8583]289    """Representation of a student. Skip regular matric_number validation.
290
[8867]291    """
Note: See TracBrowser for help on using the repository browser.