source: main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py @ 17963

Last change on this file since 17963 was 17963, checked in by Henrik Bettermann, 7 weeks ago

Let JUPEB students pay by instalments.

  • Property svn:keywords set to Id
File size: 10.7 KB
Line 
1## $Id: utils.py 17963 2024-11-26 02:34:19Z 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"""
20from copy import deepcopy
21from zope.security import checkPermission
22from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
23
24class CustomKofaUtils(NigeriaKofaUtils):
25    """A collection of methods subject to customization.
26    """
27
28    SYSTEM_MAX_LOAD = {
29        'swap-mem': None,
30        'virt-mem': 80.0,
31        'cpu-load': 100.0,
32        }
33
34    PREFERRED_LANGUAGES_DICT = {
35        }
36
37    APP_CATS_DICT = {
38        'basic': 'ASE, PUDE, PCE, PRENCE',
39        'no': 'No Application',
40        'sandwich': 'Sandwich',
41        'cest': 'Part-Time, Diploma, Certificate',
42        'dp_ft': 'Diploma Full-Time Programmes',
43        'dp': 'Diploma Programmes',
44        'pt_ext': 'Part-Time (extended application)',
45        'pg': 'Postgraduate (main advert)',
46        'coe': 'CoE Programmes',
47        'pgnils': 'Postgraduate NILS',
48        'spesse': 'SPESSE Programmes',
49        'pg_ft': 'Postgraduate Full-Time (deprecated)',
50        'pg_pt': 'Postgraduate Part-Time (deprecated)',
51        'pg_ext': 'Postgraduate (extended application, deprecated)',
52        'pg_new': 'Postgraduate (supplementary application #1, deprecated)',
53        'pg_new2': 'Postgraduate (supplementary application #2, deprecated)',
54        'pre': 'Pre-Degree Studies',
55        'asaba': 'FCE Asaba',
56        'akoka': 'FCE Akoka',
57        'akokaj': 'FCE Akoka JUPEB',
58        'special_ft': 'Special Full-Time',
59        'cdl': 'Center For Distance Learning',
60        'french': 'French Language Center',
61        }
62
63    # de modes are only used for entry_mode
64    MODE_GROUPS = {
65        'All':('all',),
66        'Undergraduate Full-Time':('ug_ft', 'special_ft'),
67        'Undergraduate Part-Time':('ug_pt'),
68        'Diploma/Certificate Full-Time':('dp_ft', 'ct_ft'),
69        'Diploma/Certificate Part-Time':('dp_pt', 'ct_pt'),
70        'Postgraduate Full-Time':('pg_ft', 'pgd_ft'),
71        'Postgraduate Part-Time':('pg_pt', 'special_pg_pt', 'pgd_pt'),
72        }
73
74    PAYMENT_CATEGORIES = {
75        'schoolfee': 'School Fee',
76        'schoolfee_1': 'School Fee (1st instalment)',
77        'secondinstall':'School Fee (2nd instalment)',
78        'clearance': 'Acceptance Fee',
79        'bed_allocation': 'Bed Allocation Fee',
80        #'hostel_application': 'Hostel Application Fee',
81        'hostel_maintenance': 'Hostel Maintenance Fee',
82        #'tempmaint_1': 'Hall 1-4 M/F Ekehuan',
83        #'tempmaint_2': 'Hall 5 M/F',
84        #'tempmaint_3': 'Clinical Hostel',
85        'transfer': 'Transfer Fee',
86        'gown': 'Gown Hire Fee',
87        'application': 'Application Fee',
88        'transcript': 'Transcript Fee',
89        'admission_checking': 'Admission Checking Fee',
90        'jupeb': 'JUPEB Examination Fee',
91        'registration': 'Total Registration Fee',
92        'clinexam':'Clinical Examination Fee',
93        #'pharmd_1':'Clerkship Fee',
94        'pharmd_2':'Module 1 Fee',
95        'develop':'Development Fee',
96        'carryover':'School Fee (carry over from previous sessions)',
97        'foreign':'School Fee (paid in foreign currency)',
98        'medical_quest':'Medical Questionnaire Fee',
99        'plag_test':'Final Year Plagiarism Test',
100        'flc_modules': 'FLC Modules Fee',
101        'medical_clearance': 'Medical Clearance Fee',
102        }
103
104    SELECTABLE_PAYMENT_CATEGORIES = {
105        'schoolfee': 'School Fee',
106        'clearance': 'Acceptance Fee',
107        'bed_allocation': 'Bed Allocation Fee',
108        #'hostel_application': 'Hostel Application Fee',
109        'hostel_maintenance': 'Hostel Maintenance Fee',
110        #'tempmaint_1': 'Hall 1-4 M/F Ekehuan Maintenance Fee',
111        #'tempmaint_2': 'Hall 5 M/F Maintenance Fee',
112        #'tempmaint_3': 'Clinical Hostel Maintenance Fee',
113        'gown': 'Gown Hire Fee',
114        'application': 'Application Fee',
115        'transcript': 'Transcript Fee',
116        'transfer': 'Transfer Fee',
117        'jupeb': 'JUPEB Examination Fee',
118        'clinexam':'Clinical Examination Fee',
119        #'pharmd_1':'PharmD Clerkship Fee (1st school fee prepayment)',
120        'pharmd_2':'PharmD Module 1 Fee (school fee prepayment)',
121        #'develop':'Development Fee',
122        'medical_quest':'Medical Questionnaire Fee',
123        'plag_test':'Final Year Plagiarism Test (for final year project or PG thesis)',
124        'flc_modules': 'FLC Modules Fee',
125        'medical_clearance': 'Medical Clearance Fee',
126        }
127
128    REPORTABLE_PAYMENT_CATEGORIES = {
129        'schoolfee': 'School Fee',
130        'schoolfee_1': 'School Fee (1st instalment)',
131        'secondinstall':'School Fee (2nd instalment)',
132        'clearance': 'Acceptance Fee',
133        'bed_allocation': 'Bed Allocation Fee',
134        'hostel_maintenance': 'Hostel Maintenance Fee',
135        'medical_quest':'Medical Questionnaire Fee',
136        }
137
138    def selectable_payment_categories(self, student):
139        spc = deepcopy(self.SELECTABLE_PAYMENT_CATEGORIES)
140        if student.is_jupeb:
141            spc[schoolfee_1] =  'School Fee (1st instalment)'
142            spc[secondinstal] = 'School Fee (2nd instalment)'
143        return spc
144
145    PREVIOUS_PAYMENT_CATEGORIES = deepcopy(SELECTABLE_PAYMENT_CATEGORIES)
146
147    DISABLE_PAYMENT_GROUP_DICT = {
148        'sf_all':    'School Fee - All',
149        'sf_found':  'School Fee - Foundation',
150        'sf_pg':     'School Fee - PG',
151        'sf_pt':     'School Fee - UG PT',
152        'sf_ft':     'School Fee - UG FT',
153        'sf_sw':     'School Fee - Sandwich',
154        'sf_dp':     'School Fee - Diploma',
155        'sf_return': 'School Fee - Returning',
156        'maint_all': 'Accomm. Fee - All',
157        'cl_all':    'Accept. Fee - All',
158        'cl_jupeb':  'Accept. Fee - JUPEB',
159        'cl_allexj': 'Accept. Fee - All except JUPEB',
160        }
161
162    SEMESTER_DICT = {
163        1: '1st Semester',
164        2: '2nd Semester',
165        3: 'Combined',
166        4: '1st Term',
167        5: '2nd Term',
168        6: '3rd Term',
169        9: 'N/A',
170        11: 'Module I',
171        12: 'Module II',
172        13: 'Module III',
173        }
174
175    BALANCE_PAYMENT_CATEGORIES = {
176        'schoolfee': 'School Fee',
177        'clearance': 'Clearance Fee',
178        'hostel_maintenance': 'Hostel Maintenance Fee',
179        'bed_allocation': 'Bed Allocation Fee',
180        'carryover':'School Fee (carry over from previous sessions)',
181        'foreign':'School Fee (paid in foreign currency)',
182        'flc_modules': 'FLC Modules Fee',
183        }
184
185    EXAM_GRADES = NigeriaKofaUtils.EXAM_GRADES + (('B1', 'B1'), ('P', 'P'),)
186
187    SPECIAL_HANDLING_DICT = {
188        'regular': 'Regular Hostel',
189        'blocked': 'Blocked Hostel',
190        'clinical': 'Clinical Hostel',
191        'ekenwan': 'Ekenwan Campus',
192        'pg': 'Postgraduate Hostel',
193        }
194
195    STUDY_MODES_DICT = {
196        'ume_ft': 'UME Full-Time',
197        'ug_ft': 'Undergraduate Full-Time',
198        'ug_pt': 'Undergraduate Part-Time',
199        'dp_pt': 'Diploma Part-Time',
200        'ct_ft': 'Certificate Full-Time',
201        'dp_ft': 'Diploma Full-Time',
202        'de_ft': 'Direct Entry Full-Time',
203        'de_pt': 'Direct Entry Part-Time',
204        'pg_ft': 'Postgraduate Full-Time',
205        'pg_pt': 'Postgraduate Part-Time',
206        'pgd_ft': 'Postgraduate Diploma Full-Time',
207        'pgd_pt': 'Postgraduate Diploma Part-Time',
208        'special_pg_pt': 'Special Postgraduate Part-Time',
209        'ug_sw': 'Undergraduate Sandwich',
210        'transfer_pt': 'Transfer Part-Time',
211        'transfer_ft': 'Transfer Full-Time',
212        'ct_pt': 'Certificate Part-Time',
213        'transfer': 'Transfer',
214        'transferred': 'Transferred',
215        'found': 'Foundation',
216        'no': 'no application',
217        'special_ft': 'Special Full-Time',
218        'cdl': 'Open & Distance Learning',
219        }
220
221    def sortCertificates(self, context, resultset):
222        """Sort already filtered certificates in `CertificateSource`.
223        """
224        resultlist = sorted(resultset, key=lambda
225            value: value.__parent__.__parent__.__parent__.code +
226            value.__parent__.__parent__.code +
227            value.code)
228        return resultlist
229
230    def getCertTitle(self, context, value):
231        """Compose the titles in `CertificateSource`.
232        """
233        try: title = "%s / %s / %s (%s)" % (
234            value.__parent__.__parent__.__parent__.title,
235            value.__parent__.__parent__.title,
236            value.title, value.code)
237        except AttributeError:
238            title = "NA / %s (%s)" % (value.title, value.code)
239        return title
240
241    def collect_exporters(self, context):
242        # Used for `ExportJobContainerJobConfig`.
243        # We provide all student exporters, nothing else, yet.
244        # Bursary, Department or Accommodation Officers don't
245        # have the general exportData
246        # permission and are only allowed to export bursary, payments
247        # overview or accommodation data respectively.
248        # This is the only place where waeup.exportAccommodationData,
249        # waeup.exportBursaryData and waeup.exportPaymentsOverview
250        # are used.
251        # Uniben: Add NYSC Officers.
252        exporters = []
253        if not checkPermission('waeup.exportData', context):
254            if checkPermission('waeup.exportBursaryData', context):
255                exporters += [('Bursary Data', 'bursary'),
256                              ('School Fee Payments Overview',
257                               'sfpaymentsoverview'),
258                              ('Session Payments Overview',
259                               'sessionpaymentsoverview')]
260            if checkPermission('waeup.exportPaymentsOverview', context):
261                exporters += [('School Fee Payments Overview',
262                               'sfpaymentsoverview'),
263                              ('Session Payments Overview',
264                               'sessionpaymentsoverview')]
265            if checkPermission('waeup.exportAccommodationData', context):
266                exporters += [('Bed Tickets', 'bedtickets'),
267                              ('Accommodation Payments',
268                               'accommodationpayments')]
269            if checkPermission('waeup.exportNYSCData', context):
270                exporters += [('NYSC Indication', 'nysc'),]
271            return exporters
272
Note: See TracBrowser for help on using the repository browser.