← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20726: tracker-capture: use exact match search for uniqueness validation

 

------------------------------------------------------------
revno: 20726
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-15 17:34:26 +0200
message:
  tracker-capture: use exact match search for uniqueness validation
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js	2015-10-09 15:13:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.validations.js	2015-10-15 15:34:26 +0000
@@ -137,7 +137,7 @@
     };
 })
 
-.directive("d2AttributeValidator", function($q, TEIService, AttributesFactory, EntityQueryFactory, SessionStorageService) {
+.directive("d2AttributeValidator", function($q, TEIService, SessionStorageService) {
     return {
         restrict: "A",         
         require: "ngModel",
@@ -151,9 +151,8 @@
                     
                     if (currentValue) {
                         
-                        attributeData.value = currentValue;
-                        var atts = AttributesFactory.generateAttributeFilters([attributeData]);
-                        var attUrl = EntityQueryFactory.getAttributesQuery(atts, null);                        
+                        attributeData.value = currentValue;                        
+                        var attUrl = 'filter=' + attributeData.id + ':EQ:' + attributeData.value;
                         var ouId = SessionStorageService.get('ouSelected');
                         
                         if(attrs.selectedProgram && attributeData.programScope){
@@ -164,7 +163,7 @@
                             ouMode = 'SELECTED';
                         }                        
 
-                        TEIService.search(ouId, ouMode, null, programUrl, attUrl.url, pager, true).then(function(data) {
+                        TEIService.search(ouId, ouMode, null, programUrl, attUrl, pager, true).then(function(data) {
                             if(attrs.selectedTeiId){
                                 if(data.rows[0][0] !== attrs.selectedTeiId){
                                     deferred.reject();