=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2010-01-22 05:09:00 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2010-03-02 05:43:25 +0000 @@ -43,6 +43,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.hisp.dhis.customvalue.CustomValue; import org.hisp.dhis.customvalue.CustomValueService; import org.hisp.dhis.dataelement.CalculatedDataElement; @@ -68,8 +70,12 @@ public class DefaultDataEntryScreenManager implements DataEntryScreenManager { + private static final Log log = LogFactory.getLog( DefaultDataEntryScreenManager.class ); + private static final String DEFAULT_FORM = "defaultform"; + private static final String MULTI_DIMENSIONAL_FORM = "multidimensionalform"; + private static final String EMPTY = ""; // ------------------------------------------------------------------------- @@ -98,7 +104,7 @@ } private DataElementCategoryService categoryService; - + public void setCategoryService( DataElementCategoryService categoryService ) { this.categoryService = categoryService; @@ -144,13 +150,13 @@ return true; } } - + return false; } public String getScreenType( DataSet dataSet ) { - return hasMultiDimensionalDataElement( dataSet ) ? MULTI_DIMENSIONAL_FORM : DEFAULT_FORM; + return hasMultiDimensionalDataElement( dataSet ) ? MULTI_DIMENSIONAL_FORM : DEFAULT_FORM; } public Collection getAllCalculatedDataElements( DataSet dataSet ) @@ -187,7 +193,7 @@ if ( !cde.isSaved() ) { calculatedDataElementMap.put( cde, dataElementService.getDataElementFactors( cde ) ); - } + } } } @@ -239,11 +245,12 @@ factor = factorMap.get( operandId ); String dataElementIdString = operandId.substring( 0, operandId.indexOf( SEPARATOR ) ); - String optionComboIdString = operandId.substring( operandId.indexOf( SEPARATOR ) + 1, operandId.length() ); + String optionComboIdString = operandId.substring( operandId.indexOf( SEPARATOR ) + 1, operandId + .length() ); DataElement element = dataElementService.getDataElement( Integer.parseInt( dataElementIdString ) ); - DataElementCategoryOptionCombo optionCombo = categoryService - .getDataElementCategoryOptionCombo( Integer.parseInt( optionComboIdString ) ); + DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( Integer + .parseInt( optionComboIdString ) ); dataValue = dataValueService.getDataValue( organisationUnit, element, period, optionCombo ); @@ -303,12 +310,11 @@ // --------------------------------------------------------------------- Pattern identifierPattern = Pattern.compile( "value\\[(.*)\\].value:value\\[(.*)\\].value" ); - + // --------------------------------------------------------------------- // Iterate through all matching data element fields - // --------------------------------------------------------------------- + // --------------------------------------------------------------------- - while ( dataElementMatcher.find() ) { // ----------------------------------------------------------------- @@ -329,7 +335,14 @@ int optionComboId = Integer.parseInt( identifierMatcher.group( 2 ) ); DataElement dataElement = dataElementService.getDataElement( dataElementId ); - + + if ( dataElement == null ) + { + log.error( "Data Element exits in data entry form but not in this Data Set: " + dataElementId ); + + return "This data element not exits in data set: " + dataElementId; + } + // ------------------------------------------------------------- // Find type of data element // ------------------------------------------------------------- @@ -365,8 +378,9 @@ // ------------------------------------------------------------- boolean customValueExists = customValuesExists( customValues, dataElementId, optionComboId ); - - if ( dataElement.getType().equals( VALUE_TYPE_BOOL ) || (dataElement.getType().equals( VALUE_TYPE_STRING ) && customValueExists ) ) + + if ( dataElement.getType().equals( VALUE_TYPE_BOOL ) + || (dataElement.getType().equals( VALUE_TYPE_STRING ) && customValueExists) ) { dataElementCode = dataElementCode.replace( "input", "select" ); dataElementCode = dataElementCode.replaceAll( "value=\".*?\"", "" ); @@ -407,7 +421,8 @@ dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" ); // ------------------------------------------------------------- - // Insert title information - Data element id, name, type, min, max + // Insert title information - Data element id, name, type, min, + // max // ------------------------------------------------------------- if ( dataElementCode.contains( "title=\"\"" ) ) @@ -581,7 +596,7 @@ // --------------------------------------------------------------------- Map dataElementMap = getDataElementMap( dataSet ); - + while ( dataElementMatcher.find() ) { // ----------------------------------------------------------------- @@ -601,13 +616,15 @@ int dataElementId = Integer.parseInt( identifierMatcher.group( 1 ) ); int optionComboId = Integer.parseInt( identifierMatcher.group( 2 ) ); - DataElement dataElement = dataElementMap.get( dataElementId ); //dataElementService.getDataElement( dataElementId ); - - if( dataElement==null ) + DataElement dataElement = dataElementMap.get( dataElementId ); // dataElementService.getDataElement( + // dataElementId + // ); + + if ( dataElement == null ) { - throw new RuntimeException("Data Element Id: " + dataElementId + " not found"); + throw new RuntimeException( "Data Element Id: " + dataElementId + " not found" ); } - + // ------------------------------------------------------------- // Find value type of data element // ------------------------------------------------------------- @@ -643,8 +660,9 @@ // ------------------------------------------------------------- boolean customValueExists = customValuesExists( customValues, dataElementId, optionComboId ); - - if ( dataElement.getType().equals( DataElement.VALUE_TYPE_BOOL ) || (dataElement.getType().equals( VALUE_TYPE_STRING ) && customValueExists ) ) + + if ( dataElement.getType().equals( DataElement.VALUE_TYPE_BOOL ) + || (dataElement.getType().equals( VALUE_TYPE_STRING ) && customValueExists) ) { dataElementCode = dataElementCode.replace( "input", "select" ); dataElementCode = dataElementCode.replaceAll( "value=\".*?\"", "" ); @@ -683,7 +701,8 @@ dataElementCode = dataElementCode.replaceAll( "view=\".*?\"", "" ); // ------------------------------------------------------------- - // Insert title information - Data element id, name, type, min, max + // Insert title information - Data element id, name, type, min, + // max // ------------------------------------------------------------- if ( dataElementCode.contains( "title=\"\"" ) ) @@ -802,7 +821,7 @@ dataElementMatcher.appendReplacement( sb, appendCode ); } } - + dataElementMatcher.appendTail( sb ); return sb.toString(); @@ -816,19 +835,21 @@ * Tests whether the given Collection of CustomValues contains a CustomValue * with the given data element identifier and category option combo id. */ - private boolean customValuesExists( Collection customValues, int dataElementId, int categoryOptionComboId ) + private boolean customValuesExists( Collection customValues, int dataElementId, + int categoryOptionComboId ) { for ( CustomValue customValue : customValues ) { - if ( dataElementId == customValue.getDataElement().getId() && categoryOptionComboId == customValue.getOptionCombo().getId() ) + if ( dataElementId == customValue.getDataElement().getId() + && categoryOptionComboId == customValue.getOptionCombo().getId() ) { return true; } } - + return false; } - + /** * Returns the value of the DataValue in the Collection of DataValues with * the given data element identifier and category option combo id. @@ -837,7 +858,8 @@ { for ( DataValue dataValue : dataValues ) { - if ( dataValue.getDataElement().getId() == dataElementId && dataValue.getOptionCombo().getId() == categoryOptionComboId ) + if ( dataValue.getDataElement().getId() == dataElementId + && dataValue.getOptionCombo().getId() == categoryOptionComboId ) { return dataValue.getValue(); } @@ -845,7 +867,7 @@ return EMPTY; } - + /** * Returns the value of the DataValue in the Collection of DataValues with * the given data element identifier. @@ -859,10 +881,10 @@ return dataValue.getValue(); } } - + return EMPTY; } - + /** * Returns a Map of all DataElements in the given DataSet where the key is * the DataElement identifier and the value is the DataElement. @@ -870,12 +892,12 @@ private Map getDataElementMap( DataSet dataSet ) { Map map = new HashMap(); - + for ( DataElement element : dataSet.getDataElements() ) { map.put( element.getId(), element ); } - + return map; } } === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml' --- dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml 2010-02-25 09:05:59 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/pom.xml 2010-03-02 05:43:25 +0000 @@ -10,7 +10,7 @@ dhis-web-excel-reporting - jar + war DHIS Web Excel Reporting === added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/images/group.jpg' Binary files dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/images/group.jpg 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/images/group.jpg 2010-03-02 05:43:25 +0000 differ === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm 2010-02-25 02:41:20 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reports.vm 2010-03-02 05:43:25 +0000 @@ -37,8 +37,8 @@ $i18n.getString( 'set_organisationunit_group_level' ) #end - #if($report.isCategory()) - + #if($report.isCategory()) + $i18n.getString( 'dataelement_groups' ) #end #if($report.isPeriodColumnListing())