=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java' --- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java 2012-03-27 06:09:22 +0000 +++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java 2012-04-29 09:57:26 +0000 @@ -36,6 +36,7 @@ import java.util.Set; import org.apache.commons.collections.CollectionUtils; +import org.hisp.dhis.attribute.AttributeService; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; @@ -49,12 +50,16 @@ import org.hisp.dhis.indicator.IndicatorService; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.Period; +import org.hisp.dhis.reportsheet.AttributeValueGroupOrder; +import org.hisp.dhis.reportsheet.CategoryOptionGroupOrder; import org.hisp.dhis.reportsheet.DataElementGroupOrder; import org.hisp.dhis.reportsheet.ExportItem; import org.hisp.dhis.reportsheet.ExportReport; +import org.hisp.dhis.reportsheet.ExportReportAttribute; import org.hisp.dhis.reportsheet.ExportReportCategory; import org.hisp.dhis.reportsheet.ExportReportService; import org.hisp.dhis.reportsheet.ExportReportStore; +import org.hisp.dhis.reportsheet.ExportReportVerticalCategory; import org.hisp.dhis.reportsheet.PeriodColumn; import org.hisp.dhis.reportsheet.status.DataEntryStatus; import org.hisp.dhis.user.User; @@ -75,6 +80,13 @@ // Dependency // ------------------------------------------------------------------------- + private AttributeService attributeService; + + public void setAttributeService( AttributeService attributeService ) + { + this.attributeService = attributeService; + } + private DataElementService dataElementService; public void setDataElementService( DataElementService dataElementService ) @@ -333,7 +345,30 @@ Set items = new HashSet( exportReport.getExportItemsByItemType( ExportItem.TYPE.DATAELEMENT, ExportItem.TYPE.INDICATOR ) ); - if ( exportReport.getReportType().equalsIgnoreCase( ExportReport.TYPE.CATEGORY ) ) + if ( exportReport.getReportType().equalsIgnoreCase( ExportReport.TYPE.ATTRIBUTE ) ) + { + for ( AttributeValueGroupOrder groupOrder : ((ExportReportAttribute) exportReport) + .getAttributeValueOrders() ) + { + if ( groupOrder.getAttribute() == null ) + { + return i18n.getString( "no_attribute_selected" ); + } + + if ( attributeService.getAttribute( groupOrder.getAttribute().getId() ) == null ) + { + return i18n.getString( "attribute_with_id" ) + ": " + groupOrder.getAttribute().getId() + + i18n.getString( "does_not_exist" ); + } + + if ( groupOrder.getAttributeValues() == null || groupOrder.getAttributeValues().isEmpty() ) + { + return i18n.getString( "group_order" ) + ": " + groupOrder.getName() + " " + + i18n.getString( "has_no_element" ); + } + } + } + else if ( exportReport.getReportType().equalsIgnoreCase( ExportReport.TYPE.CATEGORY ) ) { for ( DataElementGroupOrder groupOrder : ((ExportReportCategory) exportReport).getDataElementOrders() ) { @@ -366,6 +401,39 @@ } } } + else if ( exportReport.getReportType().equalsIgnoreCase( ExportReport.TYPE.CATEGORY_VERTICAL ) ) + { + for ( CategoryOptionGroupOrder groupOrder : ((ExportReportVerticalCategory) exportReport) + .getCategoryOptionGroupOrders() ) + { + if ( groupOrder.getCategoryOptions() == null || groupOrder.getCategoryOptions().isEmpty() ) + { + return i18n.getString( "group_order" ) + ": " + groupOrder.getName() + " " + + i18n.getString( "has_no_element" ); + } + } + + String deId = null; + List deIds = new ArrayList(); + + for ( ExportItem item : items ) + { + deId = item.getExpression().split( "\\" + DataElementOperand.SEPARATOR )[0].replace( "[", "" ); + + if ( !deIds.contains( deId ) ) + { + deIds.add( deId ); + + DataElement de = dataElementService.getDataElement( Integer.parseInt( deId ) ); + + if ( de == null ) + { + return i18n.getString( "dataelement_with_id" ) + ": " + deId + " " + + i18n.getString( "does_not_exist" ); + } + } + } + } else { Set operands = new HashSet(); === modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml' --- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-04-26 18:25:07 +0000 +++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-04-29 09:57:26 +0000 @@ -16,6 +16,7 @@ + === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/GetCategoryOptionsByCategoryAction.java' --- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/GetCategoryOptionsByCategoryAction.java 2012-04-26 18:25:07 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/GetCategoryOptionsByCategoryAction.java 2012-04-29 09:57:26 +0000 @@ -57,7 +57,7 @@ private Integer categoryId; - public void setAttributeId( Integer categoryId ) + public void setCategoryId( Integer categoryId ) { this.categoryId = categoryId; } === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java' --- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java 2012-04-25 09:59:24 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java 2012-04-29 09:57:26 +0000 @@ -143,6 +143,7 @@ { ExportItem newExportItem = new ExportItem(); + newExportItem.setPeriodType( exportItem.getPeriodType() ); newExportItem.setExpression( de.getId() + SEPARATOR + optionCombo.getId() ); double result = this.getDataValue( newExportItem, organisationUnit ); === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java' --- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java 2012-04-19 08:53:59 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java 2012-04-29 09:57:26 +0000 @@ -132,15 +132,11 @@ else { ExportItem newReportItem = new ExportItem(); - newReportItem.setColumn( reportItem.getColumn() ); - newReportItem.setRow( reportItem.getRow() ); - newReportItem.setPeriodType( reportItem.getPeriodType() ); - newReportItem.setName( reportItem.getName() ); - newReportItem.setSheetNo( reportItem.getSheetNo() ); - newReportItem.setItemType( reportItem.getItemType() ); String expression = reportItem.getExpression(); expression = expression.replace( "*", String.valueOf( dataElement.getId() ) ); + + newReportItem.setPeriodType( reportItem.getPeriodType() ); newReportItem.setExpression( expression ); double value = this.getDataValue( newReportItem, organisationUnit ); === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportVerticalCategoryAction.java' --- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportVerticalCategoryAction.java 2012-04-26 19:11:23 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportVerticalCategoryAction.java 2012-04-29 09:57:26 +0000 @@ -26,7 +26,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - +import static org.hisp.dhis.dataelement.DataElementOperand.SEPARATOR; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -88,7 +88,9 @@ if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT ) ) { - de = dataElementService.getDataElement( Integer.parseInt( reportItem.getExpression().split( "." )[0] ) ); + de = dataElementService.getDataElement( Integer.parseInt( reportItem.getExpression().split( + "\\" + SEPARATOR )[0].replace( "[", "" ) ) ); + optionCombos = de.getCategoryCombo().getOptionCombos(); } @@ -134,13 +136,14 @@ String expression = reportItem.getExpression(); expression = expression.replace( "*", String.valueOf( optionCombo.getId() ) ); + newReportItem.setPeriodType( reportItem.getPeriodType() ); newReportItem.setExpression( expression ); double value = this.getDataValue( newReportItem, organisationUnit ); ExcelUtils.writeValueByPOI( rowBegin, reportItem.getColumn(), String.valueOf( value ), ExcelUtils.NUMBER, sheet, this.csNumber ); - + break; } } === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExpressionUtils.java' --- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExpressionUtils.java 2012-04-28 18:30:18 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExpressionUtils.java 2012-04-29 09:57:26 +0000 @@ -128,18 +128,17 @@ while ( matcher.find() ) { String replaceString = matcher.group(); - - replaceString = replaceString.replaceAll( "[\\[\\]]", "" ); + + replaceString = replaceString.replaceAll( "[\\[\\]]", EMPTY ); String dataElementIdString = replaceString.substring( 0, replaceString.indexOf( SEPARATOR ) ); String optionComboIdString = replaceString.substring( replaceString.indexOf( SEPARATOR ) + 1, replaceString.length() ); - + int dataElementId = Integer.parseInt( dataElementIdString ); int optionComboId = Integer.parseInt( optionComboIdString ); DataElement dataElement = dataElementService.getDataElement( dataElementId ); - DataElementCategoryOptionCombo optionCombo = categoryService .getDataElementCategoryOptionCombo( optionComboId ); === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties' --- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-04-28 16:58:08 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-04-29 09:57:26 +0000 @@ -312,6 +312,7 @@ indicator_with_id = Indicator with id dataelement_with_id = Dataelement with id cate_option_combo_with_id = Option combo with id +attribute_with_id = Attribute with id does_not_exist = does not exist period_columns = Period columns please_select_attribute = Please select an attribute @@ -320,4 +321,8 @@ available_attributevalues = Available attribute value selected_attributevalues = Selected attribute value sort_attributevalue = Sort attribute value -selected_list_should_not_empty = The selected list should not empty \ No newline at end of file +no_attribute_selected = There is no attribute selected +selected_list_should_not_empty = The selected list should not empty +select_category = Select category +please_select_category = Please select a category +categoryoption_groups = Category Option Groups \ No newline at end of file === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties' --- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-04-28 16:58:08 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-04-29 09:57:26 +0000 @@ -356,3 +356,8 @@ selected_list_should_not_empty=Danh s\u00e1ch n\u00e0y kh\u00f4ng n\u00ean r\u1ed7ng intro_export_reports=T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0 x\u00f3a c\u00e1c b\u00e1o c\u00e1o b\u1ea3ngl. M\u1ed9t b\u00e1o c\u00e1o b\u1ea3ngl ch\u1ee9a nhi\u1ec1u ph\u1ea7n t\u1eed. B\u00e1o c\u00e1o b\u1ea3ng c\u00f3 th\u1ec3 thu\u1ed9c nhi\u1ec1u lo\u1ea1i b\u00e1o c\u00e1o kh\u00e1c nhau. Cho ph\u00e9p g\u00e1n b\u00e1o c\u00e1o cho m\u1ed9t hay nhi\u1ec1u \u0111\u01a1n v\u1ecb ho\u1eb7c nh\u00f3m \u0111\u01a1n v\u1ecb v\u00e0 m\u1ed9t s\u1ed1 t\u00f9y ch\u1ecdn kh\u00e1c. intro_import_reports=T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, x\u00f3a v\u00e0 xem c\u00e1c ph\u1ea7n t\u1eed \u0111\u1ec3 t\u00edch h\u1ee3p d\u1eef li\u1ec7u t\u1eeb c\u00e1c t\u1eadp tin b\u1ea3ng. C\u00e1c ph\u1ea7n t\u1eed n\u00e0y t\u01b0\u01a1ng \u0111\u01b0\u01a1ng v\u1edbi c\u00e1c ph\u1ea7n t\u1eed b\u00e1o c\u00e1o. +no_attribute_selected = Kh\u00f4ng c\u00f3 Thu\u1ed9c t\u00ednh n\u00e0o \u0111\u01b0\u1ee3c ch\u1ecdn trong khi thi\u1ebft k\u1ebf b\u00e1o c\u00e1o +attribute_with_id = Thu\u1ed9c t\u00ednh c\u00f3 m\u00e3 +select_category = Ch\u1ecdn ph\u00e2n lo\u1ea1i +please_select_category = H\u00e3y ch\u1ecdn ph\u00e2n lo\u1ea1i +categoryoption_groups = Nh\u00f3m c\u00e1c Ph\u00e2n lo\u1ea1i \ No newline at end of file === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/categoryOptionGroupOrder.js' --- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/categoryOptionGroupOrder.js 2012-04-26 18:25:07 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/categoryOptionGroupOrder.js 2012-04-29 09:57:26 +0000 @@ -18,7 +18,7 @@ var availableList = jQuery( '#availableCategoryOptions' ); availableList.empty(); - var selectedList = jQuery( '#categoryOptions' ); + var selectedList = jQuery( '#categoryOptionIds' ); selectedList.empty(); } @@ -50,14 +50,14 @@ { var categoryOptions = json.categoryOptionGroupOrder.categoryOptions; var categoryId = ( categoryOptions.length > 0 ? categoryOptions[ 0 ].categoryId : "" ); - var list = jQuery( "#categoryOptions" ); + var list = jQuery( "#categoryOptionIds" ); list.empty(); selectedCategoryOptionMap = []; var items = []; setFieldValue( "name", json.categoryOptionGroupOrder.name ); categoryLib.loadCategories( "categoryId", categoryId ); - categoryLib.loadCategoryOptionsByCategory( categoryId, items, "availableCategoryOptions", "categoryOptions", true ); + categoryLib.loadCategoryOptionsByCategory( categoryId, items, "availableCategoryOptions", "categoryOptionIds", true ); for ( var i = 0 ; i < categoryOptions.length ; i++ ) { @@ -67,7 +67,7 @@ selectedCategoryOptionMap[ id + "-" + categoryId ] = items; - categoryLib.removeDuplicatedItem( "availableCategoryOptions", "categoryOptions" ); + categoryLib.removeDuplicatedItem( "availableCategoryOptions", "categoryOptionIds" ); jQuery( "#categoryOptionGroupsForm" ).attr( "action", "updateCategoryOptionGroupOrderFor" + clazzName + ".action" ); dialog.dialog( "open" ); @@ -89,12 +89,12 @@ { if ( json.response == "success" ) { - if ( hasElements( 'categoryOptions' ) ) + if ( hasElements( 'categoryOptionIds' ) ) { - selectAllById( 'categoryOptions' ); + selectAllById( 'categoryOptionIds' ); _form.submit(); } - else { markInvalid( "categoryOptions", i18n_selected_list_empty ); } + else { markInvalid( "categoryOptionIds", i18n_selected_list_empty ); } } else { markInvalid( "name", json.message ); } } ); === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listCategoryOptionGroupOrder.vm' --- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listCategoryOptionGroupOrder.vm 2012-04-26 18:25:07 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listCategoryOptionGroupOrder.vm 2012-04-29 09:57:26 +0000 @@ -46,7 +46,7 @@
    -#foreach( $group in $!report.categoryOptionOrders ) +#foreach( $group in $!report.categoryOptionGroupOrders )
  • @@ -78,27 +78,27 @@ -
    - + -
    -
    -
    - +
    +
    +
    +
    - +

    -

    -

    - +


    +

    +

    +
    === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm' --- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm 2012-04-16 03:00:30 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm 2012-04-29 09:57:26 +0000 @@ -48,6 +48,8 @@ $i18n.getString( 'attributevalue_groups' ) #elseif( $exportReport.isCategory() ) $i18n.getString( 'dataelement_groups' ) + #elseif( $exportReport.isCategoryVertical() ) + $i18n.getString( 'categoryoption_groups' ) #elseif( $exportReport.isPeriodColumnListing() ) #end