Changeset 16439


Ignore:
Timestamp:
30 Mar 2021, 09:40:15 (4 years ago)
Author:
Henrik Bettermann
Message:

Customize CustomStudyCourseManageFormPage?.

File:
1 edited

Legend:

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

    r16427 r16439  
    2323from zope.formlib.textwidgets import BytesDisplayWidget
    2424from zope.component import getUtility
     25from zope.event import notify
    2526from hurry.workflow.interfaces import IWorkflowInfo
     27from waeup.kofa.utils.helpers import get_current_principal
    2628from waeup.kofa.interfaces import (
    2729    REQUESTED, IExtFileStore, IKofaUtils, IObjectHistory)
     
    3739    ExportPDFTranscriptSlip,
    3840    PaymentsManageFormPage,
    39     StartClearancePage)
     41    StartClearancePage,
     42    StudyCourseManageFormPage)
    4043from waeup.kofa.students.workflow import (CREATED, ADMITTED, PAID,
    4144    CLEARANCE, REQUESTED, RETURNING, CLEARED, REGISTERED, VALIDATED,
     
    499502            self.flash(_('Current level not available for certificate.'))
    500503            return
    501         #notify(grok.ObjectModifiedEvent(self.context.__parent__))
    502504        return
    503505
     
    516518    def view_scores_allowed(self):
    517519        return checkPermission('waeup.manageStudent', self.context)
     520
     521class CustomStudyCourseManageFormPage(StudyCourseManageFormPage):
     522    """ Page to edit the student study course data
     523    """
     524
     525    @action(_('Save'), style='primary')
     526    def save(self, **data):
     527        user = get_current_principal()
     528        if user.id not in ('admin', 'med', 'zope.mgr', 'zope.manager',
     529                           'benamechi', 'tbazuaye'):
     530            if data['previous_verdict'] == 'R' and self.context.previous_verdict != 'R':
     531                self.flash(_('You are not entitled to assign this verdict.'),
     532                           type="warning")
     533                return
     534            if data['current_verdict'] == 'R' and self.context.current_verdict != 'R':
     535                self.flash(_('You are not entitled to assign this verdict.'),
     536                           type="warning")
     537                return
     538        try:
     539            msave(self, **data)
     540        except ConstraintNotSatisfied:
     541            # The selected level might not exist in certificate
     542            self.flash(_('Current level not available for certificate.'),
     543                       type="warning")
     544            return
     545        #notify(grok.ObjectModifiedEvent(self.context.__parent__))
     546        return
    518547
    519548class CustomExportPDFCourseRegistrationSlip(
Note: See TracChangeset for help on using the changeset viewer.