Index: WAeUP_SRP/branches/uli/skins/waeup_academics/getCertificateInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_academics/getCertificateInfo.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_academics/getCertificateInfo.py	(revision 1653)
@@ -18,5 +18,5 @@
 
 info = {}
-info['action'] = "%s" % context.campus.absolute_url()
+info['action'] = "%s" % context.absolute_url()
 info['choosen_ids'] = request.get('ids',[])
 info['doc'] = context.getContent()
Index: WAeUP_SRP/branches/uli/skins/waeup_academics/getLevelInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_academics/getLevelInfo.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_academics/getLevelInfo.py	(revision 1653)
@@ -16,4 +16,5 @@
 wf = context.portal_workflow
 mtool = context.portal_membership
+academics_path = "%s/campus/academics" % context.portal_url()
 path_info = request.get('PATH_INFO').split('/')
 try:
@@ -44,5 +45,5 @@
     ro = r.getObject()
     rd = ro.getContent()
-    row['id'] = r.getId
+    course_id = row['id'] = r.getId
     row['title'] = rd.Title()
     row['core'] = rd.core_or_elective
@@ -50,5 +51,10 @@
     row['url'] = ro.absolute_url()
     row['review_state'] = wf.getInfoFor(ro,'review_state','None')
-    row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
+    editable = row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
+    if editable:
+        course_res = context.courses_catalog(code=course_id)
+        if course_res:
+            rc = course_res[0]
+            row['real_course_path'] = "%s/%s/%s/courses/%s" % (academics_path,rc.faculty,rc.department,course_id)
     if rd.semester == 'first':
         first.append(row)
Index: WAeUP_SRP/branches/uli/skins/waeup_academics/level_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_academics/level_view.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_academics/level_view.pt	(revision 1653)
@@ -48,4 +48,8 @@
                     [edit]
                     </a> 
+                <a tal:condition="row/real_course_path|nothing" 
+                   href="edit" tal:attributes="href string:${row/real_course_path}">
+                    [goto course]
+                    </a> 
                 </td>
               </tr>
Index: WAeUP_SRP/branches/uli/skins/waeup_default/mail2admin.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_default/mail2admin.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_default/mail2admin.py	(revision 1653)
@@ -37,5 +37,5 @@
      email,
      'kehindesamuel@waeup.org',
-     'henrik@waeup.org',
+     'waeup@saoas.org',
 #    'js@aixtraware.de',
      email,
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/check_online_payments.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/check_online_payments.py	(revision 1653)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/check_online_payments.py	(revision 1653)
@@ -0,0 +1,69 @@
+## Script (Python) "check_online_payments"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+payment callback
+"""
+import logging
+logger = logging.getLogger('Skins.check_online_payments')
+from AccessControl import Unauthorized
+import DateTime
+if context.portal_membership.isAnonymousUser():
+    return None
+
+request = context.REQUEST
+response = request.RESPONSE
+students = context.portal_url.getPortalObject().campus.students
+wftool = context.portal_workflow
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+member_id = str(member)
+student_id = context.getStudentId()
+online_transactions = context.online_payments_import
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write("%s<br>\n" % s)
+try:
+    from Products.AdvancedQuery import Eq, Between, Le,In
+    aq_portal = context.portal_catalog.evalAdvancedQuery
+    aq_students = context.students_catalog.evalAdvancedQuery
+except:
+    aq_portal = None
+
+query1 = Eq('portal_type','Payment')
+query2 = Eq('SearchableText',"Approved Successful")	 	
+online_payments = aq_portal(query1 & query2)
+set_trace()
+online_transactions = context.online_payments_import
+
+for op_brain in online_payments:
+    student_id = op_brain.getPath().split('/')[-3]
+    payment_doc = op_brain.getObject().getContent()
+    order_id = "%s%s" % (student_id[1:],op_brain.getId[1:])
+    transactions = online_transactions(student_id = student_id)
+    payment_id = op_brain.getId
+    if payment_doc.resp_code == "00" and not transactions:
+        rwrite('"%s","%s","no transaction for successfull payment","","%s"' % (student_id,payment_id,payment_doc.date))
+        continue
+    for transaction in transactions:
+        t_order_id = transaction.order_id
+        if t_order_id == order_id:
+            rwrite('"%s","%s","%s","%s","%s"' % (student_id,
+                                                                        op_brain.getId,
+                                                                        transaction.response_code,
+                                                                        payment_doc.resp_code,
+                                                                        payment_doc.date
+                                                                        ))
+            continue
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/check_transactions.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/check_transactions.py	(revision 1653)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/check_transactions.py	(revision 1653)
@@ -0,0 +1,92 @@
+## Script (Python) "check_transactions"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+payment callback
+"""
+import logging
+logger = logging.getLogger('Skins.check_transactions')
+from AccessControl import Unauthorized
+import DateTime
+if context.portal_membership.isAnonymousUser():
+    return None
+
+request = context.REQUEST
+response = request.RESPONSE
+students = context.portal_url.getPortalObject().campus.students
+wftool = context.portal_workflow
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+member_id = str(member)
+student_id = context.getStudentId()
+online_transactions = context.online_payments_import
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write("%s<br>\n" % s)
+correct = 0
+count = 0
+approved = 0
+for ot_brain in online_transactions():
+    student_id = ot_brain.student_id
+    if not students.hasObject(student_id):
+        rwrite("%s not found" % student_id)
+        continue
+    student_obj = getattr(students,student_id)
+    if not student_obj.hasObject('payments'):
+        rwrite("%s payments-folder not found" % student_id)
+        continue
+    payments_folder = getattr(student_obj,'payments')
+    payment_id = "p%s" % ot_brain.order_id[6:]
+    if not payments_folder.hasObject(payment_id):
+        rwrite("%s payment %s not found" % (student_id,payment_id))
+        continue
+    payment_obj = getattr(payments_folder,payment_id)
+    payment_doc = payment_obj.getContent()
+    response_code = ot_brain.response_code
+    count +=1
+    if payment_doc.resp_code != response_code:
+        rwrite('"%d","%d","%s","%s","%s","%s"' % (
+                                                  count,correct,
+                                                  student_id,
+                                                  payment_id,
+                                                  response_code,
+                                                  payment_doc.resp_code
+                                                  ))
+    elif payment_doc.resp_code == response_code:
+        correct +=1
+        rwrite('"%d","%d","%s","%s","%s","%s"' % (
+                                                  count,correct,
+                                                  student_id,
+                                                  payment_id,
+                                                  response_code,
+                                                  payment_doc.resp_code
+                                                  ))
+    if payment_doc.resp_code == "" and response_code == "00":
+        pd = {}
+        review_state = wftool.getInfoFor(payment_obj,'review_state',None)
+        if review_state != "opened":
+            logger.info('payment object of %s closed' % (student_id))
+            continue
+        review_state = wftool.getInfoFor(student_obj,'review_state',None)
+        if review_state != "cleared_and_validated":
+            logger.info('%s review_state = %s' % (student_id,review_state))
+            continue
+        pd['resp_code'] = 'IP'
+        pd['resp_desc'] = 'Payment approved by import, %s' % (DateTime.DateTime())
+        payment_doc.edit(mapping=pd)
+        if payment_doc.type_description.startswith('School Fee'):
+            wftool.doActionFor(student_obj,'pay_school_fee')
+        logger.info('%s approves epayment for %s by import' % (member,student_id))
+        wftool.doActionFor(payment_obj,'close')
+        approved += 1
+        if approved > 50:
+            context.waeup_tool.doCommit()
+            logger.info('%s transactions commited' % (approved))
+            approved = 0
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/epayment_cb.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/epayment_cb.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/epayment_cb.py	(revision 1653)
@@ -14,4 +14,5 @@
 import logging
 logger = logging.getLogger('Skins.epayment_cb')
+from AccessControl import Unauthorized
 import DateTime
 if context.portal_membership.isAnonymousUser():
@@ -21,6 +22,14 @@
 students = context.portal_url.getPortalObject().campus.students
 wftool = context.portal_workflow
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+member_id = str(member)
 student_id = context.getStudentId()
-if student_id is None:
+if student_id is None or student_id != member_id:
+    logger.info('%s tried to access payment object of %s' % (member_id,student_id))
+    referer = request.get('HTTP_REFERER','none')
+    logger.info('%s:%s illegal access, referer = %s' % (member_id,student_id,referer))
+    real_ip = request.get('HTTP_X_REAL_IP',"none")
+    logger.info('%s:%s illegal access, real_x_ip = %s' % (member_id,student_id,real_ip))
     return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
 
@@ -37,5 +46,9 @@
 for rc,pdk in resp_codes:
     pd[pdk] = request.get(rc)
-context.getContent().edit(mapping=pd)
+try:
+    context.getContent().edit(mapping=pd)
+except UnAuthorized,E:
+    logger.info('%s ' % student_id)
+
 #resp = pd['resp_desc']
 #if  resp.startswith('Appro') and resp.endswith('essful'):
@@ -44,4 +57,8 @@
     wftool.doActionFor(student,'pay_school_fee')
     logger.info('%s received valid callback' % student_id)
+    referer = request.get('HTTP_REFERER','none')
+    logger.info('%s valid callback referer = %s' % (student_id,referer))
+    real_ip = request.get('HTTP_X_REAL_IP',"none")
+    logger.info('%s valid callback real_ip = %s' % (student_id,real_ip))
 
 elif len(resp) < 3:
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/getPaymentsFolderInfo.py	(revision 1653)
@@ -53,5 +53,9 @@
     else:
         row['is_approvable'] = is_so and (review_state == "opened")
-    if (review_state == "closed") and so_object.resp_code in ('SC','00','AP',):
+    if so_object.type_description.startswith('School Fee'):
+        row['is_requeryable'] = (review_state == "opened") and info['review_state'] == 'cleared_and_validated'
+    else:
+        row['is_requeryable'] = is_so and (review_state == "opened")
+    if (review_state == "closed") and so_object.resp_code in ('SC','00','AP','IP',):
         row['confirmed'] = 'active'
     else:
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_online.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_online.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/pay_online.py	(revision 1653)
@@ -91,5 +91,5 @@
 info['callback_url'] = "%s/payments/%s/epayment_cb" % (student.absolute_url(),p_id)
 
-logger.info('%(student_id)s initiated online school fee payment' % info)
+logger.info('%(student_id)s initiated online school fee payment with order_id %(order_id)s and callback url %(callback_url)s' % info)
 payment_fields = (('x_SiteID','site_id'),
                   ('x_Redirect_url','callback_url'),
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/payment_receipt.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/payment_receipt.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/payment_receipt.pt	(revision 1653)
@@ -8,5 +8,5 @@
       <span tal:condition="info">
       
-        <metal:block tal:condition="python:info_doc['doc'].resp_code in ('00','AP',)">            
+        <metal:block tal:condition="python:info_doc['doc'].resp_code in ('00','AP','IP')">            
         <h3>Online Payment Receipt</h3>
         <br />
@@ -106,5 +106,5 @@
         </metal:block>
         
-        <metal:block tal:condition="python:info_doc['doc'].resp_code not in ('SC','00','AP','')">            
+        <metal:block tal:condition="python:info_doc['doc'].resp_code not in ('SC','00','AP','IP','')">            
         <h3>Response from Bank: "<span tal:content="python:info_doc['doc'].resp_desc" />"</h3>
         <br />        
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/payments_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/payments_view.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/payments_view.pt	(revision 1653)
@@ -34,9 +34,17 @@
             </td>
             <td>
-            <a tal:condition="python:row['is_approvable']"
+            <a tal:condition="row/is_approvable"
                tal:attributes="href string:${context/absolute_url}/${row/id}/approve_epayment;
                                onclick python:'return window.confirm(\'%s\')' %(cpsmcat('Are you sure? You will not be able to undo the approval.'), );
                                ">
                 [approve payment]
+            </a>             
+            </td>
+            <td tal:condition="nothing">
+            <a tal:condition="row/is_requeryable"
+               tal:attributes="href string:${context/absolute_url}/${row/id}/requery_payment;
+                               onclick python:'return window.confirm(\'%s\')' %(cpsmcat('Are you sure? You will not be able to undo the approval.'), );
+                               ">
+                [requery payment]
             </a>             
             </td>
@@ -53,4 +61,8 @@
                 value="Initiate School Fee Online Payment" 
                 />
+                
+
+
+                
         </form>  
 
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/requery_payment.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/requery_payment.py	(revision 1653)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/requery_payment.py	(revision 1653)
@@ -0,0 +1,66 @@
+## Script (Python) "pay_online"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+requery online-payment
+"""
+from urllib import urlencode
+import logging
+logger = logging.getLogger('Skins.requery_payment')
+import DateTime
+
+if context.portal_membership.isAnonymousUser():
+    return None
+
+request = context.REQUEST
+wftool = context.portal_workflow
+students = context.portal_url.getPortalObject().campus.students
+
+student_id = context.getStudentId()
+student = getattr(students,student_id)
+
+sbrain = context.students_catalog(id=student_id)[0]
+info = {}
+info['site_id'] = '300100100'
+info['currency_id'] = '566'
+
+#from Products.zdb import set_trace;set_trace()
+if student_id is None:
+    return context.REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
+
+if context.portal_url().find('uniben-demo.waeup.org') >-1 or\
+   context.portal_url().find('uniben.waeup.org') >-1:
+    info['action'] = "http://www.wemaonlinepayments.biz/querytransaction.aspx"
+else:
+    #pass
+    #return None
+    info['action'] = "%s/payments/%s/simulate_queryatransaction" % (student.absolute_url(),p_id)
+
+
+payment = context
+if payment.portal_type != 'Payment':
+    return
+payment_doc = payment.getContent()
+#from Products.zdb import set_trace;set_trace()
+info['order_id'] = p_id = payment_doc.order_id
+info['callback_url'] = "%s/payments/%s/epayment_requery_cb" % (student.absolute_url(),p_id)
+info['type_description'] = payment_doc.type_description
+info['amount'] = payment_doc.amount
+info['student_id'] = student_id
+logger.info('%(student_id)s requeried online school fee payment for order_id %(order_id)s' % info)
+payment_fields = (('x_SiteID','site_id'),
+                  ('x_OrderID','order_id'),
+                  ('x_Redirect_url','callback_url'),
+                  )
+args = {}
+for arg,field in payment_fields:
+    args[arg] = info[field]
+info['args'] = args
+return context.requery_payment_form(info=info)
Index: WAeUP_SRP/branches/uli/skins/waeup_epayment/requery_payment_form.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_epayment/requery_payment_form.pt	(revision 1653)
+++ WAeUP_SRP/branches/uli/skins/waeup_epayment/requery_payment_form.pt	(revision 1653)
@@ -0,0 +1,42 @@
+<metal:body use-macro="here/main_template/macros/master">
+    <metal:main fill-slot="main"
+                tal:define="info options/info">
+                
+        <h3>Requery Online Payment! </h3>
+        <br />
+                
+      <form method="post" action="pay_online"
+            tal:attributes="action info/action ">
+      <span tal:repeat="arg python:info['args'].items()"
+            tal:omit-tag="">
+          <input type="hidden" tal:attributes="name python:arg[0];value python:arg[1]" />
+      </span>          
+        <table>
+          <tr>
+            <td width="100px">
+            Payment:</td>
+            <td tal:content="info/type_description"></td>
+          </tr>
+          <tr>
+            <td >
+            Amount:
+            </td>
+            <td> Naira <span tal:content="info/amount" /></td>
+          </tr>
+          <tr>
+            <td >
+            Bank:
+            </td>
+            <td>Wema Bank</td>
+          </tr>          
+        </table>
+        <br />
+        <input type="submit" 
+               class="standalone" 
+               name="goto_bank" 
+               value="Requery this payment with Bank" 
+               />
+      </form>
+    </metal:main>
+</metal:body>
+
Index: WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/add_course_result.py	(revision 1653)
@@ -38,13 +38,13 @@
     if d['title'] == 'unknown':
         err = "No such course!"
-        logger.info('%s tried to add StudentCourseResult object %s for non-existing course' % (member,course_id))
+        #logger.info('%s tried to add StudentCourseResult object %s for non-existing course' % (member,course_id))
         break
     if context.hasObject(course_id):
         err = "Course already exists!"
-        logger.info('%s tried to add StudentCourseResult object %s which is already in course list' % (member,course_id))
+        #logger.info('%s tried to add StudentCourseResult object %s which is already in course list' % (member,course_id))
         break
     if context.hasObject("%s_co" % course_id):
         err = "Course already exists as carryover course!"
-        logger.info('%s tried to add StudentCourseResult object %s which already exists as carryover course' % (member,course_id))
+        #logger.info('%s tried to add StudentCourseResult object %s which already exists as carryover course' % (member,course_id))
         break
     break
@@ -54,5 +54,5 @@
     #args['error'] = err
     args['portal_status_message'] = err
-    url = "%s?%s" % (context.absolute_url(),urlencode(args))
+    url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
     return request.RESPONSE.redirect(url)
 
@@ -66,10 +66,12 @@
 args['course_id'] = course_id
 
-logger.info('%s added StudentCourseResult object %s' % (member,course_id))
+logger.info('%s added StudentCourseResult object %s for %s' % (member,course_id,context.getStudentId()))
 
-args = {}
 psm = "You successfully added course %s!" % course_id
 args['portal_status_message'] = psm
-url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+if action_after_validate:
+    url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+else:
+    url = context.absolute_url() + '?' + urlencode(args)
 return REQUEST.RESPONSE.redirect(url)
 
Index: WAeUP_SRP/branches/uli/skins/waeup_student/change_password.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/change_password.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/change_password.py	(revision 1653)
@@ -4,4 +4,14 @@
 
 """
+
+return
+
+
+
+
+
+
+
+
 request = context.REQUEST
 import DateTime,logging
Index: WAeUP_SRP/branches/uli/skins/waeup_student/clearance_edit.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/clearance_edit.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/clearance_edit.py	(revision 1653)
@@ -120,5 +120,5 @@
         wftool.doActionFor(info['clear'],'open')
         wftool.doActionFor(info['student'],'reject_clearance')
-        action = "/contact_student_form"
+        action = "/external_contact_student_form"
         psm = "Student's clearance request has been rejected! Please fill and submit the form below!"
         subject = "Clearance request rejected"
Index: WAeUP_SRP/branches/uli/skins/waeup_student/contact_student_form.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/contact_student_form.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/contact_student_form.pt	(revision 1653)
@@ -28,4 +28,6 @@
       <input type="hidden" name="probtype" type="text" id="probtype"
              tal:attributes="value subject"/>     
+      <input type="hidden" name="action" type="text" id="action"
+             tal:attributes="value continue"/>  
              
       <table width="100%" border="0" cellspacing="5" cellpadding="0">
Index: WAeUP_SRP/branches/uli/skins/waeup_student/course_registration_slip.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/course_registration_slip.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/course_registration_slip.pt	(revision 1653)
@@ -19,5 +19,8 @@
       
       <div tal:condition="validated">
-        - validated by Course Adviser -
+        - validated by Course Adviser - 
+      <span tal:condition="info/doc/validated_by|nothing" tal:omit-tag="">
+        <span tal:replace="info/doc/validated_by" /> on <span tal:replace="info/doc/validation_date" />
+      </span>
       </div>
       <div tal:condition="not: validated">
Index: WAeUP_SRP/branches/uli/skins/waeup_student/create_level.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/create_level.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/create_level.py	(revision 1653)
@@ -31,27 +31,32 @@
 current_level = student.level
 in_progress =  request.get('in_progress','not started')
+level_created =  request.get('level_created','xxx')
+create_level =  request.get('create_level',None)
 
-if context.hasObject(current_level):
-    response.redirect("%s/%s" % (context.absolute_url(),current_level))
+if context.hasObject(current_level) and create_level :
+    logger.info('%s", level %s already exists' % (student.id,current_level))
     return
 
-if in_progress in ('not started','started'):
-    session.set('in_progress','started')
-    view = context.in_progress_view(refresh=3,page='create_level?in_progress=started')
-    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
-    response.setHeader('Content-length','%d' % (len(view)))
-    response.setStatus('OK')
-    response.write(view)
-    response.write('')
-    if in_progress == 'started':
-        return
+##if in_progress in ('not started','started'):
+##    session.set('in_progress','started')
+##    view = context.in_progress_view(refresh=20,page='create_level?in_progress=started')
+##    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+##    response.setHeader('Content-length','%d' % (len(view)))
+##    response.setStatus('OK')
+##    response.write(view)
+##    response.write('')
+##    if in_progress == 'started':
+##        return
     
-
-context.invokeFactory('StudentStudyLevel',"%s" % current_level)
-level = getattr(context,"%s" % current_level)
-context.portal_workflow.doActionFor(level,'open')
-study_session = context.getSessionString()
-level.getContent().edit(mapping={'session': study_session})
-context.portal_workflow.doActionFor(level,'close_for_edit')
+if level_created == current_level:
+    level = getattr(context,"%s" % current_level)
+else:
+    context.invokeFactory('StudentStudyLevel',"%s" % current_level)
+    level = getattr(context,"%s" % current_level)
+    context.portal_workflow.doActionFor(level,'open')
+    study_session = context.getSessionString()
+    level.getContent().edit(mapping={'session': study_session})
+    context.portal_workflow.doActionFor(level,'close_for_edit')
+    response.redirect("%s?level_created=%s" % (context.absolute_url(),current_level))
 results = context.results_import(matric_no = student.matric_no)
 if results:
@@ -90,19 +95,22 @@
         context.portal_workflow.doActionFor(course_result,'open')
         course_result.getContent().edit(mapping=d)
-res = context.portal_catalog(portal_type="Certificate", id = cert_id)
-l = []
-if res:
-    cert = res[0]
-    path = cert.getPath()
-    query = Eq("path",path) &\
-            Eq('portal_type','CertificateCourse') &\
-            Eq('SearchableText', "%s" % student.level)
-    courses = aq_portal(query)
-    for c in courses:
-        d = context.getCourseInfo(c.getId)
-        cr_id = level.invokeFactory('StudentCourseResult',c.getId)
-        course_result = getattr(level,cr_id)
-        context.portal_workflow.doActionFor(course_result,'open')
-        d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
-        course_result.getContent().edit(mapping=d)
-return
+level['create_course_results'](cert_id,current_level)
+##res = context.portal_catalog(portal_type="Certificate", id = cert_id)
+##l = []
+##if res:
+##    cert = res[0]
+##    path = cert.getPath()
+##    #set_trace()
+##    query = Eq("path","%s/%s" % (path,current_level)) &\
+##            Eq('portal_type','CertificateCourse')
+##    courses = aq_portal(query)
+##    for c in courses:
+##        d = context.getCourseInfo(c.getId)
+##        cr_id = level.invokeFactory('StudentCourseResult',c.getId)
+##        course_result = getattr(level,cr_id)
+##        context.portal_workflow.doActionFor(course_result,'open')
+##        d['core_or_elective'] = getattr(c.getObject().getContent(),'core_or_elective')
+##        course_result.getContent().edit(mapping=d)
+        
+return response.redirect("%s/%s" % (context.absolute_url(),current_level))
+
Index: WAeUP_SRP/branches/uli/skins/waeup_student/delete_course_result.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/delete_course_result.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/delete_course_result.py	(revision 1653)
@@ -14,4 +14,6 @@
 
 from Products.CMFCore.utils import getToolByName
+from AccessControl import Unauthorized
+
 here = context
 from urllib import urlencode
@@ -30,13 +32,21 @@
             real_ids.append(id)
     if real_ids:
-        context.manage_delObjects(real_ids)
-        logger.info('%s deleted StudentCourseResult object %s' % (member,id))
-        message = 'psm_item(s)_deleted'
+        try:
+            context.manage_delObjects(real_ids)
+            logger.info('%s deleted StudentCourseResult object %s for %s' % (member,id,context.getStudentId()))
+            message = 'psm_item(s)_deleted'
+        except Unauthorized:
+            logger.info('%s has no permission to delete StudentCourseResult objects for %s' % (member,context.getStudentId()))
+            message = 'no item(s) deleted'
 else:
     message = 'psm_select_at_least_one_document'
-    
+
 args = {}
 args['portal_status_message'] = message
-url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+
+if action_after_validate:
+    url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+else:
+    url = context.absolute_url() + '?' + urlencode(args)
 if REQUEST is not None:
-    return REQUEST.RESPONSE.redirect(url)    
+    return REQUEST.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getSessionResults.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getSessionResults.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getSessionResults.py	(revision 1653)
@@ -101,5 +101,5 @@
 #set_trace()
 verdict_voc = context.portal_vocabularies.verdicts
-verdict_code = student_from_cat.get('verdict',None)
+verdict_code = student_from_cat.verdict
 if verdict_code:
     info['verdict'] = verdict = verdict_voc.get(verdict_code,'N/A').upper()
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getStudyCourseInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getStudyCourseInfo.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getStudyCourseInfo.py	(revision 1653)
@@ -25,5 +25,5 @@
 info = {}
 info['is_so'] = context.isSectionOfficer()
-info['action'] = "%s" % context.campus.absolute_url()
+info['action'] = "%s" % context.absolute_url()
 info['choosen_ids'] = request.get('ids',[])
 course  = info['doc'] = context.getContent()
@@ -57,5 +57,5 @@
 may_register = (student_review_state in ('school_fee_paid',)) and\
                current_level not in levels and\
-               (sbrain.verdict in ('A','B') or sbrain.jamb_reg_no.startswith('6'))
+               (sbrain.verdict in ('A','B','C') or sbrain.jamb_reg_no.startswith('6'))
 
 levels.sort()
Index: WAeUP_SRP/branches/uli/skins/waeup_student/getStudyLevelInfo.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/getStudyLevelInfo.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/getStudyLevelInfo.py	(revision 1653)
@@ -40,8 +40,10 @@
     return 0.0
 
-def cmp_semester(a,b):
-    if a['semester'] == b['semester']:
+def cmp_semester_id(a,b):
+    s1 = "%(semester)s%(id)s" % a
+    s2 = "%(semester)s%(id)s" % b
+    if s1 == s2:
         return 0
-    if a['semester'] > b['semester']:
+    if s1 > s2:
         return 1
     return -1
@@ -104,7 +106,7 @@
         normal.append(d)
 info['credits_total'] = credits_total
-carry_overs.sort(cmp_semester)
+carry_overs.sort(cmp_semester_id)
 info['carry_overs'] = carry_overs
-normal.sort(cmp_semester)
+normal.sort(cmp_semester_id)
 info['normal'] = normal
 
Index: WAeUP_SRP/branches/uli/skins/waeup_student/layout_personal_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/layout_personal_view.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/layout_personal_view.pt	(revision 1653)
@@ -9,5 +9,5 @@
       <td><span class="dlabel">Student ID</span>:
       </td>
-      <td tal:condition="nothing"> 
+      <td> 
          <span tal:replace="context/getStudentId" />
       </td>      
Index: WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/mail2student.py	(revision 1653)
@@ -5,8 +5,10 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=co_name=None,co_email=None,student_email=None,probtype=None,commt=None
+##parameters=co_name=None,co_email=None,student_email=None,probtype=None,commt=None, action=None
 ##title=
 ##
 # $Id: mail2admin.py 869 2006-11-15 13:46:49Z henrik $
+
+from urllib import urlencode
 
 mhost = context.MailHost
@@ -27,11 +29,13 @@
 #prop.email_from_address should be used for To:
 REQUEST = context.REQUEST
-url_tuple = REQUEST.HTTP_REFERER.split('?')
-if len(url_tuple) == 2:
-    url_tuple[1] ='portal_status_message=Your message has been sent!'
-else:
-    url_tuple.append('portal_status_message=Your message has been sent!')
-redirect_url = "?".join(url_tuple)
-REQUEST.set('rurl', redirect_url) # to see the result in the error log
+
+#url_tuple = REQUEST.HTTP_REFERER.split('?')
+#if len(url_tuple) == 2:
+#    url_tuple[1] ='portal_status_message=Your message has been sent!'
+#else:
+#    url_tuple.append('portal_status_message=Your message has been sent!')
+#redirect_url = "?".join(url_tuple)
+#REQUEST.set('rurl', redirect_url) # to see the result in the error log
+
 msg = message % (
      co_name,
@@ -39,5 +43,5 @@
      student_email,
      co_email,
-     'henrik@waeup.org',
+     'waeup@saoas.org',
 #    'js@aixtraware.de',
      co_email,
@@ -47,6 +51,18 @@
 mhost.send(msg)
 
-REQUEST = context.REQUEST
-RESPONSE = REQUEST.RESPONSE
 
-RESPONSE.redirect(redirect_url)
+#REQUEST = context.REQUEST
+#RESPONSE = REQUEST.RESPONSE
+#RESPONSE.redirect(redirect_url)
+
+args = {}
+psm = "Your message has been sent!"
+args['portal_status_message'] = psm
+if action:
+    url = context.absolute_url() + '/' + action + '?' + urlencode(args)
+else:
+    url = context.absolute_url() +'?' + urlencode(args)
+return REQUEST.RESPONSE.redirect(url)
+
+
+
Index: WAeUP_SRP/branches/uli/skins/waeup_student/refresh_level.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/refresh_level.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/refresh_level.py	(revision 1653)
@@ -112,4 +112,7 @@
 psm = "Course list updated!"
 args['portal_status_message'] = psm
-url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+if action_after_validate:
+    url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+else:
+    url = context.absolute_url() + '?' + urlencode(args)
 return REQUEST.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/register_courses.py	(revision 1653)
@@ -19,5 +19,5 @@
         pass
 
-from urllib import urlencode        
+from urllib import urlencode
 
 request = context.REQUEST
@@ -47,4 +47,7 @@
 psm = "You successfully submitted your course list!"
 args['portal_status_message'] = psm
-url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+if action_after_validate:
+    url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args)
+else:
+    url = context.absolute_url() + '?' + urlencode(args)
 return REQUEST.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/reject_courses.py	(revision 1653)
@@ -46,4 +46,7 @@
 args['continue'] = action_after_validate
 args['portal_status_message'] = psm
-url = context.absolute_url() + '/' + action_after_reject + '?' + urlencode(args)
+if action_after_reject:
+    url = context.absolute_url() + '/' + action_after_reject + '?' + urlencode(args)
+else:
+    url = context.absolute_url() + '?' + urlencode(args)
 return REQUEST.RESPONSE.redirect(url)
Index: WAeUP_SRP/branches/uli/skins/waeup_student/statistics_new_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/statistics_new_view.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/statistics_new_view.pt	(revision 1653)
@@ -33,5 +33,5 @@
             <th align="right">CR</th>
             <th align="right">VC</th>
-            <th align="right">SFP</th>
+            <th align="right">SFP+</th>
           </tr>
           <tr tal:repeat="d departments"
@@ -74,5 +74,5 @@
         <tr><td>CR: </td> <td>Clearance requested</td></tr>
         <tr><td>VC: </td> <td>Validated and cleared</td></tr>
-        <tr><td>SFP: </td> <td>School fee paid</td></tr>
+        <tr><td>SFP+: </td> <td>School fee paid and further</td></tr>
         </table>
       </span>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/statistics_ret_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/statistics_ret_view.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/statistics_ret_view.pt	(revision 1653)
@@ -34,5 +34,5 @@
             <th >Faculty</th>
             <th align="right">RET</th>
-            <th align="right">SFP</th>
+            <th align="right">SFP+</th>
           </tr>
           <tr tal:define="d python:departments[0]"
@@ -60,5 +60,5 @@
         <table>
         <tr><td>RET:</td> <td>Returning students who have logged in</td></tr>
-        <tr><td>SFP:</td> <td>Returning students who already paid their school fee</td></tr>
+        <tr><td>SFP:</td> <td>Returning students who paid their school fee</td></tr>
         </table>        
       </span>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/study_course_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/study_course_view.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/study_course_view.pt	(revision 1653)
@@ -66,5 +66,5 @@
             tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
             <td align="left" valign="middle" style="width: 5px;" 
-                tal:condition="python: 0 and is_so">
+                tal:condition="python:is_so">
               <input type="checkbox" name="ids:list" value="" id="" class="noborder"
                      tal:condition="is_so"
@@ -84,9 +84,8 @@
                summary="contents of the folder"
                class="folderButtons">
-          <tr>
+          <tr tal:condition="python: is_so and info['items']">
             <td align="left" valign="top" rowspan="3"></td>
             <td align="left" valign="top">
-              <span tal:condition="python:0 and is_so">
-                <input type="button" value="button_select_all" class="context"
+              <input type="button" value="button_select_all" class="context"
                        onclick="someJavaScriptFunctionThatWillBeReplaced"
                        i18n:attributes="value"
@@ -94,10 +93,9 @@
                        % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))"
                        />
-                <input type="submit" name="folder_delete:method" value="button_delete"
-                       class="destructive" i18n:attributes="value"
-                       tal:attributes="onclick python:'return window.confirm(\'%s\')' %
-                       (cpsmcat('description_confirm_delete'), )" 
-                       />
-              </span>
+              <input type="submit" name="folder_delete:method" value="button_delete"
+                     class="destructive" i18n:attributes="value"
+                     tal:attributes="onclick python:'return window.confirm(\'%s\')' %
+                     (cpsmcat('description_confirm_delete'), )" 
+                     />
             </td>
           </tr>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/study_level_view.pt
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/study_level_view.pt	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/study_level_view.pt	(revision 1653)
@@ -64,5 +64,6 @@
         <br />
       <div class="" tal:condition="not: info/normal">
-        Your faculty has not yet provided the list of courses for your certificate. Please contact your faculty!
+        <font color="red">Your faculty has not yet provided the list of courses for your certificate. Please contact your faculty!</font>
+        <br /><br />
       </div>
         <table class="contentListing" width="100%" id="folder_content"
@@ -109,8 +110,21 @@
                        class="context" value="Update" 
                        />
+                      
+                       
                 <br /><br />
                 <input tal:condition="info/normal" 
                        type="submit" name="register_courses:method"
                        class="context" value="Submit" />
+                       
+                <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                       tal:attributes="value string:study_level_view"/>  
+                       
+                <br /><br />
+                
+                <strong>Note:</strong> 'Update' checks for all courses in your certificate and will add them to your course list irrespective of
+                prior deletion, i.e. already deleted courses will show up again. 
+                
+                Please use this function only if you are sure that your faculty has added courses which are not yet on your course list.                                
+                       
             </td>
           </tr>
@@ -142,4 +156,9 @@
                 <input tal:condition="python: review_state in ('courses_registered', 'courses_validated',)" type="submit" name="reject_courses:method"
                        class="context" value="Reject" />
+                       
+                <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
+                       tal:attributes="value string:study_level_view"/>                         
+                <input type="hidden" name="action_after_reject" type="text" id="action_after_reject"
+                       tal:attributes="value string:contact_student_form"/>                         
 
             </td>
@@ -176,7 +195,7 @@
                        
                 <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
-                       tal:attributes="value string:/study_level_view"/>                         
+                       tal:attributes="value string:study_level_view"/>                         
                 <input type="hidden" name="action_after_reject" type="text" id="action_after_reject"
-                       tal:attributes="value string:/contact_student_form"/>    
+                       tal:attributes="value string:contact_student_form"/>    
                                              
 
@@ -199,5 +218,5 @@
                      />
               <input type="hidden" name="action_after_validate" type="text" id="action_after_validate"
-                       tal:attributes="value string:/study_level_view"/>                       
+                       tal:attributes="value string:study_level_view"/>                       
             </td>                
         </table>
Index: WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py	(revision 1593)
+++ WAeUP_SRP/branches/uli/skins/waeup_student/validate_courses.py	(revision 1653)
@@ -13,4 +13,6 @@
 """
 from Products.CMFCore.WorkflowCore import WorkflowException
+import DateTime
+current = DateTime.DateTime()
 try:
     from Products.zdb import set_trace
@@ -30,4 +32,8 @@
 student_id = context.getStudentId()
 student = getattr(students_folder,student_id)
+level_doc = context.getContent()
+if level_doc.portal_type == 'StudentStudyLevel':
+    level_doc.edit(mapping={'validated_by': member_id,
+                            'validation_date': current,})
 try:
     wftool.doActionFor(student,'validate_courses')
Index: WAeUP_SRP/branches/uli/skins/waeup_utilities/ti_151_resolve.py
===================================================================
--- WAeUP_SRP/branches/uli/skins/waeup_utilities/ti_151_resolve.py	(revision 1653)
+++ WAeUP_SRP/branches/uli/skins/waeup_utilities/ti_151_resolve.py	(revision 1653)
@@ -0,0 +1,114 @@
+## Script (Python) "ti_151_resolve"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+resolve ticket #151
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+import logging
+#>>>>>>>>>>>>>>>><
+logger = logging.getLogger('Skins.ti_151_resolve')
+logger.info('already done on 26.3.07 by joachim')
+return
+#<<<<<<<<<<<<<<<<<
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+students = context.portal_url.getPortalObject().campus.students
+#from string import Template
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write(s)
+def getObject(outer,object):
+    if outer.hasObject(object):
+        return getattr(outer,object)
+    return None
+
+try:
+    from Products.AdvancedQuery import Eq, Between, Le,In
+    aq_students = context.students_catalog.evalAdvancedQuery
+except:
+    evalAdvancedQuery = None
+
+students_cat = context.students_catalog
+query = Eq('faculty','PSC') & Eq('department','PHY') & In('level',('300','400'))
+brains = aq_students(query)
+#brains = students_cat(faculty = 'PSC',department='PHY', level='400')
+total = 0
+count_ok = 0
+count_nosc = 0
+count_nolevel = 0
+count_level = 0
+count_renamed = 0
+#set_trace()
+#template = Template('"$count","$id","$course"')
+to_rename = []
+for student in brains:
+    student_dict = {}
+    for field in students_cat.schema():
+        student_dict[field] = getattr(student,field)
+    #s = template.substitute(student_dict,count=count,)
+    student_dict['total'] = total
+    while True:
+        if student.course == "BSCINP":
+            student_dict['message'] = "OK"
+            count_ok += 1
+            student_dict['sp_count'] = count_ok
+            s = '"%(total)d","%(sp_count)s","%(id)s","%(course)s","%(message)s",' % student_dict
+            break
+        student_dict['message'] = ""
+        student_obj = getObject(students,student.id)
+        if student_obj is None:
+            student_dict['message'] = "No student object"
+            break
+        study_course_obj = getObject(student_obj,'study_course')
+        if study_course_obj is None:
+            student_dict['message'] = "No study_course object"
+            count_nosc += 1
+            student_dict['sp_count'] = count_nosc
+            break
+        level_obj = getObject(student_obj,student.level)
+        if level_obj:
+            count_level += 1
+            study_course.manage_delObjects((student.level,))
+            student_dict['message'] = "Level deleted"
+            student_dict['sp_count'] = count_level
+        count_renamed += 1
+        to_rename.append(student.id)
+        student_dict['sp_count'] = count_renamed
+        student_dict['message'] = student_dict['message'] + "renamed to BSCINP"
+        study_course_doc = study_course_obj.getContent()
+        study_course_obj.edit(mapping = {'study_course': "BSCINP"})
+        total += 1
+        s = '"%(total)d","%(sp_count)s","%(id)s","%(course)s","%(message)s",' % student_dict
+        rwrite("%s<br />\r\n" %s)
+        break
+    total += 1
+    s = '"%(total)d","%(sp_count)s","%(id)s","%(course)s","%(message)s",' % student_dict
+    rwrite("%s<br />\r\n" %s)
+for sid in to_rename:
+    students_cat.modifyRecord(id = sid,course="BSCINP")
+sum = count_ok + count_nosc + count_nolevel + count_level    
+rwrite("total=%d,sum of below=%d,<br>\r\n correct study_course=%d<br>\r\n no study_course=%d<br>\r\n no level=%d<br>\r\n with level =%d,<br />\n Done" %
+        (total,
+         sum,
+         count_ok,
+         count_nosc,
+         count_nolevel,
+         count_level)
+         )
+
+logger.info("total=%d,sum=%d,ok=%d,no study_course=%d,no level=%d,with level =%d,\n Done" %
+             (total,sum,count_ok,count_nosc,count_nolevel,count_level))
