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

Last change on this file since 17513 was 17510, checked in by Henrik Bettermann, 20 months ago

PG students now also pay additional fees.

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