Ignore:
Timestamp:
19 Nov 2019, 13:07:22 (5 years ago)
Author:
Henrik Bettermann
Message:

Move viewlet classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/viewlets.py

    r15651 r15826  
    1919import grok
    2020from zope.component import getUtility
     21from waeup.kofa.interfaces import IExtFileStore
    2122from waeup.kofa.browser.viewlets import ManageActionButton
    2223from waeup.kofa.students.interfaces import IStudentsUtils
     24from waeup.kofa.students.viewlets import (
     25    PaymentReceiptActionButton, StudentPassportActionButton)
    2326from waeup.kofa.students.fileviewlets import (
    2427    StudentFileDisplay, StudentFileUpload, StudentImage)
    2528from waeup.kofa.students.browser import ExportPDFClearanceSlip
    26 
    27 from kofacustom.nigeria.students.interfaces import INigeriaStudent
     29from kofacustom.nigeria.students.interfaces import (
     30    INigeriaStudent, INigeriaStudentOnlinePayment)
    2831from kofacustom.nigeria.students.browser import NigeriaStudentBaseDisplayFormPage
    2932from kofacustom.nigeria.interfaces import MessageFactory as _
     
    3841    return False
    3942
     43class StudentPassportActionButton(StudentPassportActionButton):
     44
     45    @property
     46    def target_url(self):
     47        # Passport pictures must not be editable if application slip
     48        # exists.
     49        slip = getUtility(IExtFileStore).getFileByContext(
     50            self.context, 'application_slip')
     51        PORTRAIT_CHANGE_STATES = getUtility(IStudentsUtils).PORTRAIT_CHANGE_STATES
     52        if self.context.state not in PORTRAIT_CHANGE_STATES or slip is not None:
     53            return ''
     54        return self.view.url(self.view.context, self.target)
     55
     56class PaymentReceiptActionButton(PaymentReceiptActionButton):
     57    grok.order(4)
     58    grok.context(INigeriaStudentOnlinePayment)
     59
     60    @property
     61    def target_url(self):
     62        if not self.context.r_company:
     63            return ''
     64        return self.view.url(self.view.context, self.target)
     65
    4066# Financial Clearance Officer buttons
    4167
Note: See TracChangeset for help on using the changeset viewer.