Changeset 6974 for main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Timestamp:
- 31 Oct 2011, 08:27:43 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py
r6973 r6974 229 229 230 230 @grok.action('Switch reservation of selected beds') 231 def switchReservation (self, **data):231 def switchReservations(self, **data): 232 232 form = self.request.form 233 233 if form.has_key('val_id'): … … 240 240 child_id = [child_id] 241 241 switched = [] 242 beds_for_fresh = getattr(self.context,'beds_for_fresh',[])243 beds_for_pre = getattr(self.context,'beds_for_pre',[])244 beds_for_returning = getattr(self.context,'beds_for_returning',[])245 beds_for_final = getattr(self.context,'beds_for_final',[])246 242 for bed_id in child_id: 247 243 try: 248 actual_type = self.context[bed_id].bed_type 249 sh, sex, bt = actual_type.split('_') 250 hostel_id, block, room_nr, bed = bed_id.split('_') 251 if bt == 'reserved': 252 bt = 'all' 253 if bed in beds_for_fresh: 254 bt = 'fr' 255 elif bed in beds_for_pre: 256 bt = 'pr' 257 elif bed in beds_for_final: 258 bt = 'fi' 259 elif bed in beds_for_returning: 260 bt = 're' 261 bt = u'%s_%s_%s' % (sh, sex, bt) 262 else: 263 bt = u'%s_%s_reserved' % (sh, sex) 264 self.context[bed_id].bed_type = bt 244 self.context[bed_id].switchReservation() 265 245 switched.append(bed_id) 266 246 except: … … 270 250 return 271 251 if len(switched): 272 #import pdb; pdb.set_trace()273 252 self.flash('Successfully switched: %s' % ', '.join(switched)) 274 253 self.redirect(self.url(self.context, '@@manage')+'#tab-2') -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py
r6973 r6974 109 109 110 110 def getBedCoordinates(self): 111 """Determine the coordinates from bed_id.111 """Determine the coordinates from the bed_id. 112 112 """ 113 pass 113 return self.bed_id.split('_') 114 115 def switchReservation(self): 116 """Reserves a bed or relases a reserved bed respectively. 117 """ 118 sh, sex, bt = self.bed_type.split('_') 119 hostel_id, block, room_nr, bed = self.getBedCoordinates() 120 beds_for_fresh = getattr(self,'beds_for_fresh',[]) 121 beds_for_pre = getattr(self,'beds_for_pre',[]) 122 beds_for_returning = getattr(self,'beds_for_returning',[]) 123 beds_for_final = getattr(self,'beds_for_final',[]) 124 if bt == 'reserved': 125 bt = 'all' 126 if bed in beds_for_fresh: 127 bt = 'fr' 128 elif bed in beds_for_pre: 129 bt = 'pr' 130 elif bed in beds_for_final: 131 bt = 'fi' 132 elif bed in beds_for_returning: 133 bt = 're' 134 bt = u'%s_%s_%s' % (sh, sex, bt) 135 else: 136 bt = u'%s_%s_reserved' % (sh, sex) 137 self.bed_type = bt 138 return 114 139 115 140 def loggerInfo(self, ob_class, comment=None): -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py
r6973 r6974 139 139 """ 140 140 141 def switchReservation(): 142 """Reserves bed or relases reserved bed respectively. 143 """ 144 141 145 bed_id = schema.TextLine( 142 146 title = u'Bed Id',
Note: See TracChangeset for help on using the changeset viewer.