Changeset 1390


Ignore:
Timestamp:
5 Feb 2007, 09:02:07 (18 years ago)
Author:
joachim
Message:

check for mulitple invocation (in custom)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_epayment/pay_by_sc.py

    r1376 r1390  
    6969order_id = ds.get('pin_n')
    7070p_id = "p%s" % order_id
    71 now = DateTime.DateTime()
    72 info['date'] = now
    73 info['amount'] = "n/a"
    74 pin = info['order_id'] = ds.get('pin')
    75 info['type_code'] = "%s" % pin
    76 info['type_description'] = 'School Fee for Session 2006/2007'
    77 info['resp_code'] = "SC"
    78 info['resp_desc'] = "SC Payment Successful"
    79 payments.invokeFactory('Payment', p_id)
    80 payment = getattr(payments,p_id)
    81 wftool = context.portal_workflow
    82 wftool.doActionFor(payment,'open')
    83 payment.getContent().edit(mapping=info)
    84 wftool.doActionFor(payment,'close')
    85 wftool.doActionFor(student,'pay_school_fee')
    86 logger.info('"%s", "paid school fee by scratch card"' % student_id)
     71if not hasattr(payments,p_id):
     72    now = DateTime.DateTime()
     73    info['date'] = now
     74    info['amount'] = "n/a"
     75    pin = info['order_id'] = ds.get('pin')
     76    info['type_code'] = "%s" % pin
     77    info['type_description'] = 'School Fee for Session 2006/2007'
     78    info['resp_code'] = "SC"
     79    info['resp_desc'] = "SC Payment Successful"
     80    payments.invokeFactory('Payment', p_id)
     81    payment = getattr(payments,p_id)
     82    wftool = context.portal_workflow
     83    wftool.doActionFor(payment,'open')
     84    payment.getContent().edit(mapping=info)
     85    wftool.doActionFor(payment,'close')
     86    wftool.doActionFor(student,'pay_school_fee')
     87    logger.info('"%s", "paid school fee by scratch card"' % student_id)
     88else:
     89    logger.info('"%s", "repeatedly paid school fee by scratch card"' % student_id)
    8790url = "%s/payments" % (student.absolute_url())
    8891request.RESPONSE.redirect(url)
Note: See TracChangeset for help on using the changeset viewer.