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

Last change on this file since 16408 was 16306, checked in by Henrik Bettermann, 4 years ago

Resolve ticket #70

  • Property svn:keywords set to Id
File size: 6.9 KB
Line 
1## $Id: interfaces.py 16306 2020-11-10 07:20:03Z 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    sponsor = schema.Choice(
52        title = _(u'Sponsor'),
53        vocabulary = sponsors_vocab,
54        required = False,
55        )
56
57ICustomStudentBase['email2'].order = ICustomStudentBase[
58    'phone'].order
59ICustomStudentBase['phone'].order = ICustomStudentBase[
60    'email'].order
61
62class ICustomStudentPersonal(IStudentPersonal):
63    """Student personal/bio data.
64
65    """
66
67    is_foreigner = Attribute('True if student is non-Nigerian')
68
69    # Duplicated fields from the ICustomStudentBase
70
71    email = schema.ASCIILine(
72        title = _(u'Email'),
73        required = False,
74        constraint=validate_email,
75        )
76
77    email2 = schema.ASCIILine(
78        title = _(u'Second Email'),
79        required = False,
80        constraint=validate_email,
81        )
82
83    phone = PhoneNumber(
84        title = _(u'Phone'),
85        required = False,
86        )
87
88    parents_email = schema.ASCIILine(
89        title = _(u"Parents' Email"),
90        required = False,
91        constraint=validate_email,
92        )
93
94    sponsor = schema.Choice(
95        title = _(u'Sponsor'),
96        vocabulary = sponsors_vocab,
97        required = False,
98        readonly = True,
99        )
100
101    # New fields
102
103    perm_address = schema.Text(
104        title = _(u'Home Address'),
105        required = False,
106        )
107
108    postal_address = schema.Text(
109        title = _(u'Postal Address'),
110        required = False,
111        )
112
113    hostel_address = schema.Text(
114        title = _(u'Hostel Address'),
115        required = False,
116        )
117
118    father_address = schema.Text(
119        title = _(u'Father\'s Address'),
120        required = False,
121        )
122
123    mother_address = schema.Text(
124        title = _(u'Mother\'s Address'),
125        required = False,
126        )
127
128    guardian_address = schema.Text(
129        title = _(u'Guardian/Sponsor\'s Address'),
130        required = False,
131        )
132
133    father_phone = PhoneNumber(
134        title = _(u'Father\'s Mobile Phone Number'),
135        description = u'',
136        required = False,
137        readonly = False,
138        )
139
140    mother_phone = PhoneNumber(
141        title = _(u'Mother\'s Mobile Phone Number'),
142        description = u'',
143        required = False,
144        readonly = False,
145        )
146
147    guardian_phone = PhoneNumber(
148        title = _(u'Guardian\'s Mobile Phone Number'),
149        description = u'',
150        required = False,
151        readonly = False,
152        )
153
154    marit_stat = schema.Choice(
155        title = u'Marital Status',
156        default = 'unmarried',
157        required = False,
158        vocabulary = SimpleKofaVocabulary(
159            (_('Unmarried'), 'unmarried'),
160            (_('Married'), 'married'),)
161        )
162
163    religion = schema.Choice(
164        title = u'Religion',
165        default = 'no_say',
166        required = False,
167        vocabulary = SimpleKofaVocabulary(
168            (_('Muslim'), 'muslim'),
169            (_('Christian'), 'christian'),
170            (_('Others'), 'others'),
171            (_('Prefer not to say'), 'no_say'),)
172        )
173
174    disabled = schema.Bool(
175        title = u'Disabled',
176        default = False,
177        required = False,
178        )
179
180class ICustomStudentPersonalEdit(ICustomStudentPersonal):
181    """Interface for editing personal data by students.
182
183    Here we can repeat the fields from IStudentPersonal and set the
184    `required` if necessary.
185    """
186
187class ICustomUGStudentClearance(INigeriaUGStudentClearance):
188    """Representation of ug student clearance data.
189
190    """
191
192class ICustomPGStudentClearance(INigeriaPGStudentClearance):
193    """Representation of pg student clearance data.
194
195    """
196
197
198class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance,
199    ICustomPGStudentClearance, ICustomStudentPersonal):
200    """Representation of a student.
201
202    """
203
204class ICustomStudentStudyCourse(INigeriaStudentStudyCourse):
205    """A container for student study levels.
206
207    """
208
209class ICustomStudentStudyLevel(INigeriaStudentStudyLevel):
210    """A container for course tickets.
211
212    """
213
214class ICustomStudentOnlinePayment(ICustomOnlinePayment):
215    """A student payment via payment gateways.
216
217    This Interface does not inherit from IStudentOnlinePayment.
218    Thus all fields from IStudentOnlinePayment have to be repeated here.
219    """
220
221    p_current = schema.Bool(
222        title = _(u'Current Session Payment'),
223        default = True,
224        required = False,
225        )
226
227    p_level = schema.Choice(
228        title = _(u'Payment Level'),
229        source = StudyLevelSource(),
230        required = False,
231        )
232
233ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[
234    'p_session'].order
235ICustomStudentOnlinePayment['provider_amt'].order = ICustomStudentOnlinePayment[
236    'net_amt'].order
237
238class ICustomCourseTicket(INigeriaCourseTicket):
239    """A course ticket.
240
241    """
242
243class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
244    """Representation of a student. Skip regular reg_number validation.
245
246    """
247
248class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo):
249    """Representation of a student. Skip regular matric_number validation.
250
251    """
Note: See TracBrowser for help on using the repository browser.