Changeset 6994 for main/waeup.sirp/trunk
- Timestamp:
- 4 Nov 2011, 07:13:32 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/payments/vocabularies.py
r6929 r6994 11 11 ('School Fee','schoolfee'), 12 12 ('Clearance','clearance'), 13 ('Bed Allocation','bed_allocation'), 13 14 ('Hostel Maintenance','hostel_maintenance'), 14 15 ('Transfer','transfer'), -
main/waeup.sirp/trunk/src/waeup/sirp/students/accommodation.py
r6992 r6994 21 21 from grok import index 22 22 from zope.component.interfaces import IFactory 23 from waeup.sirp.interfaces import academic_sessions_vocab 23 24 from waeup.sirp.students.interfaces import ( 24 25 IStudentAccommodation, IStudentNavigation, IBedTicket) … … 64 65 return self.__parent__.__parent__ 65 66 67 def getSessionString(self): 68 return academic_sessions_vocab.getTerm( 69 self.booking_session).title 70 66 71 BedTicket = attrs_to_fields(BedTicket) 67 72 -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6993 r6994 128 128 title = u'Accommodation' 129 129 130 class BedTicketBreadcrumb(Breadcrumb): 131 """A breadcrumb for bed tickets. 132 """ 133 grok.context(IBedTicket) 134 @property 135 136 def title(self): 137 return 'Bed Ticket %s' % self.context.getSessionString() 138 130 139 class StudyLevelBreadcrumb(Breadcrumb): 131 140 """A breadcrumb for course lists. … … 898 907 #order_id = "%s%s" % (student_id[1:],timestamp) 899 908 payment.p_id = "p%s" % timestamp 900 (payment.amount_auth, 901 payment.p_item, payment.p_session, 902 payment.surcharge_1, 903 payment.surcharge_2, 904 payment.surcharge_3, 905 error) = self.getPaymentDetails( 909 pay_details = self.getPaymentDetails( 906 910 data['p_category'],self.context.__parent__) 907 if error:908 self.flash( error)911 if pay_details['error']: 912 self.flash(pay_details['error']) 909 913 self.redirect(self.url(self.context)) 910 914 return 915 payment.amount_auth = pay_details['amount'] 916 payment.p_item = pay_details['p_item'] 917 payment.p_session = pay_details['p_session'] 918 payment.surcharge_1 = pay_details['surcharge_1'] 919 payment.surcharge_2 = pay_details['surcharge_2'] 920 payment.surcharge_3 = pay_details['surcharge_3'] 911 921 self.context[payment.p_id] = payment 912 922 self.flash('Payment ticket created.') … … 966 976 return 967 977 self.context.ac = pin 978 elif self.context.p_category == 'bed_allocation': 979 # Create HOS access code 980 pin, error = create_accesscode('HOS',0,student.student_id) 981 if error: 982 self.flash('Valid callback received. ' + error) 983 return 984 self.context.ac = pin 968 985 self.flash('Valid callback received.') 969 986 return … … 1072 1089 1073 1090 def update(self, SUBMIT=None): 1074 (booking_session, booking_fee, maint_fee, allowed_states, 1075 error) = self.getAccommodationDetails(self.context.__parent__) 1076 if not self.context.getStudent().state in allowed_states: 1091 acc_details = self.getAccommodationDetails(self.context.__parent__) 1092 if not self.context.getStudent().state in acc_details['allowed_states']: 1077 1093 self.flash("Wrong state.") 1078 1094 self.redirect(self.url(self.context)) … … 1102 1118 bedticket = createObject(u'waeup.BedTicket') 1103 1119 bedticket.booking_code = pin 1120 bedticket.booking_session = acc_details['booking_session'] 1104 1121 bedticket.bed = u'Test Bed' 1105 self.context[ 'test'] = bedticket1122 self.context[str(acc_details['booking_session'])] = bedticket 1106 1123 self.flash('Bed ticket created.') 1107 1124 self.redirect(self.url(self.context)) 1108 1125 return 1126 1127 class BedTicketDisplayFormPage(WAeUPDisplayFormPage): 1128 """ Page to display bed tickets 1129 """ 1130 grok.context(IBedTicket) 1131 grok.name('index') 1132 grok.require('waeup.viewStudent') 1133 form_fields = grok.AutoFields(IBedTicket) 1134 form_fields[ 1135 'booking_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1136 pnav = 4 1137 1138 @property 1139 def label(self): 1140 return 'Bed Ticket for Session %s' % self.context.getSessionString() 1141 1142 @property 1143 def title(self): 1144 return 'Bed Ticket %s' % self.context.getSessionString() 1109 1145 1110 1146 class StudentHistoryPage(WAeUPPage): -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r6992 r6994 346 346 ) 347 347 348 booking_fee =schema.Int( 349 title = u'Booking Fee', 350 default = 0, 351 required = False, 352 readonly = False, 353 ) 354 355 maint_date = schema.Datetime( 356 title = u'Maintenance Fee Payment Date', 357 required = False, 358 readonly = False, 359 ) 360 361 maint_code = schema.TextLine( 362 title = u'Maintenance Fee Payment Code', 363 default = u'Certificate XYZ', 364 required = False, 365 readonly = False, 366 ) 367 368 maint_fee = schema.Int( 369 title = u'Maintenance Fee', 370 default = 0, 371 required = False, 372 readonly = False, 373 ) 348 def getSessionString(): 349 """Returns the the title of academic_sessions_vocab term 350 """ 374 351 375 352 class IStudentPaymentsContainer(IPaymentsContainer): -
main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py
r6993 r6994 24 24 # This function is for demonstration and testing only. 25 25 def getPaymentDetails(category, student): 26 surcharge_1 = surcharge_2 = surcharge_3 = 027 p_item= u''28 amount= 029 error= u''30 p_session= student['studycourse'].current_session31 session = str( p_session)26 d = {} 27 d['p_item'] = u'' 28 d['amount'] = 0 29 d['error'] = u'' 30 d['p_session'] = student['studycourse'].current_session 31 session = str(d['p_session']) 32 32 try: 33 33 academic_session = getSite()['configuration'][session] 34 34 except KeyError: 35 error = u'Session configuration object is not available.' 36 return (amount, p_item, p_session, 37 surcharge_1, surcharge_2, surcharge_3, error) 35 d['error'] = u'Session configuration object is not available.' 36 return d 37 d['surcharge_1'] = academic_session.surcharge_1 38 d['surcharge_2'] = academic_session.surcharge_2 39 d['surcharge_3'] = academic_session.surcharge_3 38 40 if category == 'schoolfee': 39 amount = academic_session.fee_1 40 surcharge_1 = academic_session.surcharge_1 41 surcharge_2 = academic_session.surcharge_2 42 surcharge_3 = academic_session.surcharge_3 43 p_item = student['studycourse'].certificate.code 41 d['amount'] = academic_session.fee_1 42 d['p_item'] = student['studycourse'].certificate.code 44 43 elif category == 'clearance': 45 p_item = student['studycourse'].certificate.code 46 amount = academic_session.fee_2 47 return (amount, p_item, p_session, 48 surcharge_1, surcharge_2, surcharge_3, error) 44 d['p_item'] = student['studycourse'].certificate.code 45 d['amount'] = academic_session.fee_2 46 elif category == 'bed_allocation': 47 #d['p_item'] = student['studycourse'].certificate.code 48 d['amount'] = academic_session.booking_fee 49 return d 49 50 50 51 # To be specified in customization packages. 51 52 # This function is for demonstration and testing only. 52 53 def getAccommodationDetails(student): 53 bookin_fee = maint_fee = 0 54 error = u'' 54 d = {} 55 d['bookin_fee'] = d['maint_fee'] = 0 56 d['error'] = u'' 55 57 site_confoguration = getSite()['configuration'] 56 booking_session = site_confoguration.accommodation_session 57 allowed_states = site_confoguration.accommodation_states 58 session = str(booking_session) 59 try: 60 academic_session = getSite()['configuration'][session] 61 except KeyError: 62 error = u'Session configuration object is not available.' 63 return (booking_session, booking_fee, maint_fee, allowed_states, 64 error) 65 booking_fee = academic_session.booking_fee 66 maint_fee = academic_session.maint_fee 67 return booking_session, booking_fee, maint_fee, allowed_states, error 58 d['booking_session'] = site_confoguration.accommodation_session 59 d['allowed_states'] = site_confoguration.accommodation_states 60 session = str(d['booking_session']) 61 return d
Note: See TracChangeset for help on using the changeset viewer.