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

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

Use CustomKofaUtils?.selectable_payment_categories for customization instead of customizing the view.

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