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

Last change on this file since 16749 was 16749, checked in by Henrik Bettermann, 3 years ago

Add text book and registration fees.

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