[7419] | 1 | ## $Id: utils.py 16008 2020-02-20 13:06:08Z 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 | |
---|
[16008] | 74 | def _nce3PaymentMade(self, student): |
---|
| 75 | if len(student['payments']): |
---|
| 76 | for ticket in student['payments'].values(): |
---|
| 77 | if ticket.p_state == 'paid' and \ |
---|
| 78 | ticket.p_level in (300, 310, 320) and \ |
---|
| 79 | ticket.p_category == 'schoolfee': |
---|
| 80 | return True |
---|
| 81 | return False |
---|
| 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': |
---|
[8599] | 107 | amount = academic_session.booking_fee |
---|
[7151] | 108 | elif category == 'hostel_maintenance': |
---|
[9611] | 109 | current_session = student['studycourse'].current_session |
---|
| 110 | bedticket = student['accommodation'].get(str(current_session), None) |
---|
| 111 | if bedticket is not None and bedticket.bed is not None: |
---|
| 112 | p_item = bedticket.bed_coordinates |
---|
[13616] | 113 | if bedticket.bed.__parent__.maint_fee > 0: |
---|
| 114 | amount = bedticket.bed.__parent__.maint_fee |
---|
[9611] | 115 | else: |
---|
[13616] | 116 | return _(u'No bed space allocated.'), None |
---|
| 117 | if student.current_mode.endswith('_sw') \ |
---|
| 118 | or student.current_mode == 'pd_ft': |
---|
| 119 | amount *= 0.625 |
---|
[7151] | 120 | elif category == 'clearance': |
---|
[9143] | 121 | amount = academic_session.clearance_fee |
---|
[8599] | 122 | try: |
---|
| 123 | p_item = student['studycourse'].certificate.code |
---|
| 124 | except (AttributeError, TypeError): |
---|
| 125 | return _('Study course data are incomplete.'), None |
---|
[13800] | 126 | if student.state not in (ADMITTED, CLEARANCE, REQUESTED, CLEARED): |
---|
| 127 | return _(u'Acceptance Fee payments not allowed.'), None |
---|
[11932] | 128 | elif category == 'third_semester' and student.current_mode == 'nce_ft': |
---|
[16008] | 129 | if not self._nce3PaymentMade(student): |
---|
| 130 | return _(u'Make NCE 3 school fee payment first.'), None |
---|
[11919] | 131 | if student.depcode in ARTS: |
---|
[14931] | 132 | amount = 7688 |
---|
[11919] | 133 | else: |
---|
[14931] | 134 | amount = 7938 |
---|
[7151] | 135 | elif category == 'schoolfee': |
---|
[12602] | 136 | p_item = student.certcode |
---|
| 137 | if not p_item: |
---|
[8599] | 138 | return _('Study course data are incomplete.'), None |
---|
[10012] | 139 | if student.state not in (CLEARED, RETURNING): |
---|
| 140 | return _('Wrong state.'), None |
---|
[10661] | 141 | # PDE repeater |
---|
| 142 | if student.current_verdict == 'OPDE': |
---|
[11850] | 143 | amount = 23000 |
---|
[13274] | 144 | # PDE new |
---|
| 145 | elif student.current_mode == 'pd_ft' and student.state == CLEARED: |
---|
[15523] | 146 | amount = 70000 |
---|
[10660] | 147 | # PDE |
---|
| 148 | elif student.current_mode == 'pd_ft': |
---|
[13275] | 149 | amount = 35300 |
---|
[12602] | 150 | |
---|
| 151 | #Short Duration ICT Programs |
---|
| 152 | elif p_item in ('CCO','DPMTS','DTPGD') and \ |
---|
| 153 | student.state == CLEARED: |
---|
| 154 | amount = 15000 |
---|
| 155 | elif p_item in ('ADTPGD','ADPMTS') and \ |
---|
| 156 | student.state == CLEARED: |
---|
| 157 | amount = 16000 |
---|
| 158 | elif p_item in ('ADPMTSI','ADTPGDI','DPMTSI','DTPGDI') and \ |
---|
| 159 | student.state == CLEARED: |
---|
| 160 | amount = 25000 |
---|
| 161 | elif p_item in ('ADPMTSA','ADTPGDA') and \ |
---|
| 162 | student.state == CLEARED: |
---|
| 163 | amount = 35000 |
---|
| 164 | |
---|
[10012] | 165 | # UG |
---|
| 166 | elif student.current_mode == 'ug_ft': |
---|
[10876] | 167 | if student.state == CLEARED: |
---|
| 168 | amount = 65650 |
---|
[13779] | 169 | # Introducing repeater fee for 'ug_ft' for 1st time |
---|
| 170 | # on 15/03/2016 |
---|
| 171 | elif student.current_verdict == 'O': |
---|
| 172 | amount = 56150 |
---|
[10876] | 173 | else: |
---|
[14379] | 174 | amount = 56150 |
---|
[10012] | 175 | # NCE |
---|
[9143] | 176 | elif not student.current_mode.endswith('_sw'): |
---|
| 177 | # PRENCE |
---|
| 178 | if student.current_level == 10 and student.state == CLEARED: |
---|
| 179 | if student.depcode in ARTS: |
---|
[14933] | 180 | amount = 24500 |
---|
[9143] | 181 | else: |
---|
[14933] | 182 | amount = 25000 |
---|
[10012] | 183 | # NCE I fresh |
---|
[9143] | 184 | elif student.current_level == 100 and student.state == CLEARED: |
---|
| 185 | if student.depcode in ARTS: |
---|
[15283] | 186 | amount = 28000 |
---|
[9143] | 187 | else: |
---|
[15283] | 188 | amount = 28500 |
---|
[14931] | 189 | # SIWES Fee |
---|
| 190 | if student.depcode in ('AGE', 'BED', 'FAA', 'HEC', 'CSC', 'MUS'): |
---|
| 191 | amount += 3000 |
---|
[10012] | 192 | # NCE II |
---|
[9143] | 193 | elif student.current_level in (100, 110, 120) and \ |
---|
| 194 | student.state == RETURNING: |
---|
| 195 | if student.depcode in ARTS: |
---|
[15283] | 196 | amount = 24500 |
---|
[9143] | 197 | else: |
---|
[15283] | 198 | amount = 25000 |
---|
[10012] | 199 | # NCE III |
---|
[9143] | 200 | elif student.current_level in (200, 210, 220): |
---|
| 201 | if student.depcode in ARTS: |
---|
[14931] | 202 | amount = 15375 |
---|
[9143] | 203 | else: |
---|
[14931] | 204 | amount = 15875 |
---|
[10012] | 205 | # NCE III repeater |
---|
[9143] | 206 | elif student.current_level in (300, 310, 320) and \ |
---|
| 207 | student.current_verdict == 'O': |
---|
| 208 | if student.depcode in ARTS: |
---|
[14931] | 209 | amount = 13475 |
---|
[9143] | 210 | else: |
---|
[14931] | 211 | amount = 13975 |
---|
[10012] | 212 | # NCE III spillover |
---|
[9143] | 213 | elif student.current_level in (300, 310, 320) and \ |
---|
| 214 | student.current_verdict == 'B': |
---|
| 215 | if student.depcode in ARTS: |
---|
[14931] | 216 | amount = 13475 |
---|
[9143] | 217 | else: |
---|
[14931] | 218 | amount = 13975 |
---|
[10012] | 219 | # NCE III second spillover |
---|
[9143] | 220 | elif student.current_level in (400, 410, 420) and \ |
---|
| 221 | student.current_verdict == 'B': |
---|
| 222 | if student.depcode in ARTS: |
---|
[14931] | 223 | amount = 13475 |
---|
[9143] | 224 | else: |
---|
[14931] | 225 | amount = 13975 |
---|
[9143] | 226 | else: |
---|
[14265] | 227 | # NCE I fresh sw |
---|
[9143] | 228 | if student.current_level == 100 and student.state == CLEARED: |
---|
| 229 | if student.depcode in ARTS: |
---|
[14193] | 230 | amount = 23100 |
---|
[9143] | 231 | else: |
---|
[14193] | 232 | amount = 23600 |
---|
[14265] | 233 | # NCE II fresh sw |
---|
| 234 | elif student.current_level == 200 and student.state == CLEARED: |
---|
| 235 | if student.depcode in ARTS: |
---|
| 236 | amount = 19000 |
---|
| 237 | else: |
---|
| 238 | amount = 19500 |
---|
[10012] | 239 | # NCE II sw |
---|
[9143] | 240 | elif student.current_level in (100, 110, 120) and \ |
---|
| 241 | student.state == RETURNING: |
---|
| 242 | if student.depcode in ARTS: |
---|
[11850] | 243 | amount = 19000 |
---|
[9143] | 244 | else: |
---|
[11882] | 245 | amount = 19500 |
---|
[10012] | 246 | # NCE III sw |
---|
[9143] | 247 | elif student.current_level in (200, 210, 220): |
---|
| 248 | if student.depcode in ARTS: |
---|
[11850] | 249 | amount = 21000 |
---|
[9143] | 250 | else: |
---|
[14193] | 251 | amount = 21500 |
---|
[10012] | 252 | # NCE IV sw |
---|
[9143] | 253 | elif student.current_level in (300, 310, 320): |
---|
| 254 | if student.depcode in ARTS: |
---|
[11850] | 255 | amount = 19000 |
---|
[9143] | 256 | else: |
---|
[11850] | 257 | amount = 19500 |
---|
[10012] | 258 | # NCE V sw |
---|
[9143] | 259 | elif student.current_level in (400, 410, 420): |
---|
| 260 | if student.depcode in ARTS: |
---|
[11850] | 261 | amount = 19000 |
---|
[9143] | 262 | else: |
---|
[11850] | 263 | amount = 19500 |
---|
[10012] | 264 | # NCE V spillover sw |
---|
[9143] | 265 | elif student.current_level in (500, 510, 520) and \ |
---|
| 266 | student.current_verdict == 'B': |
---|
| 267 | if student.depcode in ARTS: |
---|
[11850] | 268 | amount = 17500 |
---|
[9143] | 269 | else: |
---|
[11850] | 270 | amount = 18000 |
---|
[10012] | 271 | # NCE V second spillover sw |
---|
[9143] | 272 | elif student.current_level in (600, 610, 620) and \ |
---|
| 273 | student.current_verdict == 'B': |
---|
| 274 | if student.depcode in ARTS: |
---|
[11850] | 275 | amount = 17500 |
---|
[9143] | 276 | else: |
---|
[11850] | 277 | amount = 18000 |
---|
[10009] | 278 | # NCE student payment can be disabled by |
---|
| 279 | # setting the base school fee to -1 |
---|
| 280 | if academic_session.school_fee_base == -1 and \ |
---|
| 281 | student.current_mode.startswith('nce'): |
---|
[10010] | 282 | return _(u'School fee payment is disabled.'), None |
---|
[9297] | 283 | if student.state == RETURNING: |
---|
[9525] | 284 | # Override p_session and p_level |
---|
[9297] | 285 | p_session, p_level = self.getReturningData(student) |
---|
[9525] | 286 | academic_session = self._getSessionConfiguration(p_session) |
---|
| 287 | if academic_session == None: |
---|
| 288 | return _(u'Session configuration object is not available.'), None |
---|
[9143] | 289 | |
---|
[8599] | 290 | if amount in (0.0, None): |
---|
| 291 | return _(u'Amount could not be determined.'), None |
---|
[14566] | 292 | |
---|
| 293 | # Add session and level specific penalty fee. |
---|
[13881] | 294 | if category == 'schoolfee' and student.current_mode in ( |
---|
[14617] | 295 | 'ug_ft', 'de_ft') and student.state != CLEARED: |
---|
[13881] | 296 | amount += academic_session.penalty_ug_ft |
---|
| 297 | elif category == 'schoolfee' and student.current_mode in ( |
---|
[14556] | 298 | 'nce_ft',) and student['studycourse'].previous_verdict != 'O': |
---|
[14566] | 299 | # NCE I fresh |
---|
| 300 | if student.current_level == 100 and student.state == CLEARED: |
---|
| 301 | amount += academic_session.penalty_nce1_ft |
---|
| 302 | # NCE II |
---|
| 303 | elif student.current_level in (100, 110, 120) and \ |
---|
| 304 | student.state == RETURNING: |
---|
| 305 | amount += academic_session.penalty_nce2_ft |
---|
| 306 | # NCE III (except repeaters and spillovers) |
---|
| 307 | elif student.current_level in (200, 210, 220): |
---|
| 308 | amount += academic_session.penalty_nce3_ft |
---|
[14618] | 309 | elif category == 'schoolfee' and student.current_mode in ('nce_sw', |
---|
| 310 | 'nce_pt') and student['studycourse'].previous_verdict != 'O': |
---|
[14566] | 311 | # NCE I fresh |
---|
| 312 | if student.current_level == 100 and student.state == CLEARED: |
---|
| 313 | amount += academic_session.penalty_nce1_pt |
---|
| 314 | # NCE II |
---|
| 315 | elif student.current_level in (100, 110, 120) and \ |
---|
| 316 | student.state == RETURNING: |
---|
| 317 | amount += academic_session.penalty_nce2_pt |
---|
| 318 | # NCE III (except repeaters and spillovers) |
---|
| 319 | elif student.current_level in (200, 210, 220): |
---|
| 320 | amount += academic_session.penalty_nce3_pt |
---|
[13881] | 321 | elif category == 'schoolfee' and student.current_mode in ('prence',): |
---|
| 322 | amount += academic_session.penalty_prence |
---|
[11649] | 323 | if self.samePaymentMade(student, category, p_item, p_session): |
---|
| 324 | return _('This type of payment has already been made.'), None |
---|
[11457] | 325 | if self._isPaymentDisabled(p_session, category, student): |
---|
[13800] | 326 | return _('This category of payments has been disabled.'), None |
---|
[8713] | 327 | payment = createObject(u'waeup.StudentOnlinePayment') |
---|
[8953] | 328 | timestamp = ("%d" % int(time()*10000))[1:] |
---|
[8599] | 329 | payment.p_id = "p%s" % timestamp |
---|
| 330 | payment.p_category = category |
---|
| 331 | payment.p_item = p_item |
---|
| 332 | payment.p_session = p_session |
---|
| 333 | payment.p_level = p_level |
---|
[9153] | 334 | payment.p_current = p_current |
---|
[10388] | 335 | payment.amount_auth = float(amount) + GATEWAY_AMT |
---|
[8599] | 336 | return None, payment |
---|
[7621] | 337 | |
---|
[9207] | 338 | def getAccommodationDetails(self, student): |
---|
| 339 | """Determine the accommodation data of a student. |
---|
| 340 | """ |
---|
| 341 | d = {} |
---|
| 342 | d['error'] = u'' |
---|
| 343 | hostels = grok.getSite()['hostels'] |
---|
| 344 | d['booking_session'] = hostels.accommodation_session |
---|
| 345 | d['allowed_states'] = hostels.accommodation_states |
---|
| 346 | d['startdate'] = hostels.startdate |
---|
| 347 | d['enddate'] = hostels.enddate |
---|
| 348 | d['expired'] = hostels.expired |
---|
| 349 | # Determine bed type |
---|
| 350 | studycourse = student['studycourse'] |
---|
| 351 | certificate = getattr(studycourse,'certificate',None) |
---|
| 352 | current_level = studycourse.current_level |
---|
| 353 | if None in (current_level, certificate): |
---|
| 354 | return d |
---|
| 355 | end_level = certificate.end_level |
---|
| 356 | if current_level == 10: |
---|
| 357 | bt = 'pr' |
---|
| 358 | elif current_level == 100: |
---|
| 359 | bt = 'fr' |
---|
| 360 | elif current_level >= 300: |
---|
| 361 | bt = 'fi' |
---|
| 362 | else: |
---|
| 363 | bt = 're' |
---|
| 364 | if student.sex == 'f': |
---|
| 365 | sex = 'female' |
---|
| 366 | else: |
---|
| 367 | sex = 'male' |
---|
| 368 | special_handling = 'regular' |
---|
[13614] | 369 | if certificate.study_mode == 'ug_ft': |
---|
| 370 | special_handling = 'ugft' |
---|
[9207] | 371 | d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt) |
---|
| 372 | return d |
---|
| 373 | |
---|
[14617] | 374 | #def warnCreditsOOR(self, studylevel, course=None): |
---|
| 375 | # """Return message if credits are out of range. |
---|
| 376 | # """ |
---|
| 377 | # # adding a course ticket |
---|
| 378 | # if course: |
---|
| 379 | # if course.semester == 1: |
---|
| 380 | # if studylevel.total_credits_s1 + course.credits > 24: |
---|
| 381 | # return _('Maximum credits in 1st semester exceeded.') |
---|
| 382 | # if course.semester == 2: |
---|
| 383 | # if studylevel.total_credits_s2 + course.credits > 24: |
---|
| 384 | # return _('Maximum credits in 2nd semester exceeded.') |
---|
| 385 | # # registering course list |
---|
| 386 | # else: |
---|
| 387 | # if studylevel.total_credits_s1 > 24: |
---|
| 388 | # return _('Maximum credits in 1st semester exceeded.') |
---|
| 389 | # if studylevel.total_credits_s1 < 18: |
---|
| 390 | # return _('Minimum credits in 1st semester not reached.') |
---|
| 391 | # if studylevel.total_credits_s2 > 24: |
---|
| 392 | # return _('Maximum credits in 2nd semester exceeded.') |
---|
| 393 | # if studylevel.total_credits_s2 < 18: |
---|
| 394 | # return _('Minimum credits in 2nd semester not reached.') |
---|
| 395 | # return |
---|
| 396 | |
---|
[14586] | 397 | def warnCreditsOOR(self, studylevel, course=None): |
---|
[14591] | 398 | """Return message if credits are out of range. |
---|
[9903] | 399 | """ |
---|
[14591] | 400 | # adding a course ticket |
---|
| 401 | if course: |
---|
[14617] | 402 | if studylevel.total_credits + course.credits > 52: |
---|
| 403 | return _('Maximum credits exceeded.') |
---|
[14591] | 404 | # registering course list |
---|
| 405 | else: |
---|
[14617] | 406 | if studylevel.total_credits > 52: |
---|
| 407 | return _('Maximum credits exceeded.') |
---|
[14618] | 408 | if studylevel.__parent__.previous_verdict == 'O': |
---|
| 409 | return |
---|
[14591] | 410 | if studylevel.total_credits_s1 < 18: |
---|
| 411 | return _('Minimum credits in 1st semester not reached.') |
---|
| 412 | if studylevel.total_credits_s2 < 18: |
---|
| 413 | return _('Minimum credits in 2nd semester not reached.') |
---|
[14586] | 414 | return |
---|
[9903] | 415 | |
---|
[9950] | 416 | def getPDFCreator(self, context): |
---|
| 417 | """Get a pdf creator suitable for `context`. |
---|
| 418 | |
---|
| 419 | The default implementation always returns the default creator. |
---|
| 420 | """ |
---|
| 421 | mode = getattr(context, 'current_mode', None) |
---|
| 422 | if mode and mode.startswith('ug'): |
---|
| 423 | return getUtility(IPDFCreator, name='ibadan_pdfcreator') |
---|
| 424 | return getUtility(IPDFCreator) |
---|
| 425 | |
---|
[9982] | 426 | def _admissionText(self, student, portal_language): |
---|
| 427 | mode = getattr(student, 'current_mode', None) |
---|
| 428 | if mode and mode.startswith('ug'): |
---|
| 429 | text = trans(_( |
---|
| 430 | 'With reference to your application for admission into Bachelor Degree ' |
---|
| 431 | 'Programme of the University of Ibadan, this is to inform you that you have ' |
---|
| 432 | 'been provisionally admitted to pursue a full-time Bachelor of Arts in ' |
---|
| 433 | 'Education Degree Programme as follows:'), |
---|
| 434 | portal_language) |
---|
| 435 | else: |
---|
| 436 | inst_name = grok.getSite()['configuration'].name |
---|
| 437 | text = trans(_( |
---|
[15890] | 438 | 'This is to inform you that you have been provisionally\n' |
---|
[15891] | 439 | 'admitted into ${a}\n' |
---|
| 440 | 'as follows:', mapping = {'a': inst_name}), |
---|
[9982] | 441 | portal_language) |
---|
| 442 | return text |
---|
| 443 | |
---|
[9989] | 444 | def getBedCoordinates(self, bedticket): |
---|
| 445 | """Return bed coordinates. |
---|
| 446 | |
---|
| 447 | Bed coordinates are invisible in FCEOkene. |
---|
| 448 | """ |
---|
| 449 | return _('(see payment slip)') |
---|
| 450 | |
---|
[13030] | 451 | def _isPaymentDisabled(self, p_session, category, student): |
---|
| 452 | academic_session = self._getSessionConfiguration(p_session) |
---|
| 453 | if category == 'schoolfee': |
---|
| 454 | if 'sf_all' in academic_session.payment_disabled: |
---|
| 455 | return True |
---|
| 456 | if 'sf_nce1' in academic_session.payment_disabled and \ |
---|
| 457 | student.current_level == 100 and student.state == CLEARED and \ |
---|
| 458 | student.current_mode == 'nce_ft': |
---|
| 459 | return True |
---|
| 460 | return False |
---|
| 461 | |
---|
[10019] | 462 | SEPARATORS_DICT = { |
---|
| 463 | 'form.fst_sit_fname': _(u'First Sitting Record'), |
---|
| 464 | 'form.scd_sit_fname': _(u'Second Sitting Record'), |
---|
| 465 | #'form.alr_fname': _(u'Advanced Level Record'), |
---|
| 466 | 'form.hq_type': _(u'Advanced Level Record'), |
---|
| 467 | 'form.hq2_type': _(u'Second Higher Education Record'), |
---|
| 468 | 'form.nysc_year': _(u'NYSC Information'), |
---|
| 469 | 'form.employer': _(u'Employment History'), |
---|
| 470 | 'form.former_matric': _(u'Former Student'), |
---|
| 471 | } |
---|
| 472 | |
---|
[10023] | 473 | SKIP_UPLOAD_VIEWLETS = ( |
---|
| 474 | 'higherqualificationresultupload', |
---|
| 475 | 'secondHigherqualificationresultupload', |
---|
| 476 | 'certificateupload', |
---|
| 477 | 'secondcertificateupload', |
---|
| 478 | 'thirdcertificateupload', |
---|
| 479 | 'resultstatementupload', |
---|
| 480 | 'secondrefereeletterupload', |
---|
| 481 | 'thirdrefereeletterupload',) |
---|
| 482 | |
---|
[8460] | 483 | # FCEOkene prefix |
---|
[10520] | 484 | STUDENT_ID_PREFIX = u'K' |
---|