Changeset 3151 for WAeUP_SRP/base
- Timestamp:
- 12 Feb 2008, 20:03:59 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_accommodation/change_bed.py
r3150 r3151 35 35 if info['acco'] is None: 36 36 logger.info('No accommodation object for %s' % (student_id)) 37 return redirect("%s/%s " % (students.absolute_url(),student_id))37 return redirect("%s/%s/no_booking_allowed" % (students.absolute_url(),student_id)) 38 38 res = beds(student=student_id) 39 39 status = info['student_status'] … … 43 43 else: 44 44 allocated_bed = res[0] 45 #student = student_id46 if allocated_bed.bed_type == status:47 logger.info('Status %s of %s has not changed' % (status,student_id))48 return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))49 logger.info('Bed status %s of %s has changed to %s' % (allocated_bed.bed_type,student_id,status))50 beds.modifyRecord(bed=allocated_bed.bed,student=beds.not_occupied)51 logger.info('Bed %s released' % (allocated_bed.bed))52 45 code,bed = beds.searchAndReserveBed(student_id,status) 53 46 if code > 0: 47 if res: 48 if allocated_bed.bed_type == status: 49 logger.info('Status %s of %s has not changed' % (status,student_id)) 50 psm='Student status has not changed!' 51 return redirect("%s/%s/%s/waeup_document_view?portal_status_message=%s" % (students.absolute_url(),student_id,info['acco_id'],psm)) 52 logger.info('Bed status %s of %s has changed to %s' % (allocated_bed.bed_type,student_id,status)) 53 beds.modifyRecord(bed=allocated_bed.bed,student=beds.not_occupied) 54 logger.info('Bed %s released' % (allocated_bed.bed)) 54 55 d = {} 55 56 d['bed'] = bed … … 61 62 acco_doc.edit(mapping=d) 62 63 logger.info('Bed %s allocated to %s' % (bed,student_id)) 63 return redirect("%s/%s/%s" % (students.absolute_url(),student_id,info['acco_id'])) 64 # student_obj = getattr(students,student_id) 65 # acco_id = "accommodation_%s" % context.getSessionId()[0] 66 # if acco_id in student_obj.objectIds(): 67 # acco_doc = getattr(student_obj, acco_id).getContent() 68 # if acco_doc.bed == bed: 69 # acco_doc.edit(mapping={'bed':"-- cancelled by officer due to failed bed change request --"}) 70 acco_doc = info['acco_doc'] 71 if acco_doc.bed == bed: 72 acco_doc.edit(mapping={'bed':"-- cancelled by officer due to failed bed change request --"}) 64 psm='Bed changed!' 65 return redirect("%s/%s/%s/waeup_document_view?portal_status_message=%s" % (students.absolute_url(),student_id,info['acco_id'],psm)) 66 #acco_doc = info['acco_doc'] 67 #acco_doc.edit(mapping={'bed':"-- cancelled by officer due to failed bed change request --"}) 73 68 logger.info('New bed allocation for %s failed, code = %s' % (student_id,code)) 74 logger.info('%s cancelled booking of bed %s by %s' % (member,bed,student_id)) 75 return redirect("%s/%s/%s" % (students.absolute_url(),student_id,info['acco_id'])) 69 #logger.info('%s cancelled booking of bed %s by %s' % (member,bed,student_id)) 70 psm='Bed change failed!' 71 return redirect("%s/%s/%s/waeup_document_view?portal_status_message=%s" % (students.absolute_url(),student_id,info['acco_id'],psm)) 76 72 77 73 info = {}
Note: See TracChangeset for help on using the changeset viewer.