- Timestamp:
- 4 Sep 2019, 08:26:25 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.dspg/trunk/src/kofacustom/dspg/applicants/browser.py
r15579 r15580 34 34 ExportJobContainerOverview, 35 35 ExportJobContainerJobStart, 36 ExportJobContainerDownload) 36 ExportJobContainerDownload, 37 ApplicantBaseDisplayFormPage) 37 38 from waeup.kofa.browser.viewlets import ManageActionButton 38 39 from waeup.kofa.applicants.viewlets import ( … … 40 41 from waeup.kofa.applicants.pdf import PDFApplicationSlip 41 42 from waeup.kofa.applicants.workflow import ADMITTED, PAID, STARTED 43 from waeup.kofa.students.interfaces import IStudentsUtils 42 44 from kofacustom.nigeria.applicants.interfaces import ( 43 45 UG_OMIT_DISPLAY_FIELDS, … … 46 48 UG_OMIT_EDIT_FIELDS 47 49 ) 50 from kofacustom.nigeria.applicants.browser import ( 51 NigeriaExportPDFPaymentSlipPage) 48 52 from kofacustom.dspg.applicants.interfaces import ( 49 53 ICustomUGApplicant, ICustomUGApplicantEdit, 50 54 ICustomSpecialApplicant, 55 ICustomApplicantOnlinePayment, 56 ICustomApplicant, 51 57 ND_OMIT_DISPLAY_FIELDS, 52 58 ND_OMIT_PDF_FIELDS, … … 355 361 return _('Upload your passport photo before making payment.') 356 362 return '' 363 364 class CustomApplicantBaseDisplayFormPage(ApplicantBaseDisplayFormPage): 365 366 grok.context(ICustomApplicant) 367 368 @property 369 def form_fields(self): 370 if self.context.__parent__.prefix in ('conv', 'special'): 371 form_fields = grok.AutoFields(ICustomApplicant).select( 372 'applicant_id', 'reg_number', 'email') 373 form_fields['reg_number'].field.title = u'Identification Number' 374 return form_fields 375 form_fields = grok.AutoFields(ICustomApplicant).select( 376 'applicant_id', 'reg_number', 'email', 'course1') 377 return form_fields 378 379 class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage): 380 """Deliver a PDF slip of the context. 381 """ 382 383 grok.context(ICustomApplicantOnlinePayment) 384 385 @property 386 def form_fields(self): 387 form_fields = grok.AutoFields(ICustomApplicantOnlinePayment).omit( 388 'ac', 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item', 389 'p_split_data') 390 form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 391 form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 392 if self.context.__parent__.__parent__.prefix in ('conv', 'special'): 393 form_fields = form_fields.omit('p_session') 394 return form_fields 395 396 def render(self): 397 if self.payment_slip_download_warning: 398 self.flash(self.payment_slip_download_warning, type='danger') 399 self.redirect(self.url(self.context)) 400 return 401 applicantview = CustomApplicantBaseDisplayFormPage(self.context.__parent__, 402 self.request) 403 students_utils = getUtility(IStudentsUtils) 404 return students_utils.renderPDF(self,'payment_slip.pdf', 405 self.context.__parent__, applicantview, note=self.note)
Note: See TracChangeset for help on using the changeset viewer.