Changeset 7024 for main/waeup.sirp/trunk


Ignore:
Timestamp:
7 Nov 2011, 18:21:42 (13 years ago)
Author:
Henrik Bettermann
Message:

Students are only allowed to create bed allocation payment tickets if their current session matches the accommodation session.

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

Legend:

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

    r7023 r7024  
    917917    @grok.action('Create ticket')
    918918    def createTicket(self, **data):
     919        p_category = data['p_category']
     920        student = self.context.__parent__
     921        if p_category == 'bed_allocation' and student[
     922            'studycourse'].current_session != grok.getSite()[
     923            'configuration'].accommodation_session:
     924                self.flash(
     925                    'Your current session does not match accommodation session.')
     926                self.redirect(self.url(self.context))
     927                return
    919928        payment = createObject(u'waeup.StudentOnlinePayment')
    920929        self.applyData(payment, **data)
     
    923932        payment.p_id = "p%s" % timestamp
    924933        pay_details  = self.getPaymentDetails(
    925             data['p_category'],self.context.__parent__)
     934            p_category,student)
    926935        if pay_details['error']:
    927936            self.flash(pay_details['error'])
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7022 r7024  
    863863        self.browser.getControl("Add online payment ticket").click()
    864864        self.browser.getControl(name="form.p_category").value = ['bed_allocation']
     865        # If student is not in accommodation session, payment cannot be processed
     866        self.app['configuration'].accommodation_session = 2011
     867        self.browser.getControl("Create ticket").click()
     868        self.assertMatches('...Your current session does not match...',
     869                           self.browser.contents)
     870        self.app['configuration'].accommodation_session = 2004
     871        self.browser.getControl("Add online payment ticket").click()
     872        self.browser.getControl(name="form.p_category").value = ['bed_allocation']
    865873        self.browser.getControl("Create ticket").click()
    866874        ctrl = self.browser.getControl(name='val_id')
Note: See TracChangeset for help on using the changeset viewer.