- Timestamp:
- 15 Sep 2012, 19:48:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9161 r9188 1408 1408 buttonname = _('Create bed ticket') 1409 1409 notice = '' 1410 with_ac = True 1410 1411 1411 1412 def update(self, SUBMIT=None): … … 1448 1449 self.redirect(self.url(self.context)) 1449 1450 return 1450 self.ac_series = self.request.form.get('ac_series', None) 1451 self.ac_number = self.request.form.get('ac_number', None) 1451 if self.with_ac: 1452 self.ac_series = self.request.form.get('ac_series', None) 1453 self.ac_number = self.request.form.get('ac_number', None) 1452 1454 if SUBMIT is None: 1453 1455 return 1454 pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number) 1455 code = get_access_code(pin) 1456 if not code: 1457 self.flash(_('Activation code is invalid.')) 1458 return 1456 if self.with_ac: 1457 pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number) 1458 code = get_access_code(pin) 1459 if not code: 1460 self.flash(_('Activation code is invalid.')) 1461 return 1459 1462 # Search and book bed 1460 1463 cat = queryUtility(ICatalog, name='beds_catalog', default=None) … … 1462 1465 owner=(student.student_id,student.student_id)) 1463 1466 if len(entries): 1464 # If bed space has bee manually allocated use this bed1467 # If bed space has been manually allocated use this bed 1465 1468 bed = [entry for entry in entries][0] 1466 1469 else: … … 1478 1481 mapping = {'a':acc_details['bt']})) 1479 1482 return 1480 # Mark pin as used (this also fires a pin related transition) 1481 if code.state == USED: 1482 self.flash(_('Activation code has already been used.')) 1483 return 1484 else: 1485 comment = _(u'invalidated') 1486 # Here we know that the ac is in state initialized so we do not 1487 # expect an exception, but the owner might be different 1488 if not invalidate_accesscode( 1489 pin,comment,self.context.student.student_id): 1490 self.flash(_('You are not the owner of this access code.')) 1483 if self.with_ac: 1484 # Mark pin as used (this also fires a pin related transition) 1485 if code.state == USED: 1486 self.flash(_('Activation code has already been used.')) 1491 1487 return 1488 else: 1489 comment = _(u'invalidated') 1490 # Here we know that the ac is in state initialized so we do not 1491 # expect an exception, but the owner might be different 1492 if not invalidate_accesscode( 1493 pin,comment,self.context.student.student_id): 1494 self.flash(_('You are not the owner of this access code.')) 1495 return 1492 1496 # Create bed ticket 1493 1497 bedticket = createObject(u'waeup.BedTicket')
Note: See TracChangeset for help on using the changeset viewer.