## Script (Python) "getPaymentsInfo"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
# $Id: getPaymentsFolderInfo.py 1283 2007-01-12 13:14:45Z joachim $
"""
Info for the PaymentsFolder
"""
import logging
logger = logging.getLogger('EPayment.')
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()
for o_id in context.objectIds():
    d = {}
    d['id'] = o_id
    res = context.portal_catalog(id=o_id)
    if res:
        title = res[0].Title
        d['title'] = title or o_id 
    else:
        d['title'] = "no Title"
    payments.append(d)
info = {}
is_so = info['is_so'] = context.isSectionOfficer()
info['student_name'] = s_brain.name
info['payments'] = payments
return info
