source: main/kofacustom.unidel/trunk/src/kofacustom/unidel/utils/utils.py @ 18362

Last change on this file since 18362 was 18362, checked in by Henrik Bettermann, 3 weeks ago

New payment category.

  • Property svn:keywords set to Id
File size: 7.8 KB
RevLine 
[16717]1## $Id: utils.py 18362 2026-11-13 08:43:06Z henrik $
[15614]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##
18"""Customize general helper utilities for Kofa.
19"""
[18317]20import string
[16870]21from copy import deepcopy
[15614]22from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
23
24class CustomKofaUtils(NigeriaKofaUtils):
25    """A collection of methods subject to customization.
26    """
27
[16870]28    PAYMENT_CATEGORIES = {
29        'schoolfee': 'School Fee',
30        'clearance': 'Acceptance Fee',
[16882]31        'bed_allocation': 'Bed Reservation',
[16894]32        'hostel_maintenance': 'Hostel Fee',
[16870]33        #'transfer': 'Transfer Fee',
34        #'gown': 'Gown Hire Fee',
35        'application': 'Application Fee',
36        #'app_balance': 'Application Fee Balance',
[17891]37        'transcript': 'Transcript Fee',
[17894]38        'transcript_student': 'Transcript Fee Students Copy',
39        'transcript_local': 'Transcript Fee Local Copy',
40        'transcript_inter': 'Transcript Fee International Copy',
[18354]41        'late_registration': 'Late Course Registration Fee',
[16870]42        #'combi': 'Combi Payment',
[17328]43        'med_reg':'Medical Registration Fee',
[17698]44        'teaching_practice':'Teaching Practice Fee',
[17839]45        'ijmb_exam':'IJMB Examination Fees',
[17934]46        'union': 'Student Union Due',
[18046]47        'siwes': 'SIWES',
[18143]48        'trcn_nce': 'NCE TRCN Induction / License Fees',
49        'trcn_degree': 'DEGREE TRCN Induction / License Fees',
[18208]50        'twohundred_ced': 'CED Registration Fee (200 Level)',
51        'threehundred_ced': 'CED Registration Fee (300 Level)',
[18242]52        'convocation': 'Convocation Fee',
[18289]53        'plagtest':   'Turnitin Plagiarism Checker',
[18271]54        'plagtest_2': 'Turnitin Plagiarism Checker 2',
55        'plagtest_3': 'Turnitin Plagiarism Checker 3',
56        'plagtest_4': 'Turnitin Plagiarism Checker 4',
57        'plagtest_5': 'Turnitin Plagiarism Checker 5',
[18287]58        'plagtest_6': 'Turnitin Plagiarism Checker 6',
59        'plagtest_7': 'Turnitin Plagiarism Checker 7',
60        'plagtest_8': 'Turnitin Plagiarism Checker 8',
61        'plagtest_9': 'Turnitin Plagiarism Checker 9',
62        'plagtest_10': 'Turnitin Plagiarism Checker 10',
63        'plagtest_11': 'Turnitin Plagiarism Checker 11',
64        'plagtest_12': 'Turnitin Plagiarism Checker 12',
65        'plagtest_13': 'Turnitin Plagiarism Checker 13',
66        'plagtest_14': 'Turnitin Plagiarism Checker 14',
67        'plagtest_15': 'Turnitin Plagiarism Checker 15',
68        'plagtest_16': 'Turnitin Plagiarism Checker 16',
69        'plagtest_17': 'Turnitin Plagiarism Checker 17',
70        'plagtest_18': 'Turnitin Plagiarism Checker 18',
71        'plagtest_19': 'Turnitin Plagiarism Checker 19',
[18282]72        'dsb': 'Digital Skills Training Fee',
[18362]73        'grad_clear':'Grad. Students Clearance Processsing Charges',
[16870]74        }
75
76    SELECTABLE_PAYMENT_CATEGORIES = {
77        'schoolfee': 'School Fee',
78        'clearance': 'Acceptance Fee',
[16890]79        #'bed_allocation': 'Bed Reservation (free of charge)',
[18354]80        'late_registration': 'Late Course Registration Fee',
[16894]81        'hostel_maintenance': 'Hostel Fee',
[17328]82        'med_reg':'Medical Registration Fee',
[17698]83        'teaching_practice':'Teaching Practice Fee',
[17839]84        'ijmb_exam':'IJMB Examination Fees',
[17894]85        #'transcript': 'Transcript Fee',
86        'transcript_student': 'Transcript Fee Students Copy',
87        'transcript_local': 'Transcript Fee Local Copy',
88        'transcript_inter': 'Transcript Fee International Copy',
[18046]89        'siwes': 'SIWES',
[17935]90        #'union': 'Student Union Due',
[18143]91        'trcn_nce': 'NCE TRCN Induction / License Fees',
92        'trcn_degree': 'DEGREE TRCN Induction / License Fees',
[18208]93        'twohundred_ced': 'CED Registration Fee (200 Level)',
94        'threehundred_ced': 'CED Registration Fee (300 Level)',
[18242]95        'convocation': 'Convocation Fee',
[18288]96        'plagtest':   'Turnitin Plagiarism Checker',
[18282]97        'dsb': 'Digital Skills Training Fee',
[18362]98        'grad_clear':'Grad. Students Clearance Processsing Charges',
[16870]99        }
100
101    def selectable_payment_categories(self, student):
102        return self.SELECTABLE_PAYMENT_CATEGORIES
103
104    PREVIOUS_PAYMENT_CATEGORIES = deepcopy(SELECTABLE_PAYMENT_CATEGORIES)
105
[17598]106    DISABLE_PAYMENT_GROUP_DICT = {
107        'sf_all':    'School Fee - All',
108        'sf_ugft':   'School Fee - Undergraduate Full-Time',
109        }
110
[16953]111    COURSE_CATEGORY_DICT = {
112        'C':'Core Course (C)',
113        'R':'Required Courses (R)',
114        'E':'Elective Courses (E)',
115        }
[17056]116       
117    STUDY_MODES_DICT = {
[17129]118        'ug_ft': 'Undergraduate Full-Time',
[17204]119        'ug_pt': 'Undergraduate Part-Time',
[17056]120        'found': 'Foundation',
[17116]121        'dp_ft': 'Full-Time Diploma Programmes',
122        'dp_pt': 'Part-Time Diploma Programmes',
[17128]123        'de_ft': 'Direct Entry Full-Time Programmes',
[17347]124        'nce_ft': 'NCE Full-Time',
125        'nce_pt': 'NCE Part-Time',
[17949]126        'pde': 'Professional Diploma in Education Programmes',
[17952]127        'trc': 'TRCN Programmes',
[18282]128        'dsb': 'Digital Skill Boulevard Certificate Programmes',
[18337]129        'pg_ft': 'Postgraduate Full-Time',
130        'pg_pt': 'Postgraduate Part-Time',
[17056]131        }
[16953]132
[18313]133    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
134
[17062]135    APP_CATS_DICT = {
[17124]136        'basic': 'UAS, PUTME, PCE, PRENCE',
137        'basic_de': 'UAS, PUTME, PUDE, PCE, PRENCE',
[17062]138        'no': 'No Application',
[17278]139        'pre': 'Pre-Degree Programmes',
140        'jupeb': 'JUPEB Pre-Degree (Foundation) Programmes',
141        'ijmb': 'IJMB Foundation School Programmes',
[17115]142        'dp_ft': 'Full-Time Diploma Programmes',
143        'dp_pt': 'Part-Time Diploma Programmes',
[17204]144        'ug_pt': 'Undergraduate Part-Time Programmes',
[17506]145        'df': 'Digital Forensic for Professionals and Academia',
[17554]146        'law': 'Certificate in Law Programme',
[17949]147        'pde': 'Professional Diploma in Education Programmes',
[17952]148        'trcdeg': 'TRCN Degree Programmes',
149        'trcnce': 'TRCN NCE Programmes',
[18282]150        'dsb': 'Digital Skill Boulevard Certificate Programmes',
[18337]151        'pg_ft': 'Full-Time Postgraduate Programmes',
152        'pg_pt': 'Part-Time Postgraduate Programmes',
[17062]153        }
154
[17304]155    SPECIAL_HANDLING_DICT = {
156        'regular': 'Regular Hostel',
157        'blocked': 'Blocked Hostel',
158        'oyibu': 'Owa-Oyibu Campus Hostel',
159        'alero': 'Owa-Alero Campus Hostel',
160        }
[18317]161
162    def fullname(self, firstname, lastname, middlename=None):
163        """Construct fullname.
164        """
165        try:
166            lastname = lastname.upper()
167        except AttributeError:
168            pass
169        # We remove single initial
170        if firstname and len(firstname) == 1:
171            firstname = ''
172        if middlename and len(middlename) == 1:
173            middlename = ''
174        if lastname and len(lastname) == 1:
175            lastname = ''
176        # We construct givennames
177        givennames = ''
178        if middlename and firstname:
179            givennames = '%s %s' % (firstname, middlename)
180        elif firstname:
181            givennames = firstname
182        elif middlename:
183            givennames = middlename
184        givennames = string.capwords(
185            givennames.replace('-', ' - ')).replace(' - ', '-')
186        # We construct fullname
187        fullname = ''
188        if lastname and givennames:
189            fullname = '%s, %s' % (lastname, givennames)
190        elif lastname:
191            fullname = lastname
192        elif givennames:
193            fullname = givennames
194        if '<' in fullname:
195            return 'XXX'
196        return fullname
Note: See TracBrowser for help on using the repository browser.