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

Last change on this file since 18337 was 18337, checked in by Henrik Bettermann, 2 months ago

Implement pg application.

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