Ignore:
Timestamp:
5 Oct 2020, 06:25:25 (4 years ago)
Author:
Henrik Bettermann
Message:

Implement new personal edit form requirements.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/browser.py

    r16263 r16264  
    132132            self.redirect(self.url(self.context))
    133133            return
     134        minamount = 200000
     135        if not self.context.minimumFreshStudentPayments(minamount):
     136            self.flash('Please make required payments first '
     137                       '(at least in the amount of %s Naira).' % minamount,
     138                       type="warning")
     139            self.redirect(self.url(self.context, 'view_personal'))
     140            return
    134141        super(CustomStudentPersonalEditFormPage, self).update()
    135142        return
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/student.py

    r16249 r16264  
    5151        return False
    5252
     53    def minimumFreshStudentPayments(self, minamount):
     54        """Neede to access edit_personal. Only in iuokada package.
     55        """
     56        if not self.is_fresh:
     57            return False
     58        total_amount = 0.0
     59        for ticket in self['payments'].values():
     60            if ticket.p_state == 'paid':
     61                total_amount += ticket.amount_auth
     62        if total_amount > minamount:
     63            return True
     64        return False
     65
     66    @property
     67    def personal_data_expired(self):
     68        # This reqirement is not compatible with minimumFreshStudentPayments.
     69        return False
     70
    5371
    5472# Set all attributes of Student required in IStudent as field
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_browser.py

    r16263 r16264  
    110110        self.browser.getControl(name="form.password").value = 'spwd'
    111111        self.browser.getControl("Login").click()
    112         self.assertFalse('Library' in self.browser.contents)
     112        self.assertFalse('Download Library' in self.browser.contents)
    113113        self.student.library = True
    114114        self.browser.open(self.student_path)
     
    138138        open(path, 'wb').write(self.browser.contents)
    139139        print "Sample PDF studycourse_slip.pdf written to %s" % path
     140
     141    def test_student_personal_edit(self):
     142        IWorkflowState(self.student).setState('school fee paid')
     143        self.browser.open(self.login_path)
     144        self.browser.getControl(name="form.login").value = self.student_id
     145        self.browser.getControl(name="form.password").value = 'spwd'
     146        self.browser.getControl("Login").click()
     147        self.browser.getLink("Bio Data").click()
     148        self.browser.getLink("Edit registration bio data").click()
     149        self.assertTrue("Please make required payments first" in self.browser.contents)
     150        self.assertEqual(self.browser.url, self.personal_path)
    140151
    141152    def test_student_personal_slip(self):
Note: See TracChangeset for help on using the changeset viewer.