Changeset 6936 for main/waeup.sirp/trunk/src/waeup/sirp/students
- Timestamp:
- 24 Oct 2011, 10:23:11 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6930 r6936 21 21 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 22 22 from zope.component import createObject 23 from waeup.sirp.accesscodes import invalidate_accesscode, get_access_code 23 from waeup.sirp.accesscodes import ( 24 invalidate_accesscode, get_access_code, purchase_accesscode) 24 25 from waeup.sirp.accesscodes.workflow import USED 25 26 from waeup.sirp.browser import ( … … 924 925 # from the incoming request. 925 926 def update(self): 927 student = self.context.getStudent() 926 928 self.context.r_amount_approved = self.context.amount_auth 927 929 self.context.r_card_num = u'0000' … … 930 932 self.context.payment_date = datetime.now() 931 933 if self.context.p_category == 'clearance': 932 # Find valid CLR access code 933 pass 934 # Create CLR access code 935 pin, error = purchase_accesscode('CLR',0,student.student_id) 936 if error: 937 self.flash(error) 938 return 939 self.context.ac = pin 940 return 934 941 elif self.context.p_category == 'schoolfee': 935 # Find valid SFE access code 936 pass 937 return 942 # Create SFE access code 943 pin, error = purchase_accesscode('SFE',0) 944 if error: 945 self.flash(error) 946 return 947 self.context.ac = pin 948 return 938 949 939 950 def render(self): … … 1076 1087 1077 1088 def update(self, SUBMIT=None): 1089 if not self.context.state == 'admitted': 1090 self.flash("Wrong state.") 1091 self.redirect(self.url(self.context)) 1092 return 1078 1093 self.ac_series = self.request.form.get('ac_series', None) 1079 1094 self.ac_number = self.request.form.get('ac_number', None) … … 1084 1099 code = get_access_code(pin) 1085 1100 if not code: 1086 self.flash('Ac cesscode is invalid.')1101 self.flash('Activation code is invalid.') 1087 1102 return 1088 1103 # Mark pin as used (this also fires a pin related transition) 1089 1104 # and fire transition start_clearance 1090 1105 if code.state == USED: 1091 self.flash('Ac cesscode has already been used.')1106 self.flash('Activation code has already been used.') 1092 1107 return 1093 1108 else:
Note: See TracChangeset for help on using the changeset viewer.