Index: WAeUP_SRP/trunk/WAeUPTool.py
===================================================================
--- WAeUP_SRP/trunk/WAeUPTool.py	(revision 1780)
+++ WAeUP_SRP/trunk/WAeUPTool.py	(revision 1781)
@@ -218,5 +218,5 @@
                 d[field] = dict.get(field,'')
             sub_doc.edit(mapping = d)
-            new_state = f2t[pt]['wf_state']
+            new_state = f2t[pt]['wf_transition']
             if new_state != "remain":
                 self.portal_workflow.doActionFor(sub_obj,new_state,dest_container=sub_obj)
@@ -605,5 +605,5 @@
             data = {}
 
-            # format of the first file sent from Tayo
+            # format of the first file sent by Tayo
             #data['datetime'] = date = DateTime.DateTime(pay_transaction['Date'])
             #data['student_id'] = student_id = pay_transaction['Payer ID']
@@ -612,5 +612,5 @@
             #data['amount'] = amount = pay_transaction['Amount']
 
-            # format of the second file sent from Tayo
+            # format of the second file sent by Tayo
             data['datetime'] = date = 0
             data['student_id'] = student_id = pay_transaction['Payer ID']
@@ -652,9 +652,11 @@
     ###)
 
+    
+    # all workflow transitions refer to students in state returning
     student_field2types = {   ###(
                       'StudentApplication':
                           {'id': 'application',
                            'title': 'Application Data',
-                           'wf_state': 'close',
+                           'wf_transition': 'close',
                            'fields':
                              ('jamb_reg_no',
@@ -669,5 +671,5 @@
                           {'id': 'pume',
                            'title': 'Pume Data',
-                           'wf_state': 'close',
+                           'wf_transition': 'close',
                            'fields':
                              ('pume_score',
@@ -677,5 +679,5 @@
                           {'id': 'clearance',
                            'title': 'Clearance Data',
-                           'wf_state': 'close',
+                           'wf_transition': 'close',
                            'fields':
                              ('matric_no',
@@ -687,5 +689,5 @@
                           {'id': 'personal',
                            'title': 'Personal Data',
-                           'wf_state': 'open',
+                           'wf_transition': 'open',
                            'fields':
                              ('firstname',
@@ -701,5 +703,5 @@
                           {'id': 'study_course',
                            'title': 'Study Course',
-                           'wf_state': 'open',
+                           'wf_transition': 'open',
                            'fields':
                              ('study_course',
@@ -713,5 +715,5 @@
                           {'id': 'payments',
                            'title': 'Payments',
-                           'wf_state': 'open',
+                           'wf_transition': 'open',
                            'fields':
                              ()
@@ -723,6 +725,6 @@
     security.declareProtected(ModifyPortalContent,'importStudent') ###(
     def importStudent(self,dict):
-        "create a students data"
-        logger = logging.getLogger('WAeUPTool.import_student')
+        "create a students record due import"
+        logger = logging.getLogger('WAeUPTool.importStudent')
         students_folder = self.portal_url.getPortalObject().campus.students
         jamb_reg_no = dict.get('jamb_reg_no',None)
@@ -748,10 +750,9 @@
             sub_obj = getattr(student_obj,f2t[pt]['id'])
             sub_doc = sub_obj.getContent()
-            #self.portal_workflow.doActionFor(sub_obj,'open',dest_container=sub_obj)
             d['Title'] = f2t[pt]['title']
             for field in f2t[pt]['fields']:
                 d[field] = dict.get(field,'')
             sub_doc.edit(mapping = d)
-            new_state = f2t[pt]['wf_state']
+            new_state = f2t[pt]['wf_transition']
             if new_state != "remain":
                 self.portal_workflow.doActionFor(sub_obj,new_state,dest_container=sub_obj)
@@ -764,6 +765,6 @@
     security.declareProtected(ModifyPortalContent,'importEditStudent') ###(
     def importEditStudent(self,dict):
-        "edit a students data"
-        logger = logging.getLogger('WAeUPTool.create_student')
+        "edit a students record due import"
+        logger = logging.getLogger('WAeUPTool.importEditStudent')
         students_folder = self.portal_url.getPortalObject().campus.students
         sid = dict.get('id',None)
@@ -804,10 +805,10 @@
                 sub_obj = getattr(student_obj,f2t[pt]['id'])
             sub_doc = sub_obj.getContent()
-            self.portal_workflow.doActionFor(sub_obj,'open',dest_container=sub_obj)
+            # self.portal_workflow.doActionFor(sub_obj,'open',dest_container=sub_obj)
             d['Title'] = f2t[pt]['title']
             for field in f2t[pt]['fields']:
                 d[field] = dict.get(field,'')
             sub_doc.edit(mapping = d)
-            # new_state = f2t[pt]['wf_state']
+            # new_state = f2t[pt]['wf_transition']
             # if new_state != "remain":
             #     self.portal_workflow.doActionFor(sub_obj,new_state,dest_container=sub_obj)
Index: WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 1780)
+++ WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 1781)
@@ -44,16 +44,17 @@
         student = getattr(students,str(member))
         student_app = getattr(student,'application',None)
-        if request.has_key('returning') and student_app is None:
+        student_per = getattr(student,'personal',None)
+        if request.has_key('returning') and  student_app is None:
             email=request.get("email")
             phone=request.get("phone_nr")
             context.waeup_tool.makeStudentData(str(member),
-                                               email=email,
-                                               phone_nr=phone,
-                                               )
-            d = {}
-            d['id'] = str(member)
-            d['email'] = email
-            d['phone'] = phone
-            context.students_catalog.modifyRecord(**d)
+                                                   email=email,
+                                                   phone_nr=phone,
+                                                   )
+            #d = {}
+            #d['id'] = str(member)
+            #d['email'] = email
+            #d['phone'] = phone
+            #context.students_catalog.modifyRecord(**d)
         elif student_app is None:
             context.waeup_tool.makeStudentData(str(member))
@@ -73,4 +74,19 @@
         logger.info('%s logged in, review_state %s' % (member,s_review_state))
         app_doc = student_app.getContent()
+        
+        if request.has_key('returning'):
+            email=request.get("email")
+            phone=request.get("phone_nr")        
+            # should be always closed, however ...
+            if a_review_state != 'opened':
+                wftool.doActionFor(student_app,'open')
+            # should be always opened after import, however ...
+            if p_review_state != 'opened':    
+                wftool.doActionFor(student_per,'open')
+            per_doc = student_per.getContent()
+            app_doc.edit(mapping = {'app_email' : email})
+            per_doc.edit(mapping = {'email' : email, 'phone' : phone})
+            wftool.doActionFor(student_app,'close')
+        
         #from Products.zdb import set_trace;set_trace()
         if load_passport and 'passport' not in app_doc.objectIds():
Index: WAeUP_SRP/trunk/skins/waeup_student/getRetStudentStatistics.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getRetStudentStatistics.py	(revision 1780)
+++ WAeUP_SRP/trunk/skins/waeup_student/getRetStudentStatistics.py	(revision 1781)
@@ -22,5 +22,5 @@
 entry_sessions = ('94','95','96','97','98','99','00','01','02','03','04','05')
 
-new_states =      ('returning',
+ret_states =      ('returning',
                    'school_fee_paid',
                    'courses_registered',
@@ -39,5 +39,5 @@
 res = context.students_catalog(entry_session = entry_sessions)
 dict['total'] = len(res)
-for state in new_states:
+for state in ret_states:
     res = context.students_catalog(entry_session = entry_sessions, review_state = state)
     dict[state] = len(res)
@@ -55,5 +55,5 @@
     res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId)
     dict['total'] = len(res)
-    for state in new_states:
+    for state in ret_states:
         res = context.students_catalog(entry_session = entry_sessions, faculty = f.getId, review_state = state)
         dict[state] = len(res)
