[7419] | 1 | ## $Id: utils.py 17183 2022-11-30 14:35:10Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2011 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 | ## |
---|
[7151] | 18 | import grok |
---|
[9190] | 19 | import random |
---|
[8599] | 20 | from time import time |
---|
[9950] | 21 | from zope.component import createObject, getUtility |
---|
[13800] | 22 | from waeup.kofa.interfaces import ( |
---|
| 23 | CLEARED, RETURNING, PAID, ADMITTED, CLEARANCE, REQUESTED) |
---|
[8834] | 24 | from kofacustom.nigeria.students.utils import NigeriaStudentsUtils |
---|
[8247] | 25 | from waeup.kofa.accesscodes import create_accesscode |
---|
[9143] | 26 | from waeup.kofa.interfaces import CLEARED, RETURNING |
---|
[8460] | 27 | from waeup.fceokene.interfaces import MessageFactory as _ |
---|
[9950] | 28 | from waeup.kofa.browser.interfaces import IPDFCreator |
---|
[9982] | 29 | from waeup.kofa.students.utils import trans |
---|
[6902] | 30 | |
---|
[11919] | 31 | # Very special school fee configuration, should be moved to |
---|
| 32 | # a seperate file. |
---|
| 33 | |
---|
| 34 | ARTS = ('CRS','ISS','HIS','MUS','ECO','GEO','POL','SOS','CCA','ECU', |
---|
| 35 | 'THA','GED','GSE','PES','SPC','ENG','FRE','ARB','HAU','IGB', |
---|
| 36 | 'YOR','NCRS','NISS','NHIS','NMUS','NECO','NGEO','NPOL', |
---|
| 37 | 'NCCA','NECU','NTHA','NGED','NGSE','NPES','NSPC','NENG', |
---|
| 38 | 'NFRE','NARB','NHAU','NIGB','NYOR','NSOS') |
---|
| 39 | |
---|
[15594] | 40 | GATEWAY_AMT = 0.0 |
---|
[15283] | 41 | |
---|
[8834] | 42 | class CustomStudentsUtils(NigeriaStudentsUtils): |
---|
[7151] | 43 | """A collection of customized methods. |
---|
| 44 | |
---|
| 45 | """ |
---|
| 46 | |
---|
[15706] | 47 | def selectBed(self, available_beds): |
---|
[13459] | 48 | """Randomly select a bed from the list of available beds. |
---|
[9190] | 49 | """ |
---|
| 50 | return random.choice(available_beds) |
---|
| 51 | |
---|
[8270] | 52 | def getReturningData(self, student): |
---|
| 53 | """ This method defines what happens after school fee payment |
---|
[8319] | 54 | of returning students depending on the student's senate verdict. |
---|
[8270] | 55 | """ |
---|
[8319] | 56 | prev_level = student['studycourse'].current_level |
---|
| 57 | cur_verdict = student['studycourse'].current_verdict |
---|
| 58 | if cur_verdict in ('A','B','L','M','N','Z',): |
---|
| 59 | # Successful student |
---|
| 60 | new_level = divmod(int(prev_level),100)[0]*100 + 100 |
---|
[9923] | 61 | elif cur_verdict in ('C','O'): |
---|
[8319] | 62 | # Student on probation |
---|
| 63 | new_level = int(prev_level) + 10 |
---|
| 64 | else: |
---|
| 65 | # Student is somehow in an undefined state. |
---|
| 66 | # Level has to be set manually. |
---|
| 67 | new_level = prev_level |
---|
[9923] | 68 | if cur_verdict == 'O': |
---|
| 69 | new_session = student['studycourse'].current_session |
---|
| 70 | else: |
---|
| 71 | new_session = student['studycourse'].current_session + 1 |
---|
[8270] | 72 | return new_session, new_level |
---|
| 73 | |
---|
[16899] | 74 | #def _nce3PaymentMade(self, student, p_level): |
---|
| 75 | # if len(student['payments']): |
---|
| 76 | # for ticket in student['payments'].values(): |
---|
| 77 | # if ticket.p_state in ('paid', 'scholarship', 'waived') and \ |
---|
| 78 | # ticket.p_level == p_level and \ |
---|
| 79 | # ticket.p_category == 'schoolfee': |
---|
| 80 | # return True |
---|
| 81 | # return False |
---|
[16008] | 82 | |
---|
[9153] | 83 | def setPaymentDetails(self, category, student, |
---|
[15678] | 84 | previous_session=None, previous_level=None, combi=[]): |
---|
[8599] | 85 | """Create Payment object and set the payment data of a student for |
---|
| 86 | the payment category specified. |
---|
| 87 | |
---|
| 88 | """ |
---|
[8306] | 89 | details = {} |
---|
[8599] | 90 | p_item = u'' |
---|
| 91 | amount = 0.0 |
---|
| 92 | error = u'' |
---|
[9153] | 93 | if previous_session: |
---|
| 94 | return _('Previous session payment not yet implemented.'), None |
---|
[8599] | 95 | p_session = student['studycourse'].current_session |
---|
| 96 | p_level = student['studycourse'].current_level |
---|
[9153] | 97 | p_current = True |
---|
[9525] | 98 | academic_session = self._getSessionConfiguration(p_session) |
---|
| 99 | if academic_session == None: |
---|
[8599] | 100 | return _(u'Session configuration object is not available.'), None |
---|
[9525] | 101 | # Determine fee. |
---|
[7151] | 102 | if category == 'transfer': |
---|
[8599] | 103 | amount = academic_session.transfer_fee |
---|
[7151] | 104 | elif category == 'gown': |
---|
[8599] | 105 | amount = academic_session.gown_fee |
---|
[7151] | 106 | elif category == 'bed_allocation': |
---|
[17183] | 107 | acco_details = self.getAccommodationDetails(student) |
---|
| 108 | p_session = acco_details['booking_session'] |
---|
| 109 | p_item = acco_details['bt'] |
---|
[8599] | 110 | amount = academic_session.booking_fee |
---|
[7151] | 111 | elif category == 'hostel_maintenance': |
---|
[17183] | 112 | amount = 0.0 |
---|
| 113 | booking_session = grok.getSite()['hostels'].accommodation_session |
---|
| 114 | bedticket = student['accommodation'].get(str(booking_session), None) |
---|
[9611] | 115 | if bedticket is not None and bedticket.bed is not None: |
---|
[17183] | 116 | p_session = booking_session |
---|
[9611] | 117 | p_item = bedticket.bed_coordinates |
---|
[13616] | 118 | if bedticket.bed.__parent__.maint_fee > 0: |
---|
| 119 | amount = bedticket.bed.__parent__.maint_fee |
---|
[9611] | 120 | else: |
---|
[13616] | 121 | return _(u'No bed space allocated.'), None |
---|
| 122 | if student.current_mode.endswith('_sw') \ |
---|
| 123 | or student.current_mode == 'pd_ft': |
---|
| 124 | amount *= 0.625 |
---|
[7151] | 125 | elif category == 'clearance': |
---|
[9143] | 126 | amount = academic_session.clearance_fee |
---|
[8599] | 127 | try: |
---|
| 128 | p_item = student['studycourse'].certificate.code |
---|
| 129 | except (AttributeError, TypeError): |
---|
| 130 | return _('Study course data are incomplete.'), None |
---|
[13800] | 131 | if student.state not in (ADMITTED, CLEARANCE, REQUESTED, CLEARED): |
---|
| 132 | return _(u'Acceptance Fee payments not allowed.'), None |
---|
[16899] | 133 | #elif category == 'third_semester' and student.current_mode == 'nce_ft' \ |
---|
| 134 | # and p_level in (300, 310, 320, 400, 410, 420): |
---|
| 135 | # #if not self._nce3PaymentMade(student, p_level): |
---|
| 136 | # # return _(u'Make NCE 3 school fee payment first.'), None |
---|
| 137 | # no_additional_courses = 0 |
---|
| 138 | # courses_level = student['studycourse'].get(str(p_level)) |
---|
| 139 | # if courses_level and len(courses_level)> 6: |
---|
| 140 | # no_additional_courses = len(courses_level)-6 |
---|
| 141 | # amount = 2000.0 * no_additional_courses |
---|
[16461] | 142 | elif category.startswith('schoolfee'): |
---|
| 143 | if category == 'schoolfee_pde1': |
---|
[16462] | 144 | if not student.current_mode.startswith('pd'): |
---|
| 145 | return _('You are not a PDE student.'), None |
---|
[16461] | 146 | if student.state != CLEARED: |
---|
| 147 | return _('You are not a fresh student.'), None |
---|
[16899] | 148 | if category == 'schoolfee_third': |
---|
| 149 | if not student.current_mode == 'nce_ft' \ |
---|
| 150 | or not p_level in (300, 310, 320, 400, 410, 420): |
---|
| 151 | return _('You are not an NCE 3 student.'), None |
---|
[12602] | 152 | p_item = student.certcode |
---|
| 153 | if not p_item: |
---|
[8599] | 154 | return _('Study course data are incomplete.'), None |
---|
[10012] | 155 | if student.state not in (CLEARED, RETURNING): |
---|
| 156 | return _('Wrong state.'), None |
---|
[10661] | 157 | # PDE repeater |
---|
| 158 | if student.current_verdict == 'OPDE': |
---|
[11850] | 159 | amount = 23000 |
---|
[13274] | 160 | # PDE new |
---|
| 161 | elif student.current_mode == 'pd_ft' and student.state == CLEARED: |
---|
[15523] | 162 | amount = 70000 |
---|
[16461] | 163 | if category == 'schoolfee_pde1': |
---|
| 164 | amount = 40000 |
---|
[10660] | 165 | # PDE |
---|
| 166 | elif student.current_mode == 'pd_ft': |
---|
[13275] | 167 | amount = 35300 |
---|
[12602] | 168 | |
---|
| 169 | #Short Duration ICT Programs |
---|
| 170 | elif p_item in ('CCO','DPMTS','DTPGD') and \ |
---|
| 171 | student.state == CLEARED: |
---|
| 172 | amount = 15000 |
---|
| 173 | elif p_item in ('ADTPGD','ADPMTS') and \ |
---|
| 174 | student.state == CLEARED: |
---|
| 175 | amount = 16000 |
---|
| 176 | elif p_item in ('ADPMTSI','ADTPGDI','DPMTSI','DTPGDI') and \ |
---|
| 177 | student.state == CLEARED: |
---|
| 178 | amount = 25000 |
---|
| 179 | elif p_item in ('ADPMTSA','ADTPGDA') and \ |
---|
| 180 | student.state == CLEARED: |
---|
| 181 | amount = 35000 |
---|
| 182 | |
---|
[10012] | 183 | # UG |
---|
| 184 | elif student.current_mode == 'ug_ft': |
---|
[10876] | 185 | if student.state == CLEARED: |
---|
[17069] | 186 | amount = 87200 |
---|
[13779] | 187 | # Introducing repeater fee for 'ug_ft' for 1st time |
---|
| 188 | # on 15/03/2016 |
---|
| 189 | elif student.current_verdict == 'O': |
---|
[17069] | 190 | amount = 70700 |
---|
[10876] | 191 | else: |
---|
[17069] | 192 | amount = 70700 |
---|
[10012] | 193 | # NCE |
---|
[9143] | 194 | elif not student.current_mode.endswith('_sw'): |
---|
[17113] | 195 | # in 2022 NCE school fees have encreased |
---|
| 196 | increment_2022 = 11000 |
---|
[9143] | 197 | # PRENCE |
---|
| 198 | if student.current_level == 10 and student.state == CLEARED: |
---|
| 199 | if student.depcode in ARTS: |
---|
[14933] | 200 | amount = 24500 |
---|
[9143] | 201 | else: |
---|
[14933] | 202 | amount = 25000 |
---|
[10012] | 203 | # NCE I fresh |
---|
[9143] | 204 | elif student.current_level == 100 and student.state == CLEARED: |
---|
| 205 | if student.depcode in ARTS: |
---|
[15283] | 206 | amount = 28000 |
---|
[9143] | 207 | else: |
---|
[15283] | 208 | amount = 28500 |
---|
[14931] | 209 | # SIWES Fee |
---|
[16542] | 210 | if student.depcode in ('AGE', 'BED', 'FAA', 'HEC', 'CSC', 'MUS') \ |
---|
[17087] | 211 | or student.certcode in ('NCECHECSC', |
---|
| 212 | 'NCEBIOCSC', |
---|
| 213 | 'NCEPHYCSC', |
---|
| 214 | 'NCEPHECSC', |
---|
| 215 | 'NCETHAMUS', |
---|
| 216 | 'NCEANFMUS', |
---|
| 217 | 'NCEHISMUS', |
---|
| 218 | 'NCEIGBMUS', |
---|
| 219 | 'NCESPCCSC', |
---|
| 220 | ): |
---|
[14931] | 221 | amount += 3000 |
---|
[10012] | 222 | # NCE II |
---|
[9143] | 223 | elif student.current_level in (100, 110, 120) and \ |
---|
| 224 | student.state == RETURNING: |
---|
| 225 | if student.depcode in ARTS: |
---|
[15283] | 226 | amount = 24500 |
---|
[9143] | 227 | else: |
---|
[15283] | 228 | amount = 25000 |
---|
[16899] | 229 | # NCE III third semester |
---|
| 230 | elif category == 'schoolfee_third': |
---|
| 231 | amount = 7000 |
---|
[17113] | 232 | increment_2022 = 20125 |
---|
[10012] | 233 | # NCE III |
---|
[9143] | 234 | elif student.current_level in (200, 210, 220): |
---|
| 235 | if student.depcode in ARTS: |
---|
[14931] | 236 | amount = 15375 |
---|
[9143] | 237 | else: |
---|
[14931] | 238 | amount = 15875 |
---|
[17113] | 239 | increment_2022 = 20125 |
---|
[10012] | 240 | # NCE III repeater |
---|
[9143] | 241 | elif student.current_level in (300, 310, 320) and \ |
---|
| 242 | student.current_verdict == 'O': |
---|
| 243 | if student.depcode in ARTS: |
---|
[14931] | 244 | amount = 13475 |
---|
[9143] | 245 | else: |
---|
[14931] | 246 | amount = 13975 |
---|
[17113] | 247 | increment_2022 = 20125 |
---|
[10012] | 248 | # NCE III spillover |
---|
[9143] | 249 | elif student.current_level in (300, 310, 320) and \ |
---|
| 250 | student.current_verdict == 'B': |
---|
| 251 | if student.depcode in ARTS: |
---|
[14931] | 252 | amount = 13475 |
---|
[9143] | 253 | else: |
---|
[14931] | 254 | amount = 13975 |
---|
[17113] | 255 | increment_2022 = 20125 |
---|
[10012] | 256 | # NCE III second spillover |
---|
[9143] | 257 | elif student.current_level in (400, 410, 420) and \ |
---|
| 258 | student.current_verdict == 'B': |
---|
| 259 | if student.depcode in ARTS: |
---|
[14931] | 260 | amount = 13475 |
---|
[9143] | 261 | else: |
---|
[14931] | 262 | amount = 13975 |
---|
[17113] | 263 | increment_2022 = 20125 |
---|
| 264 | |
---|
| 265 | if student.entry_session > 2021: |
---|
| 266 | amount += increment_2022 |
---|
[9143] | 267 | else: |
---|
[14265] | 268 | # NCE I fresh sw |
---|
[9143] | 269 | if student.current_level == 100 and student.state == CLEARED: |
---|
| 270 | if student.depcode in ARTS: |
---|
[14193] | 271 | amount = 23100 |
---|
[9143] | 272 | else: |
---|
[14193] | 273 | amount = 23600 |
---|
[14265] | 274 | # NCE II fresh sw |
---|
| 275 | elif student.current_level == 200 and student.state == CLEARED: |
---|
| 276 | if student.depcode in ARTS: |
---|
| 277 | amount = 19000 |
---|
| 278 | else: |
---|
| 279 | amount = 19500 |
---|
[10012] | 280 | # NCE II sw |
---|
[9143] | 281 | elif student.current_level in (100, 110, 120) and \ |
---|
| 282 | student.state == RETURNING: |
---|
| 283 | if student.depcode in ARTS: |
---|
[11850] | 284 | amount = 19000 |
---|
[9143] | 285 | else: |
---|
[11882] | 286 | amount = 19500 |
---|
[10012] | 287 | # NCE III sw |
---|
[9143] | 288 | elif student.current_level in (200, 210, 220): |
---|
| 289 | if student.depcode in ARTS: |
---|
[11850] | 290 | amount = 21000 |
---|
[9143] | 291 | else: |
---|
[14193] | 292 | amount = 21500 |
---|
[10012] | 293 | # NCE IV sw |
---|
[9143] | 294 | elif student.current_level in (300, 310, 320): |
---|
| 295 | if student.depcode in ARTS: |
---|
[11850] | 296 | amount = 19000 |
---|
[9143] | 297 | else: |
---|
[11850] | 298 | amount = 19500 |
---|
[10012] | 299 | # NCE V sw |
---|
[9143] | 300 | elif student.current_level in (400, 410, 420): |
---|
| 301 | if student.depcode in ARTS: |
---|
[11850] | 302 | amount = 19000 |
---|
[9143] | 303 | else: |
---|
[11850] | 304 | amount = 19500 |
---|
[10012] | 305 | # NCE V spillover sw |
---|
[9143] | 306 | elif student.current_level in (500, 510, 520) and \ |
---|
| 307 | student.current_verdict == 'B': |
---|
| 308 | if student.depcode in ARTS: |
---|
[11850] | 309 | amount = 17500 |
---|
[9143] | 310 | else: |
---|
[11850] | 311 | amount = 18000 |
---|
[10012] | 312 | # NCE V second spillover sw |
---|
[9143] | 313 | elif student.current_level in (600, 610, 620) and \ |
---|
| 314 | student.current_verdict == 'B': |
---|
| 315 | if student.depcode in ARTS: |
---|
[16921] | 316 | amount = 17500 |
---|
[9143] | 317 | else: |
---|
[16921] | 318 | amount = 18000 |
---|
[10009] | 319 | # NCE student payment can be disabled by |
---|
| 320 | # setting the base school fee to -1 |
---|
| 321 | if academic_session.school_fee_base == -1 and \ |
---|
| 322 | student.current_mode.startswith('nce'): |
---|
[10010] | 323 | return _(u'School fee payment is disabled.'), None |
---|
[9297] | 324 | if student.state == RETURNING: |
---|
[9525] | 325 | # Override p_session and p_level |
---|
[9297] | 326 | p_session, p_level = self.getReturningData(student) |
---|
[9525] | 327 | academic_session = self._getSessionConfiguration(p_session) |
---|
| 328 | if academic_session == None: |
---|
| 329 | return _(u'Session configuration object is not available.'), None |
---|
[17087] | 330 | else: |
---|
| 331 | fee_name = category + '_fee' |
---|
| 332 | amount = getattr(academic_session, fee_name, 0.0) |
---|
| 333 | |
---|
[8599] | 334 | if amount in (0.0, None): |
---|
| 335 | return _(u'Amount could not be determined.'), None |
---|
[14566] | 336 | |
---|
| 337 | # Add session and level specific penalty fee. |
---|
[13881] | 338 | if category == 'schoolfee' and student.current_mode in ( |
---|
[14617] | 339 | 'ug_ft', 'de_ft') and student.state != CLEARED: |
---|
[13881] | 340 | amount += academic_session.penalty_ug_ft |
---|
| 341 | elif category == 'schoolfee' and student.current_mode in ( |
---|
[14556] | 342 | 'nce_ft',) and student['studycourse'].previous_verdict != 'O': |
---|
[14566] | 343 | # NCE I fresh |
---|
| 344 | if student.current_level == 100 and student.state == CLEARED: |
---|
| 345 | amount += academic_session.penalty_nce1_ft |
---|
| 346 | # NCE II |
---|
| 347 | elif student.current_level in (100, 110, 120) and \ |
---|
| 348 | student.state == RETURNING: |
---|
| 349 | amount += academic_session.penalty_nce2_ft |
---|
| 350 | # NCE III (except repeaters and spillovers) |
---|
| 351 | elif student.current_level in (200, 210, 220): |
---|
| 352 | amount += academic_session.penalty_nce3_ft |
---|
[14618] | 353 | elif category == 'schoolfee' and student.current_mode in ('nce_sw', |
---|
| 354 | 'nce_pt') and student['studycourse'].previous_verdict != 'O': |
---|
[14566] | 355 | # NCE I fresh |
---|
| 356 | if student.current_level == 100 and student.state == CLEARED: |
---|
| 357 | amount += academic_session.penalty_nce1_pt |
---|
| 358 | # NCE II |
---|
| 359 | elif student.current_level in (100, 110, 120) and \ |
---|
| 360 | student.state == RETURNING: |
---|
| 361 | amount += academic_session.penalty_nce2_pt |
---|
| 362 | # NCE III (except repeaters and spillovers) |
---|
| 363 | elif student.current_level in (200, 210, 220): |
---|
| 364 | amount += academic_session.penalty_nce3_pt |
---|
[13881] | 365 | elif category == 'schoolfee' and student.current_mode in ('prence',): |
---|
| 366 | amount += academic_session.penalty_prence |
---|
[11649] | 367 | if self.samePaymentMade(student, category, p_item, p_session): |
---|
| 368 | return _('This type of payment has already been made.'), None |
---|
[11457] | 369 | if self._isPaymentDisabled(p_session, category, student): |
---|
[13800] | 370 | return _('This category of payments has been disabled.'), None |
---|
[8713] | 371 | payment = createObject(u'waeup.StudentOnlinePayment') |
---|
[8953] | 372 | timestamp = ("%d" % int(time()*10000))[1:] |
---|
[8599] | 373 | payment.p_id = "p%s" % timestamp |
---|
| 374 | payment.p_category = category |
---|
| 375 | payment.p_item = p_item |
---|
| 376 | payment.p_session = p_session |
---|
| 377 | payment.p_level = p_level |
---|
[9153] | 378 | payment.p_current = p_current |
---|
[10388] | 379 | payment.amount_auth = float(amount) + GATEWAY_AMT |
---|
[8599] | 380 | return None, payment |
---|
[7621] | 381 | |
---|
[9207] | 382 | def getAccommodationDetails(self, student): |
---|
| 383 | """Determine the accommodation data of a student. |
---|
| 384 | """ |
---|
| 385 | d = {} |
---|
| 386 | d['error'] = u'' |
---|
| 387 | hostels = grok.getSite()['hostels'] |
---|
| 388 | d['booking_session'] = hostels.accommodation_session |
---|
| 389 | d['allowed_states'] = hostels.accommodation_states |
---|
| 390 | d['startdate'] = hostels.startdate |
---|
| 391 | d['enddate'] = hostels.enddate |
---|
| 392 | d['expired'] = hostels.expired |
---|
| 393 | # Determine bed type |
---|
| 394 | studycourse = student['studycourse'] |
---|
| 395 | certificate = getattr(studycourse,'certificate',None) |
---|
| 396 | current_level = studycourse.current_level |
---|
| 397 | if None in (current_level, certificate): |
---|
| 398 | return d |
---|
| 399 | end_level = certificate.end_level |
---|
| 400 | if current_level == 10: |
---|
| 401 | bt = 'pr' |
---|
| 402 | elif current_level == 100: |
---|
| 403 | bt = 'fr' |
---|
| 404 | elif current_level >= 300: |
---|
| 405 | bt = 'fi' |
---|
| 406 | else: |
---|
| 407 | bt = 're' |
---|
| 408 | if student.sex == 'f': |
---|
| 409 | sex = 'female' |
---|
| 410 | else: |
---|
| 411 | sex = 'male' |
---|
| 412 | special_handling = 'regular' |
---|
[13614] | 413 | if certificate.study_mode == 'ug_ft': |
---|
| 414 | special_handling = 'ugft' |
---|
[9207] | 415 | d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt) |
---|
| 416 | return d |
---|
| 417 | |
---|
[14617] | 418 | #def warnCreditsOOR(self, studylevel, course=None): |
---|
| 419 | # """Return message if credits are out of range. |
---|
| 420 | # """ |
---|
| 421 | # # adding a course ticket |
---|
| 422 | # if course: |
---|
| 423 | # if course.semester == 1: |
---|
| 424 | # if studylevel.total_credits_s1 + course.credits > 24: |
---|
| 425 | # return _('Maximum credits in 1st semester exceeded.') |
---|
| 426 | # if course.semester == 2: |
---|
| 427 | # if studylevel.total_credits_s2 + course.credits > 24: |
---|
| 428 | # return _('Maximum credits in 2nd semester exceeded.') |
---|
| 429 | # # registering course list |
---|
| 430 | # else: |
---|
| 431 | # if studylevel.total_credits_s1 > 24: |
---|
| 432 | # return _('Maximum credits in 1st semester exceeded.') |
---|
| 433 | # if studylevel.total_credits_s1 < 18: |
---|
| 434 | # return _('Minimum credits in 1st semester not reached.') |
---|
| 435 | # if studylevel.total_credits_s2 > 24: |
---|
| 436 | # return _('Maximum credits in 2nd semester exceeded.') |
---|
| 437 | # if studylevel.total_credits_s2 < 18: |
---|
| 438 | # return _('Minimum credits in 2nd semester not reached.') |
---|
| 439 | # return |
---|
| 440 | |
---|
[14586] | 441 | def warnCreditsOOR(self, studylevel, course=None): |
---|
[14591] | 442 | """Return message if credits are out of range. |
---|
[9903] | 443 | """ |
---|
[14591] | 444 | # adding a course ticket |
---|
| 445 | if course: |
---|
[14617] | 446 | if studylevel.total_credits + course.credits > 52: |
---|
| 447 | return _('Maximum credits exceeded.') |
---|
[14591] | 448 | # registering course list |
---|
| 449 | else: |
---|
[14617] | 450 | if studylevel.total_credits > 52: |
---|
| 451 | return _('Maximum credits exceeded.') |
---|
[14618] | 452 | if studylevel.__parent__.previous_verdict == 'O': |
---|
| 453 | return |
---|
[14591] | 454 | if studylevel.total_credits_s1 < 18: |
---|
| 455 | return _('Minimum credits in 1st semester not reached.') |
---|
| 456 | if studylevel.total_credits_s2 < 18: |
---|
| 457 | return _('Minimum credits in 2nd semester not reached.') |
---|
[14586] | 458 | return |
---|
[9903] | 459 | |
---|
[9950] | 460 | def getPDFCreator(self, context): |
---|
| 461 | """Get a pdf creator suitable for `context`. |
---|
| 462 | |
---|
| 463 | The default implementation always returns the default creator. |
---|
| 464 | """ |
---|
| 465 | mode = getattr(context, 'current_mode', None) |
---|
| 466 | if mode and mode.startswith('ug'): |
---|
| 467 | return getUtility(IPDFCreator, name='ibadan_pdfcreator') |
---|
| 468 | return getUtility(IPDFCreator) |
---|
| 469 | |
---|
[9982] | 470 | def _admissionText(self, student, portal_language): |
---|
| 471 | mode = getattr(student, 'current_mode', None) |
---|
| 472 | if mode and mode.startswith('ug'): |
---|
| 473 | text = trans(_( |
---|
| 474 | 'With reference to your application for admission into Bachelor Degree ' |
---|
| 475 | 'Programme of the University of Ibadan, this is to inform you that you have ' |
---|
| 476 | 'been provisionally admitted to pursue a full-time Bachelor of Arts in ' |
---|
| 477 | 'Education Degree Programme as follows:'), |
---|
| 478 | portal_language) |
---|
| 479 | else: |
---|
| 480 | inst_name = grok.getSite()['configuration'].name |
---|
| 481 | text = trans(_( |
---|
[15890] | 482 | 'This is to inform you that you have been provisionally\n' |
---|
[15891] | 483 | 'admitted into ${a}\n' |
---|
| 484 | 'as follows:', mapping = {'a': inst_name}), |
---|
[9982] | 485 | portal_language) |
---|
| 486 | return text |
---|
| 487 | |
---|
[9989] | 488 | def getBedCoordinates(self, bedticket): |
---|
| 489 | """Return bed coordinates. |
---|
| 490 | |
---|
| 491 | Bed coordinates are invisible in FCEOkene. |
---|
| 492 | """ |
---|
| 493 | return _('(see payment slip)') |
---|
| 494 | |
---|
[13030] | 495 | def _isPaymentDisabled(self, p_session, category, student): |
---|
| 496 | academic_session = self._getSessionConfiguration(p_session) |
---|
| 497 | if category == 'schoolfee': |
---|
| 498 | if 'sf_all' in academic_session.payment_disabled: |
---|
| 499 | return True |
---|
| 500 | if 'sf_nce1' in academic_session.payment_disabled and \ |
---|
| 501 | student.current_level == 100 and student.state == CLEARED and \ |
---|
| 502 | student.current_mode == 'nce_ft': |
---|
| 503 | return True |
---|
[16554] | 504 | if category == 'clearance': |
---|
| 505 | if 'cl_except_ug' in academic_session.payment_disabled and \ |
---|
| 506 | student.current_mode != 'ug_ft': |
---|
| 507 | return True |
---|
[13030] | 508 | return False |
---|
| 509 | |
---|
[10019] | 510 | SEPARATORS_DICT = { |
---|
| 511 | 'form.fst_sit_fname': _(u'First Sitting Record'), |
---|
| 512 | 'form.scd_sit_fname': _(u'Second Sitting Record'), |
---|
| 513 | #'form.alr_fname': _(u'Advanced Level Record'), |
---|
| 514 | 'form.hq_type': _(u'Advanced Level Record'), |
---|
| 515 | 'form.hq2_type': _(u'Second Higher Education Record'), |
---|
| 516 | 'form.nysc_year': _(u'NYSC Information'), |
---|
| 517 | 'form.employer': _(u'Employment History'), |
---|
| 518 | 'form.former_matric': _(u'Former Student'), |
---|
| 519 | } |
---|
| 520 | |
---|
[10023] | 521 | SKIP_UPLOAD_VIEWLETS = ( |
---|
| 522 | 'higherqualificationresultupload', |
---|
| 523 | 'secondHigherqualificationresultupload', |
---|
| 524 | 'certificateupload', |
---|
| 525 | 'secondcertificateupload', |
---|
| 526 | 'thirdcertificateupload', |
---|
| 527 | 'resultstatementupload', |
---|
| 528 | 'secondrefereeletterupload', |
---|
| 529 | 'thirdrefereeletterupload',) |
---|
| 530 | |
---|
[17178] | 531 | ACCOMMODATION_SPAN = 1 |
---|
| 532 | |
---|
[8460] | 533 | # FCEOkene prefix |
---|
[10520] | 534 | STUDENT_ID_PREFIX = u'K' |
---|