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

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

Rename exam fee.

  • Property svn:keywords set to Id
File size: 15.1 KB
Line 
1## $Id: utils.py 16952 2022-05-10 09:43:01Z 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
22import grok
23from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
24from waeup.kofa.students.workflow  import ALUMNI_STATES
25
26class CustomKofaUtils(NigeriaKofaUtils):
27    """A collection of methods subject to customization.
28    """
29
30    PREFERRED_LANGUAGES_DICT = {
31        }
32
33    COURSE_CATEGORY_DICT = {
34        'C':'Core Course (C)',
35        'R':'Required Courses (R)',
36        'E':'Elective Courses (E)',
37        }
38
39    PAYMENT_CATEGORIES = {
40        'schoolfee': 'School Fee',
41        'schoolfee_1': 'School Fee Plus (1st instalment)',
42        'schoolfee_2': 'School Fee (2nd instalment)',
43        'schoolfee_incl': 'School Fee Plus',
44        'clearance': 'Acceptance Fee',
45        'clearance_incl': 'Acceptance Fee Plus',
46        'hostel_maintenance': 'Hostel Accommodation Fee',
47        'application': 'Application Fee',
48        'app_balance': 'Application Fee Balance',
49        'bed_allocation': 'Bed Allocation Fee',
50        'transfer': 'Transfer Fee',
51        'transcript_local': 'Local Transcript Fee',
52        'transcript_inter': 'International Transcript Fee',
53        'late_registration': 'Late Course Registration Fee',
54        'welfare': 'Student Welfare Assurance Fee',
55        'union': 'Student Union Dues',
56        'lapel': 'Lapel/File Fee',
57        'matric_gown': 'Matriculation Gown Fee',
58        'concessional': 'Concessional Fee',
59        'id_card': 'Student ID Card',
60        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
61        'gst_text_book_1': 'Text Book Fee GST101 GST102',
62        'gst_text_book_2': 'Text Book Fee GST111 GST112',
63        'gst_text_book_3': 'Text Book Fee GST222',
64        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
65        'gst_registration_2': 'Registration Fee GST222',
66        'ent_text_book_1': 'Text Book Fee ENT201',
67        'ent_text_book_2': 'Text Book Fee ENT211',
68        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
69        'ent_registration_1': 'Registration Fee ENT201',
70        'ent_registration_2': 'Registration Fee ENT211',
71        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
72        'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
73        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
74        'ict': 'ICT/Affidavit Dues',
75        'affidavit': 'Affidavit Dues',
76        'restitution': 'Restitution Fee',
77        'sports': 'Sports Fee',
78        'library': 'UG Library Fee',
79        'library_pg': 'PG Library Fee',
80        'sports_library': 'Sports Development and Library Fee',
81        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
82        'lab_2': 'Laboratory Due (BIO101/BIO111)',
83        'lms_sund': 'LMS + Sundry Fees',
84        'exam': 'IJMBE Examination Fee',
85        }
86
87    SELECTABLE_PAYMENT_CATEGORIES = {
88        'schoolfee': 'School Fee without additional fees',
89        'schoolfee_1': 'School Fee (1st instalment) incl. additional fees',
90        'schoolfee_2': 'School Fee (2nd instalment)',
91        'schoolfee_incl': 'School Fee incl. additional fees',
92        'clearance': 'Acceptance Fee without additional fees',
93        'clearance_incl': 'Acceptance Fee incl. additional fees',
94        'hostel_maintenance': 'Hostel Accommodation Fee',
95        #'application': 'Application Fee',
96        #'bed_allocation': 'Bed Allocation Fee',
97        #'transfer': 'Transfer Fee',
98        'transcript_local': 'Local Transcript Fee',
99        'transcript_inter': 'International Transcript Fee',
100        'late_registration': 'Late Course Registration Fee',
101        #'welfare': 'Student Welfare Assurance Fee',
102        #'union': 'Student Union Dues',
103        #'lapel': 'Lapel/File Fee',
104        #'matric_gown': 'Matriculation Gown Fee',
105        'concessional': 'Concessional Fee',
106        #'id_card': 'Student ID Card',
107        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
108        'gst_text_book_1': 'Text Book Fee GST101 GST102',
109        'gst_text_book_2': 'Text Book Fee GST111 GST112',
110        'gst_text_book_3': 'Text Book Fee GST222',
111        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
112        'gst_registration_2': 'Registration Fee GST222',
113        'ent_text_book_1': 'Text Book Fee ENT201',
114        'ent_text_book_2': 'Text Book Fee ENT211',
115        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
116        'ent_registration_1': 'Registration Fee ENT201',
117        'ent_registration_2': 'Registration Fee ENT211',
118        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
119        'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
120        #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
121        'ict': 'ICT/Affidavit Dues',
122        #'affidavit': 'Affidavit Dues',
123        'restitution': 'Restitution Fee',
124        'sports': 'Sports Fee',
125        'library': 'UG Library Fee',
126        'library_pg': 'PG Library Fee',
127        'sports_library': 'Sports Development and Library Fee',
128        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
129        'lab_2': 'Laboratory Due (BIO101/BIO111)',
130        'lms_sund': 'LMS plus Sundry Fees (new UG students only)',
131        }
132
133    ALUMNI_PAYMENT_CATS =  {
134        'transcript_local': 'Transcript Fee Local',
135        'transcript_inter': 'Transcript Fee International',
136        }
137
138    REDUCED_PAYMENT_CATS =  {
139        'clearance': 'Acceptance Fee',
140        'schoolfee': 'School Fee',
141        'late_registration': 'Late Course Registration Fee',
142        'sports': 'Sports Fee',
143        'library': 'UG Library Fee',
144        'library_pg': 'PG Library Fee',
145        'sports_library': 'Sports Development and Library Fee',
146        }
147
148    IJMBE_PAYMENT_CATS =  {
149        'clearance': 'Acceptance Fee',
150        'schoolfee': 'School Fee',
151        'schoolfee_1': 'School Fee (1st instalment)',
152        'schoolfee_2': 'School Fee (2nd instalment)',
153        'sports': 'Sports Fee',
154        'library': 'UG Library Fee',
155        'library_pg': 'PG Library Fee',
156        'sports_library': 'Sports Development and Library Fee',
157        'exam': 'IJMBE Examination Fee',
158        }
159
160    PT_AND_DSH_PAYMENT_CATS =  {
161        'clearance_incl': 'Acceptance Fee Plus',
162        'schoolfee_incl': 'School Fee Plus',
163        'ent_text_book_1': 'Text Book Fee ENT201',
164        'ent_text_book_2': 'Text Book Fee ENT211',
165        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
166        'ent_registration_1': 'Registration Fee ENT201',
167        'ent_registration_2': 'Registration Fee ENT211',
168        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
169        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
170        'gst_registration_2': 'Registration Fee GST222',
171        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
172        'gst_text_book_1': 'Text Book Fee GST101 GST102',
173        'gst_text_book_2': 'Text Book Fee GST111 GST112',
174        'gst_text_book_3': 'Text Book Fee GST222',
175        'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
176        'late_registration': 'Late Course Registration Fee',
177        'sports': 'Sports Fee',
178        'library': 'UG Library Fee',
179        'library_pg': 'PG Library Fee',
180        'sports_library': 'Sports Development and Library Fee',
181        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
182        'lab_2': 'Laboratory Due (BIO101/BIO111)',
183        }
184
185    def selectable_payment_categories(self, student):
186        if student.state in ALUMNI_STATES:
187            return self.ALUMNI_PAYMENT_CATS
188        if student.current_mode in (
189            'special_pg_ft', 'special_pg_pt', 'found', 'bridge'):
190            return self.REDUCED_PAYMENT_CATS
191        if student.current_mode in (
192            'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
193            return self.PT_AND_DSH_PAYMENT_CATS
194        if student.current_mode == 'ijmbe':
195            return self.IJMBE_PAYMENT_CATS
196        return self.SELECTABLE_PAYMENT_CATEGORIES
197
198    REPORTABLE_PAYMENT_CATEGORIES = {
199        'schoolfee': 'School Fee',
200        'schoolfee_incl': 'School Fee Plus',
201        'schoolfee_1': 'School Fee 1 Plus',
202        'schoolfee_2': 'School Fee 2',
203        'clearance': 'Acceptance Fee',
204        'clearance_incl': 'Acceptance Fee Plus',
205        'hostel_maintenance': 'Hostel Maintenance Fee',
206        }
207
208    BALANCE_PAYMENT_CATEGORIES = {
209        'schoolfee': 'School Fee',
210        'clearance': 'Acceptance Fee',
211        'hostel_maintenance': 'Hostel Maintenance Fee',
212        'late_registration': 'Late Course Registration Fee',
213        'welfare': 'Student Welfare Assurance Fee',
214        'union': 'Student Union Dues',
215        'lapel': 'Lapel/File Fee',
216        'matric_gown': 'Matriculation Gown Fee',
217        'id_card': 'Student ID Card',
218        'gst_text_book_1': 'Text Book Fee GST101 GST102',
219        'gst_text_book_2': 'Text Book Fee GST111 GST112',
220        'gst_text_book_3': 'Text Book Fee GST222',
221        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
222        'gst_registration_2': 'Registration Fee GST222',
223        'ent_text_book_1': 'Text Book Fee ENT201',
224        'ent_text_book_2': 'Text Book Fee ENT211',
225        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
226        'ent_registration_1': 'Registration Fee ENT201',
227        'ent_registration_2': 'Registration Fee ENT211',
228        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
229        #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
230        'ict': 'ICT/Affidavit Dues',
231        #'affidavit': 'Affidavit Dues',
232        'restitution': 'Restitution Fee',
233        }
234
235    PREVIOUS_PAYMENT_CATEGORIES = {
236        'schoolfee': 'School Fee',
237        'clearance': 'Acceptance Fee',
238        'late_registration': 'Late Course Registration Fee',
239        }
240
241    APP_CATS_DICT = {
242        'basic': 'PUTME, PUDE, PCE, PRENCE',
243        'no': 'No Application',
244        'pg_ft': 'Postgraduate Full-Time',
245        'pg_pt': 'Postgraduate Part-Time',
246        'cest': 'Part-Time, Diploma, Certificate',
247        'found': 'Foundation',
248        'ptee': 'Part-Time Entrance Examination',
249        'ioe_dp': 'Institute of Education Diploma',
250        'ijmbe': 'IJMBE Preparation',
251        'bridge': 'Bridge',
252        'dsh': 'Science and Humanities',
253
254        }
255
256    STUDY_MODES_DICT = {
257        'ug_ft': 'Undergraduate Full Time',
258        'ug_pt': 'Undergraduate Part Time',
259        'de_ft': 'Direct Entry Full Time',
260        'de_pt': 'Direct Entry Part Time',
261        'dp_pt': 'Diploma Part Time',
262        'dp_ft': 'Diploma Full Time',
263        'special_pg_ft': 'Postgraduate Full Time',
264        'special_pg_pt': 'Postgraduate Part Time',
265        'found': 'Foundation',
266        'transfer': 'Transfer',
267        'transferred': 'Transferred',
268        'mug_ft': 'Undergraduate Full Time Merit List',
269        'mde_ft': 'Direct Entry Full Time Merit List',
270        'ijmbe': 'IJMBE Preparation',
271        'bridge': 'Bridge',
272        'ug_dsh': 'Undergraduate Science and Humanities',
273        'de_dsh': 'Direct Entry Science and Humanities',
274        }
275
276    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
277
278    VERDICTS_DICT = {
279        '0': 'not yet',
280        'A': 'Successful student',
281        'B': 'Student with carryover courses',
282        'C': 'Student on probation',
283        'D': 'Withdrawn from the faculty',
284        #'E': 'Student who were previously on probation',
285        #'F': 'Medical case',
286        #'G': 'Absent from examination',
287        #'H': 'Withheld results',
288        #'I': 'Expelled/rusticated/suspended student',
289        #'J': 'Temporary withdrawn from the university',
290        #'K': 'Unregistered student',
291        #'L': 'Referred student',
292        #'M': 'Reinstatement',
293        #'N': 'Student on transfer',
294        #'O': 'NCE-III repeater',
295        #'Y': 'No previous verdict',
296        #'X': 'New 300 level student',
297        'Z': 'Successful student (provisional)',
298        #'A1': 'First Class',
299        #'A2': 'Second Class Upper',
300        #'A3': 'Second Class Lower',
301        #'A4': 'Third Class',
302        #'A5': 'Pass',
303        #'A6': 'Distinction',
304        #'A7': 'Credit',
305        #'A8': 'Merit',
306        'NER': 'No evidence of registration',
307        'NYV': 'Not yet verified',
308        'FRNS': 'Faculty requirements not satisfied',
309        }
310
311    DISABLE_PAYMENT_GROUP_DICT = {
312        'sf_all': 'School Fee - All Students',
313        'sf_pg': 'School Fee - Postgraduate Students',
314        'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students',
315        'sf_found': 'School Fee - Foundation Students',
316        'maint_all': 'Accommodation Fee - All Students',
317        'cl_regular': 'Acceptance Fee - Regular Students',
318        }
319
320    MODE_GROUPS = {
321        'All': ('all',),
322        'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'),
323        'Undergraduate Part-Time': ('ug_pt', 'de_pt'),
324        'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'),
325        'Foundation Programme': ('found',),
326        'Institute of Education': ('dp_ft'),
327        'IJMBE Preparation': ('ijmbe',),
328        'Bridge': ('bridge',),
329        }
330
331    #: Maximum number of files listed in `finished` subfolder
332    MAX_FILES = 5000
333
334    def fullname(self, firstname, lastname, middlename=None):
335        """Construct fullname.
336        """
337        try:
338            lastname = lastname.upper()
339        except AttributeError:
340            pass
341        # We remove single initial
342        if firstname and len(firstname) == 1:
343            firstname = ''
344        if middlename and len(middlename) == 1:
345            middlename = ''
346        if lastname and len(lastname) == 1:
347            lastname = ''
348        # We construct givennames
349        givennames = ''
350        if middlename and firstname:
351            givennames = '%s %s' % (firstname, middlename)
352        elif firstname:
353            givennames = firstname
354        elif middlename:
355            givennames = middlename
356        givennames = string.capwords(
357            givennames.replace('-', ' - ')).replace(' - ', '-')
358        # We construct fullname
359        fullname = ''
360        if lastname and givennames:
361            fullname = '%s, %s' % (lastname, givennames)
362        elif lastname:
363            fullname = lastname
364        elif givennames:
365            fullname = givennames
366        if '<' in fullname:
367            return 'XXX'
368        return fullname
369
370    def getUsers(self):
371        users = sorted(
372            grok.getSite()['users'].items(), key=lambda x: x[0])
373        for key, val in users:
374            yield(dict(name=key, val="%s - %s" % (val.name, val.title)))
Note: See TracBrowser for help on using the repository browser.