Changeset 7021 for main/waeup.custom/trunk/src/waeup
- Timestamp:
- 7 Nov 2011, 17:20:24 (13 years ago)
- Location:
- main/waeup.custom/trunk/src/waeup/custom
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.custom/trunk/src/waeup/custom/interfaces.py
r6950 r7021 2 2 ## interfaces.py 3 3 from zope import schema 4 from waeup.sirp.interfaces import IWAeUPObject, academic_sessions_vocab 4 from waeup.sirp.interfaces import ( 5 IWAeUPObject, ISessionConfiguration, academic_sessions_vocab) 5 6 6 class ISessionConfiguration(IWAeUPObject): 7 # It's recommended to replicate all fields from the base package here. 8 class ISessionConfiguration(ISessionConfiguration): 7 9 """A session configuration object. 8 10 """ 9 11 10 academic_session = schema.Choice( 11 title = u'Academic Session', 12 source = academic_sessions_vocab, 13 default = None, 14 required = True, 15 readonly = True 16 ) 17 18 fee_1 = schema.Int( 12 school_fee_base = schema.Int( 19 13 title = u'School Fee', 20 14 default = 0, … … 31 25 ) 32 26 27 surcharge_3 = schema.Int( 28 title = u'Surcharge 3', 29 default = 0, 30 ) 31 32 clearance = schema.Int( 33 title = u'Clearance Fee', 34 default = 0, 35 ) 36 37 booking_fee = schema.Int( 38 title = u'Booking Fee', 39 default = 0, 40 ) 41 42 maint_fee = schema.Int( 43 title = u'Maintenance Fee', 44 default = 0, 45 ) 46 33 47 gown = schema.Int( 34 48 title = u'Gown Fee', … … 38 52 transfer = schema.Int( 39 53 title = u'Transfer Fee', 40 default = 0,41 )42 43 hostelmaintenance = schema.Int(44 title = u'Hostel Maintenance Fee',45 default = 0,46 )47 48 clearance = schema.Int(49 title = u'Clearance Fee',50 54 default = 0, 51 55 ) -
main/waeup.custom/trunk/src/waeup/custom/students/tests.py
r6950 r7021 9 9 10 10 def test_manage_payments(self): 11 # Add missing configuration data 12 self.app['configuration']['2004'].gown_fee = 150 13 self.app['configuration']['2004'].transfer_fee = 90 14 self.app['configuration']['2004'].clearance_fee = 120 15 self.app['configuration']['2004'].maint_fee = 180 11 16 12 17 # Managers can add online payment tickets 13 18 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 14 self.browser.open(self.payments_student_path)15 self.browser.getControl("Add online payment ticket").click()16 self.browser.getControl("Create ticket").click()17 self.assertMatches('...Session configuration object is not available...',18 self.browser.contents)19 20 # Set up SessionConfiguration object21 configuration = SessionConfiguration()22 configuration.academic_session = 200423 configuration.fee_1 = 2000024 self.app['configuration'].addSessionConfiguration(configuration)25 26 19 self.browser.open(self.payments_student_path) 27 20 self.browser.getControl("Add online payment ticket").click() … … 43 36 self.browser.contents) 44 37 self.browser.open(self.manage_student_path) 45 self.browser.getControl(name="transition").value = ['pay_first_school_fee'] 38 self.browser.getControl( 39 name="transition").value = ['pay_first_school_fee'] 46 40 self.browser.getControl("Save").click() 47 41 self.browser.getControl(name="transition").value = ['reset6'] … … 58 52 self.browser.getControl("Create ticket").click() 59 53 self.browser.open(self.payments_student_path + '/addop') 60 self.browser.getControl(name="form.p_category").value = ['hostel_maintenance'] 54 self.browser.getControl( 55 name="form.p_category").value = ['bed_allocation'] 56 self.browser.getControl("Create ticket").click() 57 self.browser.open(self.payments_student_path + '/addop') 58 self.browser.getControl( 59 name="form.p_category").value = ['hostel_maintenance'] 61 60 self.browser.getControl("Create ticket").click() 62 61 self.browser.open(self.payments_student_path + '/addop') … … 70 69 self.browser.contents) 71 70 71 # If the session configuration doesn't exist and error message will 72 # be shown 73 del self.app['configuration']['2004'] 74 self.browser.open(self.payments_student_path) 75 self.browser.getControl("Add online payment ticket").click() 76 self.browser.getControl("Create ticket").click() 77 self.assertMatches('...Session configuration object is not...', 78 self.browser.contents) 72 79 80 -
main/waeup.custom/trunk/src/waeup/custom/students/utils.py
r6950 r7021 4 4 5 5 def getPaymentDetails(category, student): 6 7 surcharge_1 = surcharge_2 = surcharge_3= 08 p_item= u''9 amount= 010 error= u''11 p_session= student['studycourse'].current_session12 session = str( p_session)6 d = {} 7 d['surcharge_1'] = d['surcharge_2'] = d['surcharge_3'] = 0 8 d['p_item'] = u'' 9 d['amount'] = 0 10 d['error'] = u'' 11 d['p_session'] = student['studycourse'].current_session 12 session = str(d['p_session']) 13 13 try: 14 14 academic_session = getSite()['configuration'][session] 15 15 except KeyError: 16 error = u'Session configuration object is not available.' 17 return (amount, p_item, p_session, 18 surcharge_1, surcharge_2, surcharge_3, error) 16 d['error'] = u'Session configuration object is not available.' 17 return d 19 18 if category == 'transfer': 20 amount = academic_session.transfer19 d['amount'] = academic_session.transfer_fee 21 20 elif category == 'gown': 22 amount = academic_session.gown 21 d['amount'] = academic_session.gown_fee 22 elif category == 'bed_allocation': 23 d['amount'] = academic_session.booking_fee 23 24 elif category == 'hostel_maintenance': 24 amount = academic_session.hostelmaintenance25 d['amount'] = academic_session.maint_fee 25 26 elif category == 'clearance': 26 p_item= student['studycourse'].certificate.code27 amount = academic_session.clearance27 d['p_item'] = student['studycourse'].certificate.code 28 d['amount'] = academic_session.clearance_fee 28 29 elif category == 'schoolfee': 29 surcharge_1= academic_session.surcharge_130 surcharge_2= academic_session.surcharge_231 amount = getSchoolFee(student, surcharge_1 + surcharge_2)30 d['surcharge_1'] = academic_session.surcharge_1 31 d['surcharge_2'] = academic_session.surcharge_2 32 d['amount'] = getSchoolFee(student, d['surcharge_1'] + d['surcharge_2']) 32 33 code = student['studycourse'].certificate.code 33 34 #session_string = academic_sessions_vocab.by_value[p_session + 1].title 34 p_item = code 35 p_session += 1 36 if amount ==0: 37 error = u'Amount could not be determined.' 38 return (amount, p_item, p_session, 39 surcharge_1, surcharge_2, surcharge_3, error) 35 d['p_item'] = code 36 d['p_session'] += 1 37 if d['amount'] == 0: 38 d['error'] = u'Amount could not be determined.' 39 return d 40 40 41 41 def getSchoolFee(student, surcharge): 42 42 study_mode = student['studycourse'].certificate.study_mode 43 entry_mode = student .entry_mode43 entry_mode = student['studycourse'].entry_mode 44 44 state = student.state 45 45 #lga = student.lga
Note: See TracChangeset for help on using the changeset viewer.