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

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

Change payment categories.

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