1 | ## $Id: utils.py 14296 2016-11-28 12:10:49Z 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 | |
---|
21 | import string |
---|
22 | from kofacustom.nigeria.utils.utils import NigeriaKofaUtils |
---|
23 | |
---|
24 | class 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_1': 'Text Book Fee GST101 GST102', |
---|
52 | 'gst_text_book_2': 'Text Book Fee GST111 GST112', |
---|
53 | 'gst_text_book_3': 'Text Book Fee GST222', |
---|
54 | 'ent_text_book_4': 'Text Book Fee ENT201', |
---|
55 | 'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112', |
---|
56 | 'gst_registration_2': 'Registration Fee GST222', |
---|
57 | 'ent_registration_3': 'Registration Fee ENT201', |
---|
58 | 'fac_dep': 'Faculty and Departmental Dues', |
---|
59 | } |
---|
60 | |
---|
61 | SELECTABLE_PAYMENT_CATEGORIES = { |
---|
62 | 'schoolfee': 'School Fee without additional fees', |
---|
63 | 'schoolfee_1': 'School Fee (1st instalment) + Student Union Dues + Welfare Assurance Fee', |
---|
64 | 'schoolfee_2': 'School Fee (2nd instalment)', |
---|
65 | 'schoolfee_incl': 'School Fee + Student Union Dues + Welfare Assurance Fee', |
---|
66 | 'clearance': 'Acceptance Fee without additional fees', |
---|
67 | 'clearance_incl': 'Acceptance Fee + Matric Gown Fee + Lapel/File Fee', |
---|
68 | 'hostel_maintenance': 'Hostel Accommodation Fee', |
---|
69 | #'application': 'Application Fee', |
---|
70 | #'bed_allocation': 'Bed Allocation Fee', |
---|
71 | #'transfer': 'Transfer Fee', |
---|
72 | 'transcript_local': 'Local Transcript Fee', |
---|
73 | 'transcript_inter': 'International Transcript Fee', |
---|
74 | 'late_registration': 'Late Course Registration Fee', |
---|
75 | #'welfare': 'Student Welfare Assurance Fee', |
---|
76 | #'union': 'Student Union Dues', |
---|
77 | #'lapel': 'Lapel/File Fee', |
---|
78 | #'matric_gown': 'Matriculation Gown Fee', |
---|
79 | 'concessional': 'Concessional Fee', |
---|
80 | #'id_card': 'Student ID Card', |
---|
81 | 'gst_text_book_1': 'Text Book Fee GST101 GST102', |
---|
82 | 'gst_text_book_2': 'Text Book Fee GST111 GST112', |
---|
83 | 'gst_text_book_3': 'Text Book Fee GST222', |
---|
84 | 'ent_text_book_4': 'Text Book Fee ENT201', |
---|
85 | 'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112', |
---|
86 | 'gst_registration_2': 'Registration Fee GST222', |
---|
87 | 'ent_registration_3': 'Registration Fee ENT201', |
---|
88 | 'fac_dep': 'Faculty and Departmental Dues', |
---|
89 | } |
---|
90 | |
---|
91 | REPORTABLE_PAYMENT_CATEGORIES = { |
---|
92 | 'schoolfee': 'School Fee', |
---|
93 | 'schoolfee_incl': 'School Fee Plus', |
---|
94 | 'schoolfee_1': 'School Fee 1 Plus', |
---|
95 | 'schoolfee_2': 'School Fee 2', |
---|
96 | 'clearance': 'Acceptance Fee', |
---|
97 | 'clearance_incl': 'Acceptance Fee Plus', |
---|
98 | 'hostel_maintenance': 'Hostel Maintenance Fee', |
---|
99 | } |
---|
100 | |
---|
101 | BALANCE_PAYMENT_CATEGORIES = { |
---|
102 | 'schoolfee': 'School Fee', |
---|
103 | 'clearance': 'Acceptance Fee', |
---|
104 | 'hostel_maintenance': 'Hostel Maintenance Fee', |
---|
105 | 'late_registration': 'Late Course Registration Fee', |
---|
106 | 'welfare': 'Student Welfare Assurance Fee', |
---|
107 | 'union': 'Student Union Dues', |
---|
108 | 'lapel': 'Lapel/File Fee', |
---|
109 | 'matric_gown': 'Matriculation Gown Fee', |
---|
110 | 'id_card': 'Student ID Card', |
---|
111 | 'gst_text_book_1': 'Text Book Fee GST101 GST102', |
---|
112 | 'gst_text_book_2': 'Text Book Fee GST111 GST112', |
---|
113 | 'gst_text_book_3': 'Text Book Fee GST222', |
---|
114 | 'ent_text_book_4': 'Text Book Fee ENT201', |
---|
115 | 'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112', |
---|
116 | 'gst_registration_2': 'Registration Fee GST222', |
---|
117 | 'ent_registration_3': 'Registration Fee ENT201', |
---|
118 | 'fac_dep': 'Faculty and Departmental Dues', |
---|
119 | } |
---|
120 | |
---|
121 | APP_CATS_DICT = { |
---|
122 | 'basic': 'PUTME, PUDE, PCE, PRENCE', |
---|
123 | 'no': 'No Application', |
---|
124 | 'pg_ft': 'Postgraduate Full-Time', |
---|
125 | 'pg_pt': 'Postgraduate Part-Time', |
---|
126 | 'cest': 'Part-Time, Diploma, Certificate', |
---|
127 | 'found': 'Foundation', |
---|
128 | 'ptee': 'Part-Time Entrance Examination', |
---|
129 | 'ioe_dp': 'Institute of Education Diploma', |
---|
130 | } |
---|
131 | |
---|
132 | STUDY_MODES_DICT = { |
---|
133 | 'ug_ft': 'Undergraduate Full Time', |
---|
134 | 'ug_pt': 'Undergraduate Part Time', |
---|
135 | 'de_ft': 'Direct Entry Full Time', |
---|
136 | 'de_pt': 'Direct Entry Part Time', |
---|
137 | 'dp_pt': 'Diploma Part Time', |
---|
138 | 'dp_ft': 'Diploma Full Time', |
---|
139 | 'special_pg_ft': 'Postgraduate Full Time', |
---|
140 | 'special_pg_pt': 'Postgraduate Part Time', |
---|
141 | 'found': 'Foundation', |
---|
142 | 'transfer': 'Transfer', |
---|
143 | 'mug_ft': 'Undergraduate Full Time Merit List', |
---|
144 | 'mde_ft': 'Direct Entry Full Time Merit List', |
---|
145 | } |
---|
146 | |
---|
147 | VERDICTS_DICT = { |
---|
148 | '0': 'not yet', |
---|
149 | 'A': 'Successful student', |
---|
150 | 'B': 'Student with carryover courses', |
---|
151 | 'C': 'Student on probation', |
---|
152 | #'D': 'Withdrawn from the faculty', |
---|
153 | #'E': 'Student who were previously on probation', |
---|
154 | #'F': 'Medical case', |
---|
155 | #'G': 'Absent from examination', |
---|
156 | #'H': 'Withheld results', |
---|
157 | #'I': 'Expelled/rusticated/suspended student', |
---|
158 | #'J': 'Temporary withdrawn from the university', |
---|
159 | #'K': 'Unregistered student', |
---|
160 | #'L': 'Referred student', |
---|
161 | #'M': 'Reinstatement', |
---|
162 | #'N': 'Student on transfer', |
---|
163 | #'O': 'NCE-III repeater', |
---|
164 | #'Y': 'No previous verdict', |
---|
165 | #'X': 'New 300 level student', |
---|
166 | 'Z': 'Successful student (provisional)', |
---|
167 | #'A1': 'First Class', |
---|
168 | #'A2': 'Second Class Upper', |
---|
169 | #'A3': 'Second Class Lower', |
---|
170 | #'A4': 'Third Class', |
---|
171 | #'A5': 'Pass', |
---|
172 | #'A6': 'Distinction', |
---|
173 | #'A7': 'Credit', |
---|
174 | #'A8': 'Merit', |
---|
175 | 'NEOR': 'No evidence of registration', |
---|
176 | 'NEOV': 'No evidence of verification', |
---|
177 | 'FRNS': 'Faculty requirements not satisfied', |
---|
178 | } |
---|
179 | |
---|
180 | DISABLE_PAYMENT_GROUP_DICT = { |
---|
181 | 'sf_all': 'School Fee - All Students', |
---|
182 | 'sf_pg': 'School Fee - Postgraduate Students', |
---|
183 | 'sf_pt': 'School Fee - Part-Time Students', |
---|
184 | 'sf_found': 'School Fee - Foundation Students', |
---|
185 | 'maint_all': 'Accommodation Fee - All Students', |
---|
186 | 'cl_regular': 'Acceptance Fee - Regular Students', |
---|
187 | } |
---|
188 | |
---|
189 | MODE_GROUPS = { |
---|
190 | 'All': ('all',), |
---|
191 | 'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'), |
---|
192 | 'Undergraduate Part-Time': ('ug_pt', 'de_pt'), |
---|
193 | 'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'), |
---|
194 | 'Foundation Programme': ('found',), |
---|
195 | 'Institute of Education': ('dp_ft'), |
---|
196 | } |
---|
197 | |
---|
198 | def fullname(self, firstname, lastname, middlename=None): |
---|
199 | """Construct fullname. |
---|
200 | """ |
---|
201 | try: |
---|
202 | lastname = lastname.upper() |
---|
203 | except AttributeError: |
---|
204 | pass |
---|
205 | # We do not necessarily have the middlename attribute |
---|
206 | if middlename: |
---|
207 | givennames = '%s %s' % (firstname, middlename) |
---|
208 | else: |
---|
209 | givennames = '%s' % firstname |
---|
210 | givennames = string.capwords( |
---|
211 | givennames.replace('-', ' - ')).replace(' - ', '-') |
---|
212 | fullname = '%s, %s' % (lastname, givennames) |
---|
213 | if '<' in fullname: |
---|
214 | return 'XXX' |
---|
215 | return fullname |
---|