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

Last change on this file since 15862 was 15862, checked in by Henrik Bettermann, 5 years ago

Add late_registration to PT_AND_DSH_PAYMENT_CATS.

  • Property svn:keywords set to Id
File size: 12.1 KB
RevLine 
[7569]1## $Id: utils.py 15862 2019-12-02 09:45:09Z 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
[8823]22from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
[15451]23from waeup.kofa.students.workflow  import ALUMNI_STATES
[7569]24
[8823]25class CustomKofaUtils(NigeriaKofaUtils):
[7569]26    """A collection of methods subject to customization.
27    """
[7845]28
29    PREFERRED_LANGUAGES_DICT = {
[9755]30        }
31
[14650]32    COURSE_CATEGORY_DICT = {
33        'C':'Core Course (C)',
34        'R':'Required Courses (R)',
35        'E':'Elective Courses (E)',
36        }
37
[9755]38    PAYMENT_CATEGORIES = {
39        'schoolfee': 'School Fee',
[13512]40        'schoolfee_1': 'School Fee Plus (1st instalment)',
41        'schoolfee_2': 'School Fee (2nd instalment)',
[13410]42        'schoolfee_incl': 'School Fee Plus',
[9755]43        'clearance': 'Acceptance Fee',
[13410]44        'clearance_incl': 'Acceptance Fee Plus',
[13424]45        'hostel_maintenance': 'Hostel Accommodation Fee',
[9755]46        'application': 'Application Fee',
[15555]47        'app_balance': 'Application Fee Balance',
[9755]48        'bed_allocation': 'Bed Allocation Fee',
49        'transfer': 'Transfer Fee',
[14296]50        'transcript_local': 'Local Transcript Fee',
51        'transcript_inter': 'International Transcript Fee',
[13035]52        'late_registration': 'Late Course Registration Fee',
[13402]53        'welfare': 'Student Welfare Assurance Fee',
[13463]54        'union': 'Student Union Dues',
[13402]55        'lapel': 'Lapel/File Fee',
[13374]56        'matric_gown': 'Matriculation Gown Fee',
57        'concessional': 'Concessional Fee',
[14234]58        'id_card': 'Student ID Card',
[14355]59        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
60        'gst_text_book_1': 'Text Book Fee GST101 GST102',
61        'gst_text_book_2': 'Text Book Fee GST111 GST112',
[14258]62        'gst_text_book_3': 'Text Book Fee GST222',
[14621]63        'ent_text_book_1': 'Text Book Fee ENT201',
[14258]64        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
65        'gst_registration_2': 'Registration Fee GST222',
[14620]66        'ent_registration_1': 'Registration Fee ENT201',
[15841]67        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[14375]68        'restitution': 'Restitution Fee',
[9755]69        }
70
71    SELECTABLE_PAYMENT_CATEGORIES = {
[13435]72        'schoolfee': 'School Fee without additional fees',
[15182]73        'schoolfee_1': 'School Fee (1st instalment) + Student Union Dues + Welfare Assurance, Library and Sports Fees',
[13512]74        'schoolfee_2': 'School Fee (2nd instalment)',
[15182]75        'schoolfee_incl': 'School Fee + Student Union Dues + Welfare Assurance, Library and Sports Fees',
[13435]76        'clearance': 'Acceptance Fee without additional fees',
[14239]77        'clearance_incl': 'Acceptance Fee + Matric Gown Fee + Lapel/File Fee',
[13454]78        'hostel_maintenance': 'Hostel Accommodation Fee',
[14243]79        #'application': 'Application Fee',
[11621]80        #'bed_allocation': 'Bed Allocation Fee',
81        #'transfer': 'Transfer Fee',
[14296]82        'transcript_local': 'Local Transcript Fee',
83        'transcript_inter': 'International Transcript Fee',
[13035]84        'late_registration': 'Late Course Registration Fee',
[14243]85        #'welfare': 'Student Welfare Assurance Fee',
86        #'union': 'Student Union Dues',
87        #'lapel': 'Lapel/File Fee',
88        #'matric_gown': 'Matriculation Gown Fee',
[13374]89        'concessional': 'Concessional Fee',
[14243]90        #'id_card': 'Student ID Card',
[14355]91        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
92        'gst_text_book_1': 'Text Book Fee GST101 GST102',
93        'gst_text_book_2': 'Text Book Fee GST111 GST112',
[14258]94        'gst_text_book_3': 'Text Book Fee GST222',
[14621]95        'ent_text_book_1': 'Text Book Fee ENT201',
[14258]96        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
97        'gst_registration_2': 'Registration Fee GST222',
[14620]98        'ent_registration_1': 'Registration Fee ENT201',
[15841]99        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[14375]100        'restitution': 'Restitution Fee',
[9755]101        }
102
[15451]103    ALUMNI_PAYMENT_CATS =  {
104        'transcript_local': 'Transcript Fee Local',
105        'transcript_inter': 'Transcript Fee International',
106        }
107
108    REDUCED_PAYMENT_CATS =  {
109        'clearance': 'Acceptance Fee',
110        'schoolfee': 'School Fee',
[15465]111        'late_registration': 'Late Course Registration Fee',
[15451]112        }
113
114    IJMBE_PAYMENT_CATS =  {
115        'clearance': 'Acceptance Fee',
116        'schoolfee': 'School Fee',
117        'schoolfee_1': 'School Fee (1st instalment)',
118        'schoolfee_2': 'School Fee (2nd instalment)',
119        }
120
121    PT_AND_DSH_PAYMENT_CATS =  {
122        'clearance_incl': 'Acceptance Fee Plus',
123        'schoolfee_incl': 'School Fee Plus',
124        'ent_registration_1': 'Registration Fee ENT201',
125        'ent_text_book_1': 'Text Book Fee ENT201',
126        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
127        'gst_registration_2': 'Registration Fee GST222',
128        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
129        'gst_text_book_1': 'Text Book Fee GST101 GST102',
130        'gst_text_book_2': 'Text Book Fee GST111 GST112',
131        'gst_text_book_3': 'Text Book Fee GST222',
[15862]132        'late_registration': 'Late Course Registration Fee',
[15451]133        }
134
[15433]135    def selectable_payment_categories(self, student):
[15451]136        if student.state in ALUMNI_STATES:
137            return self.ALUMNI_PAYMENT_CATS
138        if student.current_mode in (
139            'special_pg_ft', 'special_pg_pt', 'found', 'bridge'):
140            return self.REDUCED_PAYMENT_CATS
141        if student.current_mode in (
142            'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
143            return self.PT_AND_DSH_PAYMENT_CATS
144        if student.current_mode == 'ijmbe':
145            return self.IJMBE_PAYMENT_CATS
[15433]146        return self.SELECTABLE_PAYMENT_CATEGORIES
147
[13451]148    REPORTABLE_PAYMENT_CATEGORIES = {
149        'schoolfee': 'School Fee',
[13452]150        'schoolfee_incl': 'School Fee Plus',
[13635]151        'schoolfee_1': 'School Fee 1 Plus',
152        'schoolfee_2': 'School Fee 2',
[13451]153        'clearance': 'Acceptance Fee',
[13452]154        'clearance_incl': 'Acceptance Fee Plus',
[13451]155        'hostel_maintenance': 'Hostel Maintenance Fee',
156        }
157
[13638]158    BALANCE_PAYMENT_CATEGORIES = {
159        'schoolfee': 'School Fee',
160        'clearance': 'Acceptance Fee',
161        'hostel_maintenance': 'Hostel Maintenance Fee',
[13750]162        'late_registration': 'Late Course Registration Fee',
163        'welfare': 'Student Welfare Assurance Fee',
164        'union': 'Student Union Dues',
165        'lapel': 'Lapel/File Fee',
166        'matric_gown': 'Matriculation Gown Fee',
[14234]167        'id_card': 'Student ID Card',
[14258]168        'gst_text_book_1': 'Text Book Fee GST101 GST102',
169        'gst_text_book_2': 'Text Book Fee GST111 GST112',
170        'gst_text_book_3': 'Text Book Fee GST222',
[14621]171        'ent_text_book_1': 'Text Book Fee ENT201',
[14258]172        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
173        'gst_registration_2': 'Registration Fee GST222',
[14620]174        'ent_registration_1': 'Registration Fee ENT201',
[15841]175        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
[14375]176        'restitution': 'Restitution Fee',
[13638]177        }
178
[14544]179    PREVIOUS_PAYMENT_CATEGORIES = {
180        'schoolfee': 'School Fee',
181        'clearance': 'Acceptance Fee',
182        }
183
[10304]184    APP_CATS_DICT = {
185        'basic': 'PUTME, PUDE, PCE, PRENCE',
186        'no': 'No Application',
187        'pg_ft': 'Postgraduate Full-Time',
188        'pg_pt': 'Postgraduate Part-Time',
189        'cest': 'Part-Time, Diploma, Certificate',
190        'found': 'Foundation',
[10893]191        'ptee': 'Part-Time Entrance Examination',
[13568]192        'ioe_dp': 'Institute of Education Diploma',
[14339]193        'ijmbe': 'IJMBE Preparation',
[15224]194        'bridge': 'Bridge',
[15385]195        'dsh': 'Science and Humanities',
196
[10304]197        }
198
[11591]199    STUDY_MODES_DICT = {
200        'ug_ft': 'Undergraduate Full Time',
201        'ug_pt': 'Undergraduate Part Time',
[11593]202        'de_ft': 'Direct Entry Full Time',
203        'de_pt': 'Direct Entry Part Time',
[11591]204        'dp_pt': 'Diploma Part Time',
205        'dp_ft': 'Diploma Full Time',
[13524]206        'special_pg_ft': 'Postgraduate Full Time',
207        'special_pg_pt': 'Postgraduate Part Time',
[11591]208        'found': 'Foundation',
[13498]209        'transfer': 'Transfer',
[13749]210        'mug_ft': 'Undergraduate Full Time Merit List',
211        'mde_ft': 'Direct Entry Full Time Merit List',
[14339]212        'ijmbe': 'IJMBE Preparation',
[15217]213        'bridge': 'Bridge',
[15382]214        'ug_dsh': 'Undergraduate Science and Humanities',
215        'de_dsh': 'Direct Entry Science and Humanities',
[11591]216        }
217
[14700]218    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
219
[13127]220    VERDICTS_DICT = {
221        '0': 'not yet',
222        'A': 'Successful student',
223        'B': 'Student with carryover courses',
224        'C': 'Student on probation',
[14475]225        'D': 'Withdrawn from the faculty',
[13127]226        #'E': 'Student who were previously on probation',
227        #'F': 'Medical case',
228        #'G': 'Absent from examination',
229        #'H': 'Withheld results',
230        #'I': 'Expelled/rusticated/suspended student',
231        #'J': 'Temporary withdrawn from the university',
232        #'K': 'Unregistered student',
233        #'L': 'Referred student',
234        #'M': 'Reinstatement',
235        #'N': 'Student on transfer',
236        #'O': 'NCE-III repeater',
237        #'Y': 'No previous verdict',
238        #'X': 'New 300 level student',
239        'Z': 'Successful student (provisional)',
240        #'A1': 'First Class',
241        #'A2': 'Second Class Upper',
242        #'A3': 'Second Class Lower',
243        #'A4': 'Third Class',
244        #'A5': 'Pass',
245        #'A6': 'Distinction',
246        #'A7': 'Credit',
247        #'A8': 'Merit',
[14487]248        'NER': 'No evidence of registration',
249        'NYV': 'Not yet verified',
[13127]250        'FRNS': 'Faculty requirements not satisfied',
251        }
[13454]252
253    DISABLE_PAYMENT_GROUP_DICT = {
254        'sf_all': 'School Fee - All Students',
[14246]255        'sf_pg': 'School Fee - Postgraduate Students',
[14571]256        'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students',
[14246]257        'sf_found': 'School Fee - Foundation Students',
[13454]258        'maint_all': 'Accommodation Fee - All Students',
[13794]259        'cl_regular': 'Acceptance Fee - Regular Students',
[13454]260        }
[13870]261
262    MODE_GROUPS = {
263        'All': ('all',),
264        'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'),
265        'Undergraduate Part-Time': ('ug_pt', 'de_pt'),
266        'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'),
267        'Foundation Programme': ('found',),
268        'Institute of Education': ('dp_ft'),
[15242]269        'IJMBE Preparation': ('ijmbe',),
270        'Bridge': ('bridge',),
[13870]271        }
[13963]272
[15431]273    #: Maximum number of files listed in `finished` subfolder
274    MAX_FILES = 5000
275
[13963]276    def fullname(self, firstname, lastname, middlename=None):
277        """Construct fullname.
278        """
279        try:
280            lastname = lastname.upper()
281        except AttributeError:
282            pass
[14594]283        # We remove single initial
284        if firstname and len(firstname) == 1:
285            firstname = ''
286        if middlename and len(middlename) == 1:
287            middlename = ''
288        if lastname and len(lastname) == 1:
289            lastname = ''
290        # We construct givennames
291        givennames = ''
292        if middlename and firstname:
[13963]293            givennames = '%s %s' % (firstname, middlename)
[14594]294        elif firstname:
295            givennames = firstname
296        elif middlename:
297            givennames = middlename
[13963]298        givennames = string.capwords(
299            givennames.replace('-', ' - ')).replace(' - ', '-')
[14594]300        # We construct fullname
301        fullname = ''
302        if lastname and givennames:
303            fullname = '%s, %s' % (lastname, givennames)
304        elif lastname:
305            fullname = lastname
306        elif givennames:
307            fullname = givennames
[13963]308        if '<' in fullname:
309            return 'XXX'
310        return fullname
Note: See TracBrowser for help on using the repository browser.