source: WAeUP_SRP/trunk/skins/waeup_student/request_transfer.py @ 1323

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

no import headline fixed

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1## Script (Python) "request_transfer"
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: request_transfer.py 1321 2007-01-19 11:03:16Z henrik $
11"""
12pay online
13"""
14import logging
15from urllib import urlencode
16logger = logging.getLogger('EPayment.')
17import DateTime
18lt = context.portal_layouts
19request = context.REQUEST
20students = context.portal_url.getPortalObject().campus.students
21
22student_id = context.getStudentId()
23if student_id is None:
24    return request.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
25
26student = getattr(students,student_id)
27sbrain = context.students_catalog(id=student_id)[0]
28
29validate = request.has_key("cpsdocument_create_button")
30res,psm,ds = lt.renderLayout(layout_id= 'student_transfer',
31                      schema_id= 'epayment',
32                      context=context,
33                      mapping=validate and request,
34                      ob={},
35                      layout_mode="create",
36                      formaction = "request_transfer",
37                      button = 'Start'
38                      )
39if psm == 'invalid':
40    psm = 'Please correct your errors!'
41    return context.request_transfer_form(rendered = res,
42                                 psm = psm,
43                                 mode = 'edit',
44                                 ds = ds,
45                                 )
46elif psm == '':
47    return context.request_transfer_form(rendered = res,
48                                 psm = None,
49                                 mode = 'edit',
50                                 ds = ds,
51                                 )
52elif psm == 'valid':
53    pass
54if "payments" not in student.objectIds():
55    student.invokeFactory('PaymentsFolder','payments')
56    payments = getattr(student,'payments')
57    d = {}
58    d['Title'] = 'Payments'
59    payments.getContent().edit(mapping=d)
60    wftool.doActionFor(payments,'open')
61else:
62    payments = getattr(student,'payments')
63#from Products.zdb import set_trace; set_trace()
64info = {}
65order_id = ds.get('pin_n')
66p_id = "p%s" % order_id
67now = DateTime.DateTime()
68info['date'] = now
69info['amount'] = "n/a"
70pin = info['order_id'] = ds.get('pin')
71info['type_code'] = "%s" % pin
72info['type_description'] = 'Transfer Form SC %s' % pin
73payments.invokeFactory('Payment', p_id)
74payment = getattr(payments,p_id)
75wftool = context.portal_workflow
76wftool.doActionFor(payment,'open')
77payment.getContent().edit(mapping=info)
78wftool.doActionFor(payment,'close')
79url = "%s/payments" % (student.absolute_url())
80request.RESPONSE.redirect(url)
81
Note: See TracBrowser for help on using the repository browser.