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

Last change on this file since 18365 was 18365, checked in by Henrik Bettermann, 3 days ago

Add payment categories.

  • Property svn:keywords set to Id
File size: 8.1 KB
Line 
1## $Id: utils.py 18365 2026-11-19 09:51:31Z 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        'marine_1': 'Marine Science Year 2 field trip charge (1 trip)',
75        'marine_2': 'Marine Science Year 3 field trip charge (Two trips) ',
76        }
77
78    SELECTABLE_PAYMENT_CATEGORIES = {
79        'schoolfee': 'School Fee',
80        'clearance': 'Acceptance Fee',
81        #'bed_allocation': 'Bed Reservation (free of charge)',
82        'late_registration': 'Late Course Registration Fee',
83        'hostel_maintenance': 'Hostel Fee',
84        'med_reg':'Medical Registration Fee',
85        'teaching_practice':'Teaching Practice Fee',
86        'ijmb_exam':'IJMB Examination Fees',
87        #'transcript': 'Transcript Fee',
88        'transcript_student': 'Transcript Fee Students Copy',
89        'transcript_local': 'Transcript Fee Local Copy',
90        'transcript_inter': 'Transcript Fee International Copy',
91        'siwes': 'SIWES',
92        #'union': 'Student Union Due',
93        'trcn_nce': 'NCE TRCN Induction / License Fees',
94        'trcn_degree': 'DEGREE TRCN Induction / License Fees',
95        'twohundred_ced': 'CED Registration Fee (200 Level)',
96        'threehundred_ced': 'CED Registration Fee (300 Level)',
97        'convocation': 'Convocation Fee',
98        'plagtest':   'Turnitin Plagiarism Checker',
99        'dsb': 'Digital Skills Training Fee',
100        'grad_clear':'Grad. Students Clearance Processsing Charges',
101        'marine_1': 'Marine Science Year 2 field trip charge (1 trip)',
102        'marine_2': 'Marine Science Year 3 field trip charge (Two trips) ',
103        }
104
105    def selectable_payment_categories(self, student):
106        return self.SELECTABLE_PAYMENT_CATEGORIES
107
108    PREVIOUS_PAYMENT_CATEGORIES = deepcopy(SELECTABLE_PAYMENT_CATEGORIES)
109
110    DISABLE_PAYMENT_GROUP_DICT = {
111        'sf_all':    'School Fee - All',
112        'sf_ugft':   'School Fee - Undergraduate Full-Time',
113        }
114
115    COURSE_CATEGORY_DICT = {
116        'C':'Core Course (C)',
117        'R':'Required Courses (R)',
118        'E':'Elective Courses (E)',
119        }
120       
121    STUDY_MODES_DICT = {
122        'ug_ft': 'Undergraduate Full-Time',
123        'ug_pt': 'Undergraduate Part-Time',
124        'found': 'Foundation',
125        'dp_ft': 'Full-Time Diploma Programmes',
126        'dp_pt': 'Part-Time Diploma Programmes',
127        'de_ft': 'Direct Entry Full-Time Programmes',
128        'nce_ft': 'NCE Full-Time',
129        'nce_pt': 'NCE Part-Time',
130        'pde': 'Professional Diploma in Education Programmes',
131        'trc': 'TRCN Programmes',
132        'dsb': 'Digital Skill Boulevard Certificate Programmes',
133        'pg_ft': 'Postgraduate Full-Time',
134        'pg_pt': 'Postgraduate Part-Time',
135        }
136
137    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
138
139    APP_CATS_DICT = {
140        'basic': 'UAS, PUTME, PCE, PRENCE',
141        'basic_de': 'UAS, PUTME, PUDE, PCE, PRENCE',
142        'no': 'No Application',
143        'pre': 'Pre-Degree Programmes',
144        'jupeb': 'JUPEB Pre-Degree (Foundation) Programmes',
145        'ijmb': 'IJMB Foundation School Programmes',
146        'dp_ft': 'Full-Time Diploma Programmes',
147        'dp_pt': 'Part-Time Diploma Programmes',
148        'ug_pt': 'Undergraduate Part-Time Programmes',
149        'df': 'Digital Forensic for Professionals and Academia',
150        'law': 'Certificate in Law Programme',
151        'pde': 'Professional Diploma in Education Programmes',
152        'trcdeg': 'TRCN Degree Programmes',
153        'trcnce': 'TRCN NCE Programmes',
154        'dsb': 'Digital Skill Boulevard Certificate Programmes',
155        'pg_ft': 'Full-Time Postgraduate Programmes',
156        'pg_pt': 'Part-Time Postgraduate Programmes',
157        }
158
159    SPECIAL_HANDLING_DICT = {
160        'regular': 'Regular Hostel',
161        'blocked': 'Blocked Hostel',
162        'oyibu': 'Owa-Oyibu Campus Hostel',
163        'alero': 'Owa-Alero Campus Hostel',
164        }
165
166    def fullname(self, firstname, lastname, middlename=None):
167        """Construct fullname.
168        """
169        try:
170            lastname = lastname.upper()
171        except AttributeError:
172            pass
173        # We remove single initial
174        if firstname and len(firstname) == 1:
175            firstname = ''
176        if middlename and len(middlename) == 1:
177            middlename = ''
178        if lastname and len(lastname) == 1:
179            lastname = ''
180        # We construct givennames
181        givennames = ''
182        if middlename and firstname:
183            givennames = '%s %s' % (firstname, middlename)
184        elif firstname:
185            givennames = firstname
186        elif middlename:
187            givennames = middlename
188        givennames = string.capwords(
189            givennames.replace('-', ' - ')).replace(' - ', '-')
190        # We construct fullname
191        fullname = ''
192        if lastname and givennames:
193            fullname = '%s, %s' % (lastname, givennames)
194        elif lastname:
195            fullname = lastname
196        elif givennames:
197            fullname = givennames
198        if '<' in fullname:
199            return 'XXX'
200        return fullname
Note: See TracBrowser for help on using the repository browser.