← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2023: Fix bug: Exception into DataEntry of Patient module.

 

------------------------------------------------------------
revno: 2023
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-11-10 09:11:55 +0700
message:
  Fix bug: Exception into DataEntry of Patient module.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.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/caseentry/DataRecordingSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java	2010-08-31 14:34:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/DataRecordingSelectAction.java	2010-11-10 02:11:55 +0000
@@ -222,32 +222,32 @@
     public String execute()
         throws Exception
     {
+        // ---------------------------------------------------------------------
+        // Validate selected OrganisationUnit && Patient
+        // ---------------------------------------------------------------------
+    
         organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
-
-        // ---------------------------------------------------------------------
-        // Validate selected Patient
-        // ---------------------------------------------------------------------
-
+        
+        if ( organisationUnit == null || id == null )
+        {
+            programId = null;
+            programStageId = null;
+            
+            selectedStateManager.clearSelectedPatient();
+            selectedStateManager.clearSelectedProgram();
+            selectedStateManager.clearSelectedProgramStage();
+            
+            return SUCCESS;
+        }
+        
         patient = patientService.getPatient( id );
-
-        if ( patient == null )
-        {
-            programId = null;
-            programStageId = null;
-
-            selectedStateManager.clearSelectedPatient();
-            selectedStateManager.clearSelectedProgram();
-            selectedStateManager.clearSelectedProgramStage();
-
-            return SUCCESS;
-        }
-
+        
         selectedStateManager.setSelectedPatient( patient );
-
+        
         // ---------------------------------------------------------------------
         // Load Enrolled Programs
         // ---------------------------------------------------------------------
-
+        
         for ( Program program : patient.getPrograms() )
         {
             if ( program.getOrganisationUnits().contains( organisationUnit ) )
@@ -255,13 +255,13 @@
                 programs.add( program );
             }
         }
-
+        
         // ---------------------------------------------------------------------
         // Validate selected Program
         // ---------------------------------------------------------------------
 
         Program selectedProgram;
-
+        
         if ( programId != null )
         {
             selectedProgram = programService.getProgram( programId );
@@ -276,7 +276,6 @@
             programId = selectedProgram.getId();
             selectedStateManager.setSelectedProgram( selectedProgram );
         }
-
         else
         {
             programId = null;
@@ -287,7 +286,7 @@
 
             return SUCCESS;
         }
-
+        
         // ---------------------------------------------------------------------
         // Load the active program instance completed = false we need the
         // corresponding stage execution date
@@ -295,20 +294,20 @@
 
         Collection<ProgramInstance> progamInstances = programInstanceService.getProgramInstances( patient,
             selectedProgram, false );
-
+        
         if ( progamInstances == null || progamInstances.iterator() == null || !progamInstances.iterator().hasNext() )
             return SUCCESS;
-
+        
         programInstance = progamInstances.iterator().next();
-
+        
         colorMap = programStageInstanceService.colorProgramStageInstances( programInstance.getProgramStageInstances() );
-
+        
         // ---------------------------------------------------------------------
         // Load ProgramStages
         // ---------------------------------------------------------------------
 
         programStages = selectedProgram.getProgramStages();
-
+        
         // ---------------------------------------------------------------------
         // Validate selected ProgramStage
         // ---------------------------------------------------------------------
@@ -337,17 +336,17 @@
 
             return SUCCESS;
         }
-
+        
         // ---------------------------------------------------------------------
         // Load the programStageInstance we need the corresponding execution
         // date
         // ---------------------------------------------------------------------
 
         ProgramInstance programInstance = progamInstances.iterator().next();
-
+        
         programStageInstance = programStageInstanceService.getProgramStageInstance( programInstance,
             selectedProgramStage );
-
+        
         // ---------------------------------------------------------------------
         // Check if there is custom DataEntryForm
         // ---------------------------------------------------------------------
@@ -361,6 +360,7 @@
         {
             return CUSTOM_DATAENTRY_FORM;
         }
+        
         return DATAENTRY_FORM;
 
     }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2010-08-25 05:51:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2010-11-10 02:11:55 +0000
@@ -1,11 +1,9 @@
 <div>
     <input type="button" value="$i18n.getString( "back_to_search" )" onclick="window.location.href='searchPatient.action'" style="width:10em">
 </div>
-           
-<form id="selectRecordingForm" name="selectRecordingForm" method="post" action="selectDataRecording.action">
-
-<input type="hidden" id="id" name="id" value="$patient.id">
-    
+   
+<input type="hidden" id="id" name="id" value="$patient.id">        
+<form id="selectRecordingForm" name="selectRecordingForm" method="post" action="selectDataRecording.action?id=$patient.id">
 
 <table class="mainPageTable"> 
     <tr>