source: main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py @ 14613

Last change on this file since 14613 was 14594, checked in by Henrik Bettermann, 8 years ago

Hide firstname, middlename or surname if the character length is less than two.

  • Property svn:keywords set to Id
File size: 9.5 KB
Line 
1## $Id: utils.py 14594 2017-02-27 06:50: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##
18"""Customize general helper utilities for Kofa.
19"""
20
21import string
22from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
23
24class CustomKofaUtils(NigeriaKofaUtils):
25    """A collection of methods subject to customization.
26    """
27
28    PREFERRED_LANGUAGES_DICT = {
29        }
30
31    PAYMENT_CATEGORIES = {
32        'schoolfee': 'School Fee',
33        'schoolfee_1': 'School Fee Plus (1st instalment)',
34        'schoolfee_2': 'School Fee (2nd instalment)',
35        'schoolfee_incl': 'School Fee Plus',
36        'clearance': 'Acceptance Fee',
37        'clearance_incl': 'Acceptance Fee Plus',
38        'hostel_maintenance': 'Hostel Accommodation Fee',
39        'application': 'Application Fee',
40        'bed_allocation': 'Bed Allocation Fee',
41        'transfer': 'Transfer Fee',
42        'transcript_local': 'Local Transcript Fee',
43        'transcript_inter': 'International Transcript Fee',
44        'late_registration': 'Late Course Registration Fee',
45        'welfare': 'Student Welfare Assurance Fee',
46        'union': 'Student Union Dues',
47        'lapel': 'Lapel/File Fee',
48        'matric_gown': 'Matriculation Gown Fee',
49        'concessional': 'Concessional Fee',
50        'id_card': 'Student ID Card',
51        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
52        'gst_text_book_1': 'Text Book Fee GST101 GST102',
53        'gst_text_book_2': 'Text Book Fee GST111 GST112',
54        'gst_text_book_3': 'Text Book Fee GST222',
55        'ent_text_book_4': 'Text Book Fee ENT201',
56        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
57        'gst_registration_2': 'Registration Fee GST222',
58        'ent_registration_3': 'Registration Fee ENT201',
59        'fac_dep': 'Faculty and Departmental Dues',
60        'restitution': 'Restitution Fee',
61        }
62
63    SELECTABLE_PAYMENT_CATEGORIES = {
64        'schoolfee': 'School Fee without additional fees',
65        'schoolfee_1': 'School Fee (1st instalment) + Student Union Dues + Welfare Assurance Fee',
66        'schoolfee_2': 'School Fee (2nd instalment)',
67        'schoolfee_incl': 'School Fee + Student Union Dues + Welfare Assurance Fee',
68        'clearance': 'Acceptance Fee without additional fees',
69        'clearance_incl': 'Acceptance Fee + Matric Gown Fee + Lapel/File Fee',
70        'hostel_maintenance': 'Hostel Accommodation Fee',
71        #'application': 'Application Fee',
72        #'bed_allocation': 'Bed Allocation Fee',
73        #'transfer': 'Transfer Fee',
74        'transcript_local': 'Local Transcript Fee',
75        'transcript_inter': 'International Transcript Fee',
76        'late_registration': 'Late Course Registration Fee',
77        #'welfare': 'Student Welfare Assurance Fee',
78        #'union': 'Student Union Dues',
79        #'lapel': 'Lapel/File Fee',
80        #'matric_gown': 'Matriculation Gown Fee',
81        'concessional': 'Concessional Fee',
82        #'id_card': 'Student ID Card',
83        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
84        'gst_text_book_1': 'Text Book Fee GST101 GST102',
85        'gst_text_book_2': 'Text Book Fee GST111 GST112',
86        'gst_text_book_3': 'Text Book Fee GST222',
87        'ent_text_book_4': 'Text Book Fee ENT201',
88        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
89        'gst_registration_2': 'Registration Fee GST222',
90        'ent_registration_3': 'Registration Fee ENT201',
91        #'fac_dep': 'Faculty and Departmental Dues',
92        'restitution': 'Restitution Fee',
93        }
94
95    REPORTABLE_PAYMENT_CATEGORIES = {
96        'schoolfee': 'School Fee',
97        'schoolfee_incl': 'School Fee Plus',
98        'schoolfee_1': 'School Fee 1 Plus',
99        'schoolfee_2': 'School Fee 2',
100        'clearance': 'Acceptance Fee',
101        'clearance_incl': 'Acceptance Fee Plus',
102        'hostel_maintenance': 'Hostel Maintenance Fee',
103        }
104
105    BALANCE_PAYMENT_CATEGORIES = {
106        'schoolfee': 'School Fee',
107        'clearance': 'Acceptance Fee',
108        'hostel_maintenance': 'Hostel Maintenance Fee',
109        'late_registration': 'Late Course Registration Fee',
110        'welfare': 'Student Welfare Assurance Fee',
111        'union': 'Student Union Dues',
112        'lapel': 'Lapel/File Fee',
113        'matric_gown': 'Matriculation Gown Fee',
114        'id_card': 'Student ID Card',
115        'gst_text_book_1': 'Text Book Fee GST101 GST102',
116        'gst_text_book_2': 'Text Book Fee GST111 GST112',
117        'gst_text_book_3': 'Text Book Fee GST222',
118        'ent_text_book_4': 'Text Book Fee ENT201',
119        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
120        'gst_registration_2': 'Registration Fee GST222',
121        'ent_registration_3': 'Registration Fee ENT201',
122        'fac_dep': 'Faculty and Departmental Dues',
123        'restitution': 'Restitution Fee',
124        }
125
126    PREVIOUS_PAYMENT_CATEGORIES = {
127        'schoolfee': 'School Fee',
128        'clearance': 'Acceptance Fee',
129        }
130
131    APP_CATS_DICT = {
132        'basic': 'PUTME, PUDE, PCE, PRENCE',
133        'no': 'No Application',
134        'pg_ft': 'Postgraduate Full-Time',
135        'pg_pt': 'Postgraduate Part-Time',
136        'cest': 'Part-Time, Diploma, Certificate',
137        'found': 'Foundation',
138        'ptee': 'Part-Time Entrance Examination',
139        'ioe_dp': 'Institute of Education Diploma',
140        'ijmbe': 'IJMBE Preparation',
141        }
142
143    STUDY_MODES_DICT = {
144        'ug_ft': 'Undergraduate Full Time',
145        'ug_pt': 'Undergraduate Part Time',
146        'de_ft': 'Direct Entry Full Time',
147        'de_pt': 'Direct Entry Part Time',
148        'dp_pt': 'Diploma Part Time',
149        'dp_ft': 'Diploma Full Time',
150        'special_pg_ft': 'Postgraduate Full Time',
151        'special_pg_pt': 'Postgraduate Part Time',
152        'found': 'Foundation',
153        'transfer': 'Transfer',
154        'mug_ft': 'Undergraduate Full Time Merit List',
155        'mde_ft': 'Direct Entry Full Time Merit List',
156        'ijmbe': 'IJMBE Preparation',
157        }
158
159    VERDICTS_DICT = {
160        '0': 'not yet',
161        'A': 'Successful student',
162        'B': 'Student with carryover courses',
163        'C': 'Student on probation',
164        'D': 'Withdrawn from the faculty',
165        #'E': 'Student who were previously on probation',
166        #'F': 'Medical case',
167        #'G': 'Absent from examination',
168        #'H': 'Withheld results',
169        #'I': 'Expelled/rusticated/suspended student',
170        #'J': 'Temporary withdrawn from the university',
171        #'K': 'Unregistered student',
172        #'L': 'Referred student',
173        #'M': 'Reinstatement',
174        #'N': 'Student on transfer',
175        #'O': 'NCE-III repeater',
176        #'Y': 'No previous verdict',
177        #'X': 'New 300 level student',
178        'Z': 'Successful student (provisional)',
179        #'A1': 'First Class',
180        #'A2': 'Second Class Upper',
181        #'A3': 'Second Class Lower',
182        #'A4': 'Third Class',
183        #'A5': 'Pass',
184        #'A6': 'Distinction',
185        #'A7': 'Credit',
186        #'A8': 'Merit',
187        'NER': 'No evidence of registration',
188        'NYV': 'Not yet verified',
189        'FRNS': 'Faculty requirements not satisfied',
190        }
191
192    DISABLE_PAYMENT_GROUP_DICT = {
193        'sf_all': 'School Fee - All Students',
194        'sf_pg': 'School Fee - Postgraduate Students',
195        'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students',
196        'sf_found': 'School Fee - Foundation Students',
197        'maint_all': 'Accommodation Fee - All Students',
198        'cl_regular': 'Acceptance Fee - Regular Students',
199        }
200
201    MODE_GROUPS = {
202        'All': ('all',),
203        'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'),
204        'Undergraduate Part-Time': ('ug_pt', 'de_pt'),
205        'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'),
206        'Foundation Programme': ('found',),
207        'Institute of Education': ('dp_ft'),
208        }
209
210    def fullname(self, firstname, lastname, middlename=None):
211        """Construct fullname.
212        """
213        try:
214            lastname = lastname.upper()
215        except AttributeError:
216            pass
217        # We remove single initial
218        if firstname and len(firstname) == 1:
219            firstname = ''
220        if middlename and len(middlename) == 1:
221            middlename = ''
222        if lastname and len(lastname) == 1:
223            lastname = ''
224        # We construct givennames
225        givennames = ''
226        if middlename and firstname:
227            givennames = '%s %s' % (firstname, middlename)
228        elif firstname:
229            givennames = firstname
230        elif middlename:
231            givennames = middlename
232        givennames = string.capwords(
233            givennames.replace('-', ' - ')).replace(' - ', '-')
234        # We construct fullname
235        fullname = ''
236        if lastname and givennames:
237            fullname = '%s, %s' % (lastname, givennames)
238        elif lastname:
239            fullname = lastname
240        elif givennames:
241            fullname = givennames
242        if '<' in fullname:
243            return 'XXX'
244        return fullname
Note: See TracBrowser for help on using the repository browser.