## Script (Python) "getPaymentsFolderInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## # $Id: getPaymentsFolderInfo.py 1568 2007-03-17 08:37:51Z henrik $ """ Info for the PaymentsFolder """ #import logging #logger = logging.getLogger('Skins.getPaymentsFolderInfo') import DateTime request = context.REQUEST students = context.portal_url.getPortalObject().campus.students student_id = context.getStudentId() if student_id is None: return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) #student = getattr(students,student_id) s_brain = context.students_catalog(id = student_id)[0] payments = [] #from Products.zdb import set_trace;set_trace() info = {} is_so = info['is_so'] = context.isSectionOfficer() res = context.portal_catalog(portal_type='Student',id = student_id) if res: info['review_state'] = res[0].review_state info['student_name'] = s_brain.name payments_path = "%s/campus/students/%s/payments" % (context.portal_url.getPortalPath(),student_id) sos = context.portal_catalog(container_path=payments_path) info['is_so'] = is_so for so in sos: row = {} row['id'] = so.getId row['title'] = so.Title url = row['url'] = "%s/%s" % (payments_path,so.getId) so_object = context.restrictedTraverse(url,default=None).getContent() row['type'] = so.portal_type review_state = row['review_state'] = so.review_state if so_object.type_description.startswith('School Fee'): row['is_approvable'] = is_so and (review_state == "opened") and info['review_state'] == 'cleared_and_validated' else: row['is_approvable'] = is_so and (review_state == "opened") if (review_state == "closed") and so_object.resp_code in ('SC','00','AP',): row['confirmed'] = 'active' else: row['confirmed'] = 'unsuccessful' payments.append(row) info['payments'] = payments return info