source: main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py @ 16166

Last change on this file since 16166 was 16124, checked in by Henrik Bettermann, 5 years ago

Change sports and library fee options again.

  • Property svn:keywords set to Id
File size: 13.4 KB
Line 
1## $Id: utils.py 16124 2020-06-22 11:24: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"""
20
21import string
22import grok
23from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
24from waeup.kofa.students.workflow  import ALUMNI_STATES
25
26class CustomKofaUtils(NigeriaKofaUtils):
27    """A collection of methods subject to customization.
28    """
29
30    PREFERRED_LANGUAGES_DICT = {
31        }
32
33    COURSE_CATEGORY_DICT = {
34        'C':'Core Course (C)',
35        'R':'Required Courses (R)',
36        'E':'Elective Courses (E)',
37        }
38
39    PAYMENT_CATEGORIES = {
40        'schoolfee': 'School Fee',
41        'schoolfee_1': 'School Fee Plus (1st instalment)',
42        'schoolfee_2': 'School Fee (2nd instalment)',
43        'schoolfee_incl': 'School Fee Plus',
44        'clearance': 'Acceptance Fee',
45        'clearance_incl': 'Acceptance Fee Plus',
46        'hostel_maintenance': 'Hostel Accommodation Fee',
47        'application': 'Application Fee',
48        'app_balance': 'Application Fee Balance',
49        'bed_allocation': 'Bed Allocation Fee',
50        'transfer': 'Transfer Fee',
51        'transcript_local': 'Local Transcript Fee',
52        'transcript_inter': 'International Transcript Fee',
53        'late_registration': 'Late Course Registration Fee',
54        'welfare': 'Student Welfare Assurance Fee',
55        'union': 'Student Union Dues',
56        'lapel': 'Lapel/File Fee',
57        'matric_gown': 'Matriculation Gown Fee',
58        'concessional': 'Concessional Fee',
59        'id_card': 'Student ID Card',
60        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
61        'gst_text_book_1': 'Text Book Fee GST101 GST102',
62        'gst_text_book_2': 'Text Book Fee GST111 GST112',
63        'gst_text_book_3': 'Text Book Fee GST222',
64        'ent_text_book_1': 'Text Book Fee ENT201',
65        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
66        'gst_registration_2': 'Registration Fee GST222',
67        'ent_registration_1': 'Registration Fee ENT201',
68        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
69        'restitution': 'Restitution Fee',
70        'sports': 'Sports Fee',
71        'library': 'UG Library Fee',
72        'library_pg': 'PG Library Fee',
73        'sports_library': 'Sports Development and Library Fee',
74        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
75        'lab_2': 'Laboratory Due (BIO101/BIO111)',
76        }
77
78    SELECTABLE_PAYMENT_CATEGORIES = {
79        'schoolfee': 'School Fee without additional fees',
80        'schoolfee_1': 'School Fee (1st instalment) incl. additional fees',
81        'schoolfee_2': 'School Fee (2nd instalment)',
82        'schoolfee_incl': 'School Fee incl. additional fees',
83        'clearance': 'Acceptance Fee without additional fees',
84        'clearance_incl': 'Acceptance Fee incl. additional fees',
85        'hostel_maintenance': 'Hostel Accommodation Fee',
86        #'application': 'Application Fee',
87        #'bed_allocation': 'Bed Allocation Fee',
88        #'transfer': 'Transfer Fee',
89        'transcript_local': 'Local Transcript Fee',
90        'transcript_inter': 'International Transcript Fee',
91        'late_registration': 'Late Course Registration Fee',
92        #'welfare': 'Student Welfare Assurance Fee',
93        #'union': 'Student Union Dues',
94        #'lapel': 'Lapel/File Fee',
95        #'matric_gown': 'Matriculation Gown Fee',
96        'concessional': 'Concessional Fee',
97        #'id_card': 'Student ID Card',
98        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
99        'gst_text_book_1': 'Text Book Fee GST101 GST102',
100        'gst_text_book_2': 'Text Book Fee GST111 GST112',
101        'gst_text_book_3': 'Text Book Fee GST222',
102        'ent_text_book_1': 'Text Book Fee ENT201',
103        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
104        'gst_registration_2': 'Registration Fee GST222',
105        'ent_registration_1': 'Registration Fee ENT201',
106        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
107        'restitution': 'Restitution Fee',
108        'sports': 'Sports Fee',
109        'library': 'UG Library Fee',
110        'library_pg': 'PG Library Fee',
111        'sports_library': 'Sports Development and Library Fee',
112        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
113        'lab_2': 'Laboratory Due (BIO101/BIO111)',
114        }
115
116    ALUMNI_PAYMENT_CATS =  {
117        'transcript_local': 'Transcript Fee Local',
118        'transcript_inter': 'Transcript Fee International',
119        }
120
121    REDUCED_PAYMENT_CATS =  {
122        'clearance': 'Acceptance Fee',
123        'schoolfee': 'School Fee',
124        'late_registration': 'Late Course Registration Fee',
125        'sports': 'Sports Fee',
126        'library': 'UG Library Fee',
127        'library_pg': 'PG Library Fee',
128        'sports_library': 'Sports Development and Library Fee',
129        }
130
131    IJMBE_PAYMENT_CATS =  {
132        'clearance': 'Acceptance Fee',
133        'schoolfee': 'School Fee',
134        'schoolfee_1': 'School Fee (1st instalment)',
135        'schoolfee_2': 'School Fee (2nd instalment)',
136        'sports': 'Sports Fee',
137        'library': 'UG Library Fee',
138        'library_pg': 'PG Library Fee',
139        'sports_library': 'Sports Development and Library Fee',
140        }
141
142    PT_AND_DSH_PAYMENT_CATS =  {
143        'clearance_incl': 'Acceptance Fee Plus',
144        'schoolfee_incl': 'School Fee Plus',
145        'ent_registration_1': 'Registration Fee ENT201',
146        'ent_text_book_1': 'Text Book Fee ENT201',
147        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
148        'gst_registration_2': 'Registration Fee GST222',
149        'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
150        'gst_text_book_1': 'Text Book Fee GST101 GST102',
151        'gst_text_book_2': 'Text Book Fee GST111 GST112',
152        'gst_text_book_3': 'Text Book Fee GST222',
153        'late_registration': 'Late Course Registration Fee',
154        'sports': 'Sports Fee',
155        'library': 'UG Library Fee',
156        'library_pg': 'PG Library Fee',
157        'sports_library': 'Sports Development and Library Fee',
158        'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
159        'lab_2': 'Laboratory Due (BIO101/BIO111)',
160        }
161
162    def selectable_payment_categories(self, student):
163        if student.state in ALUMNI_STATES:
164            return self.ALUMNI_PAYMENT_CATS
165        if student.current_mode in (
166            'special_pg_ft', 'special_pg_pt', 'found', 'bridge'):
167            return self.REDUCED_PAYMENT_CATS
168        if student.current_mode in (
169            'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
170            return self.PT_AND_DSH_PAYMENT_CATS
171        if student.current_mode == 'ijmbe':
172            return self.IJMBE_PAYMENT_CATS
173        return self.SELECTABLE_PAYMENT_CATEGORIES
174
175    REPORTABLE_PAYMENT_CATEGORIES = {
176        'schoolfee': 'School Fee',
177        'schoolfee_incl': 'School Fee Plus',
178        'schoolfee_1': 'School Fee 1 Plus',
179        'schoolfee_2': 'School Fee 2',
180        'clearance': 'Acceptance Fee',
181        'clearance_incl': 'Acceptance Fee Plus',
182        'hostel_maintenance': 'Hostel Maintenance Fee',
183        }
184
185    BALANCE_PAYMENT_CATEGORIES = {
186        'schoolfee': 'School Fee',
187        'clearance': 'Acceptance Fee',
188        'hostel_maintenance': 'Hostel Maintenance Fee',
189        'late_registration': 'Late Course Registration Fee',
190        'welfare': 'Student Welfare Assurance Fee',
191        'union': 'Student Union Dues',
192        'lapel': 'Lapel/File Fee',
193        'matric_gown': 'Matriculation Gown Fee',
194        'id_card': 'Student ID Card',
195        'gst_text_book_1': 'Text Book Fee GST101 GST102',
196        'gst_text_book_2': 'Text Book Fee GST111 GST112',
197        'gst_text_book_3': 'Text Book Fee GST222',
198        'ent_text_book_1': 'Text Book Fee ENT201',
199        'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
200        'gst_registration_2': 'Registration Fee GST222',
201        'ent_registration_1': 'Registration Fee ENT201',
202        'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
203        'restitution': 'Restitution Fee',
204        }
205
206    PREVIOUS_PAYMENT_CATEGORIES = {
207        'schoolfee': 'School Fee',
208        'clearance': 'Acceptance Fee',
209        }
210
211    APP_CATS_DICT = {
212        'basic': 'PUTME, PUDE, PCE, PRENCE',
213        'no': 'No Application',
214        'pg_ft': 'Postgraduate Full-Time',
215        'pg_pt': 'Postgraduate Part-Time',
216        'cest': 'Part-Time, Diploma, Certificate',
217        'found': 'Foundation',
218        'ptee': 'Part-Time Entrance Examination',
219        'ioe_dp': 'Institute of Education Diploma',
220        'ijmbe': 'IJMBE Preparation',
221        'bridge': 'Bridge',
222        'dsh': 'Science and Humanities',
223
224        }
225
226    STUDY_MODES_DICT = {
227        'ug_ft': 'Undergraduate Full Time',
228        'ug_pt': 'Undergraduate Part Time',
229        'de_ft': 'Direct Entry Full Time',
230        'de_pt': 'Direct Entry Part Time',
231        'dp_pt': 'Diploma Part Time',
232        'dp_ft': 'Diploma Full Time',
233        'special_pg_ft': 'Postgraduate Full Time',
234        'special_pg_pt': 'Postgraduate Part Time',
235        'found': 'Foundation',
236        'transfer': 'Transfer',
237        'mug_ft': 'Undergraduate Full Time Merit List',
238        'mde_ft': 'Direct Entry Full Time Merit List',
239        'ijmbe': 'IJMBE Preparation',
240        'bridge': 'Bridge',
241        'ug_dsh': 'Undergraduate Science and Humanities',
242        'de_dsh': 'Direct Entry Science and Humanities',
243        }
244
245    ENABLE_SCORE_EDITING_GROUP_DICT = STUDY_MODES_DICT
246
247    VERDICTS_DICT = {
248        '0': 'not yet',
249        'A': 'Successful student',
250        'B': 'Student with carryover courses',
251        'C': 'Student on probation',
252        'D': 'Withdrawn from the faculty',
253        #'E': 'Student who were previously on probation',
254        #'F': 'Medical case',
255        #'G': 'Absent from examination',
256        #'H': 'Withheld results',
257        #'I': 'Expelled/rusticated/suspended student',
258        #'J': 'Temporary withdrawn from the university',
259        #'K': 'Unregistered student',
260        #'L': 'Referred student',
261        #'M': 'Reinstatement',
262        #'N': 'Student on transfer',
263        #'O': 'NCE-III repeater',
264        #'Y': 'No previous verdict',
265        #'X': 'New 300 level student',
266        'Z': 'Successful student (provisional)',
267        #'A1': 'First Class',
268        #'A2': 'Second Class Upper',
269        #'A3': 'Second Class Lower',
270        #'A4': 'Third Class',
271        #'A5': 'Pass',
272        #'A6': 'Distinction',
273        #'A7': 'Credit',
274        #'A8': 'Merit',
275        'NER': 'No evidence of registration',
276        'NYV': 'Not yet verified',
277        'FRNS': 'Faculty requirements not satisfied',
278        }
279
280    DISABLE_PAYMENT_GROUP_DICT = {
281        'sf_all': 'School Fee - All Students',
282        'sf_pg': 'School Fee - Postgraduate Students',
283        'sf_ug_pt': 'School Fee - Undergraduate Part-Time Students',
284        'sf_found': 'School Fee - Foundation Students',
285        'maint_all': 'Accommodation Fee - All Students',
286        'cl_regular': 'Acceptance Fee - Regular Students',
287        }
288
289    MODE_GROUPS = {
290        'All': ('all',),
291        'Undergraduate Full-Time': ('ug_ft', 'mde_ft', 'mug_ft', 'de_ft'),
292        'Undergraduate Part-Time': ('ug_pt', 'de_pt'),
293        'Postgraduate': ('pg_ft','special_pg_ft', 'special_pg_pt'),
294        'Foundation Programme': ('found',),
295        'Institute of Education': ('dp_ft'),
296        'IJMBE Preparation': ('ijmbe',),
297        'Bridge': ('bridge',),
298        }
299
300    #: Maximum number of files listed in `finished` subfolder
301    MAX_FILES = 5000
302
303    def fullname(self, firstname, lastname, middlename=None):
304        """Construct fullname.
305        """
306        try:
307            lastname = lastname.upper()
308        except AttributeError:
309            pass
310        # We remove single initial
311        if firstname and len(firstname) == 1:
312            firstname = ''
313        if middlename and len(middlename) == 1:
314            middlename = ''
315        if lastname and len(lastname) == 1:
316            lastname = ''
317        # We construct givennames
318        givennames = ''
319        if middlename and firstname:
320            givennames = '%s %s' % (firstname, middlename)
321        elif firstname:
322            givennames = firstname
323        elif middlename:
324            givennames = middlename
325        givennames = string.capwords(
326            givennames.replace('-', ' - ')).replace(' - ', '-')
327        # We construct fullname
328        fullname = ''
329        if lastname and givennames:
330            fullname = '%s, %s' % (lastname, givennames)
331        elif lastname:
332            fullname = lastname
333        elif givennames:
334            fullname = givennames
335        if '<' in fullname:
336            return 'XXX'
337        return fullname
338
339    def getUsers(self):
340        users = sorted(
341            grok.getSite()['users'].items(), key=lambda x: x[0])
342        for key, val in users:
343            yield(dict(name=key, val="%s - %s" % (val.name, val.title)))
Note: See TracBrowser for help on using the repository browser.