Changeset 16504 for main/waeup.uniben/trunk/src/waeup/uniben
- Timestamp:
- 12 Jun 2021, 05:05:15 (4 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
r16471 r16504 34 34 ApplicantBaseDisplayFormPage, 35 35 CheckTranscriptStatus, 36 AdditionalFile )36 AdditionalFile,) 37 37 from waeup.kofa.students.interfaces import IStudentsUtils 38 38 from waeup.kofa.applicants.interfaces import ( … … 43 43 NigeriaApplicantManageFormPage, 44 44 NigeriaApplicantEditFormPage, 45 NigeriaPDFApplicationSlip) 45 NigeriaPDFApplicationSlip, 46 NigeriaExportPDFPaymentSlipPage) 46 47 from waeup.uniben.applicants.interfaces import ( 47 48 ICustomApplicant, … … 727 728 ar_translation, self.context.application_number) 728 729 730 class CustomApplicantBaseDisplayFormPage(ApplicantBaseDisplayFormPage): 731 732 @property 733 def form_fields(self): 734 target = getattr(self.context.__parent__, 'prefix', None) 735 if target.startswith('tsc'): 736 form_fields = grok.AutoFields(ICustomApplicant).select( 737 'applicant_id', 'email', 'dispatch_address') 738 else: 739 form_fields = grok.AutoFields(ICustomApplicant).select( 740 'applicant_id', 'reg_number', 'email', 'course1') 741 if self.context.__parent__.prefix in ('special',): 742 form_fields['reg_number'].field.title = u'Identification Number' 743 return form_fields 744 return form_fields 745 746 class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage): 747 """Deliver a PDF slip of the context. 748 """ 749 750 @property 751 def omit_fields(self): 752 target = getattr(self.context.__parent__.__parent__, 'prefix', None) 753 if target.startswith('tsc'): 754 return ('date_of_birth', 'course1') 755 return 756 757 @property 758 def note(self): 759 return 760 761 def render(self): 762 if self.payment_slip_download_warning: 763 self.flash(self.payment_slip_download_warning, type='danger') 764 self.redirect(self.url(self.context)) 765 return 766 applicantview = CustomApplicantBaseDisplayFormPage(self.context.__parent__, 767 self.request) 768 students_utils = getUtility(IStudentsUtils) 769 return students_utils.renderPDF(self,'payment_slip.pdf', 770 self.context.__parent__, applicantview, 771 note=self.note, omit_fields=self.omit_fields) 772 729 773 class ExportScreeningInvitationSlip(UtilityView, grok.View): 730 774 """Deliver a PDF slip of the context. -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py
r16330 r16504 348 348 file_ctrl.add_file(image, filename='myphoto.jpg') 349 349 self.browser.getControl("Save").click() 350 applicant_url = self.browser.url 350 351 self.browser.getControl("Create and make online").click() 351 352 self.assertTrue('Payment ticket created' in self.browser.contents) 352 353 self.assertTrue('<span>40000.0</span>' in self.browser.contents) 353 354 self.assertEqual(applicant.values()[0].amount_auth, 40000.0) 355 applicant.values()[0].p_state = 'paid' 356 payment_url = self.browser.url 354 357 IWorkflowState(applicant).setState('submitted') 358 self.browser.open(payment_url) 359 self.browser.getLink("Download payment slip").click() 360 self.assertEqual(self.browser.headers['Status'], '200 Ok') 361 self.assertEqual(self.browser.headers['Content-Type'], 362 'application/pdf') 363 path = os.path.join(samples_dir(), 'tscf_payment_slip.pdf') 364 open(path, 'wb').write(self.browser.contents) 365 print "Sample tscf_payment_slip.pdf written to %s" % path 366 self.browser.open(applicant_url) 355 367 self.browser.getLink("My Data").click() 356 368 self.browser.getLink("Download application slip").click()
Note: See TracChangeset for help on using the changeset viewer.