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

Last change on this file since 16742 was 16669, checked in by Henrik Bettermann, 3 years ago

Disable affidavit due payments. They have obviously been merged with ICT Fees.

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