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

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

transfer module activated

  • Property svn:keywords set to Id
File size: 1.9 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 1339 2007-01-21 22:55:34Z 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)
23path_info = request.get('PATH_INFO').split('/')
24
25if mtool.isAnonymousUser():
26    return None
27info = {}
28#from Products.zdb import set_trace
29#set_trace()
30requested_id = context.getStudentId()
31if requested_id and not context.isStaff() and member_id != requested_id:
32    logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
33    return None
34elif context.isStaff():
35    student_id = requested_id
36else:
37    student_id = member_id
38
39
40students_object = context.portal_url.getPortalObject().campus.students
41
42student = getattr(students_object,student_id)
43payments = getattr(student,'payments').objectIds()
44info['paid'] = False
45for payment in payments:
46    if payment.startswith('transfer'):
47        info['paid'] = True
48        payments_obj = getattr(student,'payments')
49        payment_obj = getattr(payments_obj,payment)
50        info['pin'] = payment_obj.getContent().order_id
51        break
52
53
54#student = getattr(students_object, student_id)
55res = context.students_catalog(id = student_id)
56if len(res) != 1:
57    return None
58sbrain = res[0]
59info['id'] = student_id
60info['student'] = context.getFormattedStudentEntry(sbrain)
61info['entry_mode'] = sbrain.entry_mode
62results = context.results_import(matric_no=sbrain.matric_no)
63taken = []
64if len(results) > 0:
65    for r in results:
66        taken.append(r)
67info['taken'] = taken
68
69# for testing of transfer forms
70#info['paid'] = True
71#info['pin'] = 'CLR-1-0123456789'
72
73
74return info
Note: See TracBrowser for help on using the repository browser.