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

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

Make date_of_birth optional. Otherwise we can't copy application data.

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