dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40461
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20513: minor fix for add program stage section action, auto fields was not set since it used cascading f...
------------------------------------------------------------
revno: 20513
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-10-06 15:03:32 +0700
message:
minor fix for add program stage section action, auto fields was not set since it used cascading for save, and not adding it through program stage section service
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.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/AddProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java 2015-09-23 12:27:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageSectionAction.java 2015-10-06 08:03:32 +0000
@@ -28,10 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
@@ -44,7 +41,9 @@
import org.hisp.dhis.program.ProgramStageService;
import org.springframework.beans.factory.annotation.Autowired;
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
/**
* @author Chau Thu Tran
@@ -117,7 +116,7 @@
{
this.selectedIndicators = selectedIndicators;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -140,30 +139,30 @@
psDataElements.add( psDataElement );
}
- ProgramStageSection section = new ProgramStageSection( StringUtils.trimToNull( name ), psDataElements, programStage
- .getProgramStageSections().size() );
+ ProgramStageSection programStageSection = new ProgramStageSection( StringUtils.trimToNull( name ), psDataElements,
+ programStage.getProgramStageSections().size() );
+ programStageSection.setAutoFields();
// ---------------------------------------------------------------------
// Update program stage
// ---------------------------------------------------------------------
Set<ProgramStageSection> sections = programStage.getProgramStageSections();
+ sections.add( programStageSection );
- sections.add( section );
-
// ---------------------------------------------------------------------
// Program indicators
// ---------------------------------------------------------------------
-
+
List<ProgramIndicator> programIndicators = new ArrayList<>();
+
for ( Integer id : selectedIndicators )
{
ProgramIndicator indicator = programIndicatorService.getProgramIndicator( id );
programIndicators.add( indicator );
}
- section.setProgramIndicators( programIndicators );
-
+ programStageSection.setProgramIndicators( programIndicators );
programStage.setProgramStageSections( sections );
programStageService.updateProgramStage( programStage );