Fixing progran validation issues

Change-Id: I080ef2783317f1d2c7a7b36886a4e68c99bd4287
diff --git a/xos/synchronizer/steps/helpers.py b/xos/synchronizer/steps/helpers.py
index 077d559..aab5aa9 100644
--- a/xos/synchronizer/steps/helpers.py
+++ b/xos/synchronizer/steps/helpers.py
@@ -57,10 +57,15 @@
         return time.mktime(datetime.datetime.strptime(d, "%d.%m.%Y %H:%S").timetuple())
 
     @staticmethod
+    def int_to_string(i):
+        return str(i)
+
+    @staticmethod
     def update_fields(model, dict, mapping={}, transformations={}):
         dict = ProgranHelpers.convert_keys(dict, mapping, transformations)
         for k, v in dict.iteritems():
             if hasattr(model, k):
+                log.debug("Setting %s=%s on %s" % (k, v, model.model_name))
                 setattr(model, k, v)
             # else:
             #     log.debug("%s does not have a '%s' property, not updating it" % (model.model_name, k))
@@ -74,7 +79,7 @@
                 if k in transformations:
                     dict[k] = transformations[k](v)
 
-                # NOTE we may have different names that the field in the dict
+                # NOTE we may have different names than the field in the dict
                 dict[mapping[k]] = dict[k]
                 del dict[k]
         return dict
diff --git a/xos/synchronizer/steps/sync_imsi_back.py b/xos/synchronizer/steps/sync_imsi_back.py
index 7be4921..e81232c 100644
--- a/xos/synchronizer/steps/sync_imsi_back.py
+++ b/xos/synchronizer/steps/sync_imsi_back.py
@@ -66,6 +66,10 @@
             'UeStatus': 'ue_status'
         }
 
+        field_transformations = {
+            'UeStatus': ProgranHelpers.int_to_string,
+        }
+
         updated_imsi = []
 
         for i in res:
@@ -82,7 +86,7 @@
 
                 log.debug("IMSI %s is new, creating it" % i['IMSI'])
 
-            si = ProgranHelpers.update_fields(si, i, field_mapping,)
+            si = ProgranHelpers.update_fields(si, i, field_mapping, field_transformations)
 
             si.save()
 
diff --git a/xos/synchronizer/steps/sync_progranserviceinstance_back.py b/xos/synchronizer/steps/sync_progranserviceinstance_back.py
index c50773b..25a92e9 100644
--- a/xos/synchronizer/steps/sync_progranserviceinstance_back.py
+++ b/xos/synchronizer/steps/sync_progranserviceinstance_back.py
@@ -67,7 +67,7 @@
         field_mapping = {
             'Name': 'name',
             'Start': 'start',
-            'End': 'end'
+            'End': 'end',
         }
 
         field_transformations = {
@@ -135,6 +135,10 @@
                 updated_profiles.append(si.name)
                 continue
 
+            # ugly fix
+            if p['AdmControl']:
+                p['AdmControl'] = str(p['AdmControl'])
+
             si = ProgranHelpers.update_fields(si, p, field_mapping, field_transformations)
 
             # checking for handovers
@@ -157,8 +161,8 @@
             # Assigning handover to profile
             si.handover = handover
 
-            si.backend_status = "OK"
-            si.backend_code = 1
+            # si.backend_status = "OK"
+            # si.backend_code = 1
 
             si.no_sync = True
             si.previously_sync = True