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

Last change on this file since 15477 was 15465, checked in by Henrik Bettermann, 6 years ago

Include the late registration to PG payment category.

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