Changeset 1449 for WAeUP_SRP/trunk/skins/waeup_accommodation
- Timestamp:
- 20 Feb 2007, 20:23:34 (18 years ago)
- 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 15 15 logger = logging.getLogger('Accommodation.BookReservedBed') 16 16 17 change = REQUEST.has_key("reserve_and_change") 17 #change = REQUEST.has_key("reserve_and_change") 18 change = False 18 19 release = REQUEST.has_key("release") 19 20 reserve = REQUEST.has_key("reserve") … … 61 62 res = acco_cat(bed = bid) 62 63 psm = '' 64 students = context.portal_url.getPortalObject().campus.students 65 student_obj = getattr(students,sid) 66 acco_id = "accommodation_%s" % context.getSessionId() 63 67 while True: 64 68 if not res: … … 81 85 break 82 86 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 83 92 if not already: 84 93 psm = "Student %s already has no reserved beds" % (sid, already[0].bed) … … 104 113 acco_cat.modifyRecord(bed=bed.bed,student='') 105 114 106 students = context.portal_url.getPortalObject().campus.students107 student_obj = getattr(students,sid)108 acco_id = "accommodation_%s" % context.getSessionId()109 115 if reserve or change: 110 116 acco_cat.modifyRecord(bed = bid, student = sid) … … 115 121 psm = "Bed reserved for %s %s" % (sid,student.name) 116 122 elif release: 117 acco_cat.modifyRecord(bed=bid,student='')118 123 if acco_id in student_obj.objectIds(): 119 124 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='') 122 127 logger.info('"%s","cancelled reservation %s by","%s"' % (member,bid,sid)) 123 128 psm = "%s removed from %s" % (student.name,bid) 124 125 129 mode = 'view' 126 130 return context.book_reserved_bed_form(rendered = "", -
WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt
r1444 r1449 23 23 tal:attributes="value options/button" 24 24 tal:condition="not:creation" /> 25 <input type="submit" tal:condition="python: mode !='view'"25 <input type="submit" tal:condition="python:0 and mode !='view'" 26 26 class="standalone" 27 27 name="reserve_and_change" -
WAeUP_SRP/trunk/skins/waeup_accommodation/change_bed.py
r1206 r1449 57 57 acco_doc.edit(mapping=d) 58 58 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}) 59 65 logger.info('"%s", "new bed allocation failed","%s"' % (student_id,code)) 66 logger.info('"%s","cancelled booking of %s"' % (member,bed,sid)) 60 67 redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id'])) 61 68
Note: See TracChangeset for help on using the changeset viewer.