Last change
on this file since 16176 was
5101,
checked in by Henrik Bettermann, 15 years ago
|
see ticket #651
|
-
Property svn:keywords set to
Id
|
File size:
3.2 KB
|
Rev | Line | |
---|
[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 | ## |
---|
[5062] | 10 | # $Id: getSchoolFeePrefix.py 5101 2010-03-31 13:16:04Z henrik $ |
---|
[3060] | 11 | """ |
---|
[5062] | 12 | return the Prefix for Schoolfee |
---|
[3060] | 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 | |
---|
[5061] | 29 | FRNART = ( |
---|
| 30 | "BADTSW", |
---|
| 31 | "BAEDEDO", |
---|
| 32 | "BAEDEL", |
---|
| 33 | "BAEDENG", |
---|
| 34 | "BAEDFAA", |
---|
| 35 | "BAEDFRC", |
---|
| 36 | "BAEDHIS", |
---|
| 37 | "BBEDSW", |
---|
| 38 | "BECOSW", |
---|
| 39 | "BEDADT", |
---|
| 40 | "BEMGTSW", |
---|
| 41 | "BENLSW", |
---|
| 42 | "BGEOSW", |
---|
| 43 | "BHISSW", |
---|
| 44 | "BPOLSW", |
---|
| 45 | "BSCEDAC", |
---|
| 46 | "BSCEDAP", |
---|
| 47 | "BSCEDB", |
---|
| 48 | "BSCEDBE", |
---|
| 49 | "BSCEDE", |
---|
| 50 | "BSCEDECO", |
---|
| 51 | "BSCEDES", |
---|
| 52 | "BSCEDG", |
---|
| 53 | "BSCEDGEO", |
---|
| 54 | "BSCEDGR", |
---|
| 55 | "BSCEDPOL", |
---|
| 56 | "BSCEDPS", |
---|
| 57 | "BSCEDSE", |
---|
| 58 | "BSCEDSOC", |
---|
| 59 | "BSCEDSS", |
---|
| 60 | "BSSTSW", |
---|
| 61 | "DAED", |
---|
| 62 | ) |
---|
[3329] | 63 | |
---|
[5061] | 64 | FRNSCI = ( |
---|
| 65 | "BAGRSW", |
---|
| 66 | "BBIOSW", |
---|
| 67 | "BCHESW", |
---|
| 68 | "BCSCSW", |
---|
| 69 | "BHECSW", |
---|
| 70 | "BHEDSW", |
---|
| 71 | "BISCSW", |
---|
| 72 | "BITESW", |
---|
| 73 | "BSCEDAG", |
---|
| 74 | "BSCEDBC", |
---|
| 75 | "BSCEDC", |
---|
| 76 | "BSCEDCO", |
---|
| 77 | "BSCEDEE", |
---|
| 78 | "BSCEDEM", |
---|
| 79 | "BSCEDEV", |
---|
| 80 | "BSCEDHE", |
---|
| 81 | "BSCEDHK", |
---|
| 82 | "BSCEDHM", |
---|
| 83 | "BSCEDIS", |
---|
| 84 | "BSCEDM", |
---|
| 85 | "BSCEDME", |
---|
| 86 | "BSCEDP", |
---|
| 87 | "BSCEDPE", |
---|
| 88 | "BSCEDTE", |
---|
| 89 | "BSCEDWB", |
---|
| 90 | "DHT", |
---|
| 91 | ) |
---|
[5101] | 92 | |
---|
| 93 | FRNART_FACULTY = ( |
---|
| 94 | "ART", |
---|
| 95 | "LAW", |
---|
| 96 | "SSC", |
---|
| 97 | "MGS", |
---|
| 98 | ) |
---|
[5061] | 99 | |
---|
[5101] | 100 | FRNSCI_FACULTY = ( |
---|
| 101 | "ENG", |
---|
| 102 | "LSC", |
---|
| 103 | "PSC", |
---|
| 104 | "BMS", |
---|
| 105 | "MED", |
---|
| 106 | "DEN", |
---|
| 107 | "PHA", |
---|
| 108 | "AGR", |
---|
| 109 | ) |
---|
| 110 | |
---|
| 111 | |
---|
[5061] | 112 | if student_record.lga == 'foreigner': |
---|
| 113 | if student_record.course in FRNART: |
---|
[5101] | 114 | prefix = 'FRNART' |
---|
[5061] | 115 | elif student_record.course in FRNSCI: |
---|
[5101] | 116 | prefix = 'FRNSCI' |
---|
| 117 | elif student_record.faculty in FRNART_FACULTY: |
---|
| 118 | prefix = 'FRNART' |
---|
| 119 | elif student_record.faculty in FRNSCI_FACULTY: |
---|
| 120 | prefix = 'FRNSCI' |
---|
[5061] | 121 | else: |
---|
| 122 | logger.info('%s, foreign student course %s not categorized' % (student_id,student_record.faculty)) |
---|
| 123 | prefix = "--" |
---|
| 124 | return prefix |
---|
| 125 | if student_record.review_state == 'cleared_and_validated': |
---|
| 126 | prefix = prefix + 'NEW' |
---|
| 127 | return prefix |
---|
| 128 | |
---|
[4788] | 129 | res = context.certificates_catalog(code = student_record.course) |
---|
[3060] | 130 | if not res: |
---|
[4788] | 131 | logger.info('%s, certificate %s not found' % (student_id,student_record.course)) |
---|
[3060] | 132 | prefix = "--" |
---|
| 133 | else: |
---|
[4788] | 134 | prefix = res[0].school_fee_code |
---|
[3060] | 135 | if not prefix or prefix == 'none': |
---|
[4788] | 136 | prefix = res[0].faculty |
---|
[3329] | 137 | if student_record.review_state == 'cleared_and_validated': |
---|
| 138 | prefix = prefix + 'NEW' |
---|
[3060] | 139 | return prefix |
---|
Note: See
TracBrowser for help on using the repository browser.