source: WAeUP_SRP/trunk/skins/waeup_utilities/fixPaymentPins.py @ 5506

Last change on this file since 5506 was 1377, checked in by Henrik Bettermann, 18 years ago

move hyphen in PIN strings

File size: 1.1 KB
Line 
1## Script (Python) "fixPins"
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
13"""
14
15request = REQUEST
16wftool = context.portal_workflow
17mtool = context.portal_membership
18member = mtool.getAuthenticatedMember()
19roles = member.getRolesInContext(context)
20scat = context.students_catalog
21from Products.AdvancedQuery import Eq, Between, Le,In
22aq_students = context.students_catalog.evalAdvancedQuery
23students = context.portal_url.getPortalObject().campus.students
24payments = context.portal_catalog(portal_type='Payment')
25
26list = []
27for brain in payments:
28    d = {}
29    payment = brain.getObject()
30    pay_doc = payment.getContent()
31    if pay_doc.resp_code == 'SC':
32        old = pay_doc.type_code
33        pin = old.replace('-','')
34        d['type_code'] = pin[:3]+'-'+pin[3:4]+'-'+pin[4:]
35        pay_doc.edit(mapping=d)
36        list.append('%s changed to %s' % (old,d['type_code']))
37return '\n'.join(list)
38
Note: See TracBrowser for help on using the repository browser.