[3060] | 1 | ## Script (Python) "getSchoolFeePrefix" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id:getMaintenancePrefix.py 486 2006-09-06 10:09:39Z joachim $ |
---|
| 11 | """ |
---|
| 12 | return the Prefix for Schoolfee |
---|
| 13 | """ |
---|
| 14 | |
---|
| 15 | if context.portal_membership.isAnonymousUser(): |
---|
| 16 | return None |
---|
| 17 | |
---|
| 18 | try: |
---|
| 19 | from Products.zdb import set_trace |
---|
| 20 | except: |
---|
| 21 | def set_trace(): |
---|
| 22 | pass |
---|
| 23 | import logging |
---|
| 24 | logger = logging.getLogger('Skins.getSchoolFeePrefix') |
---|
| 25 | |
---|
| 26 | student_id = context.getStudentId() |
---|
[3329] | 27 | student_record = context.students_catalog(id=student_id)[0] |
---|
| 28 | |
---|
[4788] | 29 | # still to be configured properly (see ticket 651) |
---|
| 30 | #if student_record.lga == 'foreigner': |
---|
| 31 | # if student_record.faculty in ('ART','LAW','SSC','MGS'): |
---|
| 32 | # prefix == 'FRNART' |
---|
| 33 | # elif student_record.faculty in ('MED'): |
---|
| 34 | # prefix == 'FRNSCI' |
---|
| 35 | # else: |
---|
| 36 | # logger.info('%s, foreign student faculty %s not found' % (student_id,student_record.faculty)) |
---|
| 37 | # prefix = "--" |
---|
| 38 | # return prefix |
---|
| 39 | # if student_record.review_state == 'cleared_and_validated': |
---|
| 40 | # prefix = prefix + 'NEW' |
---|
| 41 | # return prefix |
---|
[3329] | 42 | |
---|
[4788] | 43 | res = context.certificates_catalog(code = student_record.course) |
---|
[3060] | 44 | if not res: |
---|
[4788] | 45 | logger.info('%s, certificate %s not found' % (student_id,student_record.course)) |
---|
[3060] | 46 | prefix = "--" |
---|
| 47 | else: |
---|
[4788] | 48 | prefix = res[0].school_fee_code |
---|
[3060] | 49 | if not prefix or prefix == 'none': |
---|
[4788] | 50 | prefix = res[0].faculty |
---|
[3329] | 51 | if student_record.review_state == 'cleared_and_validated': |
---|
| 52 | prefix = prefix + 'NEW' |
---|
[3060] | 53 | return prefix |
---|