Changeset 14274


Ignore:
Timestamp:
15 Nov 2016, 09:12:51 (8 years ago)
Author:
Henrik Bettermann
Message:

Add provisionally_cleared field an allow students to edit
their clearance data if set.

Location:
main/kofacustom.nigeria/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/CHANGES.txt

    r13683 r14274  
    441.3.dev0 (unreleased)
    55=====================
     6
     7- Add `provisionally_cleared` field an allow students to edit
     8  their clearance data if set.
    69
    710- Add fields, permissions, browser views and buttons to enable
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/browser.py

    r14163 r14274  
    6565    """
    6666    form_fields = grok.AutoFields(INigeriaStudentBase).omit(
    67         'password', 'suspended', 'suspended_comment', 'flash_notice')
     67        'password', 'suspended', 'suspended_comment',
     68        'flash_notice', 'provisionally_cleared')
    6869    form_fields[
    6970        'financial_clearance_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py

    r14101 r14274  
    6767        )
    6868
     69    provisionally_cleared = schema.Bool(
     70        title = _(u'Provisionally Cleared'),
     71        default = False,
     72        required = False,
     73        description = u'Student will be able to edit clearance data if set.',
     74        )
     75
    6976INigeriaStudentBase['reg_number'].order = IStudentBase[
    7077    'reg_number'].order
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/student.py

    r10268 r14274  
    2323from waeup.kofa.utils.helpers import attrs_to_fields
    2424from waeup.kofa.students.student import Student, StudentFactory
     25from waeup.kofa.interfaces import CLEARANCE
    2526from kofacustom.nigeria.students.interfaces import (
    2627    INigeriaStudent, IStudentNavigation, INigeriaStudentPersonalEdit)
     
    4344        return False
    4445
     46    @property
     47    def clearance_locked(self):
     48        return self.state != CLEARANCE and not self.provisionally_cleared
     49
    4550# Set all attributes of Student required in IStudent as field
    4651# properties. Doing this, we do not have to set initial attributes
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py

    r13856 r14274  
    454454        print "Sample PDF fee_payment_history.pdf written to %s" % path
    455455        return
     456
     457    def test_provisionally_cleared(self):
     458        # Students can edit clearance data
     459        IWorkflowState(self.student).setState('school fee paid')
     460        self.browser.open(self.login_path)
     461        self.browser.getControl(name="form.login").value = self.student_id
     462        self.browser.getControl(name="form.password").value = 'spwd'
     463        self.browser.getControl("Login").click()
     464        # Student can't access the clearance form
     465        self.browser.open(self.student_path)
     466        self.browser.getLink("Clearance Data").click()
     467        # Student can't open clearance edit form before starting clearance
     468        self.browser.open(self.student_path + '/cedit')
     469        self.assertMatches('...The requested form is locked...',
     470                           self.browser.contents)
     471        self.assertFalse(
     472            '<h1 class="kofa-content-label">Edit clearance data</h1>'
     473            in self.browser.contents)
     474        # If provisionally_cleared is set they can
     475        self.student.provisionally_cleared = True
     476        self.browser.getLink("Clearance Data").click()
     477        self.browser.getLink("Edit").click()
     478        self.assertTrue(
     479            '<h1 class="kofa-content-label">Edit clearance data</h1>'
     480            in self.browser.contents)
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py

    r13712 r14274  
    7878            'next_kin_address,next_kin_name,next_kin_phone,next_kin_relation,'
    7979            'nysc_lga,nysc_location,nysc_year,officer_comment,'
    80             'perm_address,personal_updated,phone,physical_clearance_date,reg_number,'
     80            'perm_address,personal_updated,phone,physical_clearance_date,'
     81            'provisionally_cleared,reg_number,'
    8182            'religion,scd_sit_date,scd_sit_fname,scd_sit_no,'
    8283            'scd_sit_results,scd_sit_type,sex,student_id,'
     
    8687            'anna@sample.com,,,,,,,,,,,,,Anna,,,,,,"[(\'accounts\', \'A\')]"'
    8788            ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,'
    88             '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,123,,,,,'
     89            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,,123,,,,,'
    8990            '"[(\'accounts\', \'A\')]",,f,A111111,0,,,created,'
    9091            '[u\'2012-11-06 13:16:41 WAT - Record created by system\'],'
Note: See TracChangeset for help on using the changeset viewer.