Changeset 1178


Ignore:
Timestamp:
2 Jan 2007, 17:44:11 (18 years ago)
Author:
joachim
Message:

reserve_accommodation should now handle all known cases,
but only basic_functionallity tested.

Location:
WAeUP_SRP/trunk/skins/waeup_student
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_student/getAccommodationInfo.py

    r1161 r1178  
    3535    else:
    3636        student_id = member_id
    37 
    3837res = context.students_catalog(id=student_id)
    3938if len(res) != 1:
    4039    logger.info('"%s","not found in students_catalog"')
    4140    return None
     41
    4242ekehuan_certificates = ('BARTAPG',
    4343                        'BARTAPM',
     
    5959s_brain = res[0]
    6060students_object = context.portal_url.getPortalObject().campus.students
     61res = context.results_import(matric_no = s_brain.matric_no)
    6162student = getattr(students_object, student_id)
    6263info['id'] = student_id
    6364info['student'] = student
    64 info['review_state'] = wf.getInfoFor(student,'review_state',None)
     65review_state = info['review_state'] = wf.getInfoFor(student,'review_state',None)
     66booking_allowed = False
     67if not review_state not in ('cleared_and_validated',):
     68    res = context.results_import(matric_no = s_brain.matric_no)
     69    if res:
     70        booking_allowed = res[0].Verdict in ("SUCCESSFUL STUDENT",
     71                                             "STUDENT WITH CARRYOVER COURSES",)
     72else:
     73    booking_allowed = True
     74info['booking_allowed'] = booking_allowed   
     75if not booking_allowed:
     76    return info
    6577acco_id = 'accommodation_2006'
    6678acco = getattr(student,acco_id,None)
    6779info['acco'] = acco
    6880info['acco_id'] = acco_id
     81bt = 're'
    6982if acco is not None:
    7083    info['acco_doc'] = acco.getContent()
    7184    info['acco_review_state'] = wf.getInfoFor(acco,'review_state',None)
    7285d = {}
    73 bt = 'fr'
     86if review_state == "cleared_and_validated":
     87    bt = 'fr'
     88elif int(s_brain.level) < 600:
     89    bt = 're'
     90else:
     91    res = context.portal_catalog(portal_type = "Certificate", id = s_brain.course)
     92    if res:
     93        c_brain = res[0]
     94        certificate = s_brain.getObject().getContent()
     95        if int(s_brain.level) +100 == int(certificate.end_level):
     96            bt = "fi"
    7497d['sex'] = 'male'
    7598if s_brain.sex:
     
    79102elif s_brain.course in pti_certificates:
    80103    bt += "_pti"
     104elif s_brain.faculty in ('MED') and int(s_brain.level) >= 400:
     105    bt += "_med"
    81106
    82107d['bt'] = bt
  • WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py

    r1171 r1178  
    2626session = acco_id[-4:]
    2727mode = 'create'
    28 if not info['review_state'] in ('cleared_and_validated',):
     28if not info['booking_allowed']:
    2929    return context.REQUEST.RESPONSE.redirect("%s/no_booking_allowed" % info['student'].absolute_url())
    3030validate = REQUEST.has_key("cpsdocument_create_button")
     
    7575        if code < 0:
    7676            return context.accommodation_pin_edit_form(rendered = res,
    77                                  psm = bed,
     77                                 psm = "%s bed type=%s" % (bed,info['student_status']),
    7878                                 mode = mode,
    7979                                 ds = ds,
  • WAeUP_SRP/trunk/skins/waeup_student/set_access_data.py

    r1177 r1178  
    1 ##parameters=REQUEST,matric_no
    2 # $Id$
    3 """
    4 process the Application Form
    5 return html renderer + psm
    6 """
    7 import DateTime,logging
    8 current = DateTime.DateTime()
    9 pr = context.portal_registration
    10 logger = logging.getLogger('Returning')
    11 validate = REQUEST.has_key("cpsdocument_edit_button")
    12 
    13 lt = context.portal_layouts
    14 #pr = context.portal_registration
    15 default = {'matric_no':matric_no}
    16 st_res = context.students_catalog(matric_no = matric_no)
    17 if st_res:
    18     sid = st_res[0].id
    19 else:
    20     logger.info('"%s","Studentobject does not exist"' % matric_no)
    21 res,psm,ds = lt.renderLayout(layout_id= 'student_session_results_search',
    22                       schema_id= 'student_returning',
    23                       context=context,
    24                       mapping=validate and REQUEST,
    25                       ob=default,
    26                       layout_mode='edit',
    27                       formaction = "set_access_data",
    28                       button = "Search",
    29                       matric_no = matric_no,
    30                       commit = False,
    31                       )
    32 if psm == '':
    33     return context.set_access_data_form(rendered = res,
    34                                  psm = None,
    35                                  firstlayout = True,
    36                                  lastlayout = True,
    37                                  ds = ds,
    38                                  name = "%(name)s" % REQUEST.form
    39                                  )
    40 elif psm == 'invalid':
    41     psm = "Please correct your input!"
    42 elif psm == 'valid' and not REQUEST.form.has_key('acknowledge'):
    43     psm = "You did not check the ackkowledge box !"
    44 else:
    45     psm = ''
    46 if psm != '':
    47     return context.set_access_data_form(rendered = res,
    48                                  #psm = "%s, %s" % (psm,ds),
    49                                  psm = psm,
    50                                  firstlayout = True,
    51                                  lastlayout = True,
    52                                  ds = ds,
    53                                  name = "%(name)s" % REQUEST.form
    54                                  )
    55 password = REQUEST.get('widget__password')
    56 email = ds.get('email')
    57 context.waeup_tool.makeStudentMember(sid,password=password)
    58 args = {}
    59 args['__ac_name'] = sid
    60 args['__ac_password'] = password
    61 args['returning'] = '1'
    62 args['email'] = email
    63 args['phone_nr'] = ds.get('phone_nr')
    64 from urllib import urlencode
    65 url = "%s/logged_in?%s" % (context.absolute_url(),urlencode(args))
    66 return REQUEST.RESPONSE.redirect(url)
Note: See TracChangeset for help on using the changeset viewer.