← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21185: bug fix in exiting program stage data elements

 

------------------------------------------------------------
revno: 21185
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-11-24 11:38:36 +0100
message:
  bug fix in exiting program stage data elements
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java


--
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-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java	2015-11-23 06:52:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java	2015-11-24 10:38:36 +0000
@@ -430,11 +430,11 @@
             attributeService.updateAttributeValues( programStage, jsonAttributeValues );
         }
 
-        programStageService.updateProgramStage( programStage );
-
         Set<ProgramStageDataElement> programStageDataElements = new HashSet<>(
             programStage.getProgramStageDataElements() );
-
+        
+        programStage.getProgramStageDataElements().clear();
+        
         for ( int i = 0; i < this.selectedDataElementsValidator.size(); i++ )
         {
             DataElement dataElement = dataElementService.getDataElement( selectedDataElementsValidator.get( i ) );
@@ -465,13 +465,17 @@
 
                 programStageDataElements.remove( programStageDataElement );
             }
-        }
-
+            
+            programStage.getProgramStageDataElements().add( programStageDataElement );
+        }        
+        
+        programStageService.updateProgramStage( programStage );
+        
         for ( ProgramStageDataElement psdeDelete : programStageDataElements )
-        {
+        {            
             programStageDataElementService.deleteProgramStageDataElement( psdeDelete );
         }
-
+        
         programId = programStage.getProgram().getId();
 
         return SUCCESS;