← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 898: fix bug: Copy report items

 

------------------------------------------------------------
revno: 898
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2009-10-22 12:37:47 +0700
message:
  fix bug: Copy report items
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm


--
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-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java	2009-09-15 04:00:03 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java	2009-10-22 05:37:47 +0000
@@ -39,81 +39,87 @@
  * @author Tran Thanh Tri
  * @version $Id$
  */
-public class CopyReportExcelItemAction implements Action
-{
- // -------------------------------------------
-    // Dependency
-    // -------------------------------------------
-
-    private ReportExcelService reportService;
-
-    // -------------------------------------------
-    // Input
-    // -------------------------------------------
-
-    private Integer reportId;
-
-    private Integer sheetNo;
-
-    private Collection<String> reportItems;
-
-    // -------------------------------------------
-    // Getter & Setter
-    // -------------------------------------------
-
-    public void setReportService( ReportExcelService reportService )
-    {
-        this.reportService = reportService;
-    }
-
-    public Integer getReportId()
-    {
-        return reportId;
-    }
-
-    public Integer getSheetNo()
-    {
-        return sheetNo;
-    }
-
-    public void setReportId( Integer reportId )
-    {
-        this.reportId = reportId;
-    }
-
-    public void setReportItems( Collection<String> reportItems )
-    {
-        this.reportItems = reportItems;
-    }
-
-    public void setSheetNo( Integer sheetNo )
-    {
-        this.sheetNo = sheetNo;
-    }
-
-    public String execute()
-        throws Exception
-    {
-        ReportExcel reportExcel = reportService.getReportExcel( reportId  );  
-        
-            
-        for(String itemId:this.reportItems){
-            Set<ReportExcelItem> reportItems = reportExcel.getReportExcelItems(); 
-            ReportExcelItem reportItem = reportService.getReportExcelItem( Integer.parseInt( itemId ) ) ;
-            ReportExcelItem newReportItem = new ReportExcelItem();
-            newReportItem.setName( reportItem.getName() );
-            newReportItem.setItemType( reportItem.getItemType() );
-            newReportItem.setPeriodType( reportItem.getPeriodType() );
-            newReportItem.setExpression( reportItem.getExpression() );
-            newReportItem.setRow( reportItem.getRow() );
-            newReportItem.setColumn( reportItem.getColumn() );
-            newReportItem.setSheetNo( sheetNo );
-            reportItems.add( newReportItem );
-            reportExcel.setReportExcelItems( reportItems );
-            reportService.updateReportExcel( reportExcel );
-            
-        }   
-               
-        return SUCCESS;
-    }
+public class CopyReportExcelItemAction implements Action {
+
+	// -------------------------------------------
+	// Dependency
+	// -------------------------------------------
+
+	private ReportExcelService reportService;
+
+	// -------------------------------------------
+	// Input
+	// -------------------------------------------
+
+	private Integer reportId;
+
+	private Integer sheetNo;
+
+	private Collection<String> reportItems;
+
+	// -------------------------------------------
+	// Getter & Setter
+	// -------------------------------------------
+
+	public void setReportService(ReportExcelService reportService) {
+		this.reportService = reportService;
+	}
+
+	public Integer getReportId() {
+		return reportId;
+	}
+
+	public Integer getSheetNo() {
+		return sheetNo;
+	}
+
+	public void setReportId(Integer reportId) {
+		this.reportId = reportId;
+	}
+
+	public void setReportItems(Collection<String> reportItems) {
+		this.reportItems = reportItems;
+	}
+
+	public void setSheetNo(Integer sheetNo) {
+		this.sheetNo = sheetNo;
+	}
+
+	public String execute() throws Exception {
+
+		ReportExcel reportExcel = reportService.getReportExcel(reportId);
+
+		Set<ReportExcelItem> reportItems = reportExcel.getReportExcelItems();
+
+		for (String itemId : this.reportItems) {
+
+			ReportExcelItem reportItem = reportService
+					.getReportExcelItem(Integer.parseInt(itemId));
+
+			ReportExcelItem newReportItem = new ReportExcelItem();
+
+			newReportItem.setName(reportItem.getName());
+
+			newReportItem.setItemType(reportItem.getItemType());
+
+			newReportItem.setPeriodType(reportItem.getPeriodType());
+
+			newReportItem.setExpression(reportItem.getExpression());
+
+			newReportItem.setRow(reportItem.getRow());
+
+			newReportItem.setColumn(reportItem.getColumn());
+
+			newReportItem.setSheetNo(sheetNo);
+
+			reportItems.add(newReportItem);
+
+			reportExcel.getReportExcelItems().add(newReportItem);
+
+		}
+
+		reportService.updateReportExcel(reportExcel);
+
+		return SUCCESS;
+	}
 }

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm	2009-10-02 02:58:42 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm	2009-10-22 05:37:47 +0000
@@ -31,7 +31,7 @@
 	#set( $mark = false )
 	#foreach($reportItem in $reportItems)
 		<tr #alternate( $mark )>
-			<td align=center><input type="checkbox" value="$reportItem.id" name="reportItemCheck"/></td>
+			<td align=center><input type="checkbox" value="$reportItem.id" name="reportItemCheck" id="reportItemCheck"/></td>
 			<td>$encoder.htmlEncode( $reportItem.name )</td>
 			<td>$i18n.getString( $reportItem.itemType )</td>
 			<td>$i18n.getString( $reportItem.periodType )</td>