← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4726: Don't show datavalues when opening default dataentry form (Multi dataentry form)

 

------------------------------------------------------------
revno: 4726
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-09-28 10:31:19 +0700
message:
  Don't show datavalues when opening default dataentry form (Multi dataentry form)
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml


--
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/ProgramStageCustomDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java	2011-07-14 09:31:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java	2011-09-28 03:31:19 +0000
@@ -47,6 +47,7 @@
 import org.hisp.dhis.program.ProgramDataEntryService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
 
@@ -94,6 +95,13 @@
         this.programDataEntryService = programDataEntryService;
     }
 
+    private ProgramStageDataElementService programStageDataElementService;
+
+    public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+    {
+        this.programStageDataElementService = programStageDataElementService;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -263,18 +271,36 @@
 
         selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
 
+        selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
+
+        // ---------------------------------------------------------------------
+        // Get CategoryOptions
+        // ---------------------------------------------------------------------
+
+        Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
+
+        for ( DataElement dataElement : dataElements )
+        {
+            optionMap.put( dataElement.getId(), dataElement.getCategoryCombo().getOptionCombos() );
+        }
+
+        // ---------------------------------------------------------------------
+        // Get data values
+        // ---------------------------------------------------------------------
+
         Collection<PatientDataValue> patientDataValues = patientDataValueService
             .getPatientDataValues( programStageInstance );
 
+        patientDataValueMap = new HashMap<Integer, PatientDataValue>( patientDataValues.size() );
+
+        for ( PatientDataValue patientDataValue : patientDataValues )
+        {
+            patientDataValueMap.put( patientDataValue.getDataElement().getId(), patientDataValue );
+        }
+
         DataEntryForm dataEntryForm = programStage.getDataEntryForm();
-        if ( dataEntryForm == null )
-        {
-            return SUCCESS;
-        }
-
-        boolean cdeFormExists = (dataEntryForm != null);
-
-        if ( cdeFormExists )
+
+        if ( dataEntryForm != null )
         {
             customDataEntryFormExists = true;
 

=== 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	2011-09-28 02:14:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2011-09-28 03:31:19 +0000
@@ -212,6 +212,8 @@
 			ref="org.hisp.dhis.patient.PatientIdentifierService" />
 		<property name="programStageInstanceService"
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
+		<property name="programStageDataElementService"
+			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>
 
 	<!-- Visit Plan -->