source: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/interfaces.py @ 17855

Last change on this file since 17855 was 17157, checked in by Henrik Bettermann, 2 years ago

Add ‚present‘ field.

  • Property svn:keywords set to Id
File size: 9.5 KB
Line 
1## $Id: interfaces.py 17157 2022-11-03 06:00:32Z 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##
18
19from zope import schema
20from zope.interface import Attribute, invariant, Invalid
21from waeup.kofa.students.vocabularies import StudyLevelSource
22from waeup.kofa.interfaces import validate_email, SimpleKofaVocabulary
23from waeup.kofa.students.interfaces import IStudentPersonal
24from waeup.kofa.schema import FormattedDate, PhoneNumber
25from kofacustom.nigeria.students.interfaces import (
26    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
27    INigeriaStudentPersonal, INigeriaStudentStudyLevel,
28    INigeriaStudentStudyCourse, INigeriaCourseTicket,
29    INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo,
30    )
31from kofacustom.iuokada.payments.interfaces import ICustomOnlinePayment
32from kofacustom.iuokada.applicants.interfaces import sponsors_vocab
33from kofacustom.iuokada.interfaces import MessageFactory as _
34
35class ICustomStudentBase(INigeriaStudentBase):
36    """Representation of student base data.
37
38    """
39
40    email2 = schema.ASCIILine(
41        title = _(u'Second Email'),
42        required = False,
43        constraint=validate_email,
44        )
45
46    library = schema.Bool(
47        title = _(u'Library Id Card'),
48        default = False,
49        required = False,
50        )
51
52    sponsor = schema.Choice(
53        title = _(u'Sponsor'),
54        vocabulary = sponsors_vocab,
55        required = False,
56        )
57   
58    present = schema.Bool(
59        title = _(u'Physically Present on Campus'),
60        default = False,
61        required = False,
62        )
63
64ICustomStudentBase['email2'].order = ICustomStudentBase[
65    'phone'].order
66ICustomStudentBase['phone'].order = ICustomStudentBase[
67    'email'].order
68
69class ICustomStudentPersonal(IStudentPersonal):
70    """Student personal/bio data.
71
72    """
73
74    is_foreigner = Attribute('True if student is non-Nigerian')
75
76    # Duplicated fields from the ICustomStudentBase
77
78    email = schema.ASCIILine(
79        title = _(u'Email'),
80        required = False,
81        constraint=validate_email,
82        )
83
84    email2 = schema.ASCIILine(
85        title = _(u'Second Email'),
86        required = False,
87        constraint=validate_email,
88        )
89
90    phone = PhoneNumber(
91        title = _(u'Phone'),
92        required = False,
93        )
94
95    parents_email = schema.ASCIILine(
96        title = _(u"Parents' Email"),
97        required = False,
98        constraint=validate_email,
99        )
100
101    sponsor = schema.Choice(
102        title = _(u'Sponsor'),
103        vocabulary = sponsors_vocab,
104        required = False,
105        )
106
107    # New fields
108
109    perm_address = schema.Text(
110        title = _(u'Home Address'),
111        required = False,
112        )
113
114    postal_address = schema.Text(
115        title = _(u'Postal Address'),
116        required = False,
117        )
118
119    hostel_address = schema.Text(
120        title = _(u'Hostel Address'),
121        required = False,
122        )
123
124    father_address = schema.Text(
125        title = _(u'Father\'s Address'),
126        required = False,
127        )
128
129    mother_address = schema.Text(
130        title = _(u'Mother\'s Address'),
131        required = False,
132        )
133
134    guardian_address = schema.Text(
135        title = _(u'Guardian/Sponsor\'s Address'),
136        required = False,
137        )
138
139    father_phone = PhoneNumber(
140        title = _(u'Father\'s Mobile Phone Number'),
141        description = u'',
142        required = False,
143        )
144
145    mother_phone = PhoneNumber(
146        title = _(u'Mother\'s Mobile Phone Number'),
147        description = u'',
148        required = False,
149        )
150
151    guardian_phone = PhoneNumber(
152        title = _(u'Guardian\'s Mobile Phone Number'),
153        description = u'',
154        required = False,
155        )
156
157    marit_stat = schema.Choice(
158        title = u'Marital Status',
159        default = 'unmarried',
160        required = False,
161        vocabulary = SimpleKofaVocabulary(
162            (_('Unmarried'), 'unmarried'),
163            (_('Married'), 'married'),)
164        )
165
166    religion = schema.Choice(
167        title = u'Religion',
168        default = 'no_say',
169        required = False,
170        vocabulary = SimpleKofaVocabulary(
171            (_('Muslim'), 'muslim'),
172            (_('Christian'), 'christian'),
173            (_('Others'), 'others'),
174            (_('Prefer not to say'), 'no_say'),)
175        )
176
177    disabled = schema.Bool(
178        title = u'Disabled',
179        default = False,
180        required = False,
181        )
182
183class ICustomStudentPersonalEdit(ICustomStudentPersonal):
184    """Interface for editing personal data by students.
185
186    Here we can repeat the fields from IStudentPersonal and set the
187    `required` if necessary.
188    """
189
190    # Duplicated fields from the ICustomStudentPersonal:
191    # All fields are required!
192
193    email = schema.ASCIILine(
194        title = _(u'Email'),
195        required = True,
196        constraint=validate_email,
197        )
198
199    email2 = schema.ASCIILine(
200        title = _(u'Second Email'),
201        required = True,
202        constraint=validate_email,
203        )
204
205    phone = PhoneNumber(
206        title = _(u'Phone'),
207        required = True,
208        )
209
210    parents_email = schema.ASCIILine(
211        title = _(u"Parents' Email"),
212        required = True,
213        constraint=validate_email,
214        )
215
216    sponsor = schema.Choice(
217        title = _(u'Sponsor'),
218        vocabulary = sponsors_vocab,
219        required = True,
220        )
221
222    # New fields
223
224    perm_address = schema.Text(
225        title = _(u'Home Address'),
226        required = True,
227        )
228
229    postal_address = schema.Text(
230        title = _(u'Postal Address'),
231        required = True,
232        )
233
234    hostel_address = schema.Text(
235        title = _(u'Hostel Address'),
236        required = True,
237        )
238
239    father_address = schema.Text(
240        title = _(u'Father\'s Address'),
241        required = True,
242        )
243
244    mother_address = schema.Text(
245        title = _(u'Mother\'s Address'),
246        required = True,
247        )
248
249    guardian_address = schema.Text(
250        title = _(u'Guardian/Sponsor\'s Address'),
251        required = True,
252        )
253
254    father_phone = PhoneNumber(
255        title = _(u'Father\'s Mobile Phone Number'),
256        description = u'',
257        required = True,
258        )
259
260    mother_phone = PhoneNumber(
261        title = _(u'Mother\'s Mobile Phone Number'),
262        description = u'',
263        required = True,
264        )
265
266    guardian_phone = PhoneNumber(
267        title = _(u'Guardian\'s Mobile Phone Number'),
268        description = u'',
269        required = True,
270        )
271
272    marit_stat = schema.Choice(
273        title = u'Marital Status',
274        default = 'unmarried',
275        required = True,
276        vocabulary = SimpleKofaVocabulary(
277            (_('Unmarried'), 'unmarried'),
278            (_('Married'), 'married'),)
279        )
280
281    religion = schema.Choice(
282        title = u'Religion',
283        default = 'no_say',
284        required = True,
285        vocabulary = SimpleKofaVocabulary(
286            (_('Muslim'), 'muslim'),
287            (_('Christian'), 'christian'),
288            (_('Others'), 'others'),
289            (_('Prefer not to say'), 'no_say'),)
290        )
291
292    disabled = schema.Bool(
293        title = u'Disabled',
294        default = False,
295        required = True,
296        )
297
298class ICustomUGStudentClearance(INigeriaUGStudentClearance):
299    """Representation of ug student clearance data.
300
301    """
302
303class ICustomPGStudentClearance(INigeriaPGStudentClearance):
304    """Representation of pg student clearance data.
305
306    """
307
308
309class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
310    ICustomPGStudentClearance, ICustomStudentPersonal):
311    """Representation of a student.
312
313    """
314
315class ICustomStudentStudyCourse(INigeriaStudentStudyCourse):
316    """A container for student study levels.
317
318    """
319
320class ICustomStudentStudyLevel(INigeriaStudentStudyLevel):
321    """A container for course tickets.
322
323    """
324
325class ICustomStudentOnlinePayment(ICustomOnlinePayment):
326    """A student payment via payment gateways.
327
328    This Interface does not inherit from IStudentOnlinePayment.
329    Thus all fields from IStudentOnlinePayment have to be repeated here.
330    """
331
332    p_current = schema.Bool(
333        title = _(u'Current Session Payment'),
334        default = True,
335        required = False,
336        )
337
338    p_level = schema.Choice(
339        title = _(u'Payment Level'),
340        source = StudyLevelSource(),
341        required = False,
342        )
343
344ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[
345    'p_session'].order
346ICustomStudentOnlinePayment['provider_amt'].order = ICustomStudentOnlinePayment[
347    'net_amt'].order
348
349class ICustomCourseTicket(INigeriaCourseTicket):
350    """A course ticket.
351
352    """
353
354class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
355    """Representation of a student. Skip regular reg_number validation.
356
357    """
358
359class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo):
360    """Representation of a student. Skip regular matric_number validation.
361
362    """
Note: See TracBrowser for help on using the repository browser.