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

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

Implement ENT211 payments.

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