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

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

Remove email2 field.

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