=== 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-04-08 14:44:25 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceQueryParams.java 2014-04-08 15:19:50 +0000 @@ -252,6 +252,34 @@ } /** + * Add the given attributes to this params if they are not already present. + */ + public void addAttributesIfNotExist( List attrs ) + { + for ( QueryItem attr : attrs ) + { + if ( attributes != null && !attributes.contains( attr ) ) + { + attributes.add( attr ); + } + } + } + + /** + * Adds the given filters to this params if they are not already present. + */ + public void addFiltersIfNotExist( List filtrs ) + { + for ( QueryItem filter : filtrs ) + { + if ( filters != null && !filters.contains( filter ) ) + { + filters.add( filter ); + } + } + } + + /** * Indicates whether this params specifies any attributes and/or filters. */ public boolean hasAttributesOrFilters() === 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-04-08 14:57:15 +0000 +++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java 2014-04-08 15:19:50 +0000 @@ -152,11 +152,6 @@ @Override public Grid getTrackedEntityInstances( TrackedEntityInstanceQueryParams params ) { - if ( params != null ) - { - params.conform(); - } - validate( params ); // --------------------------------------------------------------------- @@ -177,11 +172,11 @@ // attributes. // --------------------------------------------------------------------- - if ( !params.hasAttributesOrFilters() ) + if ( params.isOrQuery() || !params.hasAttributes() ) { if ( params.hasProgram() ) { - params.getAttributes().addAll( QueryItem.getQueryItems( params.getProgram().getTrackedEntityAttributes() ) ); + params.addAttributesIfNotExist( QueryItem.getQueryItems( params.getProgram().getTrackedEntityAttributes() ) ); } else { @@ -189,17 +184,23 @@ Collection attributes = attributeService.getTrackedEntityAttributesDisplayInList( true ); filters.removeAll( attributes ); - params.getAttributes().addAll( QueryItem.getQueryItems( attributes ) ); - params.getFilters().addAll( QueryItem.getQueryItems( filters ) ); + params.addAttributesIfNotExist( QueryItem.getQueryItems( attributes ) ); + params.addFiltersIfNotExist( QueryItem.getQueryItems( filters ) ); } } - Grid grid = new ListGrid(); + // --------------------------------------------------------------------- + // Conform params + // --------------------------------------------------------------------- + + params.conform(); // --------------------------------------------------------------------- // Grid headers // --------------------------------------------------------------------- + Grid grid = new ListGrid(); + grid.addHeader( new GridHeader( TRACKED_ENTITY_INSTANCE_ID, "Instance" ) ); grid.addHeader( new GridHeader( CREATED_ID, "Created" ) ); grid.addHeader( new GridHeader( LAST_UPDATED_ID, "Last updated" ) ); === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-04-08 14:06:52 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2014-04-08 15:19:50 +0000 @@ -152,7 +152,7 @@ if (item.value == 'programDate') { p += "&programDate="; } else { - p += "&attribute=" + item.value; + p += "&filter=" + item.value; } } else if (item.name == 'dateOperator') { dateOperator = item.value;