source: main/waeup.fceokene/trunk/src/waeup/fceokene/utils/utils.py @ 17209

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

Implement NCE Third Semester school fee payment.

  • Property svn:keywords set to Id
File size: 7.1 KB
Line 
1## $Id: utils.py 16899 2022-03-22 12:46:49Z 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"""
20import string
21from copy import deepcopy
22from kofacustom.nigeria.utils.utils import NigeriaKofaUtils
23from waeup.fceokene.interfaces import MessageFactory as _
24
25class CustomKofaUtils(NigeriaKofaUtils):
26    """A collection of methods subject to customization.
27    """
28
29    STUDY_MODES_DICT = {
30        #'ume_ft': 'UME Full Time',
31        'ug_ft': 'Undergraduate Full Time',
32        #'ug_pt': 'Undergraduate Part Time',
33        #'dp_pt': 'Diploma Part Time',
34        'ct_ft': 'Certificate Full Time',
35        #'dp_ft': 'Diploma Full Time',
36        'de_ft': 'Direct Entry Full Time',
37        'de_pt': 'Direct Entry Part Time',
38        #'nd_ft': 'National Diploma Full Time',
39        #'nd_pt': 'National Diploma Part Time',
40        #'hnd_ft': 'Higher National Diploma Full Time',
41        #'hnd_pt': 'Higher National Diploma Part Time',
42        #'pg_ft': 'Postgraduate Full Time',
43        #'pg_pt': 'Postgraduate Part Time',
44        #'pgd_ft': 'Postgraduate Diploma Full Time',
45        #'pgd_pt': 'Postgraduate Diploma Part Time',
46        #'special_pg_pt': 'Special Postgraduate Part Time',
47        'nce_ft': 'NCE Full Time',
48        #'nce_pt': 'NCE Part Time',
49        #'ug_sw': 'Undergraduate Sandwich',
50        'nce_sw': 'NCE Sandwich',
51        #'jm_ft': 'Joint Matriculation Full Time',
52        #'ph_ft': 'Post Higher Education Full Time',
53        #'transfer_pt': 'Transfer Part Time',
54        #'transfer_ft': 'Transfer Full Time',
55        #'ct_pt': 'Certificate Part Time',
56        #'rmd_ft': 'Remedial with deficiencies',
57        #'rm_ft': 'Remedial',
58        'transfer': 'Transfer',
59        'prence': 'Pre-NCE/Pre-Degree',
60        #'prend': 'Pre-ND',
61        #'pce': 'PCE',
62        'pd_ft': 'Professional Diploma in Education',
63        #'found': 'Foundation',
64        'no': 'no application',
65        }
66
67    PREFERRED_LANGUAGES_DICT = {
68        }
69
70    APP_CATS_DICT = {
71        'basic': 'UTME, DE, PCE, PRENCE',
72        'no': 'No Application',
73        'sandwich': 'Sandwich',
74        'cest': 'Part-Time, Diploma, Certificate',
75        'bec': 'Bachelor of Education Certificate Programmes',
76        'pre': 'Pre-Degree Studies',
77        'prence': 'Pre-NCE/Pre-Degree Programmes',
78        #'tpu': 'Teaching Practice Unit Courses'  use basic instead!!
79        }
80
81    SPECIAL_HANDLING_DICT = {
82        'regular': 'Regular Hostel',
83        'blocked': 'Blocked Hostel',
84        'ugft': 'Undergraduate Fulltime Hostel'
85        }
86
87    PAYMENT_CATEGORIES = {
88        'schoolfee': 'School Fee',
89        'schoolfee_pde1': 'School Fee 1st instalment (new PDE students only)',
90        'schoolfee_third': 'NCE Third Semester Fee (6 courses)',
91        'clearance': 'Acceptance Fee',
92        'bed_allocation': 'Bed Allocation Fee',
93        'hostel_maintenance': 'Hostel Maintenance Fee',
94        'application': 'Application Fee',
95        'third_semester': 'NCE Third Semester Fee (additional courses)',
96        }
97
98    SELECTABLE_PAYMENT_CATEGORIES = {
99        'schoolfee': 'School Fee',
100        'schoolfee_pde1': 'School Fee 1st instalment (new PDE students only)',
101        'schoolfee_third': 'NCE Third Semester Fee (6 courses)',
102        'clearance': 'Acceptance Fee',
103        'bed_allocation': 'Bed Allocation Fee',
104        'hostel_maintenance': 'Hostel Maintenance Fee',
105        'application': 'Application Fee',
106        #'third_semester': 'NCE Third Semester Fee (additional courses)',
107        }
108
109    DISABLE_PAYMENT_GROUP_DICT = {
110        'sf_all': 'School Fee - All Students',
111        'sf_nce1': 'School Fee - NCE I Fresh Students',
112        'cl_except_ug': 'Acceptance Fee - All Students except UG Full Time',
113        }
114
115    BALANCE_PAYMENT_CATEGORIES = {
116        'schoolfee': 'School Fee',
117        'third_semester': 'NCE Third Semester Fee (N2000 per additional course)',
118        }
119
120    def selectable_payment_categories(self, student):
121        return self.SELECTABLE_PAYMENT_CATEGORIES
122
123    VERDICTS_DICT = {
124        '0': 'not yet',
125        'A': 'Successful student',
126        'B': 'Student with carryover courses',
127        'C': 'Student on probation',
128        'D': 'Withdrawn from the faculty',
129        #'E': 'Student who were previously on probation',
130        #'F': 'Medical case',
131        'G': 'Absent from examination',
132        #'H': 'Withheld results',
133        'I': 'Expelled/rusticated/suspended student',
134        'J': 'Temporary withdrawn from the university',
135        #'K': 'Unregistered student',
136        'L': 'Referred student',
137        'M': 'Reinstatement',
138        #'N': 'Student on transfer',
139        'O': 'NCE-III repeater',
140        #'Y': 'No previous verdict',
141        #'X': 'New 300 level student (Uniben)',
142        'Z': 'Successful student (provisional)',
143        'A1': 'First Class',
144        'A2': 'Second Class Upper',
145        'A3': 'Second Class Lower',
146        'A4': 'Third Class',
147        'A5': 'Pass',
148        'A6': 'Distinction',
149        'A7': 'Credit',
150        'A8': 'Merit',
151        'OPDE': 'PDE repeater',
152        }
153
154    def getPaymentItem(self, payment):
155        """Return payment item.
156
157        Bed coordinates are only visible after payment.
158        """
159        if 'maintenance' in payment.p_category and payment.p_state != 'paid':
160            return _('(visible after successful payment)')
161        return payment.p_item
162
163    def fullname(self, firstname, lastname, middlename=None):
164        """Construct fullname.
165        """
166        try:
167            lastname = lastname.upper()
168        except AttributeError:
169            pass
170        # We remove single initial
171        if firstname and len(firstname) == 1:
172            firstname = ''
173        if middlename and len(middlename) == 1:
174            middlename = ''
175        if lastname and len(lastname) == 1:
176            lastname = ''
177        # We construct givennames
178        givennames = ''
179        if middlename and firstname:
180            givennames = '%s %s' % (firstname, middlename)
181        elif firstname:
182            givennames = firstname
183        elif middlename:
184            givennames = middlename
185        givennames = string.capwords(
186            givennames.replace('-', ' - ')).replace(' - ', '-')
187        # We construct fullname
188        fullname = ''
189        if lastname and givennames:
190            fullname = '%s %s' % (givennames, lastname)
191        elif lastname:
192            fullname = lastname
193        elif givennames:
194            fullname = givennames
195        if '<' in fullname:
196            return 'XXX'
197        return fullname
Note: See TracBrowser for help on using the repository browser.