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

Last change on this file since 17516 was 17514, checked in by Henrik Bettermann, 16 months ago

Configure LMS Plus Fee single payment.

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