Changeset 15250 for main/waeup.kofa/trunk
- Timestamp:
- 23 Nov 2018, 11:10:19 (6 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r15243 r15250 4 4 1.6.1.dev0 (unreleased) 5 5 ======================= 6 7 * Add ReleaseExpiredAllocationsActionButton which has previously 8 only been used by Uniben. 6 9 7 10 * Fix get_student_payment_stats. Department codes are not -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py
r13565 r15250 124 124 target = 'statistics' 125 125 126 class ReleaseExpiredAllocationsActionButton(ManageActionButton): 127 grok.order(3) 128 grok.context(IHostelsContainer) 129 grok.view(HostelsContainerPage) 130 grok.require('waeup.manageHostels') 131 icon = 'actionicon_sweep.png' 132 target = 'releaseexpired' 133 text = _('Release all expired bed space allocations') 134 135 @property 136 def target_url(self): 137 if self.target and self.context.allocation_expiration: 138 return self.view.url(self.view.context, self.target) 139 return 140 141 @property 142 def onclick(self): 143 msg = "'All expired bed space allocations will be annulled. " + \ 144 "Are you sure? \\n\\n" + \ 145 "Bed space allocation expires ${a} days after accommodation " + \ 146 "booking if maintenance fee is not " + \ 147 "paid.'" 148 msg = _(msg, mapping={'a': self.context.allocation_expiration,}) 149 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 150 return "return window.confirm(%s);" % translate( 151 msg, 'waeup.kofa', target_language=portal_language) 152 126 153 class HostelsContainerManagePage(KofaEditFormPage): 127 154 """The manage page for hostel containers. … … 190 217 grok.require('waeup.manageHostels') 191 218 192 def update(self, n=7): 219 def update(self): 220 n = self.context.allocation_expiration 221 if not n: 222 self.flash( 223 _('Forbidden'), type='danger') 224 self.redirect(self.url(self.context)) 225 return 193 226 if not grok.getSite()['configuration'].maintmode_enabled_by: 194 227 self.flash( -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/interfaces.py
r14009 r15250 73 73 ) 74 74 75 allocation_expiration = schema.Int( 76 title = _(u'Allocation Expiration Time (days)'), 77 description = _( 78 'Number of days after which allocation is being annulled'), 79 required = False, 80 ) 81 75 82 def clearAllHostels(): 76 83 """Clear all hostels. -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r13533 r15250 188 188 189 189 def test_release_expired_allocations(self): 190 self.app['hostels'].allocation_expiration = 7 190 191 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 191 192 cat = queryUtility(ICatalog, name='beds_catalog') -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r15246 r15250 2406 2406 self.request, self.omit_fields) 2407 2407 students_utils = getUtility(IStudentsUtils) 2408 note = None 2409 n = grok.getSite()['hostels'].allocation_expiration 2410 if n: 2411 note = """ 2412 <br /><br /><br /><br /><br /><font size="12"> 2413 Please endeavour to pay your hostel maintenance charge within ${a} days 2414 of being allocated a space or else you are deemed to have 2415 voluntarily forfeited it and it goes back into circulation to be 2416 available for booking afresh!</font> 2417 """ 2418 note = _(note, mapping={'a': n}) 2419 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 2420 note = translate( 2421 note, 'waeup.kofa', target_language=portal_language) 2408 2422 return students_utils.renderPDF( 2409 2423 self, 'bed_allocation_slip.pdf', 2410 2424 self.context.student, studentview, 2411 omit_fields=self.omit_fields) 2425 omit_fields=self.omit_fields, 2426 note=note) 2412 2427 2413 2428 class BedTicketRelocationView(UtilityView, grok.View): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r15234 r15250 3270 3270 bed.bed_type = u'regular_female_fr' 3271 3271 self.app['hostels'][hostel.hostel_id].addBed(bed) 3272 self.app['hostels'].allocation_expiration = 7 3272 3273 3273 3274 self.browser.open(self.login_path) … … 3373 3374 self.assertEqual(self.browser.headers['Status'], '200 Ok') 3374 3375 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 3376 path = os.path.join(samples_dir(), 'bed_allocation_slip.pdf') 3377 open(path, 'wb').write(self.browser.contents) 3378 print "Sample PDF bed_allocation_slip.pdf written to %s" % path 3375 3379 # Students can't relocate themselves. 3376 3380 self.assertFalse('Relocate' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.