Index: WAeUP_SRP/base/skins/waeup_epayment/upgradePayments.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_epayment/upgradePayments.py	(revision 2895)
+++ WAeUP_SRP/base/skins/waeup_epayment/upgradePayments.py	(revision 2897)
@@ -50,62 +50,21 @@
 logger.info("found %d payments" % total)
 sid = "xxx"
-#set_trace()
 count = 1
 commit_after = 5
 commit_count = 0
 
-set_trace()
+student_id = ''
 for payment_brain in payments:
     payment = payment_brain.getObject()
-    payment['updatePayment']()
-    # student_id = payment.getPath().split('/')[-3]
-    # student_brain = context.students_catalog.getRecordByKey(student_id)
-    # if student_brain is None:
-    #     logger.info("student %s not in students_catalog" % student_id)
-    #     continue
-    # d = {}
-    # doc = payment.getObject().getContent()
-    # d['key'] = payment.getId
-    # d['amount'] = doc.amount
-    # d['description'] = d['type_description'] = doc.type_description
-    # subject = ''
-    # if doc.type_description.startswith('School'):
-    #     subject = 'schoolfee'
-    # sp = doc.type_description.rfind('/')
-    # d['session_id'] = doc.type_description[sp-2:sp]
-    # d['subject'] = subject # zb. schoolfee
-    # d['target'] = "%s" % (student_brain.course)  # faculty departmen course
-    # while True:
-    #     if doc.resp_code == "SC":
-    #         p_type = "sc"
-    #         p_status = "paid"
-    #         break
-    #     if doc.resp_code == "00":
-    #         p_type = "onl"
-    #         p_status = "paid"
-    #         break
-    #     p_type = "ONL"
-    #     p_status = "open"
-    #     break
-    # d['key'] = payment.getId
-    # d['type'] = p_type  # scratch card
-    # d['status'] = p_status
-    # d['resp_approved_amount'] = getattr(doc,'resp_approved_amount',None)
-    # d['resp_pay_reference'] = doc.resp_pay_reference
-    # d['resp_desc'] = doc.resp_desc
-    # d['order_id'] = doc.order_id
-    # d['resp_code'] = doc.resp_code
-    # d['resp_card_num'] = doc.resp_card_num
-    # d['date'] = getattr(doc,'date',None)
-    # d['resp_date'] = getattr(doc,'resp_date',None)
-    # doc.edit(mapping = d)
-    # msg = " ".join(["%s: %s" % (key,value) for key,value in d.items()])
-    # rwrite(msg)
-    logger.info('upgraded student %s payment %s' % (student_id,d['key']))
+    if payment_brain.getPath().split('/')[-3] != student_id:
+        student_id = payment_brain.getPath().split('/')[-3]
+        student_record = context.students_catalog.getRecordByKey(student_id)
+    payment['updatePayment'](student_record)
+    logger.info('upgraded student %s payment %s' % (student_record.id,payment.getId()))
     if not count % commit_after:
         logger.info("committing %d total %d" % (commit_after,count))
         commit_count += 1
-        # if not commit_count % 2:
-        #     break
+        if not commit_count % 2:
+            break
     count += 1
 logger.info("%d of %d upgraded" % (count,total))
