Changeset 17542 for main/waeup.uniben
- Timestamp:
- 16 Aug 2023, 09:24:29 (15 months ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/hostels/tests.py
r15251 r17542 47 47 self.student['accommodation'].addBedTicket(bedticket) 48 48 self.app[ 49 'hostels']['hall-x']['hall _block_room_bed'].owner = self.student_id49 'hostels']['hall-x']['hall-x_block_room_bed'].owner = self.student_id 50 50 notify(grok.ObjectModifiedEvent( 51 self.app['hostels']['hall-x']['hall _block_room_bed']))51 self.app['hostels']['hall-x']['hall-x_block_room_bed'])) 52 52 results = cat.searchResults(owner=(self.student_id, self.student_id)) 53 53 self.assertEqual(len(results), 1) … … 58 58 self.browser.open(self.container_path + '/releaseexpired') 59 59 self.assertTrue( 60 'Successfully released beds: hall _block_room_bed (B1000000)'60 'Successfully released beds: hall-x_block_room_bed (B1000000)' 61 61 in self.browser.contents) 62 62 results = cat.searchResults(owner=(self.student_id, self.student_id)) … … 65 65 '-- booking expired (2015-10-14 08:35:38 WAT) --') 66 66 self.assertEqual( 67 self.app['hostels']['hall-x']['hall _block_room_bed'].owner,67 self.app['hostels']['hall-x']['hall-x_block_room_bed'].owner, 68 68 NOT_OCCUPIED) 69 69 # Releasing is logged. … … 71 71 self.assertTrue( 72 72 'hostels.browser.ReleaseExpiredAllocationsPage - hostels - ' 73 'released: hall _block_room_bed (B1000000)'73 'released: hall-x_block_room_bed (B1000000)' 74 74 in logcontent) 75 75 return -
main/waeup.uniben/trunk/src/waeup/uniben/interfaces.py
r17301 r17542 142 142 ) 143 143 144 medical_clearance_fee = schema.Float( 145 title = _(u'Medical Clearance Fee'), 146 default = 0.0, 147 required = False, 148 ) 149 144 150 remita_enabled = schema.Bool( 145 151 title = _(u'Remita integration enabled'), -
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r17395 r17542 263 263 Dear %s, 264 264 <br /><br /><br /> 265 You are invited for your physicalclearance on:265 You are invited for your Health Centre clearance on: 266 266 <br /><br /> 267 267 <strong>%s</strong>. 268 268 <br /><br /> 269 Please bring along this letter of invitation to the University Main Auditorium 270 <br /><br /> 271 on your clearance date. 269 Please bring along your downloaded Health Centre Form to the University Health Centre 270 on your Health Centre clearance date. 272 271 <br /><br /><br /> 273 272 Signed, … … 295 294 omit_fields=self.omit_fields, 296 295 note=self.note) 296 297 class ExportMedicalExaminationSlip(UtilityView, grok.View): 298 """Deliver an . 299 300 This form page is available only in Uniben. 301 """ 302 grok.context(ICustomStudent) 303 grok.name('medical_examination_slip.pdf') 304 grok.require('waeup.viewStudent') 305 prefix = 'form' 306 307 label = u'Uniben Medical Examination Form' 308 309 omit_fields = ( 310 'suspended', 311 'adm_code', 'suspended_comment', 312 'current_level', 313 'department', 'current_mode', 314 'entry_session', 'matric_number', 315 'flash_notice', 'parents_email', 316 'faculty', 'department') 317 318 form_fields = grok.AutoFields(ICustomStudentPersonal).select( 319 'marit_stat', 'perm_address', 'next_kin_phone') 320 form_fields['perm_address'].custom_widget = BytesDisplayWidget 321 322 def _medicalClearancePaymentMade(self, student, session): 323 if len(student['payments']): 324 for ticket in student['payments'].values(): 325 if ticket.p_state == 'paid' and \ 326 ticket.p_category == 'medical_clearance' and \ 327 ticket.p_session == session: 328 return True 329 return False 330 331 def update(self): 332 if self.context.student.state != CLEARED \ 333 or not self.context.student.physical_clearance_date: 334 self.flash(_('Forbidden'), type="warning") 335 self.redirect(self.url(self.context)) 336 if not self._medicalClearancePaymentMade( 337 self.context, self.context.current_session): 338 self.flash('Please pay medical clearance fee first.', 339 type="warning") 340 self.redirect(self.url(self.context)) 341 return 342 343 def render(self): 344 studentview = StudentBasePDFFormPage(self.context.student, 345 self.request, self.omit_fields) 346 students_utils = getUtility(IStudentsUtils) 347 file_path = os.path.join( 348 os.path.dirname(__file__), 'static', 'medical_examination_form.pdf') 349 file = open(file_path, 'rb') 350 mergefiles = [file,] 351 return students_utils.renderPDF( 352 self, 'medical_examination_slip', 353 self.context.student, studentview, 354 omit_fields=self.omit_fields, 355 mergefiles=mergefiles, 356 ) 357 297 358 298 359 class ExportExaminationScheduleSlip(UtilityView, grok.View): -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r17457 r17542 230 230 self.assertTrue('Clearance has been requested' 231 231 in self.browser.contents) 232 # Now student can export physical_clearance .slip232 # Now student can export physical_clearance_slip 233 233 self.app['configuration'].name = u'University of Benin' 234 234 self.student.physical_clearance_date = u'January 5th, 2015' … … 240 240 open(path, 'wb').write(self.browser.contents) 241 241 print "Sample PDF clearance_invitation_slip.pdf written to %s" % path 242 243 def test_medical_examination_slip(self): 244 # Student can export medical_examination_slip 245 self.app['configuration']['2004'].medical_clearance_fee = 1000.0 246 self.app['configuration'].name = u'University of Benin' 247 IWorkflowState(self.student).setState('cleared') 248 self.student.perm_address = u'My Address in Nigeria' 249 self.student.physical_clearance_date = u'January 5th, 2015' 250 self.browser.open(self.login_path) 251 self.browser.getControl(name="form.login").value = self.student_id 252 self.browser.getControl(name="form.password").value = 'spwd' 253 self.browser.getControl("Login").click() 254 self.browser.open(self.clearance_path) 255 self.browser.getLink("Download medical examination slip").click() 256 self.assertTrue('Please pay medical clearance fee first' in 257 self.browser.contents) 258 self.browser.open(self.payments_path) 259 self.browser.getLink("Add current session payment ticket").click() 260 self.browser.getControl(name="form.p_category").value = ['medical_clearance'] 261 self.browser.getControl("Create ticket").click() 262 p_ticket = self.student['payments'].values()[0] 263 p_ticket.approveStudentPayment() 264 self.browser.open(self.clearance_path) 265 self.browser.getLink("Download medical examination slip").click() 266 self.assertEqual(self.browser.headers['Status'], '200 Ok') 267 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 268 path = os.path.join(samples_dir(), 'medical_examination_slip.pdf') 269 open(path, 'wb').write(self.browser.contents) 270 print "Sample PDF medical_examination_slip.pdf written to %s" % path 271 242 272 # Students can open the personal edit page and see the parent_email field. 243 273 self.browser.open(self.student_path + '/edit_personal') -
main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
r17395 r17542 19 19 import grok 20 20 from zope.component import getUtility 21 from waeup.kofa.interfaces import REQUESTED, REGISTERED, IExtFileStore21 from waeup.kofa.interfaces import REQUESTED, REGISTERED, CLEARED, IExtFileStore 22 22 from waeup.kofa.browser.viewlets import ManageActionButton 23 23 from waeup.kofa.students.interfaces import IStudentsUtils … … 136 136 return False 137 137 138 class MadicalExaminationSlipActionButton(ManageActionButton): 139 grok.order(6) 140 grok.context(ICustomStudent) 141 grok.view(StudentClearanceDisplayFormPage) 142 grok.require('waeup.viewStudent') 143 icon = 'actionicon_pdf.png' 144 text = _('Download medical examination slip') 145 target = 'medical_examination_slip.pdf' 146 147 @property 148 def target_url(self): 149 if self.context.student.state == CLEARED \ 150 and self.context.student.physical_clearance_date: 151 return self.view.url(self.view.context, self.target) 152 return False 153 138 154 class ExaminationScheduleSlipActionButton(ManageActionButton): 139 155 grok.order(10) -
main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py
r17401 r17542 95 95 'plag_test':'Final Year Plagiarism Test', 96 96 'flc_modules': 'FLC Modules Fee', 97 'medical_clearance': 'Medical Clearance Fee', 97 98 } 98 99 … … 118 119 'plag_test':'Final Year Plagiarism Test (for final year project or PG thesis)', 119 120 'flc_modules': 'FLC Modules Fee', 121 'medical_clearance': 'Medical Clearance Fee', 120 122 } 121 123
Note: See TracChangeset for help on using the changeset viewer.