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