Index: WAeUP_SRP/trunk/skins/waeup_student/getAccommodationInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getAccommodationInfo.py	(revision 1177)
+++ WAeUP_SRP/trunk/skins/waeup_student/getAccommodationInfo.py	(revision 1178)
@@ -35,9 +35,9 @@
     else:
         student_id = member_id
-
 res = context.students_catalog(id=student_id)
 if len(res) != 1:
     logger.info('"%s","not found in students_catalog"')
     return None
+
 ekehuan_certificates = ('BARTAPG',
                         'BARTAPM',
@@ -59,17 +59,40 @@
 s_brain = res[0]
 students_object = context.portal_url.getPortalObject().campus.students
+res = context.results_import(matric_no = s_brain.matric_no)
 student = getattr(students_object, student_id)
 info['id'] = student_id
 info['student'] = student
-info['review_state'] = wf.getInfoFor(student,'review_state',None)
+review_state = info['review_state'] = wf.getInfoFor(student,'review_state',None)
+booking_allowed = False
+if not review_state not in ('cleared_and_validated',):
+    res = context.results_import(matric_no = s_brain.matric_no)
+    if res:
+        booking_allowed = res[0].Verdict in ("SUCCESSFUL STUDENT",
+                                             "STUDENT WITH CARRYOVER COURSES",)
+else:
+    booking_allowed = True
+info['booking_allowed'] = booking_allowed    
+if not booking_allowed:
+    return info
 acco_id = 'accommodation_2006'
 acco = getattr(student,acco_id,None)
 info['acco'] = acco
 info['acco_id'] = acco_id
+bt = 're'
 if acco is not None:
     info['acco_doc'] = acco.getContent()
     info['acco_review_state'] = wf.getInfoFor(acco,'review_state',None)
 d = {}
-bt = 'fr'
+if review_state == "cleared_and_validated":
+    bt = 'fr'
+elif int(s_brain.level) < 600:
+    bt = 're'
+else:
+    res = context.portal_catalog(portal_type = "Certificate", id = s_brain.course)
+    if res:
+        c_brain = res[0]
+        certificate = s_brain.getObject().getContent()
+        if int(s_brain.level) +100 == int(certificate.end_level):
+            bt = "fi"
 d['sex'] = 'male'
 if s_brain.sex:
@@ -79,4 +102,6 @@
 elif s_brain.course in pti_certificates:
     bt += "_pti"
+elif s_brain.faculty in ('MED') and int(s_brain.level) >= 400:
+    bt += "_med"
 
 d['bt'] = bt
Index: WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py	(revision 1177)
+++ WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py	(revision 1178)
@@ -26,5 +26,5 @@
 session = acco_id[-4:]
 mode = 'create'
-if not info['review_state'] in ('cleared_and_validated',):
+if not info['booking_allowed']:
     return context.REQUEST.RESPONSE.redirect("%s/no_booking_allowed" % info['student'].absolute_url())
 validate = REQUEST.has_key("cpsdocument_create_button")
@@ -75,5 +75,5 @@
         if code < 0:
             return context.accommodation_pin_edit_form(rendered = res,
-                                 psm = bed,
+                                 psm = "%s bed type=%s" % (bed,info['student_status']),
                                  mode = mode,
                                  ds = ds,
Index: WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py	(revision 1177)
+++ WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py	(revision 1178)
@@ -1,66 +1,0 @@
-##parameters=REQUEST,matric_no
-# $Id$
-"""
-process the Application Form
-return html renderer + psm
-"""
-import DateTime,logging
-current = DateTime.DateTime()
-pr = context.portal_registration
-logger = logging.getLogger('Returning')
-validate = REQUEST.has_key("cpsdocument_edit_button")
-
-lt = context.portal_layouts
-#pr = context.portal_registration
-default = {'matric_no':matric_no}
-st_res = context.students_catalog(matric_no = matric_no)
-if st_res:
-    sid = st_res[0].id
-else:
-    logger.info('"%s","Studentobject does not exist"' % matric_no)
-res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search',
-                      schema_id= 'student_returning',
-                      context=context,
-                      mapping=validate and REQUEST,
-                      ob=default,
-                      layout_mode='edit',
-                      formaction = "set_access_data",
-                      button = "Search",
-                      matric_no = matric_no,
-                      commit = False,
-                      )
-if psm == '':
-    return context.set_access_data_form(rendered = res,
-                                 psm = None,
-                                 firstlayout = True,
-                                 lastlayout = True,
-                                 ds = ds,
-                                 name = "%(name)s" % REQUEST.form
-                                 )
-elif psm == 'invalid':
-    psm = "Please correct your input!"
-elif psm == 'valid' and not REQUEST.form.has_key('acknowledge'):
-    psm = "You did not check the ackkowledge box !"
-else:
-    psm = ''
-if psm != '':
-    return context.set_access_data_form(rendered = res,
-                                 #psm = "%s, %s" % (psm,ds),
-                                 psm = psm,
-                                 firstlayout = True,
-                                 lastlayout = True,
-                                 ds = ds,
-                                 name = "%(name)s" % REQUEST.form
-                                 )
-password = REQUEST.get('widget__password')
-email = ds.get('email')
-context.waeup_tool.makeStudentMember(sid,password=password)
-args = {}
-args['__ac_name'] = sid
-args['__ac_password'] = password
-args['returning'] = '1'
-args['email'] = email
-args['phone_nr'] = ds.get('phone_nr')
-from urllib import urlencode
-url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
-return REQUEST.RESPONSE.redirect(url)
