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

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

Add ICT Fee.

  • Property svn:keywords set to Id
File size: 12.0 KB
RevLine 
[7569]1## $Id: utils.py 15745 2019-11-03 08:39:29Z 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',
[15745]67        'fac_dep': 'Faculty and Departmental Dues (incl. ICT Fee)',
[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',
[15745]99        'fac_dep': 'Faculty and Departmental Dues (incl. ICT Fee)',
[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',
132        }
133
[15433]134    def selectable_payment_categories(self, student):
[15451]135        if student.state in ALUMNI_STATES:
136            return self.ALUMNI_PAYMENT_CATS
137        if student.current_mode in (
138            'special_pg_ft', 'special_pg_pt', 'found', 'bridge'):
139            return self.REDUCED_PAYMENT_CATS
140        if student.current_mode in (
141            'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
142            return self.PT_AND_DSH_PAYMENT_CATS
143        if student.current_mode == 'ijmbe':
144            return self.IJMBE_PAYMENT_CATS
[15433]145        return self.SELECTABLE_PAYMENT_CATEGORIES
146
[13451]147    REPORTABLE_PAYMENT_CATEGORIES = {
148        'schoolfee': 'School Fee',
[13452]149        'schoolfee_incl': 'School Fee Plus',
[13635]150        'schoolfee_1': 'School Fee 1 Plus',
151        'schoolfee_2': 'School Fee 2',
[13451]152        'clearance': 'Acceptance Fee',
[13452]153        'clearance_incl': 'Acceptance Fee Plus',
[13451]154        'hostel_maintenance': 'Hostel Maintenance Fee',
155        }
156
[13638]157    BALANCE_PAYMENT_CATEGORIES = {
158        'schoolfee': 'School Fee',
159        'clearance': 'Acceptance Fee',
160        'hostel_maintenance': 'Hostel Maintenance Fee',
[13750]161        'late_registration': 'Late Course Registration Fee',
162        'welfare': 'Student Welfare Assurance Fee',
163        'union': 'Student Union Dues',
164        'lapel': 'Lapel/File Fee',
165        'matric_gown': 'Matriculation Gown Fee',
[14234]166        'id_card': 'Student ID Card',
[14258]167        'gst_text_book_1': 'Text Book Fee GST101 GST102',
168        'gst_text_book_2': 'Text Book Fee GST111 GST112',
169        'gst_text_book_3': 'Text Book Fee GST222',
[14621]170        'ent_text_book_1': 'Text Book Fee ENT201',
[14258]171        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
172        'gst_registration_2': 'Registration Fee GST222',
[14620]173        'ent_registration_1': 'Registration Fee ENT201',
[14248]174        'fac_dep': 'Faculty and Departmental Dues',
[14375]175        'restitution': 'Restitution Fee',
[13638]176        }
177
[14544]178    PREVIOUS_PAYMENT_CATEGORIES = {
179        'schoolfee': 'School Fee',
180        'clearance': 'Acceptance Fee',
181        }
182
[10304]183    APP_CATS_DICT = {
184        'basic': 'PUTME, PUDE, PCE, PRENCE',
185        'no': 'No Application',
186        'pg_ft': 'Postgraduate Full-Time',
187        'pg_pt': 'Postgraduate Part-Time',
188        'cest': 'Part-Time, Diploma, Certificate',
189        'found': 'Foundation',
[10893]190        'ptee': 'Part-Time Entrance Examination',
[13568]191        'ioe_dp': 'Institute of Education Diploma',
[14339]192        'ijmbe': 'IJMBE Preparation',
[15224]193        'bridge': 'Bridge',
[15385]194        'dsh': 'Science and Humanities',
195
[10304]196        }
197
[11591]198    STUDY_MODES_DICT = {
199        'ug_ft': 'Undergraduate Full Time',
200        'ug_pt': 'Undergraduate Part Time',
[11593]201        'de_ft': 'Direct Entry Full Time',
202        'de_pt': 'Direct Entry Part Time',
[11591]203        'dp_pt': 'Diploma Part Time',
204        'dp_ft': 'Diploma Full Time',
[13524]205        'special_pg_ft': 'Postgraduate Full Time',
206        'special_pg_pt': 'Postgraduate Part Time',
[11591]207        'found': 'Foundation',
[13498]208        'transfer': 'Transfer',
[13749]209        'mug_ft': 'Undergraduate Full Time Merit List',
210        'mde_ft': 'Direct Entry Full Time Merit List',
[14339]211        'ijmbe': 'IJMBE Preparation',
[15217]212        'bridge': 'Bridge',
[15382]213        'ug_dsh': 'Undergraduate Science and Humanities',
214        'de_dsh': 'Direct Entry Science and Humanities',
[11591]215        }
216
[14700]217    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
218
[13127]219    VERDICTS_DICT = {
220        '0': 'not yet',
221        'A': 'Successful student',
222        'B': 'Student with carryover courses',
223        'C': 'Student on probation',
[14475]224        'D': 'Withdrawn from the faculty',
[13127]225        #'E': 'Student who were previously on probation',
226        #'F': 'Medical case',
227        #'G': 'Absent from examination',
228        #'H': 'Withheld results',
229        #'I': 'Expelled/rusticated/suspended student',
230        #'J': 'Temporary withdrawn from the university',
231        #'K': 'Unregistered student',
232        #'L': 'Referred student',
233        #'M': 'Reinstatement',
234        #'N': 'Student on transfer',
235        #'O': 'NCE-III repeater',
236        #'Y': 'No previous verdict',
237        #'X': 'New 300 level student',
238        'Z': 'Successful student (provisional)',
239        #'A1': 'First Class',
240        #'A2': 'Second Class Upper',
241        #'A3': 'Second Class Lower',
242        #'A4': 'Third Class',
243        #'A5': 'Pass',
244        #'A6': 'Distinction',
245        #'A7': 'Credit',
246        #'A8': 'Merit',
[14487]247        'NER': 'No evidence of registration',
248        'NYV': 'Not yet verified',
[13127]249        'FRNS': 'Faculty requirements not satisfied',
250        }
[13454]251
252    DISABLE_PAYMENT_GROUP_DICT = {
253        'sf_all': 'School Fee - All Students',
[14246]254        'sf_pg': 'School Fee - Postgraduate Students',
[14571]255        'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students',
[14246]256        'sf_found': 'School Fee - Foundation Students',
[13454]257        'maint_all': 'Accommodation Fee - All Students',
[13794]258        'cl_regular': 'Acceptance Fee - Regular Students',
[13454]259        }
[13870]260
261    MODE_GROUPS = {
262        'All': ('all',),
263        'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'),
264        'Undergraduate Part-Time': ('ug_pt', 'de_pt'),
265        'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'),
266        'Foundation Programme': ('found',),
267        'Institute of Education': ('dp_ft'),
[15242]268        'IJMBE Preparation': ('ijmbe',),
269        'Bridge': ('bridge',),
[13870]270        }
[13963]271
[15431]272    #: Maximum number of files listed in `finished` subfolder
273    MAX_FILES = 5000
274
[13963]275    def fullname(self, firstname, lastname, middlename=None):
276        """Construct fullname.
277        """
278        try:
279            lastname = lastname.upper()
280        except AttributeError:
281            pass
[14594]282        # We remove single initial
283        if firstname and len(firstname) == 1:
284            firstname = ''
285        if middlename and len(middlename) == 1:
286            middlename = ''
287        if lastname and len(lastname) == 1:
288            lastname = ''
289        # We construct givennames
290        givennames = ''
291        if middlename and firstname:
[13963]292            givennames = '%s %s' % (firstname, middlename)
[14594]293        elif firstname:
294            givennames = firstname
295        elif middlename:
296            givennames = middlename
[13963]297        givennames = string.capwords(
298            givennames.replace('-', ' - ')).replace(' - ', '-')
[14594]299        # We construct fullname
300        fullname = ''
301        if lastname and givennames:
302            fullname = '%s, %s' % (lastname, givennames)
303        elif lastname:
304            fullname = lastname
305        elif givennames:
306            fullname = givennames
[13963]307        if '<' in fullname:
308            return 'XXX'
309        return fullname
Note: See TracBrowser for help on using the repository browser.