Index: WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml
===================================================================
--- WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml	(revision 1142)
+++ WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml	(revision 1167)
@@ -11,5 +11,6 @@
   <exit-transition transition_id="pume_fail"/>
   <exit-transition transition_id="pume_pass"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -22,5 +23,6 @@
  <state state_id="admission_rejected" title="">
   <exit-transition transition_id="finally_reject"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -35,5 +37,6 @@
   <exit-transition transition_id="enter_clearance_pin"/>
   <exit-transition transition_id="raise_objection"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -47,5 +50,6 @@
   <exit-transition transition_id="apply_for_admission"/>
   <exit-transition transition_id="create_content"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -60,5 +64,6 @@
   <exit-transition transition_id="create_content"/>
   <exit-transition transition_id="request_clearance"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -72,8 +77,24 @@
  <state state_id="clearance_requested" title="">
   <exit-transition transition_id="clear_and_validate"/>
+  <exit-transition transition_id="create_content"/>
+  <exit-transition transition_id="reject_clearance"/>
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
+  <permission-map name="Modify portal content"
+                  acquired="True">
+   <permission-role>ClearanceOfficer</permission-role>
+   <permission-role>SectionOfficer</permission-role>
+  </permission-map>
+  <permission-map name="View" acquired="True">
+   <permission-role>Owner</permission-role>
+   <permission-role>SectionOfficer</permission-role>
+  </permission-map>
+ </state>
+ <state state_id="cleared_and_validated" title="">
+  <exit-transition transition_id="create_content"/>
   <exit-transition transition_id="defer"/>
   <exit-transition transition_id="reject_clearance"/>
-  <exit-transition transition_id="create_content"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -86,21 +107,13 @@
   </permission-map>
  </state>
- <state state_id="cleared_and_validated" title="">
-  <exit-transition transition_id="create_content"/>
-  <exit-transition transition_id="reject_clearance"/>
-  <permission-map name="Delete objects" acquired="False" />
-  <permission-map name="Modify portal content"
-                  acquired="True">
-   <permission-role>ClearanceOfficer</permission-role>
-   <permission-role>SectionOfficer</permission-role>
-  </permission-map>
-  <permission-map name="View" acquired="True">
-   <permission-role>Owner</permission-role>
-   <permission-role>SectionOfficer</permission-role>
-  </permission-map>
+ <state state_id="courses_registered" title="">
+  <exit-transition transition_id="notify_change_courses"/>
+  <exit-transition transition_id="validate_courses"/>
+ </state>
+ <state state_id="courses_validated" title="">
  </state>
  <state state_id="deferred" title="">
-  <exit-transition transition_id="admit"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -112,5 +125,6 @@
  </state>
  <state state_id="finally_rejected" title="">
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -125,5 +139,6 @@
  <state state_id="objection_raised" title="">
   <exit-transition transition_id="enter_clearance_pin"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -137,5 +152,6 @@
  <state state_id="pume_failed" title="">
   <exit-transition transition_id="reject_admission"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -150,17 +166,25 @@
   <exit-transition transition_id="admit"/>
   <exit-transition transition_id="reject_admission"/>
-  <permission-map name="Delete objects" acquired="False" />
-  <permission-map name="Modify portal content"
-                  acquired="True">
-   <permission-role>SectionOfficer</permission-role>
-  </permission-map>
-  <permission-map name="View" acquired="True">
-   <permission-role>Owner</permission-role>
-   <permission-role>SectionOfficer</permission-role>
-  </permission-map>
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
+  <permission-map name="Modify portal content"
+                  acquired="True">
+   <permission-role>SectionOfficer</permission-role>
+  </permission-map>
+  <permission-map name="View" acquired="True">
+   <permission-role>Owner</permission-role>
+   <permission-role>SectionOfficer</permission-role>
+  </permission-map>
+ </state>
+ <state state_id="returning" title="">
+  <exit-transition transition_id="create_content"/>
+  <exit-transition transition_id="enter_school_fee_pin"/>
+ </state>
+ <state state_id="school_fee_pin_entered" title="">
+  <exit-transition transition_id="create_content"/>
+  <exit-transition transition_id="register_courses"/>
  </state>
  <state state_id="student_created" title="">
   <exit-transition transition_id="admit"/>
-  <exit-transition transition_id="clear_and_validate"/>
   <exit-transition transition_id="create_content"/>
   <exit-transition transition_id="enter_application_pin"/>
@@ -168,5 +192,7 @@
   <exit-transition transition_id="pume_pass"/>
   <exit-transition transition_id="reject_admission"/>
-  <permission-map name="Delete objects" acquired="False" />
+  <exit-transition transition_id="return"/>
+  <permission-map name="Delete objects" acquired="False">
+  </permission-map>
   <permission-map name="Modify portal content"
                   acquired="True">
@@ -181,5 +207,5 @@
              new_state="admitted" trigger="USER"
              before_script="" after_script="">
-
+  
   <guard>
    <guard-role>SectionOfficer</guard-role>
@@ -192,5 +218,5 @@
              new_state="admission_applied" trigger="USER"
              before_script="" after_script="">
-
+  
   <guard>
    <guard-role>SectionOfficer</guard-role>
@@ -203,17 +229,19 @@
              new_state="cleared_and_validated"
              trigger="USER" before_script="" after_script="">
-
-  <guard>
-   <guard-role>SectionOfficer</guard-role>
-   <guard-role>ClearanceOfficer</guard-role>
-   <guard-role>Manager</guard-role>
-   <guard-role>SectionManager</guard-role>
-  </guard>
- </transition>
- <transition transition_id="create" title=""
+  
+  <guard>
+   <guard-role>SectionOfficer</guard-role>
+   <guard-role>ClearanceOfficer</guard-role>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+  </guard>
+ </transition>
+ <transition transition_id="create" title="Initial creation"
              new_state="student_created" trigger="USER"
              before_script="" after_script="">
-
-  <guard>
+  
+  <guard>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
   </guard>
   <transition-behavior behavior_id="allow-sub-create"/>
@@ -223,17 +251,17 @@
              new_state="" trigger="USER" before_script=""
              after_script="">
-
-  <guard>
-   <guard-role>SectionOfficer</guard-role>
-   <guard-role>Owner</guard-role>
-   <guard-role>Manager</guard-role>
-   <guard-role>SectionManager</guard-role>
+  
+  <guard>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+   <guard-role>Owner</guard-role>
   </guard>
   <transition-behavior behavior_id="allow-sub-create"/>
+  <transition-behavior behavior_id="allow-sub-delete"/>
  </transition>
  <transition transition_id="defer" title=""
              new_state="deferred" trigger="USER"
              before_script="" after_script="">
-
+  
   <guard>
    <guard-role>SectionOfficer</guard-role>
@@ -246,5 +274,5 @@
              new_state="application_pin_entered"
              trigger="USER" before_script="" after_script="">
-
+  
   <guard>
    <guard-role>SectionOfficer</guard-role>
@@ -257,10 +285,20 @@
              new_state="clearance_pin_entered"
              trigger="USER" before_script="" after_script="">
-
-  <guard>
-   <guard-role>SectionOfficer</guard-role>
-   <guard-role>Owner</guard-role>
-   <guard-role>Manager</guard-role>
-   <guard-role>SectionManager</guard-role>
+  
+  <guard>
+   <guard-role>SectionOfficer</guard-role>
+   <guard-role>Owner</guard-role>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+  </guard>
+ </transition>
+ <transition transition_id="enter_school_fee_pin" title=""
+             new_state="school_fee_pin_entered"
+             trigger="USER" before_script="" after_script="">
+  
+  <guard>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+   <guard-role>Owner</guard-role>
   </guard>
  </transition>
@@ -268,8 +306,18 @@
              new_state="finally_rejected" trigger="USER"
              before_script="" after_script="">
-
-  <guard>
-   <guard-role>SectionOfficer</guard-role>
-   <guard-role>ClearanceOfficer</guard-role>
+  
+  <guard>
+   <guard-role>SectionOfficer</guard-role>
+   <guard-role>ClearanceOfficer</guard-role>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+  </guard>
+ </transition>
+ <transition transition_id="notify_change_courses" title=""
+             new_state="school_fee_pin_entered"
+             trigger="USER" before_script="" after_script="">
+  
+  <guard>
+   <guard-role>CourseAdviser</guard-role>
    <guard-role>Manager</guard-role>
    <guard-role>SectionManager</guard-role>
@@ -279,5 +327,5 @@
              new_state="pume_failed" trigger="USER"
              before_script="" after_script="">
-
+  
   <guard>
    <guard-role>SectionOfficer</guard-role>
@@ -290,5 +338,5 @@
              new_state="pume_passed" trigger="USER"
              before_script="" after_script="">
-
+  
   <guard>
    <guard-role>SectionOfficer</guard-role>
@@ -301,11 +349,21 @@
              new_state="objection_raised" trigger="USER"
              before_script="" after_script="">
-
-  <guard>
-   <guard-role>SectionOfficer</guard-role>
-   <guard-role>Owner</guard-role>
-   <guard-role>ClearanceOfficer</guard-role>
-   <guard-role>Manager</guard-role>
-   <guard-role>SectionManager</guard-role>
+  
+  <guard>
+   <guard-role>SectionOfficer</guard-role>
+   <guard-role>Owner</guard-role>
+   <guard-role>ClearanceOfficer</guard-role>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+  </guard>
+ </transition>
+ <transition transition_id="register_courses" title=""
+             new_state="courses_registered" trigger="USER"
+             before_script="" after_script="">
+  
+  <guard>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+   <guard-role>Owner</guard-role>
   </guard>
  </transition>
@@ -313,5 +371,5 @@
              new_state="admission_rejected" trigger="USER"
              before_script="" after_script="">
-
+  
   <guard>
    <guard-role>SectionOfficer</guard-role>
@@ -324,5 +382,5 @@
              new_state="clearance_pin_entered"
              trigger="USER" before_script="" after_script="">
-
+  
   <guard>
    <guard-role>SectionOfficer</guard-role>
@@ -335,8 +393,29 @@
              new_state="clearance_requested" trigger="USER"
              before_script="" after_script="">
-
-  <guard>
-   <guard-role>SectionOfficer</guard-role>
-   <guard-role>Owner</guard-role>
+  
+  <guard>
+   <guard-role>SectionOfficer</guard-role>
+   <guard-role>Owner</guard-role>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+  </guard>
+ </transition>
+ <transition transition_id="return" title=""
+             new_state="returning" trigger="USER"
+             before_script="" after_script="">
+  
+  <guard>
+   <guard-role>SectionOfficer</guard-role>
+   <guard-role>Manager</guard-role>
+   <guard-role>SectionManager</guard-role>
+  </guard>
+ </transition>
+ <transition transition_id="validate_courses" title=""
+             new_state="courses_validated" trigger="USER"
+             before_script="" after_script="">
+  
+  <guard>
+   <guard-role>CourseAdviser</guard-role>
+   <guard-role>SectionOfficer</guard-role>
    <guard-role>Manager</guard-role>
    <guard-role>SectionManager</guard-role>
@@ -347,5 +426,5 @@
   <description>Time of the last transition</description>
   <default>
-
+   
    <expression>state_change/getDateTime</expression>
   </default>
