Index: /WAeUP_SRP/trunk/skins/waeup_aaua/getPaymentsFolderInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_aaua/getPaymentsFolderInfo.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_aaua/getPaymentsFolderInfo.py	(revision 3865)
@@ -26,13 +26,4 @@
     def set_trace():
         pass
-
-def cmp_id(a,b):
-    s1 = "%(id)s" % a
-    s2 = "%(id)s" % b
-    if s1 == s2:
-        return 0
-    if s1 > s2:
-        return 1
-    return -1
 
 import DateTime
@@ -126,5 +117,5 @@
     payments.append(row)
 
-payments.sort(cmp_id)
+payments.sort(cmp=lambda x,y: cmp(x['trans_ref'],y['trans_ref']))
 info['payments'] = payments
 return info
Index: /WAeUP_SRP/trunk/skins/waeup_aaue/getPaymentsFolderInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_aaue/getPaymentsFolderInfo.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_aaue/getPaymentsFolderInfo.py	(revision 3865)
@@ -26,13 +26,4 @@
     def set_trace():
         pass
-
-def cmp_id(a,b):
-    s1 = "%(id)s" % a
-    s2 = "%(id)s" % b
-    if s1 == s2:
-        return 0
-    if s1 > s2:
-        return 1
-    return -1
 
 import DateTime
@@ -126,5 +117,5 @@
     payments.append(row)
 
-payments.sort(cmp_id)
+payments.sort(cmp=lambda x,y: cmp(x['trans_ref'],y['trans_ref']))
 info['payments'] = payments
 return info
Index: /WAeUP_SRP/trunk/skins/waeup_aaue/getSchoolFee.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_aaue/getSchoolFee.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_aaue/getSchoolFee.py	(revision 3865)
@@ -16,32 +16,9 @@
 d = {}
 
-if brain.mode == 'ug_sw':  
-    if str(brain.level) == '100':    # both 100 fresh and 100 returning who register for 200
-        d['all'] = 35000
-    else:
-        d['all'] = 30000
-elif brain.mode == 'pg_sw':  
-    d['all'] = 35000
-elif brain.mode == 'dp_pt':  
-    if str(brain.level) in ('100',) and brain.review_state == 'cleared_and_validated':    # only 100 fresh 
-        d['all'] = 40000
-    else:
-        d['all'] = 35000
-elif brain.mode == 'ug_pt':  
-    if str(brain.level) in ('100','200',) and brain.review_state == 'cleared_and_validated':    # only 100 or 200 fresh 
-        d['all'] = 50000
-    else:
-        d['all'] = 45000
-elif brain.mode == 'pg_pt':  
-    if str(brain.level) == '600' and brain.review_state == 'cleared_and_validated':    # only 600 fresh 
-        d['all'] = 60000
-    elif str(brain.level) == '700' and brain.review_state == 'cleared_and_validated':  # only 700 fresh                                             # going to register for 700
-        d['all'] = 75000      
-    elif str(brain.level) == '600' and brain.verdict == 'C':                           # 600 repeaters
-        d['all'] = 55000
-    elif str(brain.level) == '600':                                                    # going to register for 700
-        d['all'] = 75000        
-    else:
-        d['all'] = 65000
+if brain.mode == '':  
+
+
+
+
 else:
     d['all'] = 0
Index: /WAeUP_SRP/trunk/skins/waeup_epayment/getPaymentsFolderInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_epayment/getPaymentsFolderInfo.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_epayment/getPaymentsFolderInfo.py	(revision 3865)
@@ -26,13 +26,4 @@
     def set_trace():
         pass
-
-def cmp_id(a,b):
-    s1 = "%(id)s" % a
-    s2 = "%(id)s" % b
-    if s1 == s2:
-        return 0
-    if s1 > s2:
-        return 1
-    return -1
 
 import DateTime
@@ -135,5 +126,5 @@
     payments.append(row)
 
-payments.sort(cmp_id)
+payments.sort(cmp=lambda x,y: cmp(x['trans_ref'],y['trans_ref']))
 info['payments'] = payments
 return info
Index: /WAeUP_SRP/trunk/skins/waeup_fceokene/getPaymentsFolderInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_fceokene/getPaymentsFolderInfo.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_fceokene/getPaymentsFolderInfo.py	(revision 3865)
@@ -26,13 +26,4 @@
     def set_trace():
         pass
-
-def cmp_id(a,b):
-    s1 = "%(id)s" % a
-    s2 = "%(id)s" % b
-    if s1 == s2:
-        return 0
-    if s1 > s2:
-        return 1
-    return -1
 
 import DateTime
@@ -126,5 +117,7 @@
     payments.append(row)
 
-payments.sort(cmp_id)
+payments.sort(cmp=lambda x,y: cmp(x['trans_ref'],y['trans_ref']))
+
+
 info['payments'] = payments
 return info
Index: /WAeUP_SRP/trunk/skins/waeup_fceokene/logged_in.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_fceokene/logged_in.py	(revision 3865)
+++ /WAeUP_SRP/trunk/skins/waeup_fceokene/logged_in.py	(revision 3865)
@@ -0,0 +1,271 @@
+## Script (Python) "logged_in"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+"""Prepare user login
+modified from cps_default/logged_in.py
+
+$Id: logged_in.py 1933 2007-06-19 05:05:29Z henrik $
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+import DateTime
+current = DateTime.DateTime()
+import logging
+logger = logging.getLogger('Skins.logged_in')
+
+
+from urllib import unquote
+
+request = context.REQUEST
+response = request.RESPONSE
+utool = context.portal_url
+mtool = context.portal_membership
+wftool = context.portal_workflow
+portal = utool.getPortalObject()
+
+redirect_to_portal = False
+is_anon = mtool.isAnonymousUser()
+member = mtool.getAuthenticatedMember()
+
+if context.isStaff():
+    is_unsecure = context.waeup_tool.checkGenericPassword(str(member))
+    if is_unsecure:
+        response.expireCookie('__ac', path='/')
+        return response.redirect("%s/user_logged_in_disabled" % context.portal_url())
+
+#load_passport = hasattr(context.waeup_tool,'loadStudentFoto')
+
+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_app = getattr(student,'application',None)
+        student_per = getattr(student,'personal',None)
+
+        #########################################################
+
+        # perform makeStudentData for returning students who login for the first time
+        # the returning key comes from set_access_data
+
+        if request.has_key('returning') and  student_per 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)
+        elif student_per is None:
+            context.waeup_tool.makeStudentData(str(member))
+
+        #########################################################
+
+        student_app = getattr(student,'application',None)
+
+        #########################################################
+
+        # add missing payments folder
+
+        if 'payments' not in student.objectIds():
+            student.invokeFactory('PaymentsFolder','payments')
+            payments = getattr(student,'payments')
+            wftool.doActionFor(payments,'open')
+            d = {}
+            d['Title'] = 'Online Payments'
+            payments.getContent().edit(mapping=d)
+
+        #########################################################
+
+        #student_pume = getattr(student,'pume',None)
+        s_review_state = context.getStudentReviewState(student.id)
+        a_review_state = wftool.getInfoFor(student_app,'review_state',None)
+        student_per = getattr(student,'personal',None)
+        p_review_state = wftool.getInfoFor(student_per,'review_state',None)
+        logger.info('%s logged in, review_state %s' % (member,s_review_state))
+        if student_app is None:
+            logger.info('%s logged in, without application object' % (member))
+        else:
+            app_doc = student_app.getContent()
+
+        #########################################################
+
+        # save email and phone of returning students after all objects have been created
+
+        if request.has_key('returning') and student_app:
+            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')
+
+        #########################################################
+
+        # look for passport pictures
+        student_id = student.getId()
+        if not context.waeup_tool.picturesExist(('passport',), student_id):
+            folder = 'images/reload'
+            msg = context.waeup_tool.loadStudentFoto(student,student_id,folder)
+            logger.info('%s (%s), %s' % (student_id,s_review_state,msg))
+
+
+        #########################################################
+
+        # perform necessary updates for new students
+
+        # 1. add pin and application date to app_doc
+
+        if s_review_state == "student_created":
+            wftool.doActionFor(student,'admit')
+            s_review_state = 'admitted'
+
+        if s_review_state == "admitted" and a_review_state == 'created':
+            wftool.doActionFor(student_app,'open')
+            #if student_pume is not None:
+            #  wftool.doActionFor(student_pume,'close')
+            da = {}
+            pin = request.get('pin')
+
+            # if the student comes directly, add missing pin or pin with wrong syntax (fix)
+            if not pin:
+                jamb_reg_no = app_doc.jamb_reg_no
+                for reg_no in (jamb_reg_no,jamb_reg_no.lower(),jamb_reg_no.upper()):
+                    res = context.portal_pins(student=reg_no)
+                    if len(res) > 0:
+                        break
+                if len(res) > 0:
+                    p = res[0].pin
+                    if len(p) > 10:
+                        pin = "%s-%s-%s" % (p[:3],p[3:4],p[4:])
+                    else:
+                        pin = p
+            da['app_ac_pin'] = pin
+            da['app_ac_date'] = current
+            app_doc.edit(mapping = da)
+
+        # 2. same as 1 but without opening app_doc, assuming that the student already logged in
+        #    but the pin is missing in app_doc (fix)
+
+        elif s_review_state in ("admitted") and a_review_state == 'opened' and\
+                                            not app_doc.app_ac_pin:
+            jamb_reg_no = app_doc.jamb_reg_no
+            for reg_no in (jamb_reg_no,jamb_reg_no.lower(),jamb_reg_no.upper()):
+                res = context.portal_pins(student=reg_no)
+                if len(res) > 0:
+                    break
+            if len(res) > 0:
+                p = res[0].pin
+                if len(p) > 10:
+                    pin = "%s-%s-%s" % (p[:3],p[3:4],p[4:])
+                else:
+                    pin = p
+                da = {}
+                da['app_ac_pin'] = pin
+                app_doc.edit(mapping = da)
+
+        # 3. open personal object (fix). This should be done in clearance_edit.
+
+        elif s_review_state in ("cleared_and_validated",) and\
+                             p_review_state == 'created' :
+            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'
+        #set_trace()
+
+        #########################################################
+
+        if matric_no:
+            has_results = context.results_import(matric_no = matric_no)
+        else:
+            has_results = ''
+
+        #########################################################
+
+        # fetch current verdict via getVerdict and level via getLevelFromResultsCosCode
+
+        if s_review_state in ('returning','school_fee_paid') and not (has_verdict and has_level):
+            if has_results:
+                study_course = getattr(student,'study_course')
+                sc_review_state = wftool.getInfoFor(study_course,'review_state',None)
+                dsc = {}
+                if not has_verdict and s_review_state == 'returning':
+                    dsc['current_verdict'] = context.getVerdict(has_results[0].Verdict)[0]
+                if not has_level and s_review_state == 'returning':
+                    lnr = context.getLevelFromResultsCosCode(has_results)
+                    dsc['current_level'] = "%d00" % lnr
+                elif not has_level and s_review_state == 'school_fee_paid':
+                    lnr = context.getLevelFromResultsCosCode(has_results)
+                    cv = context.getVerdict(has_results[0].Verdict)[0]
+                    if cv in ('A','B',):
+                        lnr += 1
+                    dsc['current_level'] = "%d00" % lnr
+                    dsc['previous_verdict'] = cv
+                if sc_review_state != 'opened':
+                    wftool.doActionFor(study_course,'open')
+                study_course_doc =study_course.getContent()
+                study_course_doc.edit(mapping = dsc)
+                wftool.doActionFor(study_course,'close_for_edit')
+
+        #########################################################
+
+
+        # determine appropriate redirect url
+
+        if s_review_state == "application_pin_entered":
+            redirect_url = "%s/application_edit_form" % student.absolute_url()
+        elif s_review_state in ('admitted', 'objection_raised',):
+            redirect_url = "%s/admission_form" % student.absolute_url()
+        elif s_review_state == "clearance_pin_entered":
+            redirect_url = "%s/clearance_edit_form" % student.absolute_url()
+        elif s_review_state == "cleared_and_validated":
+            redirect_url = "%s/personal_edit_form" % student.absolute_url()
+        elif s_review_state == "returning" and has_results:
+            redirect_url = "%s/session_results_view" % student.absolute_url()
+        elif s_review_state in ('school_fee_paid','courses_registered'):
+            redirect_url = "%s/study_course/study_course_view" % student.absolute_url()
+        else:
+            redirect_url = "%s/student_index" % student.absolute_url()
+
+
+    else:
+        logger.info('%s logged in' % (member))
+        redirect_url = portal.absolute_url()
+#Anonymous
+else:
+    response.expireCookie('__ac', path='/')
+    return context.user_logged_in_failed()
+
+# Setup skins
+if (getattr(utool, 'updateSkinCookie', False) and
+    utool.updateSkinCookie()):
+    context.setupCurrentSkin()
+
+response.redirect(redirect_url)
+
Index: /WAeUP_SRP/trunk/skins/waeup_fceoyo/getPaymentsFolderInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_fceoyo/getPaymentsFolderInfo.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_fceoyo/getPaymentsFolderInfo.py	(revision 3865)
@@ -26,13 +26,4 @@
     def set_trace():
         pass
-
-def cmp_id(a,b):
-    s1 = "%(id)s" % a
-    s2 = "%(id)s" % b
-    if s1 == s2:
-        return 0
-    if s1 > s2:
-        return 1
-    return -1
 
 import DateTime
@@ -126,5 +117,5 @@
     payments.append(row)
 
-payments.sort(cmp_id)
+payments.sort(cmp=lambda x,y: cmp(x['trans_ref'],y['trans_ref']))
 info['payments'] = payments
 return info
Index: /WAeUP_SRP/trunk/skins/waeup_futminna/getPaymentsFolderInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_futminna/getPaymentsFolderInfo.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_futminna/getPaymentsFolderInfo.py	(revision 3865)
@@ -26,13 +26,4 @@
     def set_trace():
         pass
-
-def cmp_id(a,b):
-    s1 = "%(id)s" % a
-    s2 = "%(id)s" % b
-    if s1 == s2:
-        return 0
-    if s1 > s2:
-        return 1
-    return -1
 
 import DateTime
@@ -127,5 +118,5 @@
 
 payments.sort(cmp_id)
-info['payments'] = payments
+payments.sort(cmp=lambda x,y: cmp(x['trans_ref'],y['trans_ref']))
 return info
 
Index: /WAeUP_SRP/trunk/skins/waeup_ois/getPaymentsFolderInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_ois/getPaymentsFolderInfo.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_ois/getPaymentsFolderInfo.py	(revision 3865)
@@ -26,13 +26,4 @@
     def set_trace():
         pass
-
-def cmp_id(a,b):
-    s1 = "%(id)s" % a
-    s2 = "%(id)s" % b
-    if s1 == s2:
-        return 0
-    if s1 > s2:
-        return 1
-    return -1
 
 import DateTime
@@ -120,5 +111,5 @@
     payments.append(row)
 
-payments.sort(cmp_id)
+payments.sort(cmp=lambda x,y: cmp(x['trans_ref'],y['trans_ref']))
 info['payments'] = payments
 return info
Index: /WAeUP_SRP/trunk/skins/waeup_unilorin/getPaymentsFolderInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_unilorin/getPaymentsFolderInfo.py	(revision 3864)
+++ /WAeUP_SRP/trunk/skins/waeup_unilorin/getPaymentsFolderInfo.py	(revision 3865)
@@ -26,13 +26,4 @@
     def set_trace():
         pass
-
-def cmp_id(a,b):
-    s1 = "%(id)s" % a
-    s2 = "%(id)s" % b
-    if s1 == s2:
-        return 0
-    if s1 > s2:
-        return 1
-    return -1
 
 import DateTime
@@ -126,5 +117,5 @@
     payments.append(row)
 
-payments.sort(cmp_id)
+payments.sort(cmp=lambda x,y: cmp(x['trans_ref'],y['trans_ref']))
 info['payments'] = payments
 return info
