Changeset 3068 for WAeUP_SRP/uniben


Ignore:
Timestamp:
30 Jan 2008, 18:49:19 (17 years ago)
Author:
joachim
Message:

avoid portal_catalog for payments list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/uniben/waeup_custom/getPaymentsFolderInfo.py

    r3060 r3068  
    1919
    2020mtool = context.portal_membership
     21wftool = context.portal_workflow
    2122member = mtool.getAuthenticatedMember()
    2223if mtool.isAnonymousUser():
     
    7576
    7677info['student_name'] = student_record.name
    77 payments_path = "%s/campus/students/%s/payments" % (context.portal_url.getPortalPath(),student_id)
    78 sos = context.portal_catalog(container_path=payments_path)
    7978info['is_so'] = is_so
    8079
    81 for so in sos:
     80for payment_id,payment in context.objectItems():
    8281    row = {}
    83     row['id'] = so.getId
    84     row['title'] = so.Title
    85     url = row['url'] = "%s/%s" % (payments_path,so.getId)
    86     so_doc = context.restrictedTraverse(url,default=None).getContent()
    87     row['type'] = so.portal_type
    88     review_state = row['review_state'] = so.review_state
    89     if so_doc.type_description.startswith('School Fee'):
     82    row['id'] = payment_id
     83    row['title'] = payment.Title()
     84    url = row['url'] = payment.absolute_url()
     85    payment_doc = payment.getContent()
     86    row['type'] = payment_doc.portal_type
     87    review_state = row['review_state'] = wftool.getInfoFor(payment,'review_state',None)
     88    if payment_doc.type_description.startswith('School Fee'):
    9089        row['is_approvable'] = is_so and (review_state == "opened") and info['review_state'] == 'cleared_and_validated'
    9190    else:
     
    9392    row['is_requeryable'] = False
    9493    #set_trace()
    95     row['resp_desc'] = getattr(so_doc,'resp_desc','no response')
    96     row['trans_ref'] = getattr(so_doc,'order_id','')
    97     if so_doc.type_description.startswith('School Fee'):
     94    row['resp_desc'] = getattr(payment_doc,'resp_desc','no response')
     95    row['trans_ref'] = getattr(payment_doc,'order_id','')
     96    if payment_doc.type_description.startswith('School Fee'):
    9897        if (review_state == 'opened' and info['review_state'] in ('cleared_and_validated',) and \
    99                                   hasattr(so_doc, 'order_id') and not so_doc.resp_code) or str(member) in ('admin',):
     98                                  hasattr(payment_doc, 'order_id') and not payment_doc.resp_code) or str(member) in ('admin',):
    10099            row['is_requeryable'] = True
    101             row['callback_url'] = "%s/payments/%s/interswitch_cb" % (student.absolute_url(),
    102                                                             so.getId)
     100            row['callback_url'] = "%(url)s/interswitch_cb" % row
    103101            href = '%(query_url)s' % info
    104102            href += '?transRef=%(trans_ref)s' % row
     
    106104            href += '&redirectURL=%(callback_url)s' % row
    107105            row['href'] = href
    108     if (review_state == "closed") and so_doc.resp_code in ('SC','00','AP','IP',):
     106    if (review_state == "closed") and payment_doc.resp_code in ('SC','00','AP','IP',):
    109107        row['confirmed'] = 'active'
    110108    else:
    111109        row['confirmed'] = 'unsuccessful'
    112110    row['is_editable'] = is_so and (row['confirmed'] == 'active')
    113 
    114111    payments.append(row)
    115112
Note: See TracChangeset for help on using the changeset viewer.