Ignore:
Timestamp:
27 Jul 2022, 14:54:11 (2 years ago)
Author:
Henrik Bettermann
Message:

Implement file upload.

Location:
main/kofacustom.edocons/trunk/src/kofacustom/edocons/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/applicants/browser.py

    r17039 r17041  
    2121from zope.component import getUtility
    2222from zope.i18n import translate
     23from waeup.kofa.interfaces import IExtFileStore, IKofaUtils
    2324from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2425from zope.formlib.textwidgets import BytesDisplayWidget
     
    2930    OnlinePaymentDisplayFormPage,
    3031    OnlinePaymentBreadcrumb, ExportPDFPaymentSlipPage,
     32    AdditionalFile
    3133    )
    3234from waeup.kofa.applicants.viewlets import (
     
    181183    """
    182184
     185    def display_fileupload(self, filename):
     186        if filename[1] == 'res_stat' \
     187            and self.target is not None \
     188            and not self.target.startswith('tsc'):
     189            return False
     190        if filename[1] == 'eligibility' \
     191            and self.target is not None \
     192            and not self.target.startswith('tsc'):
     193            return False
     194        return True
     195
    183196    @property
    184197    def form_fields(self):
     
    207220        return True
    208221
     222    def display_fileupload(self, filename):
     223        if filename[1] == 'res_stat' \
     224            and self.target is not None \
     225            and not self.target.startswith('tsc'):
     226            return False
     227        if filename[1] == 'eligibility' \
     228            and self.target is not None \
     229            and not self.target.startswith('tsc'):
     230            return False
     231        return True
     232
    209233    @property
    210234    def form_fields(self):
     
    225249        form_fields['reg_number'].for_display = True
    226250        return form_fields
     251
     252    def dataNotComplete(self, data):
     253        store = getUtility(IExtFileStore)
     254        if self.context.__parent__.with_picture \
     255            and self.context.__parent__.picture_editable:
     256            store = getUtility(IExtFileStore)
     257            if not store.getFileByContext(self.context, attr=u'passport.jpg'):
     258                return _('No passport picture uploaded.')
     259        if self.target is not None \
     260            and self.target.startswith('tscf') \
     261            and not store.getFileByContext(self.context, attr=u'res_stat.pdf'):
     262            return _('No statement of result pdf file uploaded.')
     263        #if self.target is not None \
     264        #    and self.target.startswith('tsc') \
     265        #    and not store.getFileByContext(self.context, attr=u'eligibility.pdf'):
     266        #    return _('No eligibility form pdf file uploaded.')
     267        return False
     268
     269class ResultStatement(AdditionalFile):
     270    grok.name('res_stat')
     271
     272class EligibilityForm(AdditionalFile):
     273    grok.name('eligibility')       
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/applicants/utils.py

    r17039 r17041  
    3131    """A collection of parameters and methods subject to customization.
    3232    """
     33
     34    ADDITIONAL_FILES = (
     35                 ('Eligibility Form','eligibility'),
     36                 ('Statement of Result','res_stat'),
     37                 )
    3338
    3439    SEPARATORS_DICT = {
Note: See TracChangeset for help on using the changeset viewer.