source: WAeUP_SRP/trunk/skins/waeup_epayment/getPaymentsFolderInfo.py @ 1530

Last change on this file since 1530 was 1431, checked in by Henrik Bettermann, 18 years ago

new class for unsuccessful payments_view
'uniben' removed from subobject urls

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