dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36689
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18770: Edit program stage section, getting indicators from program
------------------------------------------------------------
revno: 18770
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-31 11:57:41 +0200
message:
Edit program stage section, getting indicators from program
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.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/GetProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageSectionAction.java 2015-03-29 09:47:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageSectionAction.java 2015-03-31 09:57:41 +0000
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import org.hisp.dhis.program.ProgramIndicator;
@@ -104,9 +105,9 @@
return section;
}
- private Collection<ProgramStageDataElement> availableDataElements;
+ private List<ProgramStageDataElement> availableDataElements;
- public Collection<ProgramStageDataElement> getAvailableDataElements()
+ public List<ProgramStageDataElement> getAvailableDataElements()
{
return availableDataElements;
}
@@ -134,19 +135,23 @@
throws Exception
{
section = programStageSectionService.getProgramStageSection( id );
+
+ programStage = programStageService.getProgramStage( programStageId );
- if ( programStageId != null )
+ if ( programStage != null && programStage.getProgram() != null )
{
- programStage = programStageService.getProgramStage( programStageId );
-
- availableDataElements = programStage.getProgramStageDataElements();
- availableProgramIndicators = new ArrayList<>( programStage.getProgramIndicators() );
+ availableDataElements = new ArrayList<>( programStage.getProgramStageDataElements() );
+
+ availableProgramIndicators = new ArrayList<>( programStage.getProgram().getProgramIndicators() );
availableProgramIndicators.removeAll( section.getProgramIndicators() );
for ( ProgramStageSection section : programStage.getProgramStageSections() )
{
availableDataElements.removeAll( section.getProgramStageDataElements() );
}
+
+ Collections.sort( availableDataElements );
+ Collections.sort( availableProgramIndicators );
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java 2015-03-29 09:47:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageSectionAction.java 2015-03-31 09:57:41 +0000
@@ -170,8 +170,7 @@
programIndicators.add( indicator );
}
- section.setProgramIndicators( programIndicators );
-
+ section.setProgramIndicators( programIndicators );
programStageSectionService.updateProgramStageSection( section );