← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10249: Fix error when to run filters with number-dataelement in aggregate tabular report.

 

------------------------------------------------------------
revno: 10249
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-03-15 20:36:01 +0700
message:
  Fix error when to run filters with number-dataelement in aggregate tabular report.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.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-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-03-14 15:48:51 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2013-03-15 13:36:01 +0000
@@ -48,6 +48,7 @@
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.common.GridHeader;
+import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.i18n.I18n;
@@ -1855,11 +1856,20 @@
                 Integer id = iterFilter.next();
                 for ( String filterValue : deFilters.get( id ) )
                 {
+                    DataElement dataElement = dataElementService.getDataElement( id );
                     int index = filterValue.indexOf( PatientAggregateReport.SEPARATE_FILTER );
                     String operator = (filterValue.substring( 0, index ));
                     String value = filterValue.substring( index + 1, filterValue.length() );
-
-                    filter += "AND (SELECT value ";
+                    filter += "AND (SELECT ";
+                    if( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
+                    {
+                        filter += "cast(value as " + statementBuilder.getDoubleColumnType()+ ") ";
+                        
+                    }
+                    else
+                    {
+                        filter += " value ";
+                    }
                     filter += "FROM patientdatavalue ";
                     filter += "WHERE programstageinstanceid=psi_1.programstageinstanceid AND ";
                     filter += "dataelementid=" + id + "  ";

=== 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	2013-03-14 09:12:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-03-15 13:36:01 +0000
@@ -599,4 +599,5 @@
 confirm_data_values_aggregated_saved_into_database_directly = Are you sure you want to save data values aggregated into database directly ?
 aggregate_successfully = Aggregate successfully
 complete_quit = Complete/Quit
-re_enrol = Re-enrol
\ No newline at end of file
+re_enrol = Re-enrol
+overwrite = Overwrite
\ No newline at end of file