← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16563: Fixed bug - Exception thrown when to click Details button in Aggregate query builder result form.

 

------------------------------------------------------------
revno: 16563
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-08-29 18:02:02 +0700
message:
  Fixed bug - Exception thrown when to click Details button in Aggregate query builder result form.
modified:
  dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.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-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2014-08-29 06:39:13 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2014-08-29 11:02:02 +0000
@@ -1038,7 +1038,7 @@
         }
         else
         {
-        	 sql += "p.trackedentityinstanceid,p.trackedentityid,ou.name";
+            sql += "p.trackedentityinstanceid,ou.name,";
         }
 
         sql = sql.substring( 0, sql.length() - 1 );
@@ -1046,23 +1046,27 @@
 
         if( hasEntityInstance )
         {
-        	sql += " INNER JOIN trackedentityinstance p on p.trackedentityinstanceid=pi.trackedentityinstanceid ";
+            sql += " programinstance as pi INNER JOIN trackedentityinstance p on p.trackedentityinstanceid=pi.trackedentityinstanceid";
+            sql += " INNER JOIN organisationunit ou ON ou.organisationunitid=p.organisationunitid ";
         }
         
         if ( hasDataelement )
         {
-            sql += " programinstance as pi ";
+            if( hasEntityInstance )
+            {
+                sql += " INNER JOIN programinstance as pi on pi.trackedentityinstanceid=p.trackedentityinstanceid ";
+            }
+            else
+            {
+                sql += " programinstance as pi ";
+            }
             sql += " INNER JOIN programstageinstance psi ON pi.programinstanceid=psi.programinstanceid ";
             sql += " INNER JOIN organisationunit ou ON ou.organisationunitid=psi.organisationunitid ";
             sql += " INNER JOIN trackedentitydatavalue pdv ON pdv.programstageinstanceid=psi.programstageinstanceid ";
             sql += " INNER JOIN program pg ON pg.programid=pi.programid ";
             sql += " INNER JOIN programstage pgs ON pgs.programid=pg.programid ";
         }
-        else if( !hasEntityInstance )
-        {
-            sql += " programinstance as pi INNER JOIN trackedentityinstance p on p.trackedentityinstanceid=pi.trackedentityinstanceid";
-            sql += " INNER JOIN organisationunit ou ON ou.organisationunitid=p.organisationunitid ";
-        }
+        
 
         sql += " WHERE "
             + createSQL( caseExpression, operator, orgunitIds, DateUtils.getMediumDateString( period.getStartDate() ),