Index: /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatch.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatch.xml	(revision 1026)
+++ /WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatch.xml	(revision 1027)
@@ -8,5 +8,5 @@
  <property name="product">WAeUP_SRP</property>
  <property name="factory">addScratchCardBatch</property>
- <property name="immediate_view">batch_view</property>
+ <property name="immediate_view">search_pins</property>
  <property name="global_allow">True</property>
  <property name="filter_content_types">True</property>
@@ -26,10 +26,10 @@
  <property name="storage_methods"/>
  <property name="cps_is_portlet">False</property>
- <alias from="(Default)" to="batch_view"/>
+ <alias from="(Default)" to="search_pins"/>
  <alias from="create_do" to="scratch_card_batch_create_do"/>
  <alias from="created" to="scratch_card_batch_created"/>
- <alias from="view" to="batch_view"/>
+ <alias from="view" to="search_pins"/>
  <action title="View" action_id="view" category="object"
-    condition_expr="" url_expr="string:${object_url}/batch_view"
+    condition_expr="" url_expr="string:${object_url}/search_pins"
     visible="True">
   <permission value="Modify portal content"/>
Index: /WAeUP_SRP/trunk/skins/waeup_student/application_edit_form.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/application_edit_form.pt	(revision 1026)
+++ /WAeUP_SRP/trunk/skins/waeup_student/application_edit_form.pt	(revision 1027)
@@ -1,5 +1,5 @@
 <metal:html tal:define="info context/getStudentInfo">
   <span tal:condition="not: info">
-    <metal:block use-macro="here/error_not_found/macros/not_found" />
+    <metal:block use-macro="here/illegal_view/macros/illegal_view" />
   </span>
 <metal:block tal:condition="info"> 
Index: /WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py	(revision 1026)
+++ /WAeUP_SRP/trunk/skins/waeup_student/clearance_edit.py	(revision 1027)
@@ -54,4 +54,13 @@
         if context.isStudent():
            action = "/clearance_edit_form"
+        if clear_doc.clr_ac_pin == "":
+            res = context.portal_pins(student=member_id)
+            if res:
+                p = res[0].pin
+                if len(p) > 10:
+                    pin = "%s-%s-%s" % (p[:3],p[3:4],p[4:])
+                else:
+                    pin = p
+                clear_doc.edit(mapping={'clr_ac_pin': pin})
     elif cpsdocument_edit_and_view_button:
         if acknowledge and info['review_state'] == "clearance_pin_entered":
Index: /WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py	(revision 1026)
+++ /WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py	(revision 1027)
@@ -65,4 +65,5 @@
 dc['lga_ident'] = app_doc.get('jamb_lga')
 dc['lga'] = app_doc.get('jamb_state','no state') + ' / ' + app_doc.get('jamb_lga','no lga')
+dc['clr_ac_pin'] = pin
 dc['clr_ac_date'] = current
 dc['entry_date'] = current
