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

Last change on this file since 16750 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
RevLine 
[7569]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##
[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 = {
40        'schoolfee': 'School Fee',
[13512]41        'schoolfee_1': 'School Fee Plus (1st instalment)',
42        'schoolfee_2': 'School Fee (2nd instalment)',
[13410]43        'schoolfee_incl': 'School Fee 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',
[14621]64        'ent_text_book_1': 'Text Book Fee ENT201',
[16749]65        'ent_text_book_2': 'Text Book Fee ENT211',
[14258]66        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
67        'gst_registration_2': 'Registration Fee GST222',
[14620]68        'ent_registration_1': 'Registration Fee ENT201',
[16749]69        'ent_registration_2': 'Registration Fee ENT211',
[15841]70        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[16669]71        'ict': 'ICT/Affidavit Dues',
[16181]72        'affidavit': 'Affidavit Dues',
[14375]73        'restitution': 'Restitution Fee',
[15971]74        'sports': 'Sports Fee',
[16124]75        'library': 'UG Library Fee',
76        'library_pg': 'PG Library Fee',
77        'sports_library': 'Sports Development and Library Fee',
[16080]78        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
79        'lab_2': 'Laboratory Due (BIO101/BIO111)',
[9755]80        }
81
82    SELECTABLE_PAYMENT_CATEGORIES = {
[13435]83        'schoolfee': 'School Fee without additional fees',
[15971]84        'schoolfee_1': 'School Fee (1st instalment) incl. additional fees',
[13512]85        'schoolfee_2': 'School Fee (2nd instalment)',
[15971]86        'schoolfee_incl': 'School Fee incl. additional fees',
[13435]87        'clearance': 'Acceptance Fee without additional fees',
[15971]88        'clearance_incl': 'Acceptance Fee incl. additional fees',
[13454]89        'hostel_maintenance': 'Hostel Accommodation Fee',
[14243]90        #'application': 'Application Fee',
[11621]91        #'bed_allocation': 'Bed Allocation Fee',
92        #'transfer': 'Transfer Fee',
[14296]93        'transcript_local': 'Local Transcript Fee',
94        'transcript_inter': 'International Transcript Fee',
[13035]95        'late_registration': 'Late Course Registration Fee',
[14243]96        #'welfare': 'Student Welfare Assurance Fee',
97        #'union': 'Student Union Dues',
98        #'lapel': 'Lapel/File Fee',
99        #'matric_gown': 'Matriculation Gown Fee',
[13374]100        'concessional': 'Concessional Fee',
[14243]101        #'id_card': 'Student ID Card',
[14355]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',
[14258]105        'gst_text_book_3': 'Text Book Fee GST222',
[14621]106        'ent_text_book_1': 'Text Book Fee ENT201',
[16749]107        'ent_text_book_2': 'Text Book Fee ENT211',
[14258]108        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
109        'gst_registration_2': 'Registration Fee GST222',
[14620]110        'ent_registration_1': 'Registration Fee ENT201',
[16749]111        'ent_registration_2': 'Registration Fee ENT211',
[16177]112        #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[16669]113        'ict': 'ICT/Affidavit Dues',
114        #'affidavit': 'Affidavit Dues',
[14375]115        'restitution': 'Restitution Fee',
[16124]116        'sports': 'Sports Fee',
117        'library': 'UG Library Fee',
118        'library_pg': 'PG Library Fee',
119        'sports_library': 'Sports Development and Library Fee',
[16080]120        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
121        'lab_2': 'Laboratory Due (BIO101/BIO111)',
[9755]122        }
123
[15451]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',
[15465]132        'late_registration': 'Late Course Registration Fee',
[16124]133        'sports': 'Sports Fee',
134        'library': 'UG Library Fee',
135        'library_pg': 'PG Library Fee',
136        'sports_library': 'Sports Development and Library Fee',
[15451]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)',
[16124]144        'sports': 'Sports Fee',
145        'library': 'UG Library Fee',
146        'library_pg': 'PG Library Fee',
147        'sports_library': 'Sports Development and Library Fee',
[15451]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',
[16749]155        'ent_registration_2': 'Registration Fee ENT211',
156        'ent_text_book_2': 'Text Book Fee ENT211',
[15451]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',
[15862]163        'late_registration': 'Late Course Registration Fee',
[16124]164        'sports': 'Sports Fee',
165        'library': 'UG Library Fee',
166        'library_pg': 'PG Library Fee',
167        'sports_library': 'Sports Development and Library Fee',
[16080]168        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
169        'lab_2': 'Laboratory Due (BIO101/BIO111)',
[15451]170        }
171
[15433]172    def selectable_payment_categories(self, student):
[15451]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
[15433]183        return self.SELECTABLE_PAYMENT_CATEGORIES
184
[13451]185    REPORTABLE_PAYMENT_CATEGORIES = {
186        'schoolfee': 'School Fee',
[13452]187        'schoolfee_incl': 'School Fee Plus',
[13635]188        'schoolfee_1': 'School Fee 1 Plus',
189        'schoolfee_2': 'School Fee 2',
[13451]190        'clearance': 'Acceptance Fee',
[13452]191        'clearance_incl': 'Acceptance Fee Plus',
[13451]192        'hostel_maintenance': 'Hostel Maintenance Fee',
193        }
194
[13638]195    BALANCE_PAYMENT_CATEGORIES = {
196        'schoolfee': 'School Fee',
197        'clearance': 'Acceptance Fee',
198        'hostel_maintenance': 'Hostel Maintenance Fee',
[13750]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',
[14234]204        'id_card': 'Student ID Card',
[14258]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',
[14621]208        'ent_text_book_1': 'Text Book Fee ENT201',
[16749]209        'ent_text_book_2': 'Text Book Fee ENT211',
[14258]210        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
211        'gst_registration_2': 'Registration Fee GST222',
[14620]212        'ent_registration_1': 'Registration Fee ENT201',
[16749]213        'ent_registration_2': 'Registration Fee ENT211',
[16179]214        #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[16669]215        'ict': 'ICT/Affidavit Dues',
216        #'affidavit': 'Affidavit Dues',
[14375]217        'restitution': 'Restitution Fee',
[13638]218        }
219
[14544]220    PREVIOUS_PAYMENT_CATEGORIES = {
221        'schoolfee': 'School Fee',
222        'clearance': 'Acceptance Fee',
[16552]223        'late_registration': 'Late Course Registration Fee',
[14544]224        }
225
[10304]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',
[10893]233        'ptee': 'Part-Time Entrance Examination',
[13568]234        'ioe_dp': 'Institute of Education Diploma',
[14339]235        'ijmbe': 'IJMBE Preparation',
[15224]236        'bridge': 'Bridge',
[15385]237        'dsh': 'Science and Humanities',
238
[10304]239        }
240
[11591]241    STUDY_MODES_DICT = {
242        'ug_ft': 'Undergraduate Full Time',
243        'ug_pt': 'Undergraduate Part Time',
[11593]244        'de_ft': 'Direct Entry Full Time',
245        'de_pt': 'Direct Entry Part Time',
[11591]246        'dp_pt': 'Diploma Part Time',
247        'dp_ft': 'Diploma Full Time',
[13524]248        'special_pg_ft': 'Postgraduate Full Time',
249        'special_pg_pt': 'Postgraduate Part Time',
[11591]250        'found': 'Foundation',
[13498]251        'transfer': 'Transfer',
[13749]252        'mug_ft': 'Undergraduate Full Time Merit List',
253        'mde_ft': 'Direct Entry Full Time Merit List',
[14339]254        'ijmbe': 'IJMBE Preparation',
[15217]255        'bridge': 'Bridge',
[15382]256        'ug_dsh': 'Undergraduate Science and Humanities',
257        'de_dsh': 'Direct Entry Science and Humanities',
[11591]258        }
259
[14700]260    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
261
[13127]262    VERDICTS_DICT = {
263        '0': 'not yet',
264        'A': 'Successful student',
265        'B': 'Student with carryover courses',
266        'C': 'Student on probation',
[14475]267        'D': 'Withdrawn from the faculty',
[13127]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',
[14487]290        'NER': 'No evidence of registration',
291        'NYV': 'Not yet verified',
[13127]292        'FRNS': 'Faculty requirements not satisfied',
293        }
[13454]294
295    DISABLE_PAYMENT_GROUP_DICT = {
296        'sf_all': 'School Fee - All Students',
[14246]297        'sf_pg': 'School Fee - Postgraduate Students',
[14571]298        'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students',
[14246]299        'sf_found': 'School Fee - Foundation Students',
[13454]300        'maint_all': 'Accommodation Fee - All Students',
[13794]301        'cl_regular': 'Acceptance Fee - Regular Students',
[13454]302        }
[13870]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'),
[15242]311        'IJMBE Preparation': ('ijmbe',),
312        'Bridge': ('bridge',),
[13870]313        }
[13963]314
[15431]315    #: Maximum number of files listed in `finished` subfolder
316    MAX_FILES = 5000
317
[13963]318    def fullname(self, firstname, lastname, middlename=None):
319        """Construct fullname.
320        """
321        try:
322            lastname = lastname.upper()
323        except AttributeError:
324            pass
[14594]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:
[13963]335            givennames = '%s %s' % (firstname, middlename)
[14594]336        elif firstname:
337            givennames = firstname
338        elif middlename:
339            givennames = middlename
[13963]340        givennames = string.capwords(
341            givennames.replace('-', ' - ')).replace(' - ', '-')
[14594]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
[13963]350        if '<' in fullname:
351            return 'XXX'
352        return fullname
[15965]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.