1 | ## Script (Python) "fixScratchCardPayments" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters=REQUEST |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | # $Id: fixScratchCardPayments.py 1371 2007-01-28 21:36:52Z henrik $ |
---|
11 | """ |
---|
12 | list Students for ClearanceOfficers |
---|
13 | """ |
---|
14 | |
---|
15 | request = REQUEST |
---|
16 | wftool = context.portal_workflow |
---|
17 | mtool = context.portal_membership |
---|
18 | member = mtool.getAuthenticatedMember() |
---|
19 | roles = member.getRolesInContext(context) |
---|
20 | retcat = context.returning_import |
---|
21 | rcat = context.results_import |
---|
22 | scat = context.students_catalog |
---|
23 | from Products.AdvancedQuery import Eq, Between, Le,In |
---|
24 | aq_students = context.students_catalog.evalAdvancedQuery |
---|
25 | students = context.portal_url.getPortalObject().campus.students |
---|
26 | payments = context.portal_catalog(portal_type='Payment') |
---|
27 | d = {} |
---|
28 | list = [] |
---|
29 | d['resp_code'] = "SC" |
---|
30 | d['resp_desc'] = "SC Payment Successful" |
---|
31 | for brain in payments: |
---|
32 | payment = brain.getObject() |
---|
33 | pay_doc = payment.getContent() |
---|
34 | if pay_doc.type_description.startswith('School Fee SC'): |
---|
35 | d['type_description'] = 'School Fee for Session 2006/2007' |
---|
36 | pay_doc.edit(mapping=d) |
---|
37 | list.append('%s changed' % pay_doc.type_description) |
---|
38 | elif pay_doc.type_description.startswith('Transfer Form SC'): |
---|
39 | d['type_description'] = 'Transfer Form for Session 2006/2007' |
---|
40 | d['type_code'] = pay_doc.type_code.replace('transfer_','') |
---|
41 | pay_doc.edit(mapping=d) |
---|
42 | list.append('%s changed' % pay_doc.type_description) |
---|
43 | return '\n'.join(list) |
---|