=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2014-09-15 20:06:58 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/Indicator.java 2014-12-13 10:38:39 +0000 @@ -63,6 +63,11 @@ private boolean annualized; + /** + * Number of decimals to use for indicator value, null implies default. + */ + private Integer decimals; + private IndicatorType indicatorType; private String numerator; @@ -156,6 +161,11 @@ { return explodedDenominator != null ? explodedDenominator : denominator; } + + public boolean hasDecimals() + { + return decimals != null && decimals >= 0; + } // ------------------------------------------------------------------------- // Getters and setters @@ -182,6 +192,19 @@ } @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public Integer getDecimals() + { + return decimals; + } + + public void setDecimals( Integer decimals ) + { + this.decimals = decimals; + } + + @JsonProperty @JsonSerialize( as = BaseIdentifiableObject.class ) @JsonView( {DetailedView.class, ExportView.class} ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) === modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2014-11-30 15:45:17 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2014-12-13 10:38:39 +0000 @@ -320,9 +320,11 @@ row.add( indicatorIndex, new DimensionItem( INDICATOR_DIM_ID, indicator ) ); + Double roundedValue = indicator.hasDecimals() ? MathUtils.getRounded( value, indicator.getDecimals() ) : MathUtils.getRounded( value ); + grid.addRow(); grid.addValues( DimensionItem.getItemIdentifiers( row ) ); - grid.addValue( params.isSkipRounding() ? value : MathUtils.getRounded( value ) ); + grid.addValue( params.isSkipRounding() ? value : roundedValue ); } } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml 2014-09-15 20:06:58 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml 2014-12-13 10:38:39 +0000 @@ -22,6 +22,8 @@ + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java 2014-10-16 06:17:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java 2014-12-13 10:38:39 +0000 @@ -32,6 +32,7 @@ import java.util.HashSet; import java.util.List; +import org.apache.commons.lang.StringUtils; import org.hisp.dhis.attribute.AttributeService; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.indicator.IndicatorGroup; @@ -112,6 +113,13 @@ { this.annualized = annualized; } + + private Integer decimals; + + public void setDecimals( Integer decimals ) + { + this.decimals = decimals; + } private Integer indicatorTypeId; @@ -185,15 +193,8 @@ { IndicatorType indicatorType = indicatorService.getIndicatorType( indicatorTypeId ); - if ( code != null && code.trim().length() == 0 ) - { - code = null; - } - - if ( description != null && description.trim().length() == 0 ) - { - description = null; - } + code = StringUtils.trimToNull( code ); + description = StringUtils.trimToNull( description ); MapLegendSet legendSet = mappingService.getMapLegendSet( selectedLegendSetId ); @@ -204,6 +205,7 @@ indicator.setCode( code ); indicator.setDescription( description ); indicator.setAnnualized( annualized ); + indicator.setDecimals( decimals ); indicator.setIndicatorType( indicatorType ); indicator.setLegendSet( legendSet ); indicator.setUrl( url ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java 2014-10-16 06:17:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java 2014-12-13 10:38:39 +0000 @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang.StringUtils; import org.hisp.dhis.attribute.AttributeService; import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.indicator.IndicatorGroup; @@ -120,6 +121,13 @@ this.annualized = annualized; } + private Integer decimals; + + public void setDecimals( Integer decimals ) + { + this.decimals = decimals; + } + private Integer indicatorTypeId; public void setIndicatorTypeId( Integer indicatorTypeId ) @@ -203,21 +211,15 @@ MapLegendSet legendSet = mappingService.getMapLegendSet( selectedLegendSetId ); - if ( code != null && code.trim().length() == 0 ) - { - code = null; - } - - if ( description != null && description.trim().length() == 0 ) - { - description = null; - } + code = StringUtils.trimToNull( code ); + description = StringUtils.trimToNull( description ); indicator.setName( name ); indicator.setShortName( shortName ); indicator.setCode( code ); indicator.setDescription( description ); indicator.setAnnualized( annualized ); + indicator.setDecimals( decimals ); indicator.setIndicatorType( indicatorType ); indicator.setLegendSet( legendSet ); indicator.setUrl( url ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2014-11-18 12:00:42 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2014-12-13 10:38:39 +0000 @@ -237,4 +237,5 @@ intro_category_option_combo = View and edit data element category option combos. Category Option Combo are fine-grained break-downs of catagory. edit_data_element_category_option_combo = Edit data element category option combo average_sum_in_org_unit_hierarchy=Average (sum in org unit hierarchy) -approve_data=Approve data \ No newline at end of file +approve_data=Approve data +decimals_in_data_output=Decimals in data output \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm 2014-04-22 16:33:23 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm 2014-12-13 10:38:39 +0000 @@ -31,7 +31,7 @@ $i18n.getString( "details" ) - + @@ -56,10 +56,24 @@ + + + + + + @@ -118,7 +132,7 @@ @@ -55,6 +55,20 @@ + + + + + + @@ -115,7 +129,7 @@