← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6168: (patient) Save providedOtherFacility when saving report-date for event.

 

------------------------------------------------------------
revno: 6168
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-03-05 15:41:21 +0700
message:
  (patient) Save providedOtherFacility when saving report-date for event.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-03-05 04:22:57 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-03-05 08:41:21 +0000
@@ -389,6 +389,7 @@
 
             executeSql( "ALTER TABLE patientdatavalue DROP COLUMN organisationUnitid" );
             executeSql( "ALTER TABLE patientdatavalue DROP COLUMN providedByAnotherFacility" );
+            executeSql( "ALTER TABLE patientdatavalue ADD PRIMARY KEY ( programstageinstanceid, dataelementid )" );
         }
         catch ( Exception ex )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java	2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CreateAnonymousEncounterAction.java	2012-03-05 08:41:21 +0000
@@ -29,6 +29,7 @@
 
 import java.util.Date;
 
+import org.hisp.dhis.caseentry.state.SelectedStateManager;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.program.ProgramInstance;
@@ -50,7 +51,14 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
+    
+    private SelectedStateManager selectedStateManager;
 
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+    
     private ProgramInstanceService programInstanceService;
 
     public void setProgramInstanceService( ProgramInstanceService programInstanceService )
@@ -129,6 +137,8 @@
             programStageInstance.setStageInProgram( programInstance.getProgramStageInstances().size() + 1 );
             programStageInstance.setDueDate( date );
             programStageInstance.setExecutionDate( date );
+            programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() );
+            programStageInstance.setProvidedByAnotherFacility( false );
 
             programStageInstanceService.addProgramStageInstance( programStageInstance );
             

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java	2011-12-19 03:08:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java	2012-03-05 08:41:21 +0000
@@ -170,6 +170,8 @@
                     programStageInstance.setStageInProgram( programStage.getStageInProgram() );
                     programStageInstance.setDueDate( dateValue );
                     programStageInstance.setExecutionDate( dateValue );
+                    programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() );
+                    programStageInstance.setProvidedByAnotherFacility( false );
 
                     programStageInstanceService.addProgramStageInstance( programStageInstance );
 
@@ -180,6 +182,7 @@
             else
             {
                 programStageInstance.setExecutionDate( dateValue );
+                programStageInstance.setOrganisationUnit( selectedStateManager.getSelectedOrganisationUnit() );
 
                 if ( programStageInstance.getProgramInstance().getProgram().getSingleEvent() )
                 {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java	2012-03-05 04:22:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveValueAction.java	2012-03-05 08:41:21 +0000
@@ -121,8 +121,6 @@
     public String execute()
         throws Exception
     {
-        OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
-
         ProgramStageInstance programStageInstance = selectedStateManager.getSelectedProgramStageInstance();
 
         DataElement dataElement = dataElementService.getDataElement( dataElementId );
@@ -142,7 +140,6 @@
         if ( programStageInstance.getExecutionDate() == null )
         {
             programStageInstance.setExecutionDate( new Date() );
-            programStageInstance.setOrganisationUnit( organisationUnit );
             programStageInstanceService.updateProgramStageInstance( programStageInstance );
         }
 

=== 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-03-05 04:22:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2012-03-05 08:41:21 +0000
@@ -418,6 +418,8 @@
 	
 	<bean id="org.hisp.dhis.caseentry.action.caseentry.CreateAnonymousEncounterAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.CreateAnonymousEncounterAction" scope="prototype">
+		<property name="selectedStateManager"
+			ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
 		<property name="programInstanceService"
 			ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="programStageInstanceService"