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

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

Add late_registration to PT_AND_DSH_PAYMENT_CATS.

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