source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py @ 13171

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

Remove clearance_locked.

  • Property svn:keywords set to Id
File size: 13.9 KB
RevLine 
[8862]1## $Id: interfaces.py 13109 2015-06-28 05:05:46Z 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##
18from zope import schema
[12503]19from zope.interface import Attribute, invariant, Invalid
[8862]20from waeup.kofa.schema import TextLineChoice
21from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab
[9567]22from waeup.kofa.schema import FormattedDate, PhoneNumber
[8862]23from waeup.kofa.schoolgrades import ResultEntryField
24from waeup.kofa.students.vocabularies import nats_vocab
25from waeup.kofa.students.interfaces import (
26    IStudentBase, IUGStudentClearance, IPGStudentClearance,
27    IStudentPersonal, IStudentNavigation, IStudentStudyLevel,
28    IStudentStudyCourse, ICourseTicket
29    )
30from waeup.kofa.students.vocabularies import (
31    nats_vocab, contextual_reg_num_source)
32from kofacustom.nigeria.interfaces import (
33    high_qual, high_grade, exam_types, LGASource)
34from kofacustom.nigeria.interfaces import MessageFactory as _
[8863]35from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
[8862]36
37
[8863]38class INigeriaStudentBase(IStudentBase):
[8862]39    """Representation of student base data.
40
41    """
42
43    reg_number = TextLineChoice(
44        title = _(u'Registration Number'),
45        required = False,
46        readonly = False,
47        source = contextual_reg_num_source,
48        )
49
[8966]50    is_staff = schema.Bool(
51        title = _(u'Staff Member'),
52        required = False,
53        readonly = False,
54        default = False,
55        )
56
[8949]57INigeriaStudentBase['reg_number'].order = IStudentBase[
58    'reg_number'].order
59
[8862]60
[8863]61class INigeriaUGStudentClearance(IUGStudentClearance):
[8862]62    """Representation of ug student clearance data.
63
64    """
[9535]65    officer_comment = schema.Text(
66        title = _(u"Officer's Comment"),
67        required = False,
68        )
69
[12392]70    physical_clearance_date = schema.TextLine(
[12120]71        title = _(u"Physical Clearance Date"),
[12107]72        required = False,
73        )
74
[9535]75    clr_code = schema.TextLine(
76        title = _(u'CLR Activation Code'),
77        required = False,
78        readonly = False,
79        )
80
[8862]81    date_of_birth = FormattedDate(
82        title = _(u'Date of Birth'),
83        required = False,
84        show_year = True,
85        )
86
87    nationality = schema.Choice(
88        source = nats_vocab,
89        title = _(u'Nationality'),
[9036]90        required = True,
[8862]91        )
92
93    lga = schema.Choice(
94        source = LGASource(),
[10690]95        title = _(u'State / LGA'),
[8862]96        required = False,
97        )
98
99    def_adm = schema.Bool(
100        title = _(u'Deferent of Admission'),
101        required = False,
102        readonly = False,
[12416]103        default = False,
[8862]104        )
105
106    fst_sit_fname = schema.TextLine(
107        title = _(u'Full Name'),
108        required = False,
109        readonly = False,
110        )
111    fst_sit_no = schema.TextLine(
112        title = _(u'Exam Number'),
113        required = False,
114        readonly = False,
115        )
116
117    fst_sit_date = FormattedDate(
118        title = _(u'Exam Date'),
119        required = False,
120        readonly = False,
121        show_year = True,
122        )
123
124    fst_sit_type = schema.Choice(
125        title = _(u'Exam Type'),
126        required = False,
127        readonly = False,
128        vocabulary = exam_types,
129        )
130
131    fst_sit_results = schema.List(
132        title = _(u'Exam Results'),
133        value_type = ResultEntryField(),
134        required = False,
135        readonly = False,
136        default = [],
137        )
138
139    scd_sit_fname = schema.TextLine(
140        title = _(u'Full Name'),
141        required = False,
142        readonly = False,
143        )
144    scd_sit_no = schema.TextLine(
145        title = _(u'Exam Number'),
146        required = False,
147        readonly = False,
148        )
149
150    scd_sit_date = FormattedDate(
151        title = _(u'Exam Date'),
152        required = False,
153        readonly = False,
154        show_year = True,
155        )
156
157    scd_sit_type = schema.Choice(
158        title = _(u'Exam Type'),
159        required = False,
160        readonly = False,
161        vocabulary = exam_types,
162        )
163
164    scd_sit_results = schema.List(
165        title = _(u'Exam Results'),
166        value_type = ResultEntryField(),
167        required = False,
168        readonly = False,
169        default = [],
170        )
171
172    alr_fname = schema.TextLine(
173        title = _(u'Full Name'),
174        required = False,
175        readonly = False,
176        )
177    alr_no = schema.TextLine(
178        title = _(u'Exam Number'),
179        required = False,
180        readonly = False,
181        )
182
183    alr_date = FormattedDate(
184        title = _(u'Exam Date'),
185        required = False,
186        readonly = False,
187        show_year = True,
188        )
189
190    alr_results = schema.List(
191        title = _(u'Exam Results'),
192        value_type = ResultEntryField(),
193        required = False,
194        readonly = False,
195        default = [],
196        )
197
198    hq_type = schema.Choice(
199        title = _(u'Qualification Obtained'),
200        required = False,
201        readonly = False,
202        vocabulary = high_qual,
203        )
204
[9552]205    hq_fname = schema.TextLine(
206        title = _(u'Full Name'),
207        required = False,
208        readonly = False,
209        )
210
[8862]211    hq_matric_no = schema.TextLine(
212        title = _(u'Former Matric Number'),
213        required = False,
214        readonly = False,
215        )
216
217    hq_degree = schema.Choice(
218        title = _(u'Class of Degree'),
219        required = False,
220        readonly = False,
221        vocabulary = high_grade,
222        )
223
224    hq_school = schema.TextLine(
225        title = _(u'Institution Attended'),
226        required = False,
227        readonly = False,
228        )
229
230    hq_session = schema.TextLine(
231        title = _(u'Years Attended'),
232        required = False,
233        readonly = False,
234        )
235
236    hq_disc = schema.TextLine(
237        title = _(u'Discipline'),
238        required = False,
239        readonly = False,
240        )
241
[12503]242    @invariant
243    def check_lga_nationality(student):
244        if student.nationality != 'NG' and student.lga not in ('foreigner', None):
245            raise Invalid(_('Nationalty and LGA are contradictory.'))
246        if student.nationality == 'NG' and student.lga == 'foreigner':
247            raise Invalid(_('Nationalty and LGA are contradictory.'))
[8862]248
[12503]249
[8863]250class INigeriaPGStudentClearance(INigeriaUGStudentClearance):
[8862]251    """Representation of pg student clearance data.
252
253    """
254
255    hq2_type = schema.Choice(
256        title = _(u'Qualification Obtained'),
257        required = False,
258        readonly = False,
259        vocabulary = high_qual,
260        )
261
262    hq2_matric_no = schema.TextLine(
263        title = _(u'Former Matric Number'),
264        required = False,
265        readonly = False,
266        )
267
268    hq2_degree = schema.Choice(
269        title = _(u'Class of Degree'),
270        required = False,
271        readonly = False,
272        vocabulary = high_grade,
273        )
274
275    hq2_school = schema.TextLine(
276        title = _(u'Institution Attended'),
277        required = False,
278        readonly = False,
279        )
280
281    hq2_session = schema.TextLine(
282        title = _(u'Years Attended'),
283        required = False,
284        readonly = False,
285        )
286
287    hq2_disc = schema.TextLine(
288        title = _(u'Discipline'),
289        required = False,
290        readonly = False,
291        )
292
293    nysc_year = schema.Int(
294        title = _(u'Nysc Year'),
295        required = False,
296        readonly = False,
297        )
298
[8946]299    nysc_location = schema.TextLine(
300        title = _(u'Nysc Location'),
301        required = False,
302        )
303
[8862]304    nysc_lga = schema.Choice(
305        source = LGASource(),
[8946]306        title = _(u'Nysc LGA'),
[8862]307        required = False,
308        )
309
310    employer = schema.TextLine(
311        title = _(u'Employer'),
312        required = False,
313        readonly = False,
314        )
315
316    emp_position = schema.TextLine(
317        title = _(u'Employer Position'),
318        required = False,
319        readonly = False,
320        )
321
322    emp_start = FormattedDate(
323        title = _(u'Start Date'),
324        required = False,
325        readonly = False,
326        show_year = True,
327        )
328
329    emp_end = FormattedDate(
330        title = _(u'End Date'),
331        required = False,
332        readonly = False,
333        show_year = True,
334        )
335
336    emp_reason = schema.TextLine(
337        title = _(u'Reason for Leaving'),
338        required = False,
339        readonly = False,
340        )
341
342    employer2 = schema.TextLine(
343        title = _(u'2nd Employer'),
344        required = False,
345        readonly = False,
346        )
347
348    emp2_position = schema.TextLine(
349        title = _(u'2nd Employer Position'),
350        required = False,
351        readonly = False,
352        )
353
354    emp2_start = FormattedDate(
355        title = _(u'Start Date'),
356        required = False,
357        readonly = False,
358        show_year = True,
359        )
360    emp2_end = FormattedDate(
361        title = _(u'End Date'),
362        required = False,
363        readonly = False,
364        show_year = True,
365        )
366
367    emp2_reason = schema.TextLine(
368        title = _(u'Reason for Leaving'),
369        required = False,
370        readonly = False,
371        )
372
373    former_matric = schema.TextLine(
374        title = _(u'If yes, matric number'),
375        required = False,
376        readonly = False,
377        )
378
[9564]379class INigeriaStudentPersonal(IStudentPersonal):
380    """Student personal data.
[8862]381
[9564]382    """
383
384    is_foreigner = Attribute('True if student is non-Nigerian')
385
386    next_kin_name = schema.TextLine(
387        title = _(u'Next of Kin Name'),
388        required = False,
389        readonly = False,
390        )
391
392    next_kin_relation = schema.TextLine(
393        title = _(u'Next of Kin Relationship'),
394        required = False,
395        readonly = False,
396        )
397
398    next_kin_address = schema.Text(
399        title = _(u'Next of Kin Address'),
400        required = False,
401        readonly = False,
402        )
403
[9567]404    next_kin_phone = PhoneNumber(
405        title = _(u'Next of Kin Phone'),
406        description = u'',
407        required = False,
408        readonly = False,
409        )
410
[9564]411    marit_stat = schema.Choice(
[12972]412        title = u'Marital Status',
[9564]413        default = 'unmarried',
414        required = False,
415        vocabulary = SimpleKofaVocabulary(
416            (_('Unmarried'), 'unmarried'),
417            (_('Married'), 'married'),)
418        )
419
420    religion = schema.Choice(
421        title = u'Religion',
422        default = 'no_say',
423        required = False,
424        vocabulary = SimpleKofaVocabulary(
425            (_('Muslim'), 'muslim'),
426            (_('Christian'), 'christian'),
427            (_('Others'), 'others'),
428            (_('Prefer not to say'), 'no_say'),)
429        )
430
431    disabled = schema.Bool(
432        title = u'Disabled',
433        default = False,
434        required = False,
435        )
436
437
[8863]438class INigeriaStudent(INigeriaStudentBase,INigeriaUGStudentClearance,
439    INigeriaPGStudentClearance,INigeriaStudentPersonal):
[8862]440    """Representation of a student.
441
442    """
443
[9564]444class INigeriaStudentPersonalEdit(INigeriaStudentPersonal):
445    """Interface for editing personal data by students.
446
447    Here we can repeat the fields from IStudentPersonal and set the
448    `required` if necessary.
449    """
450
451    perm_address = schema.Text(
452        title = _(u'Permanent Address'),
453        required = True,
454        )
455
456    next_kin_name = schema.TextLine(
457        title = _(u'Next of Kin Name'),
458        required = True,
459        readonly = False,
460        )
461
462    next_kin_relation = schema.TextLine(
463        title = _(u'Next of Kin Relationship'),
464        required = True,
465        readonly = False,
466        )
467
468    next_kin_address = schema.Text(
469        title = _(u'Next of Kin Address'),
470        required = True,
471        readonly = False,
472        )
473
[9567]474    next_kin_phone = PhoneNumber(
475        title = _(u'Next of Kin Phone'),
476        description = u'',
477        required = True,
478        readonly = False,
479        )
480
481INigeriaStudentPersonalEdit['perm_address'].order = INigeriaStudentPersonal[
482    'perm_address'].order
[9564]483INigeriaStudentPersonalEdit['next_kin_name'].order = INigeriaStudentPersonal[
484    'next_kin_name'].order
485INigeriaStudentPersonalEdit['next_kin_relation'].order = INigeriaStudentPersonal[
486    'next_kin_relation'].order
487INigeriaStudentPersonalEdit['next_kin_address'].order = INigeriaStudentPersonal[
488    'next_kin_address'].order
[9567]489INigeriaStudentPersonalEdit['next_kin_phone'].order = INigeriaStudentPersonal[
490    'next_kin_phone'].order
[9564]491
[8863]492class INigeriaStudentStudyCourse(IStudentStudyCourse):
[8862]493    """A container for student study levels.
494
495    """
496
[8863]497class INigeriaStudentStudyLevel(IStudentStudyLevel):
[8862]498    """A container for course tickets.
499
500    """
501
[8863]502class INigeriaStudentOnlinePayment(INigeriaOnlinePayment):
[8862]503    """A student payment via payment gateways.
504
505    This Interface does not inherit from IStudentOnlinePayment.
506    Thus all fields from IStudentOnlinePayment have to be repeated here.
507    """
508
[9471]509    p_current = schema.Bool(
510        title = _(u'Current Session Payment'),
511        default = True,
512        required = False,
513        )
514
[8862]515    p_level = schema.Int(
516        title = _(u'Payment Level'),
517        required = False,
518        )
519
[8863]520INigeriaStudentOnlinePayment['p_level'].order = INigeriaStudentOnlinePayment[
[8862]521    'p_session'].order
522
[8863]523class INigeriaCourseTicket(ICourseTicket):
[8862]524    """A course ticket.
525
526    """
527
[8863]528class INigeriaStudentUpdateByRegNo(INigeriaStudent):
[8862]529    """Representation of a student. Skip regular reg_number validation.
530
531    """
532    reg_number = schema.TextLine(
533        title = _(u'Registration Number'),
534        required = False,
535        )
536
[8863]537class INigeriaStudentUpdateByMatricNo(INigeriaStudent):
[8862]538    """Representation of a student. Skip regular matric_number validation.
539
540    """
541    matric_number = schema.TextLine(
542        title = _(u'Matriculation Number'),
543        required = False,
544        )
Note: See TracBrowser for help on using the repository browser.