Changeset 18181
- Timestamp:
- 22 Sep 2025, 20:27:42 (14 months ago)
- Location:
- main/kofacustom.unidel/trunk/src/kofacustom/unidel/students
- Files:
-
- 2 edited
-
browser.py (modified) (2 diffs)
-
utils.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py
r17924 r18181 84 84 with_ac = False 85 85 86 def update(self, SUBMIT=None): 87 if getattr(self.request.principal, 'user_type', None) == 'student': 88 entry_session = self.context.student['studycourse'].entry_session 89 if entry_session != grok.getSite()['hostels'].accommodation_session: 90 error_message = 'Only newly admitted students can book accommodation.' 91 self.flash(error_message, type="warning") 92 self.redirect(self.url(self.context)) 93 return 94 return super(CustomBedTicketAddPage, self).update(SUBMIT) 95 86 96 class CustomAccommodationDisplayFormPage(NigeriaAccommodationDisplayFormPage): 87 97 """ Page to view bed tickets. … … 94 104 """ 95 105 with_hostel_selection = True 106 107 @property 108 def booking_allowed(self): 109 if getattr(self.request.principal, 'user_type', None) == 'student': 110 entry_session = self.context.student['studycourse'].entry_session 111 if entry_session != grok.getSite()['hostels'].accommodation_session: 112 return False 113 students_utils = getUtility(IStudentsUtils) 114 acc_details = students_utils.getAccommodationDetails(self.context.student) 115 error_message = students_utils.checkAccommodationRequirements( 116 self.context.student, acc_details) 117 if error_message: 118 return False 119 return True 120 121 @property 122 def actionsgroup2(self): 123 if getattr(self.request.principal, 'user_type', None) == 'student': 124 ## Book button can be disabled in custom packages by 125 ## uncommenting the following lines. 126 if not self.booking_allowed: 127 return [] 128 return [_('Book accommodation')] 129 return [_('Book accommodation'), _('Remove selected')] 96 130 97 131 class CustomPaymentsManageFormPage(PaymentsManageFormPage): -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/utils.py
r18179 r18181 263 263 return None, payment 264 264 265 def checkAccommodationRequirements(self, student, acc_details):265 def disabled_checkAccommodationRequirements(self, student, acc_details): 266 266 msg = super(CustomStudentsUtils, self).checkAccommodationRequirements( 267 267 student, acc_details)
Note: See TracChangeset for help on using the changeset viewer.
