← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20137: tracker-capture: relationship update send only necessary json properties

 

------------------------------------------------------------
revno: 20137
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-14 17:51:56 +0200
message:
  tracker-capture: relationship update send only necessary json properties
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html


--
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/relationship/relationship-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2015-09-14 15:40:35 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/relationship-controller.js	2015-09-14 15:51:56 +0000
@@ -103,7 +103,11 @@
 
             if( index !== -1 ){
                 $scope.selectedTei.relationships.splice(index,1);
-                TEIService.update($scope.selectedTei, $scope.optionSets, $scope.attributesById).then(function(response){
+                var trimmedTei = angular.copy($scope.selectedTei);
+                angular.forEach(trimmedTei.relationships, function(rel){
+                    delete rel.relative;
+                });
+                TEIService.update(trimmedTei, $scope.optionSets, $scope.attributesById).then(function(response){
                     if(response.response && response.response.status !== 'SUCCESS'){//update has failed
                         var dialogOptions = {
                                 headerText: 'update_error',
@@ -431,8 +435,8 @@
         var columns = attributes ? angular.copy(attributes) : [];
        
         //also add extra columns which are not part of attributes (orgunit for example)
-        columns.push({id: 'orgUnitName', name: 'Organisation unit', type: 'string', displayInListNoProgram: false});
-        columns.push({id: 'created', name: 'Registration date', type: 'string', displayInListNoProgram: false});
+        columns.push({id: 'orgUnitName', name: 'Organisation unit', type: 'TEXT', displayInListNoProgram: false});
+        columns.push({id: 'created', name: 'Registration date', type: 'TEXT', displayInListNoProgram: false});
         
         //generate grid column for the selected program/attributes
         angular.forEach(columns, function(column){

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html	2015-04-17 13:14:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/relationship/search.html	2015-09-14 15:51:56 +0000
@@ -43,7 +43,7 @@
                         </select>
                     </div>
                     <div ng-if="!attribute.optionSetValue" ng-switch="attribute.valueType">
-                        <div ng-switch-when="number">
+                        <div ng-switch-when="NUMBER">
                             <div class="dataelement-filter">                                                
                                 <div class="filter-operator">
                                     <select ng-model="attribute.operator" class="form-control-select2" ng-options="operator | translate for operator in defaultOperators">
@@ -62,7 +62,7 @@
                                 </div>                            
                             </div>                        
                         </div>
-                        <div ng-switch-when="date">
+                        <div ng-switch-when="DATE">
                             <div class="dataelement-filter">
                                 <div class="filter-operator">
                                     <select ng-model="attribute.operator" class="form-control-select2" ng-options="operator | translate for operator in defaultOperators">
@@ -81,7 +81,7 @@
                                 </div>                            
                             </div> 
                         </div>                        
-                        <div ng-switch-when="bool">
+                        <div ng-switch-when="BOOLEAN">
                             <select multiple ui-select2  ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
                                 <option ng-repeat="option in boolOperators" value="{{option}}">{{option| translate}}</option>
                             </select>