source: WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py @ 886

Last change on this file since 886 was 843, checked in by joachim, 18 years ago

show filename in clearance slip
show faculty and department title in admission_view and _slip
pin is not used, if an error occurs in the form,
the pin must therefore be the last entry field.
entry_date and entry_session are set in start_clearance

  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1##parameters=REQUEST
2# $Id: start_clearance.py 843 2006-11-11 17:40:02Z joachim $
3"""
4request Clearance
5"""
6import DateTime
7current = DateTime.DateTime()
8pr = context.portal_registration
9
10type_name = 'Student'
11ti = context.portal_types[type_name]
12REQUEST.set('type_name',type_name)
13redirect = REQUEST.RESPONSE.redirect
14wf = context.portal_workflow
15validate = REQUEST.has_key("cpsdocument_create_button")
16
17lt = context.portal_layouts
18pr = context.portal_registration
19
20res,psm,ds = lt.renderLayout(layout_id='student_clearance',
21                      schema_id= 'student_clearance',
22                      context=context,
23                      mapping=validate and REQUEST,
24                      ob={},
25                      layout_mode='create',
26                      formaction = "start_clearance",
27                      button = "Start",
28                      )
29
30info = context.getStudentInfo()
31app_doc = info['app_doc']
32if app_doc.passport is None:
33    return context.clearance_pin_form(rendered = res,
34                                 psm = "You must upload your passport picture before you can start the registration process.",
35                                 #psm = "%s, %s" % (psm,ds),
36                                 firstlayout = True,
37                                 lastlayout = True,
38                                 ds = ds,
39                                 )
40
41if psm == 'invalid':
42    return context.clearance_pin_form(rendered = res,
43                                 psm = "Please correct your input.",
44                                 #psm = "%s, %s" % (psm,ds),
45                                 firstlayout = True,
46                                 lastlayout = True,
47                                 ds = ds,
48                                 )
49elif psm == '':
50    return context.clearance_pin_form(rendered = res,
51                                 psm = None,
52                                 firstlayout = True,
53                                 lastlayout = True,
54                                 ds = ds,
55                                 )
56elif psm == 'valid':
57    info = context.getStudentInfo()
58    review_state = info['review_state']
59    wf.doActionFor(info['student'],'enter_clearance_pin')
60    wf.doActionFor(info['app'],'close')
61    wf.doActionFor(info['clear'],'open')
62    pin = str(ds.get('clr_ac_pin'))
63    dc = {}
64    dc['clr_ac_pin'] = pin
65    dc['clr_ac_date'] = current
66    dc['entry_date'] = current
67    dc['entry_session'] = "2006/2007"
68    info['clear_doc'].edit(mapping = dc)
69return redirect("%s/clearance_edit_form" % info['clear'].absolute_url())
Note: See TracBrowser for help on using the repository browser.