Fixing progran validation issues

Change-Id: I080ef2783317f1d2c7a7b36886a4e68c99bd4287
diff --git a/Dockerfile.synchronizer b/Dockerfile.synchronizer
index c41dd79..a07d3e6 100644
--- a/Dockerfile.synchronizer
+++ b/Dockerfile.synchronizer
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# docker build -t 10.90.0.131:30500/xosproject/progran-synchronizer:candidate -f Dockerfile.synchronizer .
+
 # xosproject/progran-synchronizer
 
 FROM xosproject/xos-synchronizer-base:2.1.38
diff --git a/VERSION b/VERSION
index 157e54f..f1547e6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0.6
+2.0.7
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