Changeset 17255 for main/waeup.uniben/trunk/src/waeup/uniben/students
- Timestamp:
- 3 Jan 2023, 17:40:18 (23 months ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r17142 r17255 881 881 return super(StudentMedicalHistoryEditFormPage, self).update() 882 882 883 883 884 class ExportPDFMedicalHistorySlip(grok.View): 884 885 """Deliver a PDF slip of the context. … … 893 894 'adm_code', 'date_of_birth', 894 895 'flash_notice', 'current_mode', 'entry_mode', 895 'entry_session', 'parents_email', 'study_course',896 'entry_session', 'parents_email', 896 897 'current_level', 'reg_number', 'sex', 897 898 'certificate') … … 919 920 omit_fields=self.omit_fields,) 920 921 922 class ExportPDFTishipSlip(grok.View): 923 """Deliver a PDF slip of the context. 924 """ 925 grok.context(ICustomStudent) 926 grok.name('tiship_slip.pdf') 927 grok.require('waeup.viewStudent') 928 prefix = 'form' 929 form_fields = grok.AutoFields(IMedicalHistory).select( 930 'genotype', 'bloodgroup') 931 title = '' 932 933 omit_fields = ('password', 'suspended', 'suspended_comment', 934 'adm_code', 935 'flash_notice', 'current_mode', 'entry_mode', 936 'parents_email', 937 ) 938 939 @property 940 def label(self): 941 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 942 return translate(_('TISHIP Registration Slip of'), 943 'waeup.kofa', target_language=portal_language) \ 944 + ' %s' % self.context.display_fullname 945 946 947 def _sigsInFooter(self): 948 return (_('Year of Graduation'), 949 _('Signature'), 950 _('Date'), 951 ) 952 953 def render(self): 954 studentview = StudentBasePDFFormPage(self.context.student, 955 self.request, self.omit_fields) 956 students_utils = getUtility(IStudentsUtils) 957 return students_utils.renderPDF( 958 self, 'tiship_slip.pdf', 959 self.context.student, studentview, 960 sigs_in_footer=self._sigsInFooter(), 961 omit_fields=self.omit_fields,) 962 921 963 class PlagTestInfoPage(KofaPage): 922 964 "Landing page after plagiation test payment" -
main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py
r16509 r17255 215 215 ) 216 216 217 218 # Tiship form 219 220 genotype = schema.TextLine( 221 title = _(u'Genotype'), 222 required = False, 223 ) 224 225 bloodgroup = schema.TextLine( 226 title = _(u'Blood Group'), 227 required = False, 228 ) 229 217 230 class ICustomStudentPersonal(INigeriaStudentPersonal): 218 231 """Student personal data. -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r17111 r17255 1220 1220 open(path, 'wb').write(self.browser.contents) 1221 1221 print "Sample PDF medical_questionnaire_slip.pdf written to %s" % path 1222 1223 self.browser.open(self.student_path) 1224 self.browser.getLink("Medical Questionnaire").click() 1225 self.browser.getControl(name="form.bloodgroup").value = 'A' 1226 self.browser.getControl(name="form.genotype").value = 'XYZ' 1227 self.browser.getControl("Save").click() 1228 self.browser.getLink("Download TISHIP registration slip").click() 1229 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1230 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 1231 path = os.path.join(samples_dir(), 'tiship_slip.pdf') 1232 open(path, 'wb').write(self.browser.contents) 1233 print "Sample PDF tiship_slip.pdf written to %s" % path -
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py
r16437 r17255 1 import datetime1 import datetime 2 2 from zope.component import queryUtility 3 3 from zope.interface.verify import verifyObject, verifyClass … … 141 141 result = open(self.outfile, 'rb').read() 142 142 self.assertMatches( 143 'asthma,b ody_pains,breathing,catarrh,company_confirmed,'144 'company_suspected,cough,diabetes,fever, headaches,hypertension,'143 'asthma,bloodgroup,body_pains,breathing,catarrh,company_confirmed,' 144 'company_suspected,cough,diabetes,fever,genotype,headaches,hypertension,' 145 145 'lagos_abuja,medical_updated,medicines,negative,obesity,' 146 146 'others,outside,positive,smell,sneezing,sore_throat,taste,' … … 148 148 'matric_number,faccode,depcode,state,current_session,' 149 149 'current_level\r\n' 150 ',,,,,,,,,,,,,,,,,,,,, 1,,,,A111111,Anna M. Tester,234,'150 ',,,,,,,,,,,,,,,,,,,,,,,1,,,,A111111,Anna M. Tester,234,' 151 151 'NA,NA,created,2012,200\r\n' , result 152 152 ) -
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r17236 r17255 49 49 'form.lagos_abuja': _(u'Travel History'), 50 50 'form.company_suspected': _(u'History of Contact/Infection'), 51 'form.genotype': _(u'TISHIP Registration Form Data'), 51 52 } 52 53 … … 94 95 if not student.state in acc_details['allowed_states']: 95 96 return _("You are in the wrong registration state.") 96 if student['studycourse'].current_session != acc_details[ 97 'booking_session']: 98 return _('Your current session does not ' 99 'match accommodation session.') 97 #if student['studycourse'].current_session != acc_details[ 98 # 'booking_session']: 99 # return _('Your current session does not ' 100 # 'match accommodation session.') 101 if acc_details['booking_session'] - student[ 102 'studycourse'].current_session > self.ACCOMMODATION_SPAN: 103 return _('Your current session does not allow ' + \ 104 'to book accommodation.') 100 105 stage = bt.split('_')[2] 101 106 if not student.is_postgrad and stage != 'fr' and not student[ -
main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
r17145 r17255 206 206 target = 'medical_questionnaire_slip.pdf' 207 207 208 class TishipSlipActionButton(ManageActionButton): 209 grok.order(2) 210 grok.context(ICustomStudent) 211 grok.view(StudentMedicalHistoryEditFormPage) 212 grok.require('waeup.viewStudent') 213 icon = 'actionicon_pdf.png' 214 text = _('Download TISHIP registration slip') 215 target = 'tiship_slip.pdf' 216 208 217 class PlagTestLinkActionButton(ManageActionButton): 209 218 grok.order(10)
Note: See TracChangeset for help on using the changeset viewer.