------------------------------------------------------------ revno: 4570 committer: Hieu <hieu.hispviet...@gmail.com> branch nick: dhis2 timestamp: Mon 2011-09-12 16:15:08 +0700 message: Export to PDF - Fixed NPE. modified: dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
-- 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-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java 2011-09-10 08:40:27 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/DataElementConverter.java 2011-09-12 09:15:08 +0000 @@ -55,7 +55,7 @@ I18n i18n = params.getI18n(); I18nFormat format = params.getFormat(); - PDFUtils.printObjectFrontPage( document, params.getDataElements(), i18n, format, "data_elements" ); + PDFUtils.printObjectFrontPage( document, params.getDataElementObjects(), i18n, format, "data_elements" ); for ( DataElement element : params.getDataElementObjects() ) { === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java' --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java 2011-09-10 08:40:27 +0000 +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/pdf/converter/IndicatorConverter.java 2011-09-12 09:15:08 +0000 @@ -63,7 +63,7 @@ I18n i18n = params.getI18n(); I18nFormat format = params.getFormat(); - PDFUtils.printObjectFrontPage( document, params.getIndicators(), i18n, format, "indicators" ); + PDFUtils.printObjectFrontPage( document, params.getIndicatorObjects(), i18n, format, "indicators" ); for ( Indicator indicator : params.getIndicatorObjects() ) { === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java 2011-09-09 06:18:32 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java 2011-09-12 09:15:08 +0000 @@ -407,11 +407,16 @@ table.addCell( getItalicCell( i18n.getString( "active" ) ) ); table.addCell( getTextCell( i18n.getString( getBoolean().get( element.isActive() ) ) ) ); - table.addCell( getItalicCell( i18n.getString( "type" ) ) ); - table.addCell( getTextCell( i18n.getString( getType().get( element.getType() ) ) ) ); - - table.addCell( getItalicCell( i18n.getString( "aggregation_operator" ) ) ); - table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( element.getAggregationOperator() ) ) ) ); + if ( nullIfEmpty( element.getType() ) != null ) + { + table.addCell( getItalicCell( i18n.getString( "value_type" ) ) ); + table.addCell( getTextCell( i18n.getString( getType().get( element.getType() ) ) ) ); + } + if ( nullIfEmpty( element.getAggregationOperator() ) != null ) + { + table.addCell( getItalicCell( i18n.getString( "aggregation_operator" ) ) ); + table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( element.getAggregationOperator() ) ) ) ); + } table.addCell( getEmptyCell( 2, 30 ) ); @@ -468,9 +473,11 @@ table.addCell( getItalicCell( i18n.getString( "numerator_description" ) ) ); table.addCell( getTextCell( indicator.getNumeratorDescription() ) ); - table.addCell( getItalicCell( i18n.getString( "numerator_aggregation_operator" ) ) ); - table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( - indicator.getNumeratorAggregationOperator() ) ) ) ); + if ( nullIfEmpty( indicator.getNumeratorAggregationOperator() ) != null ) + { + table.addCell( getItalicCell( i18n.getString( "numerator_aggregation_operator" ) ) ); + table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( indicator.getNumeratorAggregationOperator() ) ) ) ); + } table.addCell( getItalicCell( i18n.getString( "numerator_formula" ) ) ); table.addCell( getTextCell( expressionService.getExpressionDescription( indicator.getNumerator() ) ) ); @@ -478,9 +485,11 @@ table.addCell( getItalicCell( i18n.getString( "denominator_description" ) ) ); table.addCell( getTextCell( indicator.getDenominatorDescription() ) ); - table.addCell( getItalicCell( i18n.getString( "denominator_aggregation_operator" ) ) ); - table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( - indicator.getDenominatorAggregationOperator() ) ) ) ); + if ( nullIfEmpty( indicator.getDenominatorAggregationOperator() ) != null ) + { + table.addCell( getItalicCell( i18n.getString( "denominator_aggregation_operator" ) ) ); + table.addCell( getTextCell( i18n.getString( getAggregationOperator().get( indicator.getDenominatorAggregationOperator() ) ) ) ); + } table.addCell( getItalicCell( i18n.getString( "denominator_formula" ) ) ); table.addCell( getTextCell( expressionService.getExpressionDescription( indicator.getDenominator() ) ) ); @@ -522,7 +531,8 @@ } table.addCell( getItalicCell( i18n.getString( "opening_date" ) ) ); - table.addCell( getTextCell( unit.getOpeningDate() != null ? format.formatDate( unit.getOpeningDate() ) : EMPTY ) ); + table + .addCell( getTextCell( unit.getOpeningDate() != null ? format.formatDate( unit.getOpeningDate() ) : EMPTY ) ); if ( unit.getClosedDate() != null ) { @@ -689,6 +699,7 @@ map.put( DataElement.VALUE_TYPE_STRING, "text" ); map.put( DataElement.VALUE_TYPE_INT, "number" ); map.put( DataElement.VALUE_TYPE_BOOL, "yes_no" ); + map.put( DataElement.VALUE_TYPE_DATE, "date" ); return map; } === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-09-12 06:19:59 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-09-12 09:15:08 +0000 @@ -1344,7 +1344,7 @@ return; } - jQuery.post( 'exportToPdf.action', params ); + jQuery.postUTF8( 'exportToPdf.action', params, function(){} ); } /**
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp