dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32310
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16484: Fixed bug - The details icon in aggregate query builder result form doesn't work.
------------------------------------------------------------
revno: 16484
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-08-24 19:31:24 +0700
message:
Fixed bug - The details icon in aggregate query builder result form doesn't work.
modified:
dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
--
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-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java 2014-08-24 12:31:24 +0000
@@ -247,11 +247,43 @@
grid.addHeader( new GridHeader( i18n.getString( colName ), false, true ) );
}
- grid.addRows( rs );
+ addRows( rs, grid );
return grid;
}
+ public void addRows( SqlRowSet rs, Grid grid )
+ {
+ int cols = rs.getMetaData().getColumnCount();
+ String idValue = "";
+ int index = 1;
+ while ( rs.next() )
+ {
+ grid.addRow();
+ for ( int i = 1; i <= cols; i++ )
+ {
+ Object value = rs.getObject( i );
+ if( i==1 )
+ {
+ if( !value.toString().equals(idValue) )
+ {
+ grid.addValue( index );
+ idValue = value.toString();
+ index ++;
+ }
+ else
+ {
+ grid.addValue( "" );
+ }
+ }
+ else
+ {
+ grid.addValue( value );
+ }
+ }
+ }
+ }
+
public void insertAggregateValue( String expression, String operator, Integer dataElementId, Integer optionComboId, int attributeOptioncomboId,
Integer deSumId, Collection<Integer> orgunitIds, Period period )
{
@@ -947,7 +979,7 @@
String sql = "SELECT ";
boolean hasDataelement = hasDataelementCriteria( caseExpression );
-
+ boolean hasEntityInstance = hasEntityInstanceCriteria( caseExpression );
Collection<Integer> orgunitIds = new HashSet<>();
orgunitIds.add( orgunitId );
@@ -958,27 +990,33 @@
DateUtils.getMediumDateString( period.getStartDate() ),
DateUtils.getMediumDateString( period.getEndDate() ) );
}
+ else if ( hasDataelement )
+ {
+ sql += "pdv.programstageinstanceid as event, pdv.value,pgs.name as program_stage, psi.executiondate as report_date,";
+ }
else
{
- if ( hasDataelement )
- {
- sql += "pdv.value,pgs.name as program_stage, psi.executiondate as report_date,";
- }
+ sql += "p.trackedentityinstanceid,p.trackedentityid,ou.name";
}
sql = sql.substring( 0, sql.length() - 1 );
sql += " FROM ";
+ if( hasEntityInstance )
+ {
+ sql += " INNER JOIN trackedentityinstance p on p.trackedentityinstanceid=pi.trackedentityinstanceid ";
+ }
+
if ( hasDataelement )
{
- sql += " programinstance as pi INNER JOIN trackedentityinstance p on p.trackedentityinstanceid=pi.trackedentityinstanceid";
+ 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
+ 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 ";
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2014-07-11 05:28:48 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2014-08-24 12:31:24 +0000
@@ -694,4 +694,5 @@
users = Users
message_is_sent = Message is sent
messsage = Message
-please_select_an_orgunit = Please select an organisation unit
\ No newline at end of file
+please_select_an_orgunit = Please select an organisation unit
+event=Event
\ No newline at end of file