Changeset 3228


Ignore:
Timestamp:
25 Feb 2008, 22:53:10 (17 years ago)
Author:
Henrik Bettermann
Message:

fix WAeUPLevelWidget

adjust getPaymentsFolderInfo.py to Okene version

Location:
WAeUP_SRP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/Widgets.py

    r3219 r3228  
    438438
    439439        if not value:
    440             v = value = ''
     440            v = value = '100'
    441441        #import pdb;pdb.set_trace()
    442442        levels = self._getLevels()
  • WAeUP_SRP/uniben/waeup_custom/getPaymentsFolderInfo.py

    r3068 r3228  
    1818"""
    1919
     20from Products.AdvancedQuery import Eq, Between, Le,In
     21
    2022mtool = context.portal_membership
    2123wftool = context.portal_workflow
    2224member = mtool.getAuthenticatedMember()
     25payments_catalog = context.payments_catalog
     26aq_payments = payments_catalog.evalAdvancedQuery
    2327if mtool.isAnonymousUser():
    2428    return None
     
    3741import DateTime
    3842request = context.REQUEST
    39 students = context.portal_url.getPortalObject().campus.students
     43#students = context.portal_url.getPortalObject().campus.students
    4044student_id = context.getStudentId()
    4145if student_id is None:
    4246    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
    43 student = getattr(students,student_id)
     47#student = getattr(students,student_id)
    4448student_record = context.students_catalog.getRecordByKey(student_id)
    45 #context['updatePayments']()
    46 payments = []
     49
    4750
    4851info = {}
     
    5558fulltime = student_record.mode and student_record.mode.endswith('_ft')
    5659
    57 #if review_state == 'cleared_and_validated' or (parttime and review_state == 'returning'):
    58 #    online_payment = True
    59 #elif fulltime and review_state == 'returning':
    60 #    sc_payment = True
    6160
    6261session = student_record.session
     
    7069    info['payment_method'] = "online_payment"
    7170#elif review_state == 'cleared_and_validated' and session == '07':
    72 #    info['payment_method'] = "sc_payment"   
     71#    info['payment_method'] = "sc_payment"
    7372elif review_state == 'returning' and info['next_session'] != session:
    7473    info['payment_method'] = "sc_payment"
     
    7675
    7776info['student_name'] = student_record.name
    78 info['is_so'] = is_so
    79 
    80 for payment_id,payment in context.objectItems():
     77payments_path = "%s/campus/students/%s/payments" % (context.portal_url(),student_id)
     78payments = []
     79payment_records = aq_payments(Eq('student_id',student_id) & Eq('session_id',student_record.session))
     80vocabularies = context.portal_vocabularies
     81paid_fees = []
     82for payment in payment_records:
     83    if payment.status == "paid":
     84        paid_fees += "%s_%s" % (payment.type,payment.session_id),
     85for payment in payment_records:
    8186    row = {}
    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'):
    89         row['is_approvable'] = is_so and (review_state == "opened") and info['review_state'] == 'cleared_and_validated'
    90     else:
    91         row['is_approvable'] = is_so and (review_state == "opened")
    92     row['is_requeryable'] = False
    93     #set_trace()
    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'):
    97         if (review_state == 'opened' and info['review_state'] in ('cleared_and_validated',) and \
    98                                   hasattr(payment_doc, 'order_id') and not payment_doc.resp_code) or str(member) in ('admin',):
    99             row['is_requeryable'] = True
    100             row['callback_url'] = "%(url)s/interswitch_cb" % row
    101             href = '%(query_url)s' % info
    102             href += '?transRef=%(trans_ref)s' % row
    103             href += '&prodID=%(prod_id)s' % info
    104             href += '&redirectURL=%(callback_url)s' % row
    105             row['href'] = href
    106     if (review_state == "closed") and payment_doc.resp_code in ('SC','00','AP','IP',):
     87    row['id'] = payment.key
     88    row['title'] = "%s for Session %s, Naira %s, %s" % (vocabularies.payment_categories.get(payment.category),
     89                                                        vocabularies.sessions.get(payment.session_id),
     90                                                        payment.amount,
     91                                                        payment.date.strftime("%d/%m/%y %H:%M:%S"))
     92    url = row['url'] = "%s/p%s" % (payments_path,payment.order_id[6:])
     93    row['is_requeryable'] = "%s_%s" % (payment.type,payment.session_id) not in paid_fees or str(member) in ('admin',)
     94    row['is_approvable'] = is_so and row['is_requeryable']
     95    row['resp_desc'] = payment.resp_desc or 'Payment Process Interrupted'
     96    row['trans_ref'] = payment.order_id
     97    if row['is_requeryable']:
     98        row['callback_url'] = "%(url)s/interswitch_cb" % row
     99        href = '%(query_url)s' % info
     100        href += '?transRef=%(trans_ref)s' % row
     101        href += '&prodID=%(prod_id)s' % info
     102        href += '&redirectURL=%(callback_url)s' % row
     103        row['href'] = href
     104    if payment.status == 'paid':
    107105        row['confirmed'] = 'active'
    108106    else:
     
    111109    payments.append(row)
    112110
     111
     112
    113113payments.sort(cmp_id)
    114114info['payments'] = payments
     115
     116
    115117return info
    116118
Note: See TracChangeset for help on using the changeset viewer.