Changeset 15185 for main/kofacustom.edopoly/trunk/src/kofacustom
- Timestamp:
- 12 Oct 2018, 15:51:59 (6 years ago)
- Location:
- main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/browser.py
r15177 r15185 206 206 self.context.student, omit_fields=self.omit_fields, 207 207 pre_text=pre_text, post_text='') 208 209 class MedicalLaboratoryRequestForm(UtilityView, grok.View): 210 """Deliver a PDF notification slip. 211 """ 212 grok.context(ICustomStudent) 213 grok.name('medical_laboratory_form.pdf') 214 grok.require('waeup.viewStudent') 215 prefix = 'form' 216 217 form_fields = grok.AutoFields(ICustomStudent).select( 218 'student_id', 'matric_number', 'sex', 'email', 'phone', 'perm_address') 219 omit_fields = ('current_mode') 220 221 label = u'Student\'s Medical Laboratory Request Form' 222 title = u'Student\'s Medical Laboratory Request Form' 223 224 post_text = """ 225 226 Laboratory request: Student's Medical Test 227 228 Lab Results/Status: 229 230 Medical Laboratory Scientist's Sign.: 231 232 233 234 Notice to all newly admitted students: 235 236 1. Carry out your mandatory medical laboratory tests at: 237 (a) the Edo State Polyechnic Health Centre 238 2. Evidence of medical screening payment and the downloaded student's laboratory test request form are required for the medical tests to be conducted for students. 239 3. Collect your lab tests results and upload during clearance process online. 240 4. Students' admission records and clearance are incomplete without medical test result. 241 5. Results of medical tests from elsewhere are not accepted. 242 6. Medical tests are conducted only within admission period, and will end in matriculation week. Unnecessary delays will not be allowed. 243 7. This information applies to both full- time and part-time. 244 """ 245 246 def render(self): 247 if not self.context.medical_fee_paid: 248 self.flash('Not allowed.', type="danger") 249 self.redirect(self.url(self.context)) 250 return 251 students_utils = getUtility(IStudentsUtils) 252 return students_utils.renderPDFAdmissionLetter(self, 253 self.context.student, omit_fields=self.omit_fields, 254 pre_text='', post_text=self.post_text) -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/student.py
r15000 r15185 43 43 return False 44 44 45 @property 46 def medical_fee_paid(self): 47 for key in self['payments'].keys(): 48 ticket = self['payments'][key] 49 if ticket.p_state == 'paid' and \ 50 ticket.p_session == self.current_session and \ 51 ticket.p_category == 'medical': 52 return True 53 return False 45 54 46 55 # Set all attributes of Student required in IStudent as field -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_browser.py
r15000 r15185 21 21 from StringIO import StringIO 22 22 from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo 23 from mechanize import LinkNotFoundError 23 24 from zope.securitypolicy.interfaces import IPrincipalRoleManager 24 25 from zope.component.hooks import setSite, clearSite … … 34 35 IExtFileStore, IFileStoreNameChooser) 35 36 from waeup.kofa.students.interfaces import IStudentsUtils 37 from waeup.kofa.browser.tests.test_pdf import samples_dir 36 38 from kofacustom.edopoly.testing import FunctionalLayer 37 39 … … 44 46 def test_dummytest(self): 45 47 return 48 49 class StudentUITests(StudentsFullSetup): 50 """Tests for customized student class views and pages 51 """ 52 53 layer = FunctionalLayer 54 55 def setUp(self): 56 super(StudentUITests, self).setUp() 57 58 59 def test_medical_laboratory_form(self): 60 self.browser.open(self.login_path) 61 self.browser.getControl(name="form.login").value = self.student_id 62 self.browser.getControl(name="form.password").value = 'spwd' 63 self.browser.getControl("Login").click() 64 self.assertRaises( 65 LinkNotFoundError, 66 self.browser.getLink, 'Download medical laboratory request form') 67 # Add medical fee payment ticket 68 self.app['configuration']['2004'].medical = 180.0 69 payment = createObject('waeup.StudentOnlinePayment') 70 payment.p_category = u'medical' 71 payment.p_session = self.student.current_session 72 payment.p_id = u'anyid' 73 payment.p_state = u'paid' 74 self.student['payments']['anykey'] = payment 75 self.browser.open(self.student_path) 76 self.browser.getLink("Download medical laboratory request form").click() 77 self.assertEqual(self.browser.headers['Status'], '200 Ok') 78 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 79 path = os.path.join(samples_dir(), 'medical_laboratory_form.pdf') 80 open(path, 'wb').write(self.browser.contents) 81 print "Sample PDF medical_laboratory_form.pdf written to %s" % path -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/viewlets.py
r15177 r15185 69 69 return '' 70 70 return self.view.url(self.view.context, self.target) 71 72 class MedicalLaboratoryRequestFormActionButton(ManageActionButton): 73 grok.order(11) 74 grok.context(IStudent) 75 grok.view(StudentBaseDisplayFormPage) 76 grok.require('waeup.viewStudent') 77 icon = 'actionicon_pdf.png' 78 text = _('Download medical laboratory request form') 79 target = 'medical_laboratory_form.pdf' 80 81 @property 82 def target_url(self): 83 if not self.context.medical_fee_paid: 84 return '' 85 return self.view.url(self.view.context, self.target)
Note: See TracChangeset for help on using the changeset viewer.