dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42034
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21474: event store now returns the orgunit actually assigned to the event, not the orgunit assigned to t...
------------------------------------------------------------
revno: 21474
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-12-16 22:05:29 +0100
message:
event store now returns the orgunit actually assigned to the event, not the orgunit assigned to the TEI that owns the event
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.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-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-12-16 20:23:34 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/JdbcEventStore.java 2015-12-16 21:05:29 +0000
@@ -354,16 +354,8 @@
"inner join programinstance pi on pi.programinstanceid=psi.programinstanceid " +
"inner join program p on p.programid=pi.programid " +
"inner join programstage ps on ps.programstageid=psi.programstageid " +
- "left join trackedentityinstance tei on tei.trackedentityinstanceid=pi.trackedentityinstanceid ";
-
- if ( params.getEventStatus() == null || EventStatus.isExistingEvent( params.getEventStatus() ) )
- {
- sql += "left join organisationunit ou on (psi.organisationunitid=ou.organisationunitid) ";
- }
- else
- {
- sql += "left join organisationunit ou on (tei.organisationunitid=ou.organisationunitid) ";
- }
+ "left join trackedentityinstance tei on tei.trackedentityinstanceid=pi.trackedentityinstanceid " +
+ "left join organisationunit ou on (psi.organisationunitid=ou.organisationunitid) ";
if ( params.getTrackedEntityInstance() != null )
{
@@ -399,14 +391,14 @@
{
sql += hlp.whereAnd() + " psi.attributeoptioncomboid = " + params.getCategoryOptionCombo().getId() + " ";
}
+
+ if ( orgUnitIds != null && !orgUnitIds.isEmpty() )
+ {
+ sql += hlp.whereAnd() + " psi.organisationunitid in (" + getCommaDelimitedString( orgUnitIds ) + ") ";
+ }
if ( params.getEventStatus() == null || EventStatus.isExistingEvent( params.getEventStatus() ) )
{
- if ( orgUnitIds != null && !orgUnitIds.isEmpty() )
- {
- sql += hlp.whereAnd() + " psi.organisationunitid in (" + getCommaDelimitedString( orgUnitIds ) + ") ";
- }
-
if ( params.getStartDate() != null )
{
sql += hlp.whereAnd() + " (psi.executiondate >= '" + getMediumDateString( params.getStartDate() ) + "' "
@@ -421,11 +413,6 @@
}
else
{
- if ( orgUnitIds != null && !orgUnitIds.isEmpty() )
- {
- sql += hlp.whereAnd() + " tei.organisationunitid in (" + getCommaDelimitedString( orgUnitIds ) + ") ";
- }
-
if ( params.getStartDate() != null )
{
sql += hlp.whereAnd() + " psi.duedate >= '" + getMediumDateString( params.getStartDate() ) + "' ";