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