Ignore:
Timestamp:
20 Feb 2007, 20:23:34 (18 years ago)
Author:
joachim
Message:

modified importReservedBeds
fixReservedBeds
added release_bed
many documentation addons for xml-files

Location:
WAeUP_SRP/trunk/skins/waeup_accommodation
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py

    r1447 r1449  
    1515logger = logging.getLogger('Accommodation.BookReservedBed')
    1616
    17 change = REQUEST.has_key("reserve_and_change")
     17#change = REQUEST.has_key("reserve_and_change")
     18change = False
    1819release = REQUEST.has_key("release")
    1920reserve = REQUEST.has_key("reserve")
     
    6162res = acco_cat(bed = bid)
    6263psm = ''
     64students = context.portal_url.getPortalObject().campus.students
     65student_obj = getattr(students,sid)
     66acco_id = "accommodation_%s" % context.getSessionId()
    6367while True:
    6468    if not res:
     
    8185            break
    8286    if release:
     87        if acco_id in student_obj.objectIds():
     88            acco_doc = getattr(student_obj, acco_id).getContent()
     89            if acco_doc.bed == bid:
     90                psm = "Student %s has not reserved bed" % (sid, bid)
     91                break
    8392        if not already:
    8493            psm = "Student %s already has no reserved beds" % (sid, already[0].bed)
     
    104113        acco_cat.modifyRecord(bed=bed.bed,student='')
    105114
    106 students = context.portal_url.getPortalObject().campus.students
    107 student_obj = getattr(students,sid)
    108 acco_id = "accommodation_%s" % context.getSessionId()
    109115if reserve or change:
    110116    acco_cat.modifyRecord(bed = bid, student = sid)
     
    115121    psm = "Bed reserved for %s %s" % (sid,student.name)
    116122elif release:
    117     acco_cat.modifyRecord(bed=bid,student='')
    118123    if acco_id in student_obj.objectIds():
    119124        acco_doc = getattr(student_obj, acco_id).getContent()
    120         if acco_doc.bed == bid:
    121             acco_doc.edit(mapping={'bed':bid + " (reservation cancelled by %s!)" % member})
     125        if acco_doc.bed != bid:
     126            acco_cat.modifyRecord(bed=bid,student='')
    122127    logger.info('"%s","cancelled reservation %s by","%s"' % (member,bid,sid))
    123128    psm = "%s removed from %s" % (student.name,bid)
    124 
    125129mode = 'view'
    126130return context.book_reserved_bed_form(rendered = "",
  • WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt

    r1444 r1449  
    2323                 tal:attributes="value options/button"
    2424                 tal:condition="not:creation" />
    25           <input type="submit" tal:condition="python:mode !='view'"
     25          <input type="submit" tal:condition="python:0 and mode !='view'"
    2626                 class="standalone"
    2727                 name="reserve_and_change"
  • WAeUP_SRP/trunk/skins/waeup_accommodation/change_bed.py

    r1206 r1449  
    5757        acco_doc.edit(mapping=d)
    5858        return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
     59    student_obj = getattr(students,student_id)
     60    acco_id = "accommodation_%s" % context.getSessionId()
     61    if acco_id in student_obj.objectIds():
     62        acco_doc = getattr(student_obj, acco_id).getContent()
     63        if acco_doc.bed == bed:
     64            acco_doc.edit(mapping={'bed':bed + " (cancelled by change bed %s!)" % member})
    5965    logger.info('"%s", "new bed allocation failed","%s"' % (student_id,code))
     66    logger.info('"%s","cancelled booking of %s"' % (member,bed,sid))
    6067    redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
    6168
Note: See TracChangeset for help on using the changeset viewer.