← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13877: only join in organisationunit table if needed in person search

 

------------------------------------------------------------
revno: 13877
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-28 18:08:31 +0700
message:
  only join in organisationunit table if needed in person search
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java


--
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-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2014-01-28 11:02:46 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/PersonController.java	2014-01-28 11:08:31 +0000
@@ -135,7 +135,6 @@
     private Persons personsByFilter( List<String> filters, String orgUnitUid )
     {
         Criteria criteria = sessionFactory.getCurrentSession().createCriteria( Patient.class );
-        criteria.createAlias( "organisationUnit", "organisationUnit" );
         criteria.createAlias( "attributeValues", "attributeValue" );
         criteria.createAlias( "attributeValue.patientAttribute", "attribute" );
 
@@ -151,6 +150,7 @@
                 throw new HttpClientErrorException( HttpStatus.BAD_REQUEST, "OrganisationUnit with UID " + orgUnitUid + " does not exist." );
             }
 
+            criteria.createAlias( "organisationUnit", "organisationUnit" );
             criteria.add( Restrictions.eq( "organisationUnit.uid", orgUnitUid ) );
         }