source: WAeUP_SRP/trunk/skins/waeup_student/getTransferInfo.py @ 1492

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

payment receipts

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1## Script (Python) "getClearanceInfo"
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: getTransferInfo.py 1368 2007-01-28 09:46:17Z henrik $
11"""
12return Info about the current Student
13"""
14import logging
15logger = logging.getLogger('Student.Transfer.Info')
16from DateTime import DateTime
17
18request = context.REQUEST
19mtool = context.portal_membership
20wf = context.portal_workflow
21member = mtool.getAuthenticatedMember()
22member_id = str(member)
23
24if mtool.isAnonymousUser():
25    return None
26info = {}
27#from Products.zdb import set_trace
28#set_trace()
29requested_id = context.getStudentId()
30if requested_id and not context.isStaff() and member_id != requested_id:
31    logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
32    return None
33elif context.isStaff():
34    student_id = requested_id
35else:
36    student_id = member_id
37
38
39students_object = context.portal_url.getPortalObject().campus.students
40
41student = getattr(students_object,student_id)
42payments = getattr(student,'payments').objectIds()
43info['paid'] = False
44for payment in payments:
45    if payment.startswith('transfer'):
46        info['paid'] = True
47        payments_obj = getattr(student,'payments')
48        payment_obj = getattr(payments_obj,payment)
49        info['pin'] = payment_obj.getContent().order_id
50        break
51
52
53#student = getattr(students_object, student_id)
54res = context.students_catalog(id = student_id)
55if len(res) != 1:
56    return None
57sbrain = res[0]
58info['id'] = student_id
59info['student'] = context.getFormattedStudentEntry(sbrain)
60info['entry_mode'] = sbrain.entry_mode
61results = context.results_import(matric_no=sbrain.matric_no)
62taken = []
63if len(results) > 0:
64    for r in results:
65        taken.append(r)
66info['taken'] = taken
67
68# for testing of transfer forms
69#info['paid'] = True
70#info['pin'] = 'CLR-1-0123456789'
71
72
73return info
Note: See TracBrowser for help on using the repository browser.