Index: main/waeup.kofa/trunk/tools/add_old_id_col.py
===================================================================
--- main/waeup.kofa/trunk/tools/add_old_id_col.py	(revision 9362)
+++ main/waeup.kofa/trunk/tools/add_old_id_col.py	(revision 9362)
@@ -0,0 +1,31 @@
+"""Add a new column old id with contents from col `student_id`
+"""
+
+###
+### CONFIGURATION
+###
+
+IN_FILE = 'mytry.csv'
+
+# new col name. 'old_id' is expected by fix_import_file.py
+NEW_COL = 'old_id'
+
+###
+### CONFIGURATION - END
+###
+
+
+import csv
+OUT_FILE = '%s_edited.csv' % IN_FILE.split('.')[0]
+reader = csv.DictReader(open(IN_FILE, 'rb'))
+
+for num, row in enumerate(reader):
+    if num == 0:
+        writer = csv.DictWriter(
+            open(OUT_FILE, 'wb'), reader.fieldnames + [NEW_COL,])
+        header = dict([(x, x) for x in writer.fieldnames])
+        writer.writerow(header)
+    row[NEW_COL] = row['student_id']
+    writer.writerow(row)
+
+print "RESULT in ", OUT_FILE
Index: main/waeup.kofa/trunk/tools/copy_media_files.py
===================================================================
--- main/waeup.kofa/trunk/tools/copy_media_files.py	(revision 9361)
+++ main/waeup.kofa/trunk/tools/copy_media_files.py	(revision 9362)
@@ -28,4 +28,10 @@
 ## The Ids of new students to search for in old portal.
 NEW_IDS_CSV = "StudentIds.csv"
+
+## The ids of students that will will get a complete new number, not
+## an updated one. Must contain a mapping of old ids to new ids.
+## If no such update should be performed, please set the constant to None.
+ID_MAP_CSV = None
+ID_MAP_CSV = "id_mapping.csv"
 
 ## Permissions to be set on new files/dirs. Set OWNER and/or GROUP to
@@ -79,5 +85,5 @@
 
 def copy_file(file_src, file_dst):
-    create_path(os.path.dirname(dst))
+    create_path(os.path.dirname(file_dst))
     print "COPY FILE: %s -> %s" % (file_src, file_dst)
     shutil.copyfile(file_src, file_dst)
@@ -85,9 +91,30 @@
     return
 
+def get_new_old_id_mapping():
+    """Returns a dict mapping from _new_ ids to old (SRP) ids.
+
+    The dict is read from ID_MAP_CSV file. If this var is set to
+    ``None`` an empty dict is returned. The ID_MAP_CSV contains only
+    the student ids of those students, for which the standard method
+    (new_id=CHAR+old_id) does not work.
+    """
+    if ID_MAP_CSV is None:
+        return {}
+    if not os.path.isfile(ID_MAP_CSV):
+        raise IOError(
+            "No such file for mapping new to old ids: %s" % ID_MAP_CSV)
+    result = dict()
+    reader = csv.DictReader(open(ID_MAP_CSV, 'rb'))
+    for row in reader:
+        result[row['new_id']] = row['student_id']
+    return result
+
+# special ids not handled in common way
+new_to_old_map = get_new_old_id_mapping()
 removable_dirs = []
 reader = csv.DictReader(open(NEW_IDS_CSV, 'rb'))
 for row in reader:
     new_stud_id = row['student_id']
-    stud_id = new_stud_id[1:]
+    stud_id = new_to_old_map.get(new_stud_id[1:], new_stud_id[1:])
     src_folder = os.path.join(SRC_DIR, stud_id[0], stud_id)
     dst_folder = os.path.join(DST_DIR, new_folder_name(stud_id), new_stud_id)
Index: main/waeup.kofa/trunk/tools/fix_import_file.py
===================================================================
--- main/waeup.kofa/trunk/tools/fix_import_file.py	(revision 9361)
+++ main/waeup.kofa/trunk/tools/fix_import_file.py	(revision 9362)
@@ -36,4 +36,5 @@
 import csv
 import datetime
+import os
 import re
 import sys
@@ -159,4 +160,5 @@
     'session_id': 'p_session',
     'type': 'r_company',
+    'old_id': 'old_id',
     }
 
@@ -177,4 +179,9 @@
     }
 
+# Mapping of special cases, where new id is not deductible from old id
+# Set to `None`, if no such special cases should be considered.
+ID_MAP_CSV = None
+ID_MAP_CSV = "id_mapping.csv"
+
 ##
 ## END OF CONFIG
@@ -183,4 +190,24 @@
 # Look for the first sequence of numbers
 RE_PHONE = re.compile('[^\d]*(\d*)[^\d]*')
+
+def get_id_mapping():
+    """Returns a dict mapping from old (SRP) ids to new ids.
+
+    The dict is read from ID_MAP_CSV file. If this var is set to
+    ``None`` an empty dict is returned. The ID_MAP_CSV contains only
+    the student ids of those students, for which the standard method
+    (new_id=CHAR+old_id) does not work.
+    """
+    if ID_MAP_CSV is None:
+        return {}
+    if not os.path.isfile(ID_MAP_CSV):
+        raise IOError(
+            "No such file for mapping old to new ids: %s" % ID_MAP_CSV)
+    result = dict()
+    reader = csv.DictReader(open(ID_MAP_CSV, 'rb'))
+    for row in reader:
+        result[row['student_id']] = row['new_id']
+    return result
+
 
 def convert_fieldnames(fieldnames):
@@ -201,8 +228,11 @@
     """
 
-    @classmethod
-    def student_id(self, value, row):
+    old_new_id_map = get_id_mapping()
+
+    @classmethod
+    def student_id(cls, value, row):
         """ 'A123456' --> 'EA123456'
         """
+        value = cls.old_new_id_map.get(value, value)
         if len(value) == 7:
             return 'M' + value
