Changeset 1412 for WAeUP_SRP/trunk/skins/waeup_accommodation
- Timestamp:
- 13 Feb 2007, 14:14:44 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_accommodation
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py
r1410 r1412 16 16 17 17 mode = 'create' 18 validate = REQUEST.has_key("cpsdocument_edit_button") 18 validate = REQUEST.has_key("cpsdocument_edit_button") and\ 19 REQUEST.get("cpsdocument_edit_button").startswith('reserve') 19 20 d = {} 20 re s,psm,ds = lt.renderLayout(layout_id= 'acco_bed_booking',21 rendered,psm,ds = lt.renderLayout(layout_id= 'acco_bed_booking', 21 22 schema_id= 'acco_bed_booking', 22 23 context=context, … … 28 29 if psm == 'invalid': 29 30 psm = "Please correct your input." 30 return context.book_reserved_bed_form(rendered = re s,31 return context.book_reserved_bed_form(rendered = rendered, 31 32 psm = psm, 32 33 #psm = "%s, %s" % (psm,ds), … … 37 38 ) 38 39 elif psm == '': 39 return context.book_reserved_bed_form(rendered = re s,40 return context.book_reserved_bed_form(rendered = rendered, 40 41 psm = psm, 41 42 mode = mode, … … 46 47 elif psm == 'valid': 47 48 pass 49 #from Products.zdb import set_trace;set_trace() 48 50 hall_id = context.getId() 49 51 doc = context.getContent() … … 61 63 break 62 64 bed_brain = res[0] 65 already = acco_cat(student=sid) 66 if already: 67 psm = "Student %s already reserved bed %s" % (sid, already[0].bed) 68 break 63 69 if not bed_brain.bed_type.endswith("reserved"): 64 70 psm = "Not a reserved bed %s" % bid … … 72 78 break 73 79 if psm != '': 74 return context.book_reserved_bed_form(rendered = re s,80 return context.book_reserved_bed_form(rendered = rendered, 75 81 psm = psm, 76 82 mode = mode, … … 80 86 ) 81 87 acco_cat.modifyRecord(bed = bid, student = sid) 82 logger.info('"%s","booked reserved bed %s for","%s"' % (member,b ed,sid))83 return context.book_reserved_bed_form(rendered = res,88 logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid)) 89 return context.book_reserved_bed_form(rendered = "", 84 90 psm = "Bed reserved for %s %s" % (sid,student.name), 85 91 mode = mode, 86 92 formaction = "book_reserved_bed", 87 button = " reserve bed",93 button = "next reservation", 88 94 ds = ds, 89 95 ) -
WAeUP_SRP/trunk/skins/waeup_accommodation/reserve_accommodation.py
r1411 r1412 77 77 pin = str(ds.get('acco_res_sc_pin')) 78 78 pa = context.portal_accommodation 79 code,bed = pa.searchAndReserveBed(s_id,"%s" % (info['student_status'])) 80 #code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status'))) 81 if code == -1: 82 return context.accommodation_pin_edit_form(rendered = res, 83 psm = "%s" % bed, 84 mode = mode, 85 ds = ds, 86 ) 87 elif code == -2: 88 return context.accommodation_pin_edit_form(rendered = res, 89 psm = "No bed available. Your category is already fully booked.", 90 mode = mode, 91 ds = ds, 92 ) 79 already = pa(student=s_id) 80 if not already: 81 code,bed = pa.searchAndReserveBed(s_id,"%s" % (info['student_status'])) 82 #code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status'))) 83 if code == -1: 84 return context.accommodation_pin_edit_form(rendered = res, 85 psm = "%s" % bed, 86 mode = mode, 87 ds = ds, 88 ) 89 elif code == -2: 90 return context.accommodation_pin_edit_form(rendered = res, 91 psm = "No bed available. Your category is already fully booked.", 92 mode = mode, 93 ds = ds, 94 ) 95 else: 96 bed = already[0].bed 93 97 student.invokeFactory('StudentAccommodation',acco_id) 94 98 acco = getattr(student,acco_id)
Note: See TracChangeset for help on using the changeset viewer.