Changeset 7004 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 6 Nov 2011, 08:52:36 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7003 r7004 50 50 from waeup.sirp.students.vocabularies import StudyLevelSource 51 51 from waeup.sirp.students.utils import ( 52 getPaymentDetails, getAccommodationDetails, )52 getPaymentDetails, getAccommodationDetails, selectBed) 53 53 from waeup.sirp.browser.resources import toggleall 54 54 from waeup.sirp.authentication import get_principal_role_manager … … 1091 1091 return getAccommodationDetails(student) 1092 1092 1093 # To be sepezified in customization packages 1094 def selectBed(self, student): 1095 return getAccommodationDetails(student) 1096 1093 1097 def update(self, SUBMIT=None): 1094 1098 student = self.context.getStudent() … … 1098 1102 self.redirect(self.url(self.context)) 1099 1103 return 1104 if str(student['studycourse'].entry_session) in self.context.keys(): 1105 self.flash('Ticket for %d already created.' 1106 % student['studycourse'].entry_session) 1107 self.redirect(self.url(self.context)) 1108 return 1100 1109 self.ac_series = self.request.form.get('ac_series', None) 1101 1110 self.ac_number = self.request.form.get('ac_number', None) 1102 1103 1111 if SUBMIT is None: 1104 1112 return … … 1121 1129 entries = cat.searchResults( 1122 1130 owner=(student.student_id,student.student_id)) 1131 # Cannot happen but anyway ... 1123 1132 if len(entries): 1124 1133 bed = [entry for entry in entries][0] … … 1143 1152 bedticket.booking_session = acc_details['booking_session'] 1144 1153 bedticket.bed_type = acc_details['bt'] 1145 bed = available_beds[0] # first bed found1154 bed = selectBed(available_beds) 1146 1155 bed.bookBed(student.student_id) 1147 bedticket.bed = bed # maybe wo don't need the bed object itself 1156 bedticket.bed = bed # maybe wo don't need the bed object itself and can 1157 # remove that later 1148 1158 hall_title = bed.__parent__.hostel_name 1149 1159 coordinates = bed.getBedCoordinates()[1:] -
main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py
r6996 r7004 21 21 return 22 22 23 # To be specified in customization packages. 23 # To be specified in customization packages, see also view which 24 # calls the function. 24 25 # This function is for demonstration and testing only. 25 26 def getPaymentDetails(category, student): … … 45 46 d['amount'] = academic_session.fee_2 46 47 elif category == 'bed_allocation': 47 d['p_item'] = get BedType(student)48 d['p_item'] = getAccommodationDetails(student)['bt'] 48 49 d['amount'] = academic_session.booking_fee 49 50 return d 50 51 51 # To be specified in customization packages. 52 # To be specified in customization packages, see also view which 53 # calls the function. 52 54 # This function is for demonstration and testing only. 53 55 def getAccommodationDetails(student): … … 76 78 d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt) 77 79 return d 80 81 # To be specified in customization packages, see also view which 82 # calls the function. 83 # I the standard configuration we select the first bed found, 84 # but can also randomize the selection if we like. 85 def selectBed(available_beds): 86 return available_beds[0]
Note: See TracChangeset for help on using the changeset viewer.