← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8411: Exception thrown if to search with Use data from level(s) as Children Only option in program summ...

 

------------------------------------------------------------
revno: 8411
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-10-06 22:55:56 +0700
message:
  Exception thrown if to search with Use data from level(s) as Children Only option in program summary.
removed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePrograms.vm
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java	2012-10-06 15:13:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateReportAction.java	2012-10-06 15:55:56 +0000
@@ -43,8 +43,6 @@
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.system.util.ConversionUtils;
 
 /**
@@ -78,14 +76,7 @@
     {
         this.programInstanceService = programInstanceService;
     }
-
-    private ProgramStageInstanceService programStageInstanceService;
-
-    public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
-    {
-        this.programStageInstanceService = programStageInstanceService;
-    }
-
+    
     private OrganisationUnitService organisationUnitService;
 
     public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
@@ -166,7 +157,7 @@
     {
         return total;
     }
-    
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -204,26 +195,20 @@
                 organisationUnit.getId() ) );
         }
 
-        // ---------------------------------------------------------------------
-        // Program instances for the selected program
-        // ---------------------------------------------------------------------
-
-        total = programInstanceService.countProgramInstances( program, organisationUnit, sDate, eDate );
-
-        this.paging = createPaging( total );
-
-        programInstances = programInstanceService.getProgramInstances( program, orgunitIds, sDate, eDate,
-            paging.getStartPos(), paging.getPageSize() );
-
-        Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
-
-        for ( ProgramInstance programInstance : programInstances )
+        if ( orgunitIds.size() > 0 )
         {
-            programStageInstances.addAll( programInstance.getProgramStageInstances() );
+            // ---------------------------------------------------------------------
+            // Program instances for the selected program
+            // ---------------------------------------------------------------------
+
+            total = programInstanceService.countProgramInstances( program, organisationUnit, sDate, eDate );
+
+            this.paging = createPaging( total );
+
+            programInstances = programInstanceService.getProgramInstances( program, orgunitIds, sDate, eDate,
+                paging.getStartPos(), paging.getPageSize() );
         }
-
-        statusMap = programStageInstanceService.statusProgramStageInstances( programStageInstances );
-
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java	2012-09-03 19:53:34 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java	2012-10-06 15:55:56 +0000
@@ -87,7 +87,7 @@
     {
         orgunit = selectionManager.getSelectedOrganisationUnit();
         
-        programs = programService.getPrograms( orgunit );
+        programs = programService.getAllPrograms();
         
         programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITH_REGISTRATION ) );
         programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-10-03 06:04:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-10-06 15:55:56 +0000
@@ -246,8 +246,6 @@
 			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
-		<property name="programStageInstanceService"
-			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 		<property name="organisationUnitService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	</bean>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-09-27 08:00:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-10-06 15:55:56 +0000
@@ -327,13 +327,6 @@
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-caseentry/records.vm</param>
 		</action>
-
-		<action name="getReportPrograms"
-			class="org.hisp.dhis.caseentry.action.caseentry.GetProgramsByOrgunitAction">
-			<result name="success" type="velocity-json">
-				/dhis-web-caseentry/responsePrograms.vm
-			</result>
-		</action>
 		
 		<!-- i18n -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2012-09-23 07:34:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2012-10-06 15:55:56 +0000
@@ -1,37 +1,7 @@
 isAjax = true;
 function organisationUnitSelected( orgUnits, orgUnitNames )
 {
-    showLoader();
-	setInnerHTML( 'contentDiv','' );
-	jQuery.getJSON( "getReportPrograms.action",{}, 
-		function( json ) 
-		{    
-			setFieldValue( 'orgunitname', orgUnitNames[0] );
-			
-			clearListById('programId');
-			if( json.programs.length == 0)
-			{
-				disable('programId');
-				disable('startDate');
-				disable('endDate');
-				disable('generateBtn');
-			}
-			else
-			{
-				addOptionById( 'programId', "", i18n_please_select_a_program );
-				
-				for ( var i in json.programs ) 
-				{
-					addOptionById( 'programId', json.programs[i].id, json.programs[i].name );
-				} 
-				enable('programId');
-				enable('startDate');
-				enable('endDate');
-				enable('generateBtn');
-			}
-			
-			hideLoader();
-		});
+    setFieldValue( 'orgunitname', orgUnitNames[0] );
 }
 
 selection.setListenerFunction( organisationUnitSelected );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm	2012-09-06 03:50:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm	2012-10-06 15:55:56 +0000
@@ -15,7 +15,7 @@
 <table>	
     <tr>
 	  <td><label>$i18n.getString( "orgunit_boundary" )</label></td>
-	  <td><input type="text" readonly="readonly" id='orgunitname' name='orgunitname' #if($!orgunit) value="$!orgunit.name" #else value="[$i18n.getString( 'select' )]" #end ></td>
+	  <td><input type="text" readonly="readonly" id='orgunitname' name='orgunitname' #if($!orgunit) value="$!orgunit.name" #else value="[$i18n.getString( 'please_select' )]" #end ></td>
     </tr>
     
     <tr>

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePrograms.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePrograms.vm	2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/responsePrograms.vm	1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
-#set( $size = $programs.size() )
-{ 
-"programs": [
-	#foreach( $program in $programs )
-	  {
-		"id":  ${program.id} ,
-		"name": "$!encoder.jsonEncode( ${program.name} )",
-		"type": "$program.type"
-	  }#if( $velocityCount < $size ),#end
-	#end]
-}
\ No newline at end of file