source: WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py @ 11156

Last change on this file since 11156 was 1653, checked in by uli, 18 years ago

Incorporated changeset 1593:1652 of trunk into uli-branch.

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1## Script (Python) "getPaymentsFolderInfo"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: getPaymentsFolderInfo.py 1653 2007-03-28 02:35:25Z uli $
11"""
12Info for the PaymentsFolder
13"""
14#import logging
15#logger = logging.getLogger('Skins.getPaymentsFolderInfo')
16
17import DateTime
18request = context.REQUEST
19students = context.portal_url.getPortalObject().campus.students
20
21student_id = context.getStudentId()
22if student_id is None:
23    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
24#student = getattr(students,student_id)
25s_brain = context.students_catalog(id = student_id)[0]
26
27payments = []
28#from Products.zdb import set_trace;set_trace()
29
30info = {}
31is_so = info['is_so'] = context.isSectionOfficer()
32
33res = context.portal_catalog(portal_type='Student',id = student_id)
34if res:
35    info['review_state'] = res[0].review_state
36
37info['student_name'] = s_brain.name
38payments_path = "%s/campus/students/%s/payments" % (context.portal_url.getPortalPath(),student_id)
39sos = context.portal_catalog(container_path=payments_path)
40info['is_so'] = is_so
41
42for so in sos:
43
44    row = {}
45    row['id'] = so.getId
46    row['title'] = so.Title
47    url = row['url'] = "%s/%s" % (payments_path,so.getId)
48    so_object = context.restrictedTraverse(url,default=None).getContent()
49    row['type'] = so.portal_type
50    review_state = row['review_state'] = so.review_state
51    if so_object.type_description.startswith('School Fee'):
52        row['is_approvable'] = is_so and (review_state == "opened") and info['review_state'] == 'cleared_and_validated'
53    else:
54        row['is_approvable'] = is_so and (review_state == "opened")
55    if so_object.type_description.startswith('School Fee'):
56        row['is_requeryable'] = (review_state == "opened") and info['review_state'] == 'cleared_and_validated'
57    else:
58        row['is_requeryable'] = is_so and (review_state == "opened")
59    if (review_state == "closed") and so_object.resp_code in ('SC','00','AP','IP',):
60        row['confirmed'] = 'active'
61    else:
62        row['confirmed'] = 'unsuccessful'
63    payments.append(row)
64
65
66info['payments'] = payments
67return info
68
Note: See TracBrowser for help on using the repository browser.