Index: /main/kofacustom.nigeria/trunk/CHANGES.txt
===================================================================
--- /main/kofacustom.nigeria/trunk/CHANGES.txt	(revision 14273)
+++ /main/kofacustom.nigeria/trunk/CHANGES.txt	(revision 14274)
@@ -4,4 +4,7 @@
 1.3.dev0 (unreleased)
 =====================
+
+- Add `provisionally_cleared` field an allow students to edit
+  their clearance data if set.
 
 - Add fields, permissions, browser views and buttons to enable
Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/browser.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/browser.py	(revision 14273)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/browser.py	(revision 14274)
@@ -65,5 +65,6 @@
     """
     form_fields = grok.AutoFields(INigeriaStudentBase).omit(
-        'password', 'suspended', 'suspended_comment', 'flash_notice')
+        'password', 'suspended', 'suspended_comment',
+        'flash_notice', 'provisionally_cleared')
     form_fields[
         'financial_clearance_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py	(revision 14273)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py	(revision 14274)
@@ -67,4 +67,11 @@
         )
 
+    provisionally_cleared = schema.Bool(
+        title = _(u'Provisionally Cleared'),
+        default = False,
+        required = False,
+        description = u'Student will be able to edit clearance data if set.',
+        )
+
 INigeriaStudentBase['reg_number'].order = IStudentBase[
     'reg_number'].order
Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/student.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/student.py	(revision 14273)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/student.py	(revision 14274)
@@ -23,4 +23,5 @@
 from waeup.kofa.utils.helpers import attrs_to_fields
 from waeup.kofa.students.student import Student, StudentFactory
+from waeup.kofa.interfaces import CLEARANCE
 from kofacustom.nigeria.students.interfaces import (
     INigeriaStudent, IStudentNavigation, INigeriaStudentPersonalEdit)
@@ -43,4 +44,8 @@
         return False
 
+    @property
+    def clearance_locked(self):
+        return self.state != CLEARANCE and not self.provisionally_cleared
+
 # Set all attributes of Student required in IStudent as field
 # properties. Doing this, we do not have to set initial attributes
Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py	(revision 14273)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py	(revision 14274)
@@ -454,2 +454,27 @@
         print "Sample PDF fee_payment_history.pdf written to %s" % path
         return
+
+    def test_provisionally_cleared(self):
+        # Students can edit clearance data
+        IWorkflowState(self.student).setState('school fee paid')
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        # Student can't access the clearance form
+        self.browser.open(self.student_path)
+        self.browser.getLink("Clearance Data").click()
+        # Student can't open clearance edit form before starting clearance
+        self.browser.open(self.student_path + '/cedit')
+        self.assertMatches('...The requested form is locked...',
+                           self.browser.contents)
+        self.assertFalse(
+            '<h1 class="kofa-content-label">Edit clearance data</h1>'
+            in self.browser.contents)
+        # If provisionally_cleared is set they can
+        self.student.provisionally_cleared = True
+        self.browser.getLink("Clearance Data").click()
+        self.browser.getLink("Edit").click()
+        self.assertTrue(
+            '<h1 class="kofa-content-label">Edit clearance data</h1>'
+            in self.browser.contents)
Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py	(revision 14273)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_export.py	(revision 14274)
@@ -78,5 +78,6 @@
             'next_kin_address,next_kin_name,next_kin_phone,next_kin_relation,'
             'nysc_lga,nysc_location,nysc_year,officer_comment,'
-            'perm_address,personal_updated,phone,physical_clearance_date,reg_number,'
+            'perm_address,personal_updated,phone,physical_clearance_date,'
+            'provisionally_cleared,reg_number,'
             'religion,scd_sit_date,scd_sit_fname,scd_sit_no,'
             'scd_sit_results,scd_sit_type,sex,student_id,'
@@ -86,5 +87,5 @@
             'anna@sample.com,,,,,,,,,,,,,Anna,,,,,,"[(\'accounts\', \'A\')]"'
             ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,'
-            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,123,,,,,'
+            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,,123,,,,,'
             '"[(\'accounts\', \'A\')]",,f,A111111,0,,,created,'
             '[u\'2012-11-06 13:16:41 WAT - Record created by system\'],'
