Index: main/waeup.kofa/trunk/CHANGES.txt
===================================================================
--- main/waeup.kofa/trunk/CHANGES.txt	(revision 16830)
+++ main/waeup.kofa/trunk/CHANGES.txt	(revision 16831)
@@ -5,5 +5,8 @@
 =======================
 
-* Add importers for previous study course data.
+* Add `previous` field to `StudentStudyCourseProcessor`,
+  `StudentStudyLevelProcessor` and `CourseTicketProcessor` to ensure
+  that previous study course data are being imported into the right study
+  course container.
 
 * Add exporters for previous study course data.
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py	(revision 16830)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py	(revision 16831)
@@ -51,4 +51,12 @@
     FORBIDDEN_POSTGRAD_TRANS, FORBIDDEN_POSTGRAD_STATES)
 from waeup.kofa.utils.batching import BatchProcessor
+
+def studycourseName(row):
+    previous = row.get('previous', None)
+    if previous == '1':
+        return 'studycourse_1'
+    elif previous == '2':
+        return 'studycourse_2'
+    return 'studycourse'
 
 class StudentProcessor(BatchProcessor):
@@ -485,5 +493,9 @@
     iface_transfer = IStudentStudyCourseTransfer
     factory_name = 'waeup.StudentStudyCourse'
-    studycourse_name = 'studycourse'
+
+    @property
+    def available_fields(self):
+        return super(
+            StudentStudyCourseProcessor, self).available_fields + ['previous',]
 
     def getParent(self, row, site):
@@ -494,5 +506,12 @@
         if student is None:
             return None
-        return student.get(self.studycourse_name)
+        return student.get(studycourseName(row))
+
+    def addEntry(self, obj, row, site):
+        if studycourseName(row) == 'studycourse':
+            raise NotImplementedError('method not availabe')
+        parent = self.getParent(row, site)
+        parent[studycourseName(row)] = obj
+        return
 
     def updateEntry(self, obj, row, site, filename):
@@ -509,5 +528,5 @@
             student.transfer(
                 certificate=certificate, current_session=current_session)
-            obj = student[self.studycourse_name]
+            obj = student[studycourseName(row)]
             # Once imported we must ensure that after export and reimport
             # the student is not transferred again.
@@ -589,5 +608,4 @@
     iface = IStudentStudyLevel
     factory_name = 'waeup.StudentStudyLevel'
-    studycourse_name = 'studycourse'
 
     additional_fields_required = ['level']
@@ -595,5 +613,6 @@
     @property
     def available_fields(self):
-        fields = super(StudentStudyLevelProcessor, self).available_fields
+        fields = super(
+            StudentStudyLevelProcessor, self).available_fields + ['previous',]
         fields.remove('total_credits')
         fields.remove('gpa')
@@ -604,5 +623,5 @@
         if student is None:
             return None
-        return student[self.studycourse_name]
+        return student[studycourseName(row)]
 
     def getEntry(self, row, site):
@@ -707,5 +726,4 @@
     iface = ICourseTicketImport
     factory_name = 'waeup.CourseTicket'
-    studycourse_name = 'studycourse'
 
     additional_fields = ['level', 'code']
@@ -719,5 +737,5 @@
             'outstanding', 'course_category', 'level_session',
             'title', 'credits', 'passmark', 'semester', 'ticket_session',
-            'unlock_score'
+            'unlock_score', 'previous'
             ] + self.additional_fields
         return sorted(fields)
@@ -727,5 +745,5 @@
         if student is None:
             return None
-        return student[self.studycourse_name].get(str(row['level']))
+        return student[studycourseName(row)].get(str(row['level']))
 
     def getEntry(self, row, site):
@@ -1085,36 +1103,2 @@
         notify(grok.ObjectModifiedEvent(obj.__parent__))
         return
-
-class FirstStudentStudyCourseProcessor(StudentStudyCourseProcessor):
-    """The First Student Study Course Processor imports first
-    study course data of students who have been transferred.
-    """
-    util_name = 'studycourseprocessor_1'
-    grok.name(util_name)
-    name = _('FirstStudentStudyCourse Processor')
-    studycourse_name = 'studycourse_1'
-
-    def addEntry(self, obj, row, site):
-        parent = self.getParent(row, site)
-        parent[self.studycourse_name] = obj
-        return
-
-class FirstStudentStudyLevelProcessor(StudentStudyLevelProcessor):
-    """The First Student Study Level Processor imports study level data
-    into first study course containers of students who have been transferred.
-    """
-    util_name = 'studylevelprocessor_1'
-    grok.name(util_name)
-    name = _('FirstStudentStudyLevel Processor')
-    studycourse_name = 'studycourse_1'
-
-class FirstCourseTicketProcessor(CourseTicketProcessor):
-    """The First Course Ticket Processor imports course tickets into
-    first study level containers of students who have been transferred.
-    """
-    util_name = 'courseticketprocessor_1'
-    grok.name(util_name)
-    name = _('FirstCourseTicket Processor')
-    iface = ICourseTicketImport
-    factory_name = 'waeup.CourseTicket'
-    studycourse_name = 'studycourse_1'
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/export.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/export.py	(revision 16830)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/export.py	(revision 16831)
@@ -415,6 +415,8 @@
     """
     grok.name('studentstudycourses')
-
-    fields = tuple(sorted(iface_names(IStudentStudyCourse))) + ('student_id',)
+    previous = 0
+
+    fields = tuple(sorted(iface_names(IStudentStudyCourse))) + (
+        'student_id', 'previous')
     title = _(u'Student Study Courses (Data Backup)')
 
@@ -431,4 +433,6 @@
             student = context.student
             value = getattr(student, name, None)
+        if name == 'previous':
+            return self.previous
         return super(
             StudentStudyCourseExporter, self).mangle_value(
@@ -440,5 +444,5 @@
     """
     grok.name('studentstudycourses_1')
-
+    previous = 1
     title = _(u'First Student Study Courses (Data Backup)')
 
@@ -451,5 +455,5 @@
     """
     grok.name('studentstudycourses_2')
-
+    previous = 2
     title = _(u'Second Student Study Courses (Data Backup)')
 
@@ -465,8 +469,9 @@
     """
     grok.name('studentstudylevels')
+    previous = 0
 
     fields = tuple(sorted(iface_names(
         IStudentStudyLevel))) + (
-        'student_id', 'number_of_tickets','certcode')
+        'student_id', 'number_of_tickets','certcode', 'previous')
     title = _(u'Student Study Levels (Data Backup)')
 
@@ -480,4 +485,6 @@
             student = context.student
             value = getattr(student, name, None)
+        if name == 'previous':
+            return self.previous
         return super(
             StudentStudyLevelExporter, self).mangle_value(
@@ -489,5 +496,5 @@
     """
     grok.name('studentstudylevels_1')
-
+    previous = 1
     title = _(u'First Course Student Study Levels (Data Backup)')
 
@@ -500,5 +507,5 @@
     """
     grok.name('studentstudylevels_2')
-
+    previous = 2
     title = _(u'Second Course Student Study Levels (Data Backup)')
 
@@ -524,6 +531,7 @@
     fields = tuple(sorted(iface_names(ICourseTicket) +
         ['level', 'code', 'level_session'])) + ('student_id',
-        'certcode', 'display_fullname')
+        'certcode', 'display_fullname', 'previous')
     title = _(u'Course Tickets (Data Backup)')
+    previous = 0
 
     def filter_func(self, x, **kw):
@@ -537,4 +545,6 @@
             if name in ('student_id', 'display_fullname') and student is not None:
                 value = getattr(student, name, None)
+        if name == 'previous':
+            return self.previous
         return super(
             CourseTicketExporter, self).mangle_value(
@@ -546,5 +556,5 @@
     """
     grok.name('coursetickets_1')
-
+    previous = 1
     title = _(u'First Course Course Tickets (Data Backup)')
 
@@ -557,5 +567,5 @@
     """
     grok.name('coursetickets_2')
-
+    previous = 2
     title = _(u'Second Course Course Tickets (Data Backup)')
 
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_courseticket_data.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_courseticket_data.csv	(revision 16831)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_courseticket_data.csv	(revision 16831)
@@ -0,0 +1,10 @@
+reg_number,matric_number,level,code,score,mandatory,level_session,ticket_session,unlock_score,previous
+1,,100,COURSE1,1,True,,,,1
+2,,100,COURSE1,2,False,,,,1
+,100002,100,COURSE1,3,False,,,,1
+1,,200,COURSE1,1,True,2008,,,1
+1,,nonsense,COURSE1,5,,,,,1
+1,,100,NONSENSE,5,,,,,1
+1,,200,COURSE1,6,,2004,,,1
+1,,300,COURSE1,6,,2008,,,1
+1,,300,COURSE1,6,,2008X,,,1
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_studycourse_data.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_studycourse_data.csv	(revision 16831)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_studycourse_data.csv	(revision 16831)
@@ -0,0 +1,11 @@
+reg_number,matric_number,certificate,current_session,current_level,previous
+1,,CERT1,2008,200,1
+2,,CERT1,2008,200,1
+,100002,CERT1,2008,200,1
+1,,CERT1,2008,100,1
+4,,CERT1,2008,200,1
+5,,CERT1,2008,200,1
+6,,CERT1,2008,200,1
+7,,CERT1,2008,200,1
+8,,CERT1,2008,200,1
+9,,CERT1,2008,200,1
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_studylevel_data.csv
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_studylevel_data.csv	(revision 16831)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_first_studylevel_data.csv	(revision 16831)
@@ -0,0 +1,13 @@
+reg_number,matric_number,level_session,level_verdict,level,previous
+1,,2008,,100,1
+1,,2008,,200,1
+2,,2008,B,100,1
+,100002,2009,C,100,1
+1,,2008,A,111,1
+1,,2008,A,nonsense,1
+1,,2008,A,<IGNORE>,1
+4,,2008,A,200,1
+5,,2008,A,200,1
+6,,2008,A,200,1
+7,,2008,A,200,1
+9,,2008,A,200,1
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py	(revision 16830)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py	(revision 16831)
@@ -40,7 +40,5 @@
     StudentStudyLevelProcessor, CourseTicketProcessor,
     StudentOnlinePaymentProcessor, StudentVerdictProcessor,
-    FirstStudentStudyCourseProcessor,
-    FirstStudentStudyLevelProcessor,
-    FirstCourseTicketProcessor)
+    )
 from waeup.kofa.students.payments import StudentOnlinePayment
 from waeup.kofa.students.student import Student
@@ -95,4 +93,11 @@
     '\n')[0].split(',')
 
+FIRST_STUDYCOURSE_SAMPLE_DATA = open(
+    os.path.join(os.path.dirname(__file__), 'sample_first_studycourse_data.csv'),
+    'rb').read()
+
+FIRST_STUDYCOURSE_HEADER_FIELDS = FIRST_STUDYCOURSE_SAMPLE_DATA.split(
+    '\n')[0].split(',')
+
 TRANSFER_SAMPLE_DATA = open(
     os.path.join(os.path.dirname(__file__), 'sample_transfer_data.csv'),
@@ -140,4 +145,11 @@
     '\n')[0].split(',')
 
+FIRST_STUDYLEVEL_SAMPLE_DATA = open(
+    os.path.join(os.path.dirname(__file__), 'sample_first_studylevel_data.csv'),
+    'rb').read()
+
+FIRST_STUDYLEVEL_HEADER_FIELDS = FIRST_STUDYLEVEL_SAMPLE_DATA.split(
+    '\n')[0].split(',')
+
 COURSETICKET_SAMPLE_DATA = open(
     os.path.join(os.path.dirname(__file__), 'sample_courseticket_data.csv'),
@@ -145,4 +157,11 @@
 
 COURSETICKET_HEADER_FIELDS = COURSETICKET_SAMPLE_DATA.split(
+    '\n')[0].split(',')
+
+FIRST_COURSETICKET_SAMPLE_DATA = open(
+    os.path.join(os.path.dirname(__file__), 'sample_first_courseticket_data.csv'),
+    'rb').read()
+
+FIRST_COURSETICKET_HEADER_FIELDS = FIRST_COURSETICKET_SAMPLE_DATA.split(
     '\n')[0].split(',')
 
@@ -1141,13 +1160,15 @@
 
     def test_import_firstcourse_with_content(self):
-        processor = FirstStudentStudyCourseProcessor()
+        processor = StudentStudyCourseProcessor()
         csv_file = os.path.join(
-            self.workdir, 'sample_studycourse_data.csv')
+            self.workdir, 'sample_first_studycourse_data.csv')
+        open(csv_file, 'wb').write(FIRST_STUDYCOURSE_SAMPLE_DATA)
         num, num_warns, fin_file, fail_file = processor.doImport(
-            csv_file, STUDYCOURSE_HEADER_FIELDS,'create')
+            csv_file, FIRST_STUDYCOURSE_HEADER_FIELDS,'create')
         self.assertEqual(num_warns,1)
         content = open(fail_file).read()
         self.assertTrue('current_level: not in range' in content)
-        studycourse = processor.getEntry(dict(reg_number='1'), self.app)
+        studycourse = processor.getEntry(
+            dict(reg_number='1', previous='1'), self.app)
         self.assertEqual(studycourse.certificate.code, u'CERT1')
         self.assertEqual(studycourse.__name__, u'studycourse_1')
@@ -1156,9 +1177,11 @@
         self.assertEqual([i for i in results[0].keys()],
             [u'accommodation', u'payments', u'studycourse', u'studycourse_1'])
-        processor = FirstStudentStudyLevelProcessor()
+
+        processor = StudentStudyLevelProcessor()
         csv_file = os.path.join(
-            self.workdir, 'sample_studylevel_data.csv')
+            self.workdir, 'sample_first_studylevel_data.csv')
+        open(csv_file, 'wb').write(FIRST_STUDYLEVEL_SAMPLE_DATA)
         num, num_warns, fin_file, fail_file = processor.doImport(
-            csv_file, STUDYLEVEL_HEADER_FIELDS,'create')
+            csv_file, FIRST_STUDYLEVEL_HEADER_FIELDS,'create')
         self.assertEqual(num_warns,3)
         assert processor.entryExists(
@@ -1172,11 +1195,14 @@
         self.assertEqual([i for i in results[0]['studycourse_1'].keys()],
             [u'100', u'200'])
-        processor = FirstCourseTicketProcessor()
+
+        processor = CourseTicketProcessor()
         csv_file = os.path.join(
-            self.workdir, 'sample_courseticket_data.csv')
+            self.workdir, 'sample_first_courseticket_data.csv')
+        open(csv_file, 'wb').write(FIRST_COURSETICKET_SAMPLE_DATA)
         num, num_warns, fin_file, fail_file = processor.doImport(
-            csv_file, COURSETICKET_HEADER_FIELDS,'create')
+            csv_file, FIRST_COURSETICKET_HEADER_FIELDS,'create')
         assert processor.entryExists(
-            dict(reg_number='1', level='100', code='COURSE1'), self.app) is True
+            dict(reg_number='1', level='100',
+                 code='COURSE1', previous='1'), self.app) is True
         self.assertEqual([i for i in results[0]['studycourse_1']['100'].keys()],
             [u'COURSE1'])
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py	(revision 16830)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py	(revision 16831)
@@ -416,7 +416,7 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-
-            ',,,0,,,0,\r\n'
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+
+            ',,,0,,,0,,0\r\n'
             )
         return
@@ -433,7 +433,7 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-
-            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+
+            'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n'
             )
         return
@@ -449,7 +449,7 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-
-            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+
+            'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n'
             )
         return
@@ -464,7 +464,7 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-
-            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+
+            'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n'
             )
         return
@@ -483,7 +483,7 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-
-            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+
+            'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n'
             )
         return
@@ -501,7 +501,7 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-
-            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+
+            'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n'
             )
         return
@@ -519,7 +519,7 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-
-            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n'
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+
+            'CERT1,200,2012,0,ug_ft,2010,0,A111111,0\r\n'
             )
         return
@@ -549,5 +549,5 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
             )
         error = self.student.transfer(self.certificate2, current_session=2013)
@@ -558,6 +558,6 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-            'CERT1,200,2012,0,ug_ft,2010,0,A111111\r\n')
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+            'CERT1,200,2012,0,ug_ft,2010,0,A111111,1\r\n')
         error = self.student.transfer(self.certificate,
                                       current_session=2014,
@@ -570,6 +570,6 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-            'CERT2,,2013,,transfer,2010,,A111111\r\n')
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+            'CERT2,,2013,,transfer,2010,,A111111,2\r\n')
         exporter = StudentStudyCourseExporter()
         exporter.export_all(self.app, self.outfile)
@@ -578,6 +578,6 @@
             result,
             'certificate,current_level,current_session,current_verdict,'
-            'entry_mode,entry_session,previous_verdict,student_id\r\n'
-            'CERT1,300,2014,,transfer,2010,,A111111\r\n')
+            'entry_mode,entry_session,previous_verdict,student_id,previous\r\n'
+            'CERT1,300,2014,,transfer,2010,,A111111,0\r\n')
         return
 
@@ -591,5 +591,5 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,student_id,'
-            'number_of_tickets,certcode\r\n'
+            'number_of_tickets,certcode,previous\r\n'
             )
         error = self.student.transfer(self.certificate2, current_session=2013)
@@ -601,6 +601,6 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,student_id,'
-            'number_of_tickets,certcode\r\n'
-            '0.00,100,2012,A,100,,,,A111111,1,CERT1\r\n' )
+            'number_of_tickets,certcode,previous\r\n'
+            '0.00,100,2012,A,100,,,,A111111,1,CERT1,1\r\n' )
         study_level = StudentStudyLevel()
         study_level.level_session = 2015
@@ -620,6 +620,6 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,student_id,'
-            'number_of_tickets,certcode\r\n'
-            '0.00,400,2015,C,0,,,,A111111,0,CERT2\r\n')
+            'number_of_tickets,certcode,previous\r\n'
+            '0.00,400,2015,C,0,,,,A111111,0,CERT2,2\r\n')
         exporter = StudentStudyLevelExporter()
         exporter.export_all(self.app, self.outfile)
@@ -629,5 +629,5 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,student_id,'
-            'number_of_tickets,certcode\r\n')
+            'number_of_tickets,certcode,previous\r\n')
         return
 
@@ -642,5 +642,5 @@
             'fcode,level,level_session,mandatory,outstanding,passmark,'
             'score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             )
         error = self.student.transfer(self.certificate2, current_session=2013)
@@ -653,7 +653,7 @@
             'fcode,level,level_session,mandatory,outstanding,passmark,'
             'score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,'
-            'A111111,CERT1,Anna M. Tester\r\n')
+            'A111111,CERT1,Anna M. Tester,1\r\n')
         study_level = StudentStudyLevel()
         study_level.level_session = 2015
@@ -685,6 +685,6 @@
             'fcode,level,level_session,mandatory,outstanding,passmark,'
             'score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n1,1,CRS9,,150,DEP9,FAC9,400,2015,0,0,'
-            '100,,2,,Course 9,A111111,CERT2,Anna M. Tester\r\n')
+            'display_fullname,previous\r\n1,1,CRS9,,150,DEP9,FAC9,400,2015,0,0,'
+            '100,,2,,Course 9,A111111,CERT2,Anna M. Tester,2\r\n')
         exporter = CourseTicketExporter()
         exporter.export_all(self.app, self.outfile)
@@ -695,5 +695,5 @@
             'fcode,level,level_session,mandatory,outstanding,passmark,'
             'score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             )
         return
@@ -731,6 +731,6 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,'
-            'student_id,number_of_tickets,certcode\r\n'
-            '0.00,,,0,0,,,,,0,\r\n'
+            'student_id,number_of_tickets,certcode,previous\r\n'
+            '0.00,,,0,0,,,,,0,,0\r\n'
             )
         return
@@ -749,6 +749,6 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,'
-            'student_id,number_of_tickets,certcode\r\n'
-            '0.00,100,2012,A,100,,,,A111111,1,CERT1\r\n'
+            'student_id,number_of_tickets,certcode,previous\r\n'
+            '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n'
             )
         return
@@ -765,6 +765,6 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,'
-            'student_id,number_of_tickets,certcode\r\n'
-            '0.00,100,2012,A,100,,,,A111111,1,CERT1\r\n'
+            'student_id,number_of_tickets,certcode,previous\r\n'
+            '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n'
             )
         return
@@ -780,6 +780,6 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,'
-            'student_id,number_of_tickets,certcode\r\n'
-            '0.00,100,2012,A,100,,,,A111111,1,CERT1\r\n'
+            'student_id,number_of_tickets,certcode,previous\r\n'
+            '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n'
             )
         return
@@ -799,6 +799,6 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,'
-            'student_id,number_of_tickets,certcode\r\n'
-            '0.00,100,2012,A,100,,,,A111111,1,CERT1\r\n'
+            'student_id,number_of_tickets,certcode,previous\r\n'
+            '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n'
             )
         return
@@ -818,6 +818,6 @@
             'gpa,level,level_session,level_verdict,total_credits,'
             'transcript_remark,validated_by,validation_date,'
-            'student_id,number_of_tickets,certcode\r\n'
-            '0.00,100,2012,A,100,,,,A111111,1,CERT1\r\n'
+            'student_id,number_of_tickets,certcode,previous\r\n'
+            '0.00,100,2012,A,100,,,,A111111,1,CERT1,0\r\n'
             )
         return
@@ -855,6 +855,6 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
-            '0,0,,,,,,,,0,0,,,,,,,,\r\n'
+            'display_fullname,previous\r\n'
+            '0,0,,,,,,,,0,0,,,,,,,,,0\r\n'
             )
         return
@@ -874,7 +874,7 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,'
-            'Anna M. Tester\r\n'
+            'Anna M. Tester,0\r\n'
             )
         return
@@ -891,7 +891,7 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,'
-            'Anna M. Tester\r\n'
+            'Anna M. Tester,0\r\n'
             )
         return
@@ -907,7 +907,7 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,'
-            'Anna M. Tester\r\n'
+            'Anna M. Tester,0\r\n'
             )
         return
@@ -926,7 +926,7 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,'
-            'Anna M. Tester\r\n'
+            'Anna M. Tester,0\r\n'
             )
         # We can set the course tickets level, semester and level_session 
@@ -940,7 +940,7 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,'
-            'Anna M. Tester\r\n'
+            'Anna M. Tester,0\r\n'
             )
         # 'all' does select all
@@ -953,7 +953,7 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,'
-            'Anna M. Tester\r\n'
+            'Anna M. Tester,0\r\n'
             )
         # Level 200 tickets do not exist.
@@ -965,5 +965,5 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
                         )
         # Session 2013 tickets do not exist.
@@ -976,5 +976,5 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             )
         # 1st semester tickets do not exist.
@@ -987,5 +987,5 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             )
         # If the coursetickets catalog is used to filter students
@@ -999,7 +999,7 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,100,2012,0,0,100,,2,,Course 1,A111111,CERT1,'
-            'Anna M. Tester\r\n'
+            'Anna M. Tester,0\r\n'
             )
         exporter.export_filtered(
@@ -1010,5 +1010,5 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             )
         # Also tickets in probating levels are exported. Therefore
@@ -1023,7 +1023,7 @@
             'automatic,carry_over,code,course_category,credits,dcode,fcode,level,level_session,'
             'mandatory,outstanding,passmark,score,semester,ticket_session,title,student_id,certcode,'
-            'display_fullname\r\n'
+            'display_fullname,previous\r\n'
             '1,1,CRS1,,100,DEP1,FAC1,110,2012,0,0,100,,2,,Course 1,A111111,CERT1,'
-            'Anna M. Tester\r\n'
+            'Anna M. Tester,0\r\n'
             )
         return
