Ignore:
Timestamp:
13 Jul 2020, 07:17:03 (4 years ago)
Author:
Henrik Bettermann
Message:

Enable file upload and change prefixes.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/applicants
Files:
3 edited

Legend:

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

    r16151 r16164  
    3333    ExportPDFPageApplicationSlip,
    3434    ApplicantBaseDisplayFormPage,
    35     CheckTranscriptStatus)
     35    CheckTranscriptStatus,
     36    AdditionalFile)
    3637from waeup.kofa.students.interfaces import IStudentsUtils
    3738from waeup.kofa.applicants.interfaces import (
     
    223224    @property
    224225    def form_fields(self):
    225         if self.target is not None and self.target == 'transfull':
     226        if self.target is not None and self.target == 'tscf':
    226227            form_fields = grok.AutoFields(ITranscriptApplicant)
    227228            for field in TRANS_OMIT_FIELDS:
     
    230231            #form_fields['perm_address'].custom_widget = BytesDisplayWidget
    231232            return form_fields
    232         if self.target is not None and self.target == 'transshort':
     233        if self.target is not None and self.target == 'tscs':
    233234            form_fields = grok.AutoFields(ITranscriptApplicant)
    234235            for field in TRANS_SHORT_OMIT_FIELDS:
     
    402403    @property
    403404    def form_fields(self):
    404         if self.target is not None and self.target == 'transfull':
     405        if self.target is not None and self.target == 'tscf':
    405406            form_fields = grok.AutoFields(ITranscriptApplicant)
    406407            for field in TRANS_OMIT_FIELDS:
    407408                form_fields = form_fields.omit(field)
    408409            return form_fields
    409         if self.target is not None and self.target == 'transshort':
     410        if self.target is not None and self.target == 'tscs':
    410411            form_fields = grok.AutoFields(ITranscriptApplicant)
    411412            for field in TRANS_SHORT_OMIT_FIELDS:
     
    472473    @property
    473474    def form_fields(self):
    474         if self.target is not None and self.target == 'transfull':
     475        if self.target is not None and self.target == 'tscf':
    475476            form_fields = grok.AutoFields(ITranscriptApplicant)
    476477            for field in TRANS_OMIT_FIELDS:
    477478                form_fields = form_fields.omit(field)
    478479            return form_fields
    479         if self.target is not None and self.target == 'transshort':
     480        if self.target is not None and self.target == 'tscs':
    480481            form_fields = grok.AutoFields(ITranscriptApplicant)
    481482            for field in TRANS_SHORT_OMIT_FIELDS:
     
    533534                'a':container_title, 'b':self.context.application_number})
    534535        return super(CustomApplicantEditFormPage, self).label
     536
     537    def display_fileupload(self, filename):
     538        if filename[1] == 'res_stat.pdf' \
     539            and self.target is not None \
     540            and not self.target.startswith('tscf'):
     541            return False
     542        if filename[1] == 'eligibility.pdf' \
     543            and self.target is not None \
     544            and not self.target.startswith('tsc'):
     545            return False
     546        return True
     547
     548    def dataNotComplete(self, data):
     549        store = getUtility(IExtFileStore)
     550        if self.context.__parent__.with_picture:
     551            store = getUtility(IExtFileStore)
     552            if not store.getFileByContext(self.context, attr=u'passport.jpg'):
     553                return _('No passport picture uploaded.')
     554        if self.target is not None \
     555            and self.target.startswith('tscf') \
     556            and not store.getFileByContext(self.context, attr=u'res_stat.pdf'):
     557            return _('No statement of result pdf file uploaded.')
     558        if self.target is not None \
     559            and self.target.startswith('tsc') \
     560            and not store.getFileByContext(self.context, attr=u'eligibility.pdf'):
     561            return _('No eligibility form pdf file uploaded.')
     562        return False
    535563
    536564class CustomOnlinePaymentApprovePage(OnlinePaymentApprovePage):
     
    722750    websites = (('Uniben Alumni Portal', 'https://uniben-alumni.waeup.org/'),
    723751                ('Uniben Student Portal', 'https://uniben.waeup.org/'),)
    724     appl_url1 = 'https://uniben-alumni.waeup.org/applicants/transfull1/register'
    725     appl_url2 = 'https://uniben-alumni.waeup.org/applicants/transshort1/register'
     752    appl_url1 = 'https://uniben-alumni.waeup.org/applicants/tscf1/register'
     753    appl_url2 = 'https://uniben-alumni.waeup.org/applicants/tscs1/register'
     754
     755class ResultStatement(AdditionalFile):
     756    grok.name('res_stat.pdf')
     757
     758class EligibilityForm(AdditionalFile):
     759    grok.name('eligibility.pdf')
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py

    r16151 r16164  
    303303        applicantscontainer.application_fee = 1.0 # Must be set but is not used.
    304304        applicantscontainer.code = u'trans1234'
    305         applicantscontainer.prefix = 'transfull'
     305        applicantscontainer.prefix = 'tscf'
    306306        applicantscontainer.title = u'This is a trans container'
    307307        applicantscontainer.application_category = 'no'
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py

    r16144 r16164  
    3131    """
    3232
     33    ADDITIONAL_FILES = (
     34                 ('Eligibility Form','eligibility.pdf'),
     35                 ('Statement of Result','res_stat.pdf'),
     36                 )
     37
    3338    APP_TYPES_DICT = {
    3439        'pude': ['Post-UDE Screening', 'PUDE'],
     
    6065                 '(2nd supplementary advert)', 'ASE'],
    6166        'spft': ['Special Full-Time Programmes', 'SP'],
    62         'transfull': ['Transcript Application (without student record)', 'TRF'],
    63         'transshort': ['Transcript Application (with student record)', 'TRS'],
     67        'tscf': ['Transcript Application (without student record)', 'TRF'],
     68        'tscs': ['Transcript Application (with student record)', 'TRS'],
    6469        }
    6570
Note: See TracChangeset for help on using the changeset viewer.