Last change
on this file since 15586 was
1377,
checked in by Henrik Bettermann, 18 years ago
|
move hyphen in PIN strings
|
File size:
1.1 KB
|
Rev | Line | |
---|
[1377] | 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 | |
---|
| 15 | request = REQUEST |
---|
| 16 | wftool = context.portal_workflow |
---|
| 17 | mtool = context.portal_membership |
---|
| 18 | member = mtool.getAuthenticatedMember() |
---|
| 19 | roles = member.getRolesInContext(context) |
---|
| 20 | scat = context.students_catalog |
---|
| 21 | from Products.AdvancedQuery import Eq, Between, Le,In |
---|
| 22 | aq_students = context.students_catalog.evalAdvancedQuery |
---|
| 23 | students = context.portal_url.getPortalObject().campus.students |
---|
| 24 | payments = context.portal_catalog(portal_type='Payment') |
---|
| 25 | |
---|
| 26 | list = [] |
---|
| 27 | for 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'])) |
---|
| 37 | return '\n'.join(list) |
---|
| 38 | |
---|
Note: See
TracBrowser for help on using the repository browser.