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

Last change on this file since 17569 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
RevLine 
[7569]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##
[7822]18"""Customize general helper utilities for Kofa.
[7569]19"""
[13963]20
21import string
[15965]22import grok
[8823]23from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
[15451]24from waeup.kofa.students.workflow  import ALUMNI_STATES
[7569]25
[8823]26class CustomKofaUtils(NigeriaKofaUtils):
[7569]27    """A collection of methods subject to customization.
28    """
[7845]29
30    PREFERRED_LANGUAGES_DICT = {
[9755]31        }
32
[14650]33    COURSE_CATEGORY_DICT = {
34        'C':'Core Course (C)',
35        'R':'Required Courses (R)',
36        'E':'Elective Courses (E)',
37        }
38
[9755]39    PAYMENT_CATEGORIES = {
[17440]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',
[9755]44        'clearance': 'Acceptance Fee',
[13410]45        'clearance_incl': 'Acceptance Fee Plus',
[13424]46        'hostel_maintenance': 'Hostel Accommodation Fee',
[9755]47        'application': 'Application Fee',
[15555]48        'app_balance': 'Application Fee Balance',
[9755]49        'bed_allocation': 'Bed Allocation Fee',
50        'transfer': 'Transfer Fee',
[14296]51        'transcript_local': 'Local Transcript Fee',
52        'transcript_inter': 'International Transcript Fee',
[13035]53        'late_registration': 'Late Course Registration Fee',
[13402]54        'welfare': 'Student Welfare Assurance Fee',
[13463]55        'union': 'Student Union Dues',
[13402]56        'lapel': 'Lapel/File Fee',
[13374]57        'matric_gown': 'Matriculation Gown Fee',
58        'concessional': 'Concessional Fee',
[14234]59        'id_card': 'Student ID Card',
[14355]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',
[14258]63        'gst_text_book_3': 'Text Book Fee GST222',
[16754]64        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
65        'gst_registration_2': 'Registration Fee GST222',
[14621]66        'ent_text_book_1': 'Text Book Fee ENT201',
[16749]67        'ent_text_book_2': 'Text Book Fee ENT211',
[16754]68        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
[14620]69        'ent_registration_1': 'Registration Fee ENT201',
[16749]70        'ent_registration_2': 'Registration Fee ENT211',
[16754]71        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
[16805]72        'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
[15841]73        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[16669]74        'ict': 'ICT/Affidavit Dues',
[16181]75        'affidavit': 'Affidavit Dues',
[14375]76        'restitution': 'Restitution Fee',
[15971]77        'sports': 'Sports Fee',
[16124]78        'library': 'UG Library Fee',
79        'library_pg': 'PG Library Fee',
80        'sports_library': 'Sports Development and Library Fee',
[16080]81        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
82        'lab_2': 'Laboratory Due (BIO101/BIO111)',
[16929]83        'lms_sund': 'LMS + Sundry Fees',
[16952]84        'exam': 'IJMBE Examination Fee',
[17099]85        'access_card': 'AAU Access Card Fee',
[17514]86        'lmsplus': 'LMS Plus Fee',
[9755]87        }
88
89    SELECTABLE_PAYMENT_CATEGORIES = {
[17466]90        #'schoolfee': 'School Fees',
[17461]91        'schoolfee_1': 'School Fees Plus (1st instalment)',
[17440]92        'schoolfee_2': 'School Fees (2nd instalment)',
[17461]93        'schoolfee_incl': 'School Fees Plus',
94        'clearance': 'Acceptance Fee',
95        'clearance_incl': 'Acceptance Fee Plus',
[17456]96        'hostel_maintenance': 'Hostel Accommodation Fee',
[14243]97        #'application': 'Application Fee',
[17461]98        'bed_allocation': 'Bed Allocation Fee',
[11621]99        #'transfer': 'Transfer Fee',
[17431]100        ##'transcript_local': 'Local Transcript Fee',
101        ##'transcript_inter': 'International Transcript Fee',
[17456]102        'late_registration': 'Late Course Registration Fee',
[14243]103        #'welfare': 'Student Welfare Assurance Fee',
104        #'union': 'Student Union Dues',
105        #'lapel': 'Lapel/File Fee',
106        #'matric_gown': 'Matriculation Gown Fee',
[17431]107        ##'concessional': 'Concessional Fee',
[14243]108        #'id_card': 'Student ID Card',
[17456]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',
[17431]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',
[17514]133        'lmsplus': 'LMS Plus Fee',
[9755]134        }
135
[15451]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',
[17510]143        'schoolfee_incl': 'School Fees Plus',
[17456]144        'late_registration': 'Late Course Registration Fee',
[17431]145        ##'sports': 'Sports Fee',
146        ##'library': 'UG Library Fee',
147        ##'library_pg': 'PG Library Fee',
148        ##'sports_library': 'Sports Development and Library Fee',
[15451]149        }
150
151    IJMBE_PAYMENT_CATS =  {
152        'clearance': 'Acceptance Fee',
[17440]153        'schoolfee': 'School Fees',
154        'schoolfee_1': 'School Fees (1st instalment)',
155        'schoolfee_2': 'School Fees (2nd instalment)',
[17431]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',
[15451]161        }
162
163    PT_AND_DSH_PAYMENT_CATS =  {
164        'clearance_incl': 'Acceptance Fee Plus',
[17440]165        'schoolfee_incl': 'School Fees Plus',
[17507]166        'schoolfee_1': 'School Fees Plus (1st instalment)',
167        'schoolfee_2': 'School Fees (2nd instalment)',
[17456]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',
[17431]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)',
[15451]188        }
189
[15433]190    def selectable_payment_categories(self, student):
[15451]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
[15433]201        return self.SELECTABLE_PAYMENT_CATEGORIES
202
[13451]203    REPORTABLE_PAYMENT_CATEGORIES = {
[17440]204        'schoolfee': 'School Fees',
205        'schoolfee_incl': 'School Fees Plus',
206        'schoolfee_1': 'School Fees 1 Plus',
207        'schoolfee_2': 'School Fees 2',
[13451]208        'clearance': 'Acceptance Fee',
[13452]209        'clearance_incl': 'Acceptance Fee Plus',
[13451]210        'hostel_maintenance': 'Hostel Maintenance Fee',
211        }
212
[17456]213    BALANCE_PAYMENT_CATEGORIES = {
[17440]214        'schoolfee': 'School Fees',
[13638]215        'clearance': 'Acceptance Fee',
216        'hostel_maintenance': 'Hostel Maintenance Fee',
[13750]217        'late_registration': 'Late Course Registration Fee',
[17456]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',
[14258]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',
[16754]226        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
227        'gst_registration_2': 'Registration Fee GST222',
[14621]228        'ent_text_book_1': 'Text Book Fee ENT201',
[16749]229        'ent_text_book_2': 'Text Book Fee ENT211',
[16754]230        'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
[14620]231        'ent_registration_1': 'Registration Fee ENT201',
[16749]232        'ent_registration_2': 'Registration Fee ENT211',
[16754]233        'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
[16179]234        #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[17456]235        #'ict': 'ICT/Affidavit Dues',
[16669]236        #'affidavit': 'Affidavit Dues',
[17456]237        #'restitution': 'Restitution Fee',
[13638]238        }
239
[14544]240    PREVIOUS_PAYMENT_CATEGORIES = {
[17470]241        'schoolfee_incl': 'School Fees Plus',
[17473]242        'schoolfee_1': 'School Fees Plus (1st instalment)',
243        'schoolfee_2': 'School Fees (2nd instalment)',
[14544]244        'clearance': 'Acceptance Fee',
[16552]245        'late_registration': 'Late Course Registration Fee',
[14544]246        }
247
[10304]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',
[10893]255        'ptee': 'Part-Time Entrance Examination',
[13568]256        'ioe_dp': 'Institute of Education Diploma',
[14339]257        'ijmbe': 'IJMBE Preparation',
[15224]258        'bridge': 'Bridge',
[15385]259        'dsh': 'Science and Humanities',
260
[10304]261        }
262
[11591]263    STUDY_MODES_DICT = {
264        'ug_ft': 'Undergraduate Full Time',
265        'ug_pt': 'Undergraduate Part Time',
[11593]266        'de_ft': 'Direct Entry Full Time',
267        'de_pt': 'Direct Entry Part Time',
[11591]268        'dp_pt': 'Diploma Part Time',
269        'dp_ft': 'Diploma Full Time',
[13524]270        'special_pg_ft': 'Postgraduate Full Time',
271        'special_pg_pt': 'Postgraduate Part Time',
[11591]272        'found': 'Foundation',
[13498]273        'transfer': 'Transfer',
[16830]274        'transferred': 'Transferred',
[13749]275        'mug_ft': 'Undergraduate Full Time Merit List',
276        'mde_ft': 'Direct Entry Full Time Merit List',
[14339]277        'ijmbe': 'IJMBE Preparation',
[15217]278        'bridge': 'Bridge',
[15382]279        'ug_dsh': 'Undergraduate Science and Humanities',
280        'de_dsh': 'Direct Entry Science and Humanities',
[11591]281        }
282
[14700]283    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
284
[13127]285    VERDICTS_DICT = {
286        '0': 'not yet',
287        'A': 'Successful student',
288        'B': 'Student with carryover courses',
289        'C': 'Student on probation',
[14475]290        'D': 'Withdrawn from the faculty',
[13127]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',
[14487]313        'NER': 'No evidence of registration',
314        'NYV': 'Not yet verified',
[13127]315        'FRNS': 'Faculty requirements not satisfied',
316        }
[13454]317
318    DISABLE_PAYMENT_GROUP_DICT = {
[17440]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',
[13454]323        'maint_all': 'Accommodation Fee - All Students',
[13794]324        'cl_regular': 'Acceptance Fee - Regular Students',
[13454]325        }
[13870]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'),
[15242]334        'IJMBE Preparation': ('ijmbe',),
335        'Bridge': ('bridge',),
[13870]336        }
[13963]337
[15431]338    #: Maximum number of files listed in `finished` subfolder
339    MAX_FILES = 5000
340
[13963]341    def fullname(self, firstname, lastname, middlename=None):
342        """Construct fullname.
343        """
344        try:
345            lastname = lastname.upper()
346        except AttributeError:
347            pass
[14594]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:
[13963]358            givennames = '%s %s' % (firstname, middlename)
[14594]359        elif firstname:
360            givennames = firstname
361        elif middlename:
362            givennames = middlename
[13963]363        givennames = string.capwords(
364            givennames.replace('-', ' - ')).replace(' - ', '-')
[14594]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
[13963]373        if '<' in fullname:
374            return 'XXX'
375        return fullname
[15965]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.