← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18688: tracker-capture: bug fix in TEI registration

 

------------------------------------------------------------
revno: 18688
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-03-26 14:07:35 +0100
message:
  tracker-capture: bug fix in TEI registration
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-03-26 12:26:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2015-03-26 13:07:35 +0000
@@ -112,7 +112,7 @@
         //get selected entity        
         if(!$scope.selectedTei.trackedEntityInstance){
             $scope.selectedTei.trackedEntity = $scope.tei.trackedEntity = $scope.selectedProgram && $scope.selectedProgram.trackedEntity && $scope.selectedProgram.trackedEntity.id ? $scope.selectedProgram.trackedEntity.id : $scope.trackedEntities.selected.id;
-            $scope.selectedTei.orgUnit = $scope.selectedTei.orgUnit = $scope.selectedOrgUnit.id;
+            $scope.selectedTei.orgUnit = $scope.tei.orgUnit = $scope.selectedOrgUnit.id;
             $scope.selectedTei.attributes = $scope.selectedTei.attributes = [];
         }
         
@@ -144,6 +144,7 @@
                         enrollment.trackedEntityInstance = $scope.tei.trackedEntityInstance;
                         enrollment.program = $scope.selectedProgram.id;
                         enrollment.status = 'ACTIVE';
+                        enrollment.orgUnit = $scope.selectedOrgUnit.id;
                         enrollment.dateOfEnrollment = $scope.selectedEnrollment.dateOfEnrollment;
                         enrollment.dateOfIncident = $scope.selectedEnrollment.dateOfIncident === '' ? $scope.selectedEnrollment.dateOfEnrollment : $scope.selectedEnrollment.dateOfIncident;
 
@@ -171,6 +172,9 @@
                             }
                         });
                     }
+                    else{
+                       notifyRegistrtaionCompletion(destination, $scope.tei.trackedEntityInstance); 
+                    }
                 }                
             }
             else{//update/registration has failed

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-03-25 16:43:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-03-26 13:07:35 +0000
@@ -674,10 +674,12 @@
         },
         register: function(tei, optionSets, attributesById){
             var formattedTei = angular.copy(tei);
-            angular.forEach(formattedTei.attributes, function(att){                        
-                att.value = AttributesFactory.formatAttributeValue(att, attributesById, optionSets, 'API');                                                                
+            var attributes = [];
+            angular.forEach(formattedTei.attributes, function(att){ 
+                attributes.push({attribute: att.attribute, value: AttributesFactory.formatAttributeValue(att, attributesById, optionSets, 'API')});
             });
             
+            formattedTei.attributes = attributes;
             var promise = $http.post( '../api/trackedEntityInstances' , formattedTei ).then(function(response){                    
                 return response.data;
             });