source: WAeUP_SRP/trunk/skins/waeup_pins/getBatchInfo.py @ 720

Last change on this file since 720 was 710, checked in by joachim, 18 years ago

fixed several bugs in the Apply for PUME Process:
jamb_reg_no had wrong widget
applying with a different PIN a second time led to an error.

the new fields:
appl_email, appl_mobile are set to hidden in laymode create
could not set the fields to required, cause that broke the applyForm.
layout: student_application.xml still has them set to required.

File size: 1.2 KB
Line 
1## Script (Python) "cpsdocument_edit"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=batch=None
8##title=
9##
10# $Id: student_edit.py 486 2006-09-06 10:09:39Z joachim $
11"""
12return Info about the current Batch
13"""
14
15info = {}
16if batch is None:
17    if context.portal_type == 'ScratchCardBatch':
18        batch = context
19    else:
20        return None
21bd = batch.getContent()
22info['batch_doc'] = bd
23info['id'] = batch.getId()
24info['title'] = batch.Title or 'empty Title'
25info['unused'],used = batch.getContent().getUnusedPins()
26l = []
27students_rpath = context.portal_catalog(meta_type = "StudentsFolder")[-1].relative_path
28students_url = "%s/%s" % (context.portal_url(),students_rpath)
29
30for item in used:
31    if bd.prefix == "APP":
32        jno = item['student']
33        res = context.portal_catalog(SearchableText=jno,portal_type='StudentApplication')
34        if len(res) > 0:
35            item['student_url'] = "%s/%s" % (context.portal_url(),res[0].relative_path)
36        else:
37            item['student_url'] = None
38    else:
39        item['student_url'] = '%s/%s' % (students_url,item['student'])
40info['used'] = used
41return info
Note: See TracBrowser for help on using the repository browser.