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

Last change on this file since 1917 was 1847, checked in by joachim, 17 years ago

Patch of searchResults is not neccessary, if permission
"Access inactive portal content" is set for authenticated in uniben-root.

  • Property svn:keywords set to Id
File size: 2.6 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 1847 2007-06-02 17:33:18Z joachim $
11"""
12Info for the PaymentsFolder
13"""
14
15mtool = context.portal_membership
16if mtool.isAnonymousUser():
17    return None
18try:
19    from Products.zdb import set_trace
20except:
21    def set_trace():
22        pass
23
24
25#import logging
26#logger = logging.getLogger('Skins.getPaymentsFolderInfo')
27def cmp_id(a,b):
28    s1 = "%(id)s" % a
29    s2 = "%(id)s" % b
30    if s1 == s2:
31        return 0
32    if s1 > s2:
33        return 1
34    return -1
35
36import DateTime
37request = context.REQUEST
38students = context.portal_url.getPortalObject().campus.students
39student_id = context.getStudentId()
40if student_id is None:
41    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
42#student = getattr(students,student_id)
43s_brain = context.students_catalog(id = student_id)[0]
44
45payments = []
46#from Products.zdb import set_trace;set_trace()
47
48info = {}
49is_so = info['is_so'] = context.isSectionOfficer()
50
51#res = context.portal_catalog(portal_type='Student',id = student_id)
52#res = context.students_catalog(id = student_id)
53info['review_state'] = s_brain.review_state
54session = s_brain.session
55info['next_session'], info['next_session_str'] = context.getNextSessionId(session)
56
57info['student_name'] = s_brain.name
58payments_path = "%s/campus/students/%s/payments" % (context.portal_url.getPortalPath(),student_id)
59sos = context.portal_catalog(container_path=payments_path)
60info['is_so'] = is_so
61
62for so in sos:
63
64    row = {}
65    row['id'] = so.getId
66    row['title'] = so.Title
67    url = row['url'] = "%s/%s" % (payments_path,so.getId)
68    so_object = context.restrictedTraverse(url,default=None).getContent()
69    row['type'] = so.portal_type
70    review_state = row['review_state'] = so.review_state
71    if so_object.type_description.startswith('School Fee'):
72        row['is_approvable'] = is_so and (review_state == "opened") and info['review_state'] == 'cleared_and_validated'
73    else:
74        row['is_approvable'] = is_so and (review_state == "opened")
75    if so_object.type_description.startswith('School Fee'):
76        row['is_requeryable'] = (review_state == "opened") and info['review_state'] == 'cleared_and_validated'
77    else:
78        row['is_requeryable'] = is_so and (review_state == "opened")
79    if (review_state == "closed") and so_object.resp_code in ('SC','00','AP','IP',):
80        row['confirmed'] = 'active'
81    else:
82        row['confirmed'] = 'unsuccessful'
83    payments.append(row)
84
85payments.sort(cmp_id)
86info['payments'] = payments
87return info
88
Note: See TracBrowser for help on using the repository browser.