Index: WAeUP_SRP/trunk/skins/cps_custom/logged_in.py
===================================================================
--- WAeUP_SRP/trunk/skins/cps_custom/logged_in.py	(revision 5654)
+++ WAeUP_SRP/trunk/skins/cps_custom/logged_in.py	(revision 5655)
@@ -19,4 +19,5 @@
         pass
 import DateTime
+import os
 current = DateTime.DateTime()
 import logging
@@ -36,7 +37,8 @@
 is_anon = mtool.isAnonymousUser()
 member = mtool.getAuthenticatedMember()
+member_id = str(member)
 
 if context.isStaff():
-    is_unsecure = context.waeup_tool.checkGenericPassword(str(member))
+    is_unsecure = context.waeup_tool.checkGenericPassword(member_id)
     if is_unsecure:
         response.expireCookie('__ac', path='/')
@@ -47,9 +49,9 @@
 if not is_anon:
     if "Student" in member.getRoles():
-        to_waeup_student_home = True
         students = context.portal_url.getPortalObject().campus.students
-        student = getattr(students,str(member))
+        student = getattr(students,member_id)
         student_app = getattr(student,'application',None)
         student_per = getattr(student,'personal',None)
+      
 
         #########################################################
@@ -61,19 +63,15 @@
             email=request.get("email")
             phone=request.get("phone_nr")
-            context.waeup_tool.makeStudentData(str(member),
+            context.waeup_tool.makeStudentData(member_id,
                                                    email=email,
                                                    phone_nr=phone,
                                                    )
             #d = {}
-            #d['id'] = str(member)
+            #d['id'] = member_id
             #d['email'] = email
             #d['phone'] = phone
             #context.students_catalog.modifyRecord(**d)
         elif student_per is None:
-            context.waeup_tool.makeStudentData(str(member))
-
-        #########################################################
-
-        student_app = getattr(student,'application',None)
+            context.waeup_tool.makeStudentData(member_id)
 
         #########################################################
@@ -101,4 +99,13 @@
         else:
             app_doc = student_app.getContent()
+        
+        res = context.students_catalog(id = member_id)
+        matric_no = res[0].matric_no
+        jamb_reg_no = res[0].jamb_reg_no
+        entry_mode = res[0].entry_mode
+        verdict = res[0].verdict
+        level = res[0].level
+        has_level = level
+        has_verdict = verdict and not verdict == 'N/A'      
 
         #########################################################
@@ -124,16 +131,28 @@
         # look for passport pictures of returning students
 
-        #if s_review_state == 'returning' and 'passport' not in app_doc.objectIds():
-        # use new test
         if s_review_state == 'returning' and\
-           not context.waeup_tool.picturesExist(('passport',), student.getId()):
+           not context.waeup_tool.picturesExist(('passport',), member_id):
             folder = 'pictures_returning'
-            res = context.students_catalog(id = str(member))
+            #res = context.students_catalog(id = member_id)
             filename = res[0].matric_no.upper()
             msg = context.waeup_tool.loadStudentFoto(student,filename,folder)
             logger.info('%s (%s), %s' % (member,s_review_state,msg))
 
-
-        #########################################################
+        #########################################################
+        
+        # look for passport pictures of transfer students
+
+        if entry_mode == 'transfer' and\
+           s_review_state in ('returning','school_fee_paid',) and\
+           not context.waeup_tool.picturesExist(('passport',), member_id):
+            res_both = context.students_catalog(jamb_reg_no = jamb_reg_no)
+            #set_trace()
+            if len(res_both) == 2:
+                for ts in res_both:
+                    if ts.id != member_id:
+                        msg = context.waeup_tool.loadTransferStudentFoto(ts.id,member_id)
+                        logger.info('%s (%s on transfer), %s' % (member,s_review_state,msg))
+
+        #########################################################        
 
         # look for passport pictures of new students
@@ -144,5 +163,5 @@
                               'clearance_requested'
                              )  and not context.waeup_tool.picturesExist(('passport',),
-                                                                         student.getId()):
+                                                                         member_id):
             folder = 'pictures_admitted_latest'
             filename = app_doc.jamb_reg_no.replace('/','_')
@@ -220,12 +239,4 @@
             wftool.doActionFor(student_per,'open')
 
-        #########################################################
-
-        res = context.students_catalog(id = str(member))
-        matric_no = res[0].matric_no
-        verdict = res[0].verdict
-        level = res[0].level
-        has_level = level
-        has_verdict = verdict and not verdict == 'N/A'
 
         #########################################################
