Ignore:
Timestamp:
30 Aug 2017, 10:33:33 (7 years ago)
Author:
Henrik Bettermann
Message:

Show screening invitation link only after applicants have paid.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/applicants
Files:
2 edited

Legend:

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

    r14696 r14822  
    391391    @property
    392392    def display_actions(self):
    393         state = IWorkflowState(self.context).getState()
    394393        # If the form is unlocked, applicants are allowed to save the form
    395394        # and remove unused tickets.
    396395        actions = [[_('Save')], []]
    397396        # Only in state started they can also add tickets.
    398         if state == STARTED:
     397        if self.context.state == STARTED:
    399398            actions = [[_('Save')],
    400399                [_('Add online payment ticket')]]
    401400        # In state paid, they can submit the data and further add tickets
    402401        # if the application is special.
    403         elif self.context.special and state == PAID:
     402        elif self.context.special and self.context.state == PAID:
    404403            actions = [[_('Save'), _('Finally Submit')],
    405404                [_('Add online payment ticket')]]
    406         elif state == PAID:
     405        elif self.context.state == PAID:
    407406            actions = [[_('Save'), _('Finally Submit')], []]
    408407        return actions
     
    494493    grok.template('applicantcheckstatus')
    495494
    496 class PaymentReceiptActionButton(ManageActionButton):
     495class ScreeningInvitationActionButton(ManageActionButton):
    497496    grok.order(8) # This button should always be the last one.
    498497    grok.context(ICustomApplicant)
     
    505504    @property
    506505    def target_url(self):
    507         if not self.context.screening_date:
     506        if not self.context.screening_date or not self.context.state in (
     507            'submitted', 'admitted', 'paid', 'created'):
    508508            return ''
    509509        return self.view.url(self.view.context, self.target)
     
    563563
    564564    def update(self):
    565         if not self.context.screening_date:
     565        if not self.context.screening_date or not self.context.state in (
     566            'submitted', 'admitted', 'paid', 'created'):
    566567            self.flash(_('Forbidden'), type="warning")
    567568            self.redirect(self.url(self.context))
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/tests/test_browser.py

    r14579 r14822  
    8686        self.applicant.firstname = u'Jo'
    8787        self.applicant.email = 'xx@yy.zz'
     88        self.browser.open(self.view_path)
     89        self.assertFalse("Download application slip" in self.browser.contents)
     90        IWorkflowState(self.applicant).setState('paid')
    8891        self.browser.open(self.view_path)
    8992        self.browser.getLink("screening invitation").click()
Note: See TracChangeset for help on using the changeset viewer.