## Script (Python) "fixScratchCardPayments" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=REQUEST ##title= ## # $Id: fixScratchCardPayments.py 1371 2007-01-28 21:36:52Z henrik $ """ """ request = REQUEST wftool = context.portal_workflow mtool = context.portal_membership member = mtool.getAuthenticatedMember() roles = member.getRolesInContext(context) retcat = context.returning_import rcat = context.results_import scat = context.students_catalog from Products.AdvancedQuery import Eq, Between, Le,In aq_students = context.students_catalog.evalAdvancedQuery students = context.portal_url.getPortalObject().campus.students payments = context.portal_catalog(portal_type='Payment') list = [] for brain in payments: d = {} d['resp_code'] = "SC" d['resp_desc'] = "SC Payment Successful" payment = brain.getObject() pay_doc = payment.getContent() if pay_doc.type_description.startswith('School Fee SC'): d['type_description'] = 'School Fee for Session 2006/2007' pay_doc.edit(mapping=d) list.append('%s changed' % pay_doc.type_description) elif pay_doc.type_description.startswith('Transfer Form SC'): d['type_description'] = 'Transfer Form for Session 2006/2007' d['type_code'] = pay_doc.type_code.replace('transfer_','') pay_doc.edit(mapping=d) list.append('%s changed' % pay_doc.type_description) return '\n'.join(list)