Ignore:
Timestamp:
13 Feb 2020, 17:53:17 (5 years ago)
Author:
Henrik Bettermann
Message:

Finetune fedex payment application.

Change bank account.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/browser.py

    r15994 r16003  
    2727    IExtFileStore, IFileStoreNameChooser, IKofaUtils)
    2828from zope.formlib.textwidgets import BytesDisplayWidget
     29from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2930from waeup.kofa.utils.helpers import string_from_bytes, file_size
    3031from waeup.kofa.applicants.browser import (
    31     ApplicantCheckStatusPage, ApplicantBaseDisplayFormPage,
     32    ApplicantCheckStatusPage,
    3233    AdditionalFile)
    3334from waeup.kofa.applicants.workflow import STARTED, PAID
     
    5859    IFedexRequest,
    5960    IRecruitment,
     61    ICustomApplicantOnlinePayment,
    6062    )
    6163
     
    252254            form_fields = grok.AutoFields(IFedexRequest).omit(
    253255                'locked', 'suspended')
     256            return form_fields
    254257        if self.target is not None and self.target == 'rec':
    255258            form_fields = grok.AutoFields(IRecruitment).omit(
     
    343346            return '<br /><br />' + note
    344347        if self.target is not None and self.target in (
    345             'trans', 'cert', 'ver', 'send'):
     348            'trans', 'cert', 'ver', 'send', 'fedex'):
    346349            return
    347350        if self.context.sex == 'm':
     
    382385        elif self.target is not None and self.target == 'cert':
    383386            form_fields = grok.AutoFields(ICertificateRequest).omit(
     387                'locked', 'suspended')
     388        elif self.target is not None and self.target == 'fedex':
     389            form_fields = grok.AutoFields(IFedexRequest).omit(
    384390                'locked', 'suspended')
    385391        else:
     
    650656        return ''
    651657
     658class ApplicantBaseDisplayFormPage(CustomApplicantDisplayFormPage):
     659    grok.context(ICustomApplicant)
     660    grok.name('base')
     661
     662    @property
     663    def form_fields(self):
     664        if self.context.__parent__.prefix in ('fedex',):
     665            form_fields = grok.AutoFields(IFedexRequest).select(
     666                'applicant_id', 'trans_id', 'email',)
     667        else:
     668            form_fields = grok.AutoFields(ICustomApplicant).select(
     669                'applicant_id', 'reg_number', 'email', 'course1')
     670        if self.context.__parent__.prefix in ('special',):
     671            form_fields['reg_number'].field.title = u'Identification Number'
     672            return form_fields
     673        return form_fields
     674
    652675class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage):
     676
     677    form_fields = grok.AutoFields(ICustomApplicantOnlinePayment).omit(
     678        'ac', 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item',
     679        'p_split_data')
     680    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     681    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    653682
    654683    @property
    655684    def payment_slip_download_warning(self):
    656685        return ''
     686
     687    def render(self):
     688        if self.payment_slip_download_warning:
     689            self.flash(self.payment_slip_download_warning, type='danger')
     690            self.redirect(self.url(self.context))
     691            return
     692        applicantview = ApplicantBaseDisplayFormPage(self.context.__parent__,
     693            self.request)
     694        students_utils = getUtility(IStudentsUtils)
     695        return students_utils.renderPDF(self,'payment_slip.pdf',
     696            self.context.__parent__, applicantview, note=self.note)
    657697
    658698class CustomApplicantCheckStatusPage(ApplicantCheckStatusPage):
Note: See TracChangeset for help on using the changeset viewer.