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

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

Configure fab_lab fee.

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