source: WAeUP_SRP/trunk/skins/waeup_epayment/approve_epayment.py @ 2183

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

new logging format Part 3

File size: 1.5 KB
RevLine 
[1568]1## Script (Python) "approve_epayment"
[1427]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: aprove_epayment.py 1425 2007-02-15 17:52:01Z joachim $
11"""
12"""
13import logging
[1568]14logger = logging.getLogger('Skins.approve_epayment')
[1427]15import DateTime
16if context.portal_membership.isAnonymousUser():
17    return None
18
19request = context.REQUEST
20students = context.portal_url.getPortalObject().campus.students
21wftool = context.portal_workflow
22mtool = context.portal_membership
23is_anon = mtool.isAnonymousUser()
24member = mtool.getAuthenticatedMember()
25student_id = context.getStudentId()
26is_so = context.isSectionOfficer()
27if student_id is None or not is_so:
28    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
29
30student = getattr(students,student_id)
31
32pd = {}
33#from Products.zdb import set_trace;set_trace()
34doc = context.getContent()
35review_state = wftool.getInfoFor(context,'review_state',None)
36if review_state != "opened":
37    return "not opened %s" % review_state
38pd['resp_code'] = 'AP'
39pd['resp_desc'] = 'Payment approved by %s, %s' % (member,DateTime.DateTime())
40doc.edit(mapping=pd)
41if doc.type_description.startswith('School Fee'):
42    wftool.doActionFor(student,'pay_school_fee')
[1568]43logger.info('%s approves epayment for %s' % (member,student_id))
[1427]44wftool.doActionFor(context,'close')
45return request.RESPONSE.redirect("%s/waeup_document_view" % context.absolute_url())
Note: See TracBrowser for help on using the repository browser.