Ignore:
Timestamp:
14 Jun 2012, 07:18:20 (13 years ago)
Author:
Henrik Bettermann
Message:

Disable displaying transaction code.

Students are not allowed to change their portrait if they passed the regular Kofa application
and thus their application picture exists.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
2 edited

Legend:

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

    r8598 r8720  
    3030    StudentBaseEditFormPage, StudentPersonalEditFormPage,
    3131    OnlinePaymentDisplayFormPage, OnlinePaymentAddFormPage,
    32     OnlinePaymentBreadcrumb, ExportPDFPaymentSlipPage)
     32    OnlinePaymentBreadcrumb, ExportPDFPaymentSlipPage,
     33    StudentFilesUploadPage, emit_lock_message)
    3334from waeup.kofa.students.viewlets import (
    34     PaymentReceiptActionButton)
     35    PaymentReceiptActionButton, StudentPassportActionButton)
    3536from waeup.uniben.students.interfaces import (
    3637    ICustomStudentBase, ICustomStudent, ICustomStudentPersonal,
     
    3839    ICustomStudentOnlinePayment,
    3940    )
     41from waeup.kofa.students.workflow import ADMITTED
    4042from waeup.uniben.interfaces import MessageFactory as _
    4143
     
    166168    form_fields[
    167169        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    168     grok.template('payment_view')
    169 
    170     @property
    171     def transaction_code(self):
    172         tcode = self.context.p_id
    173         return tcode[len(tcode)-8:len(tcode)]
     170    #grok.template('payment_view')
     171
     172    #@property
     173    #def transaction_code(self):
     174    #    tcode = self.context.p_id
     175    #    return tcode[len(tcode)-8:len(tcode)]
    174176
    175177class CustomOnlinePaymentAddFormPage(OnlinePaymentAddFormPage):
     
    200202    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    201203
    202     @property
    203     def note(self):
    204         tcode = self.context.p_id
    205         tcode = tcode[len(tcode)-8:len(tcode)]
    206         amount = self.context.amount_auth
    207         note = translate(_(
    208             u"""<br /><br /><br />
    209 The tranzaction code is <strong>${a}</strong>.""",
    210             mapping = {'a':tcode}))
    211         return note
     204#    @property
     205#    def note(self):
     206#        tcode = self.context.p_id
     207#        tcode = tcode[len(tcode)-8:len(tcode)]
     208#        amount = self.context.amount_auth
     209#        note = translate(_(
     210#            u"""<br /><br /><br />
     211#The tranzaction code is <strong>${a}</strong>.""",
     212#            mapping = {'a':tcode}))
     213#        return note
     214
     215class StudentPassportActionButton(StudentPassportActionButton):
     216
     217    @property
     218    def target_url(self):
     219        slip = getUtility(IExtFileStore).getFileByContext(
     220            self.context, 'application_slip')
     221        if self.context.state != ADMITTED or slip is not None:
     222            return ''
     223        return self.view.url(self.view.context, self.target)
     224
     225class CustomStudentFilesUploadPage(StudentFilesUploadPage):
     226    """ View to upload passport picture.
     227
     228    Students are not allowed to change the picture if they
     229    passed the regular Kofa application.
     230    """
     231
     232    def update(self):
     233        slip = getUtility(IExtFileStore).getFileByContext(
     234            self.context, 'application_slip')
     235        if self.context.state != ADMITTED or slip is not None:
     236            emit_lock_message(self)
     237            return
     238        super(StudentFilesUploadPage, self).update()
     239        return
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r8676 r8720  
    1919import shutil
    2020import tempfile
     21from StringIO import StringIO
    2122from hurry.workflow.interfaces import IWorkflowState
    2223from zope.component.hooks import setSite, clearSite
     
    2627from waeup.kofa.students.tests.test_browser import StudentsFullSetup
    2728from waeup.kofa.testing import FunctionalTestCase
     29from waeup.kofa.interfaces import (
     30    IExtFileStore, IFileStoreNameChooser)
    2831from waeup.kofa.students.batching import StudentProcessor
    2932from waeup.kofa.students.interfaces import IStudentsUtils
     
    287290        self.browser.getControl(name="form.password").value = 'spwd'
    288291        self.browser.getControl("Login").click()
     292        # Even in state admitted students can't change the portait if
     293        # application slip exists.
     294        IWorkflowState(self.student).setState('admitted')
     295        self.browser.open(self.student_path)
     296        self.assertTrue('Change portrait' in self.browser.contents)
     297        file_store = getUtility(IExtFileStore)
     298        applicant_slip = 'My application slip'
     299        file_id = IFileStoreNameChooser(self.student).chooseName(
     300            attr="application_slip.pdf")
     301        file_store.createFile(file_id, StringIO(applicant_slip))
     302        self.browser.open(self.student_path)
     303        self.assertFalse('Change portrait' in self.browser.contents)
     304        self.browser.open(self.student_path + '/change_portrait')
     305        self.assertTrue('The requested form is locked' in self.browser.contents)
    289306        # Student can view and edit clearance data
    290307        self.browser.getLink("Clearance Data").click()
Note: See TracChangeset for help on using the changeset viewer.