Index: /WAeUP_SRP/trunk/Students.py
===================================================================
--- /WAeUP_SRP/trunk/Students.py	(revision 1167)
+++ /WAeUP_SRP/trunk/Students.py	(revision 1168)
@@ -851,9 +851,11 @@
                 format_error = format + ',"%(Error)s"'
                 no_certificate = "no certificate %s" % format
-            if student.get('matric_no') == '':
+            matric_no = student.get('matric_no').upper()
+            student['matric_no'] = matric_no
+            if matric_no == '':
                 student['Error'] = "Empty matric_no"  
                 no_import.append( format_error % student)
                 continue
-            if student.get('matric_no') in regs:
+            if matric_no in regs or self.returning_import(matric_no = matric_no):
                 student['Error'] = "Duplicate"  
                 no_import.append( format_error % student)
@@ -884,4 +886,5 @@
                 em = '%d transactions commited total %s\n' % (tr_count,total)
                 transaction.commit()
+                regs = []
                 logger.info(em)
                 total += tr_count
@@ -937,10 +940,12 @@
                 no_certificate = "no certificate %s" % format
             course_id = result.get('CosCode')
-            key = result.get('matric_no')+course_id
-            if key == '':
+            matric_no = result.get('matric_no').upper()
+            result['matric_no'] = matric_no
+            key = matric_no+course_id
+            if matric_no == '':
                 result['Error'] = "Empty matric_no"  
                 no_import.append( format_error % result)
                 continue
-            if key in regs:
+            if key in regs or self.results_import(key = key):
                 result['Error'] = "Duplicate"  
                 no_import.append( format_error % result)
@@ -979,4 +984,5 @@
                 transaction.commit()
                 logger.info(em)
+                regs = []
                 total += tr_count
                 tr_count = 0
