← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15676: Revert R. 15675

 

------------------------------------------------------------
revno: 15676
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-06-14 15:44:15 +0800
message:
  Revert R. 15675
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.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-api/src/main/java/org/hisp/dhis/common/QueryItem.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java	2014-06-14 03:35:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryItem.java	2014-06-14 07:44:15 +0000
@@ -40,8 +40,6 @@
  */
 public class QueryItem
 {
-    public static final String ALL = "ALL";
-    
     private IdentifiableObject item;
 
     private List<QueryFilter> filters = new ArrayList<QueryFilter>();
@@ -74,17 +72,6 @@
         }
     }
     
-    public QueryItem( IdentifiableObject item, QueryOperator operator, String filter )
-    {
-        this.item = item;
-        this.numeric = false;
-        
-        if ( operator != null && filter != null )
-        {
-            this.filters.add( new QueryFilter( operator, filter ) );
-        }
-    }
-    
     public QueryItem( IdentifiableObject item, List<QueryFilter> filters, boolean numeric )
     {
         this.item = item;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java	2014-06-14 03:35:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java	2014-06-14 07:44:15 +0000
@@ -297,6 +297,7 @@
     {
         Set<QueryItem> items = new HashSet<QueryItem>();
         List<QueryItem> duplicates = new ArrayList<QueryItem>();
+        
         for ( QueryItem item : getAttributes() )
         {
             if ( !items.add( item ) )

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2014-06-14 03:35:05 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2014-06-14 07:44:15 +0000
@@ -451,8 +451,8 @@
     private QueryItem getItem( String item, String operator, String filter )
     {
         TrackedEntityAttribute at = attributeService.getTrackedEntityAttribute( item );
-        
-        if (  !item.equals( QueryItem.ALL ) && at == null )
+
+        if ( at == null )
         {
             throw new IllegalQueryException( "Attribute does not exist: " + item );
         }
@@ -461,16 +461,7 @@
         {
             QueryOperator op = QueryOperator.fromString( operator );
             
-            if( at==null )
-            {
-                at = new TrackedEntityAttribute();
-                at.setUid( item );
-                return new QueryItem( at, op, filter );
-            }
-            else 
-            {
-                return new QueryItem( at, op, filter, at.isNumericType() );
-            }
+            return new QueryItem( at, op, filter, at.isNumericType() );
         }
         else
         {

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java	2014-06-14 03:35:05 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/hibernate/HibernateTrackedEntityInstanceStore.java	2014-06-14 07:44:15 +0000
@@ -227,12 +227,8 @@
             final String joinClause = item.hasFilter() ? "inner join" : "left join";
 
             sql += joinClause + " " + 
-                "trackedentityattributevalue as " + col + " " + "on " + col + ".trackedentityinstanceid = tei.trackedentityinstanceid ";
-
-            if( !item.getItemId().equals( QueryItem.ALL ) )
-            {
-                sql += "and " + col + ".trackedentityattributeid = " + item.getItem().getId() + " ";
-            }
+                "trackedentityattributevalue as " + col + " " + "on " + col + ".trackedentityinstanceid = tei.trackedentityinstanceid " + 
+                "and " + col + ".trackedentityattributeid = " + item.getItem().getId() + " ";
 
             if ( !params.isOrQuery() && item.hasFilter() )
             {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js	2014-06-14 03:35:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/trackedEntityInstance.js	2014-06-14 07:44:15 +0000
@@ -616,30 +616,19 @@
 	if( getFieldValue('searchPatientByAttributes')==''){
 		return;
 	}
-	var params = "ou=" + getFieldValue("orgunitId");
-	params += "&page=1";
-	if (getFieldValue('program') != '') {
-		params += "&program=" + getFieldValue('program');
-		if( getFieldValue('programStatus')!=""){
-			params += "&programStatus=" + getFieldValue('programStatus');
-		}
-	}
-	
-	params += "&filter=ALL:LIKE:" + getFieldValue('searchPatientByAttributes');
-	
-	$('#attributeIds option').each(function(i, item) {
-		params += "&attribute=" + item.value;
-	}); 
-	
-	$.ajax({
-		url : '../api/trackedEntityInstances.json',
-		type : "GET",
-		data : params,
-		success : function(json) {
-			setInnerHTML('listEntityInstanceDiv', displayTEIList(json, 1));
+	
+	jQuery('#listEntityInstanceDiv').load(
+		'searchTrackedEntityInstance.action', {
+			orgunitId: getFieldValue('orgunitId'),
+			attributeValue: getFieldValue('searchPatientByAttributes'),
+			programId: getFieldValue('program')
+		}, function() {
+			setInnerHTML('orgunitInfor', getFieldValue('orgunitName'));
+			if( getFieldValue('program')!= ''){
+				var programName = jQuery('#programIdAddTrackedEntity option:selected').text();
+				setInnerHTML('enrollmentInfor', i18n_enrollments_in + " " + programName + " " + i18n_program);
+			}
 			showById('listEntityInstanceDiv');
 			jQuery('#loaderDiv').hide();
-			setTableStyles();
-		}
-	});
+		});
 }