source: main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/interfaces.py @ 17011

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

Changes requested by email from Niyi.

  • Property svn:keywords set to Id
File size: 6.4 KB
Line 
1## $Id: interfaces.py 17011 2022-07-08 10:33:54Z henrik $
2##
3## Copyright (C) 2011 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"""Customized interfaces of the university application package.
19"""
20
21from zope import schema
22from zope.interface import Interface, Attribute, implements, directlyProvides
23from waeup.kofa.applicants.interfaces import (
24    IApplicantBaseData,
25    AppCatCertificateSource, CertificateSource)
26from waeup.kofa.schoolgrades import ResultEntryField
27from waeup.kofa.interfaces import (
28    SimpleKofaVocabulary, academic_sessions_vocab, validate_email,
29    IKofaObject)
30from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
31from waeup.kofa.students.vocabularies import (
32  nats_vocab, GenderSource,RegNumberSource)
33from waeup.kofa.applicants.interfaces import contextual_reg_num_source
34from kofacustom.lpng.interfaces import MessageFactory as _
35from kofacustom.lpng.payments.interfaces import ICustomOnlinePayment
36from kofacustom.nigeria.interfaces import LGASource
37from kofacustom.nigeria.applicants.interfaces import (
38    INigeriaApplicantOnlinePayment,)
39
40class IApplicantBaseData(IKofaObject):
41    """This is a base interface of an applicant with no field
42    required. For use with processors, forms, etc., please use one of
43    the derived interfaces below, which set more fields to required
44    state, depending on use-case.
45    """
46    state = Attribute('Application state of an applicant')
47    history = Attribute('Object history, a list of messages')
48    display_fullname = Attribute('The fullname of an applicant')
49    application_number = Attribute('The key under which the record is stored')
50    container_code = Attribute('Code of the parent container plus additional information if record is used or not')
51    translated_state = Attribute('Real name of the application state')
52    special = Attribute('True if special application')
53    payments = Attribute('List of payment objects stored in the applicant container')
54
55    application_date = Attribute('UTC datetime of submission, used for export only')
56    password = Attribute('Encrypted password of an applicant')
57
58
59    suspended = schema.Bool(
60        title = _(u'Account suspended'),
61        default = False,
62        required = False,
63        )
64
65    applicant_id = schema.TextLine(
66        title = _(u'Registrant Id'),
67        required = False,
68        readonly = False,
69        )
70       
71    vin = schema.TextLine(
72        title = _(u'Voter Identification No (VIN)'),
73        required = True,
74        )
75
76    reg_number = TextLineChoice(
77        title = _(u'Registration Number'),
78        readonly = False,
79        required = False,
80        source = contextual_reg_num_source,
81        )
82
83    firstname = schema.TextLine(
84        title = _(u'First Name'),
85        required = True,
86        )
87
88    middlename = schema.TextLine(
89        title = _(u'Middle Name'),
90        required = False,
91        )
92
93    lastname = schema.TextLine(
94        title = _(u'Last Name (Surname)'),
95        required = True,
96        )
97
98    date_of_birth = FormattedDate(
99        title = _(u'Date of Birth'),
100        required = True,
101        show_year = True,
102        )
103
104    sex = schema.Choice(
105        title = _(u'Gender'),
106        source = GenderSource(),
107        required = True,
108        )
109
110    profession = schema.ASCIILine(
111        title = _(u'Profession'),
112        required = False,
113        )
114       
115    occupation = schema.ASCIILine(
116        title = _(u'Occupation'),
117        required = False,
118        )
119
120    nationality = schema.Choice(
121        source = nats_vocab,
122        title = _(u'Nationality'),
123        required = False,
124        )
125       
126    state_of_residence = schema.Choice(
127        source = nats_vocab,
128        title = _(u'State of Residence'),
129        required = False,
130        )
131
132    perm_address = schema.Text(
133        title = _(u'Residential Address'),
134        required = False,
135        )
136               
137    lga = schema.Choice(
138        source = LGASource(),
139        title = _(u'Local Government (Nigerians only)'),
140        required = False,
141        )
142       
143    ward = schema.ASCIILine(
144        title = _(u'Ward'),
145        required = False,
146        )
147
148    phone = PhoneNumber(
149        title = _(u'Phone'),
150        description = u'',
151        required = False,
152        )
153
154    email = schema.ASCIILine(
155        title = _(u'Email Address'),
156        required = True,
157        constraint=validate_email,
158        )
159
160    notice = schema.Text(
161        title = _(u'Notice'),
162        required = False,
163        )
164
165    student_id = schema.TextLine(
166        title = _(u'Student Id'),
167        required = False,
168        readonly = False,
169        )
170
171    locked = schema.Bool(
172        title = _(u'Form locked'),
173        default = False,
174        required = False,
175        )
176
177
178class ICustomApplicant(IApplicantBaseData):
179    """An interface for both types of applicants.
180
181    Attention: The ICustomPGApplicant field seetings will be overwritten
182    by ICustomPGApplicant field settings. If a field is defined
183    in both interfaces zope.schema validates only against the
184    constraints in ICustomUGApplicant. This does not affect the forms
185    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
186    """
187
188    def writeLogMessage(view, comment):
189        """Adds an INFO message to the log file
190        """
191
192    def createStudent():
193        """Create a student object from applicant data
194        and copy applicant object.
195        """
196
197class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
198    """An applicant payment via payment gateways.
199
200    """
201
202class ICustomApplicantUpdateByRegNo(ICustomApplicant):
203    """Representation of an applicant.
204
205    Skip regular reg_number validation if reg_number is used for finding
206    the applicant object.
207    """
208
209    reg_number = schema.TextLine(
210        title = u'Registration Number',
211        required = False,
212        )
Note: See TracBrowser for help on using the repository browser.