Last change
on this file since 16680 was
5101,
checked in by Henrik Bettermann, 15 years ago
|
see ticket #651
|
-
Property svn:keywords set to
Id
|
File size:
3.2 KB
|
Line | |
---|
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: getSchoolFeePrefix.py 5101 2010-03-31 13:16:04Z henrik $ |
---|
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() |
---|
27 | student_record = context.students_catalog(id=student_id)[0] |
---|
28 | |
---|
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 | ) |
---|
63 | |
---|
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 | ) |
---|
92 | |
---|
93 | FRNART_FACULTY = ( |
---|
94 | "ART", |
---|
95 | "LAW", |
---|
96 | "SSC", |
---|
97 | "MGS", |
---|
98 | ) |
---|
99 | |
---|
100 | FRNSCI_FACULTY = ( |
---|
101 | "ENG", |
---|
102 | "LSC", |
---|
103 | "PSC", |
---|
104 | "BMS", |
---|
105 | "MED", |
---|
106 | "DEN", |
---|
107 | "PHA", |
---|
108 | "AGR", |
---|
109 | ) |
---|
110 | |
---|
111 | |
---|
112 | if student_record.lga == 'foreigner': |
---|
113 | if student_record.course in FRNART: |
---|
114 | prefix = 'FRNART' |
---|
115 | elif student_record.course in FRNSCI: |
---|
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' |
---|
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 | |
---|
129 | res = context.certificates_catalog(code = student_record.course) |
---|
130 | if not res: |
---|
131 | logger.info('%s, certificate %s not found' % (student_id,student_record.course)) |
---|
132 | prefix = "--" |
---|
133 | else: |
---|
134 | prefix = res[0].school_fee_code |
---|
135 | if not prefix or prefix == 'none': |
---|
136 | prefix = res[0].faculty |
---|
137 | if student_record.review_state == 'cleared_and_validated': |
---|
138 | prefix = prefix + 'NEW' |
---|
139 | return prefix |
---|
Note: See
TracBrowser for help on using the repository browser.