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, 10 days ago

New payment category.

  • Property svn:keywords set to Id
File size: 7.8 KB
Line 
1## $Id: utils.py 18362 2026-11-13 08:43:06Z 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##
18"""Customize general helper utilities for Kofa.
19"""
20import string
21from copy import deepcopy
22from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
23
24class CustomKofaUtils(NigeriaKofaUtils):
25    """A collection of methods subject to customization.
26    """
27
28    PAYMENT_CATEGORIES = {
29        'schoolfee': 'School Fee',
30        'clearance': 'Acceptance Fee',
31        'bed_allocation': 'Bed Reservation',
32        'hostel_maintenance': 'Hostel Fee',
33        #'transfer': 'Transfer Fee',
34        #'gown': 'Gown Hire Fee',
35        'application': 'Application Fee',
36        #'app_balance': 'Application Fee Balance',
37        'transcript': 'Transcript Fee',
38        'transcript_student': 'Transcript Fee Students Copy',
39        'transcript_local': 'Transcript Fee Local Copy',
40        'transcript_inter': 'Transcript Fee International Copy',
41        'late_registration': 'Late Course Registration Fee',
42        #'combi': 'Combi Payment',
43        'med_reg':'Medical Registration Fee',
44        'teaching_practice':'Teaching Practice Fee',
45        'ijmb_exam':'IJMB Examination Fees',
46        'union': 'Student Union Due',
47        'siwes': 'SIWES',
48        'trcn_nce': 'NCE TRCN Induction / License Fees',
49        'trcn_degree': 'DEGREE TRCN Induction / License Fees',
50        'twohundred_ced': 'CED Registration Fee (200 Level)',
51        'threehundred_ced': 'CED Registration Fee (300 Level)',
52        'convocation': 'Convocation Fee',
53        'plagtest':   'Turnitin Plagiarism Checker',
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',
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',
72        'dsb': 'Digital Skills Training Fee',
73        'grad_clear':'Grad. Students Clearance Processsing Charges',
74        }
75
76    SELECTABLE_PAYMENT_CATEGORIES = {
77        'schoolfee': 'School Fee',
78        'clearance': 'Acceptance Fee',
79        #'bed_allocation': 'Bed Reservation (free of charge)',
80        'late_registration': 'Late Course Registration Fee',
81        'hostel_maintenance': 'Hostel Fee',
82        'med_reg':'Medical Registration Fee',
83        'teaching_practice':'Teaching Practice Fee',
84        'ijmb_exam':'IJMB Examination Fees',
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',
89        'siwes': 'SIWES',
90        #'union': 'Student Union Due',
91        'trcn_nce': 'NCE TRCN Induction / License Fees',
92        'trcn_degree': 'DEGREE TRCN Induction / License Fees',
93        'twohundred_ced': 'CED Registration Fee (200 Level)',
94        'threehundred_ced': 'CED Registration Fee (300 Level)',
95        'convocation': 'Convocation Fee',
96        'plagtest':   'Turnitin Plagiarism Checker',
97        'dsb': 'Digital Skills Training Fee',
98        'grad_clear':'Grad. Students Clearance Processsing Charges',
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
106    DISABLE_PAYMENT_GROUP_DICT = {
107        'sf_all':    'School Fee - All',
108        'sf_ugft':   'School Fee - Undergraduate Full-Time',
109        }
110
111    COURSE_CATEGORY_DICT = {
112        'C':'Core Course (C)',
113        'R':'Required Courses (R)',
114        'E':'Elective Courses (E)',
115        }
116       
117    STUDY_MODES_DICT = {
118        'ug_ft': 'Undergraduate Full-Time',
119        'ug_pt': 'Undergraduate Part-Time',
120        'found': 'Foundation',
121        'dp_ft': 'Full-Time Diploma Programmes',
122        'dp_pt': 'Part-Time Diploma Programmes',
123        'de_ft': 'Direct Entry Full-Time Programmes',
124        'nce_ft': 'NCE Full-Time',
125        'nce_pt': 'NCE Part-Time',
126        'pde': 'Professional Diploma in Education Programmes',
127        'trc': 'TRCN Programmes',
128        'dsb': 'Digital Skill Boulevard Certificate Programmes',
129        'pg_ft': 'Postgraduate Full-Time',
130        'pg_pt': 'Postgraduate Part-Time',
131        }
132
133    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
134
135    APP_CATS_DICT = {
136        'basic': 'UAS, PUTME, PCE, PRENCE',
137        'basic_de': 'UAS, PUTME, PUDE, PCE, PRENCE',
138        'no': 'No Application',
139        'pre': 'Pre-Degree Programmes',
140        'jupeb': 'JUPEB Pre-Degree (Foundation) Programmes',
141        'ijmb': 'IJMB Foundation School Programmes',
142        'dp_ft': 'Full-Time Diploma Programmes',
143        'dp_pt': 'Part-Time Diploma Programmes',
144        'ug_pt': 'Undergraduate Part-Time Programmes',
145        'df': 'Digital Forensic for Professionals and Academia',
146        'law': 'Certificate in Law Programme',
147        'pde': 'Professional Diploma in Education Programmes',
148        'trcdeg': 'TRCN Degree Programmes',
149        'trcnce': 'TRCN NCE Programmes',
150        'dsb': 'Digital Skill Boulevard Certificate Programmes',
151        'pg_ft': 'Full-Time Postgraduate Programmes',
152        'pg_pt': 'Part-Time Postgraduate Programmes',
153        }
154
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        }
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.