← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20398: Minor fix for aggregate query builder.

 

------------------------------------------------------------
revno: 20398
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-29 09:08:34 -0700
message:
  Minor fix for aggregate query builder.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.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-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2015-09-28 21:49:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramInstanceStore.java	2015-09-29 16:08:34 +0000
@@ -43,6 +43,7 @@
 import org.hisp.dhis.program.ProgramInstanceQueryParams;
 import org.hisp.dhis.program.ProgramInstanceStore;
 import org.hisp.dhis.program.ProgramStatus;
+import org.hisp.dhis.program.ProgramType;
 import org.hisp.dhis.program.SchedulingProgramObject;
 import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
@@ -468,10 +469,10 @@
             + "              ON org.organisationunitid = p.organisationunitid INNER JOIN trackedentityinstancereminder prm "
             + "              ON prm.programid = pi.programid INNER JOIN trackedentityattributevalue pav "
             + "              ON pav.trackedentityinstanceid=p.trackedentityinstanceid INNER JOIN trackedentityattribute pa "
-            + "              ON pa.trackedentityattributeid=pav.trackedentityattributeid " + "       WHERE pi.status= "
+            + "              ON pa.trackedentityattributeid=pav.trackedentityattributeid " + "       WHERE pi.status= '"
             + EventStatus.ACTIVE.name()
-            + "         and prm.templatemessage is not NULL and prm.templatemessage != ''   "
-            + "         and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null and pa.valuetype='phoneNumber' "
+            + "'         and prm.templatemessage is not NULL and prm.templatemessage != ''   "
+            + "         and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null and pa.valuetype='phoneNumber' "
             + "         and ( DATE(now()) - DATE(pi." + dateToCompare + ") ) = prm.daysallowedsendmessage "
             + "         and prm.whenToSend is null and prm.dateToCompare='" + dateToCompare + "' and prm.sendto = "
             + TrackedEntityInstanceReminder.SEND_TO_TRACKED_ENTITY_INSTANCE;
@@ -486,10 +487,10 @@
             + "           ON p.trackedentityinstanceid=pi.trackedentityinstanceid INNER JOIN program pg "
             + "           ON pg.programid=pi.programid INNER JOIN organisationunit org "
             + "           ON org.organisationunitid = p.organisationunitid INNER JOIN trackedentityinstancereminder prm "
-            + "           ON prm.programid = pi.programid " + "    WHERE pi.status = " + EventStatus.ACTIVE.name()
-            + "      and org.phonenumber is not NULL and org.phonenumber != '' "
+            + "           ON prm.programid = pi.programid " + "    WHERE pi.status = '" + EventStatus.ACTIVE.name()
+            + "'      and org.phonenumber is not NULL and org.phonenumber != '' "
             + "      and prm.templatemessage is not NULL and prm.templatemessage != '' "
-            + "      and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null " + "      and ( DATE(now()) - DATE( pi."
+            + "      and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null " + "      and ( DATE(now()) - DATE( pi."
             + dateToCompare + " ) ) = prm.daysallowedsendmessage " + "      and prm.dateToCompare='" + dateToCompare
             + "'     and prm.whenToSend is null and prm.sendto =  " + TrackedEntityInstanceReminder.SEND_TO_ORGUGNIT_REGISTERED;
     }
@@ -506,11 +507,11 @@
             + "    ON prm.programid = pi.programid INNER JOIN usermembership ums "
             + "    ON ums.organisationunitid = p.organisationunitid INNER JOIN userinfo uif "
             + "    ON uif.userinfoid = ums.userinfoid "
-            + "WHERE pi.status= "
+            + "WHERE pi.status= '"
             + EventStatus.ACTIVE.name()
-            + "         and uif.phonenumber is not NULL and uif.phonenumber != '' "
+            + "'         and uif.phonenumber is not NULL and uif.phonenumber != '' "
             + "         and prm.templatemessage is not NULL and prm.templatemessage != '' "
-            + "         and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null "
+            + "         and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null "
             + "         and ( DATE(now()) - DATE( "
             + dateToCompare
             + " ) ) = prm.daysallowedsendmessage "
@@ -530,10 +531,10 @@
             + "   INNER JOIN organisationunit org " + "       ON org.organisationunitid = p.organisationunitid "
             + "   INNER JOIN trackedentityinstancereminder prm " + "       ON prm.programid = pg.programid "
             + "   INNER JOIN usergroupmembers ugm " + "       ON ugm.usergroupid = prm.usergroupid "
-            + "   INNER JOIN userinfo uif " + "       ON uif.userinfoid = ugm.userid " + "  WHERE pi.status= "
-            + EventStatus.ACTIVE.name() + "       and uif.phonenumber is not NULL and uif.phonenumber != '' "
+            + "   INNER JOIN userinfo uif " + "       ON uif.userinfoid = ugm.userid " + "  WHERE pi.status= '"
+            + EventStatus.ACTIVE.name() + "'       and uif.phonenumber is not NULL and uif.phonenumber != '' "
             + "       and prm.templatemessage is not NULL and prm.templatemessage != '' "
-            + "       and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null " + "       and (  DATE(now()) - DATE("
+            + "       and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null " + "       and (  DATE(now()) - DATE("
             + dateToCompare + ") ) = prm.daysallowedsendmessage " + "       and prm.whentosend is null "
             + "       and prm.sendto = " + TrackedEntityInstanceReminder.SEND_TO_USER_GROUP;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2015-09-28 21:49:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2015-09-29 16:08:34 +0000
@@ -46,6 +46,7 @@
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceStore;
 import org.hisp.dhis.program.ProgramStatus;
+import org.hisp.dhis.program.ProgramType;
 import org.hisp.dhis.program.SchedulingProgramObject;
 import org.hisp.dhis.system.grid.GridUtils;
 import org.hisp.dhis.system.grid.ListGrid;
@@ -362,10 +363,10 @@
             + "     ON pav.trackedentityinstanceid=p.trackedentityinstanceid "
             + " INNER JOIN trackedentityattribute pa "
             + "     ON pa.trackedentityattributeid=pav.trackedentityattributeid "
-            + "WHERE pi.status="
+            + "WHERE pi.status='"
             + EventStatus.ACTIVE.name()
-            + "     and prm.templatemessage is not NULL and prm.templatemessage != '' "
-            + "     and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null  "
+            + "'     and prm.templatemessage is not NULL and prm.templatemessage != '' "
+            + "     and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null  "
             + "     and psi.executiondate is null and pa.valuetype='phoneNumber' "
             + "     and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
             + "     and prm.whentosend is null and prm.sendto = " + TrackedEntityInstanceReminder.SEND_TO_TRACKED_ENTITY_INSTANCE;
@@ -394,11 +395,11 @@
             + "               ON pa.trackedentityattributeid=pav.trackedentityattributeid "
             + "           INNER JOIN userinfo uif "
             + "               ON pav.value=concat(uif.userinfoid ,'') "
-            + " WHERE pi.status="
+            + " WHERE pi.status='"
             + EventStatus.ACTIVE.name()
-            + " and pa.valueType='users' and uif.phonenumber is not NULL and uif.phonenumber != '' "
+            + "' and pa.valueType='users' and uif.phonenumber is not NULL and uif.phonenumber != '' "
             + "               and prm.templatemessage is not NULL and prm.templatemessage != '' "
-            + "               and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null "
+            + "               and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null "
             + "               and psi.executiondate is null "
             + "               and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
             + "               and prm.whentosend is null and prm.sendto = " + TrackedEntityInstanceReminder.SEND_TO_ATTRIBUTE_TYPE_USERS;
@@ -423,11 +424,11 @@
             + "               ON prm.programstageid = ps.programstageid "
             + "           INNER JOIN organisationunit ou "
             + "               ON ou.organisationunitid=p.organisationunitid "
-            + "WHERE pi.status= "
+            + "WHERE pi.status= '"
             + EventStatus.ACTIVE.name()
-            + "               and ou.phonenumber is not NULL and ou.phonenumber != '' "
+            + "'               and ou.phonenumber is not NULL and ou.phonenumber != '' "
             + "               and prm.templatemessage is not NULL and prm.templatemessage != '' "
-            + "               and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null "
+            + "               and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null "
             + "               and psi.executiondate is null "
             + "               and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
             + "               and prm.whentosend is null and prm.sendto = "
@@ -455,11 +456,11 @@
             + "       ON ums.organisationunitid = p.organisationunitid "
             + "   INNER JOIN userinfo uif "
             + "       ON uif.userinfoid = ums.userinfoid "
-            + "  WHERE pi.status= "
+            + "  WHERE pi.status= '"
             + EventStatus.ACTIVE.name()
-            + "       and uif.phonenumber is not NULL and uif.phonenumber != '' "
+            + "'       and uif.phonenumber is not NULL and uif.phonenumber != '' "
             + "       and prm.templatemessage is not NULL and prm.templatemessage != '' "
-            + "       and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null "
+            + "       and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null "
             + "       and psi.executiondate is null "
             + "       and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
             + "       and prm.whentosend is null and prm.sendto = "
@@ -487,11 +488,11 @@
             + "       ON ugm.usergroupid = prm.usergroupid "
             + "   INNER JOIN userinfo uif "
             + "       ON uif.userinfoid = ugm.userid "
-            + "  WHERE pi.status= "
+            + "  WHERE pi.status= '"
             + EventStatus.ACTIVE.name()
-            + "       and uif.phonenumber is not NULL and uif.phonenumber != '' "
+            + "'       and uif.phonenumber is not NULL and uif.phonenumber != '' "
             + "       and prm.templatemessage is not NULL and prm.templatemessage != '' "
-            + "       and pg.type='WITH_REGISTRATION' and prm.daysallowedsendmessage is not null "
+            + "       and pg.type='" + ProgramType.WITH_REGISTRATION.name() + "' and prm.daysallowedsendmessage is not null "
             + "       and psi.executiondate is not null "
             + "       and (  DATE(now()) - DATE(psi.duedate) ) = prm.daysallowedsendmessage "
             + "       and prm.whentosend is null " + "       and prm.sendto = " + TrackedEntityInstanceReminder.SEND_TO_USER_GROUP;