← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6995: Minor fixes in Excel Import in Local India Module

 

------------------------------------------------------------
revno: 6995
committer: Neeraj <neeraj.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2012-05-21 17:18:24 +0530
message:
  Minor fixes in Excel Import in Local India Module
modified:
  local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java
  local/in/dhis-web-excelimport/src/main/webapp/dhis-web-excelimport/portalDataImportForm.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 'local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java'
--- local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java	2012-03-19 06:11:45 +0000
+++ local/in/dhis-web-excelimport/src/main/java/org/hisp/dhis/excelimport/portal/action/PortalExcelImportResultAction.java	2012-05-21 11:48:24 +0000
@@ -224,6 +224,13 @@
     {
         return lockStatus;
     }
+	
+	String selectedPeriodicity;
+    
+    public void setSelectedPeriodicity( String selectedPeriodicity )
+    {
+        this.selectedPeriodicity = selectedPeriodicity;
+    }
 
     // -------------------------------------------------------------------------
     // Action implementation
@@ -430,8 +437,8 @@
         monthMap.put( "December", "12" );
         
         String selectedMonth = "";
-        String selectedPeriodicity = "";
-        String selectedFinancialYear = "";
+        
+		String selectedFinancialYear = "";
         String selectedFormat = "";
         String selectedParentName = "";
         
@@ -472,10 +479,12 @@
             {
                 selectedParentName = cellContent;
             }
+			/*
             else if( header.getExpression().equalsIgnoreCase( ExcelImport_Header.HEADER_PERIODICITY ) )
             {
                 selectedPeriodicity = cellContent;
             }
+			*/
         }
         
         String selStartDate = "";
@@ -492,6 +501,9 @@
             }
         }
 
+        System.out.println( "******* " +selStartDate + " : " + selectedMonth + " : " + selectedFinancialYear + " : " +  selectedPeriodicity );
+        
+        
         PeriodType periodType = periodService.getPeriodTypeByName( selectedPeriodicity );
         Period selectedPeriod = getSelectedPeriod( selStartDate, periodType );
         SimpleDateFormat periodFormat;
@@ -580,7 +592,8 @@
                     if( portalOrgUnit != null && orgUnitList.contains( portalOrgUnit ) )
                     {
                         System.out.println("--------Importing started for :"+portalOrgUnit.getName() + "-------------" );
-                        lockStatus = dataSetService.isLocked( dataSet, selectedPeriod, portalOrgUnit, null );
+                        
+						lockStatus = dataSetService.isLocked( dataSet, selectedPeriod, portalOrgUnit, null );
                         //DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetPeriodAndSource( dataSet, selectedPeriod, portalOrgUnit );
                         //if( dataSetLock != null )
                         if( lockStatus )
@@ -599,6 +612,7 @@
                         for( ExcelImport_DeCode deCode : deCodeList )
                         {
                             String deCodeExpression = deCode.getExpression();
+							System.out.println( deCodeExpression );
                             if( deCodeExpression != null && !deCodeExpression.trim().equals( "" ) )
                             {
                                 Integer deId = Integer.parseInt( deCodeExpression.split( "\\." )[0] );
@@ -928,12 +942,14 @@
                 return orgUnitId;
             }
         }
-        
+			
         return null;
     }
 
     public Integer getOrgUnitIdByURL( String url )
     {
+        url = url.replace("'","\\'");
+		System.out.println(url);
         String query = "SELECT organisationunitid FROM organisationunit WHERE url LIKE '"+ url +"'";
         SqlRowSet sqlResultSet = jdbcTemplate.queryForRowSet( query );
         if ( sqlResultSet != null && sqlResultSet.next() )

=== modified file 'local/in/dhis-web-excelimport/src/main/webapp/dhis-web-excelimport/portalDataImportForm.vm'
--- local/in/dhis-web-excelimport/src/main/webapp/dhis-web-excelimport/portalDataImportForm.vm	2011-04-15 11:43:00 +0000
+++ local/in/dhis-web-excelimport/src/main/webapp/dhis-web-excelimport/portalDataImportForm.vm	2012-05-21 11:48:24 +0000
@@ -18,7 +18,7 @@
 </style>
 
 <div id="overlay">
-	<div id="overlayImg"><img  width="50" height="50" src="images/ajax-loader.gif" /></div>
+	<div id="overlayImg"><img  width="50" height="50" src="ima	ges/ajax-loader.gif" /></div>
 </div>
 
 <script>
@@ -31,6 +31,7 @@
 	var datasetIds = new HashTable();
 	var orgunitGroupIds = new HashTable();
 	var facilityStarts = new HashTable();
+	var periodicityTable = new HashTable();
 
 	#foreach ( $excelImportSheet in $excelImportSheetList )
 		var excelImportSheetId = ""+"$excelImportSheet.xmlTemplateName";
@@ -41,6 +42,7 @@
         datasetIds.put( excelImportSheetId, "$excelImportSheet.datasetId" );
 		orgunitGroupIds.put( excelImportSheetId, "$excelImportSheet.orgunitGroupId" );
 		facilityStarts.put( excelImportSheetId, "$excelImportSheet.facilityStart" );
+		periodicityTable.put( excelImportSheetId, "$excelImportSheet.periodicity" );
 	#end
 
     function formValidations()
@@ -57,6 +59,7 @@
         document.dataImportForm.datasetId.value = datasetIds.get( importSheetList.options[importSheetListSelectedIndex].value );
         document.dataImportForm.orgunitGroupId.value = orgunitGroupIds.get( importSheetList.options[importSheetListSelectedIndex].value );
         document.dataImportForm.facilityStart.value = facilityStarts.get( importSheetList.options[importSheetListSelectedIndex].value );
+		document.dataImportForm.selectedPeriodicity.value = periodicityTable.get( importSheetList.options[importSheetListSelectedIndex].value );
 		
 		showOverlay();
         
@@ -125,6 +128,7 @@
                 <input type="hidden" name="datasetId" id="datasetId" />
 				<input type="hidden" name="orgunitGroupId" id="orgunitGroupId" />
 				<input type="hidden" name="facilityStart" id="facilityStart" />
+				<input type="hidden" name="selectedPeriodicity" id="selectedPeriodicity" />
             </td>
         </tr>
 	</table>