dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26342
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13054: Minor fix
------------------------------------------------------------
revno: 13054
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-11-28 17:39:58 +0100
message:
Minor fix
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.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-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java 2013-11-28 16:37:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java 2013-11-28 16:39:58 +0000
@@ -128,36 +128,39 @@
throw new NullPointerException();
}
- form.getOptions().put( "captureCoordinates", programStage.getCaptureCoordinates() );
-
- if ( programStage.getProgramStageSections().size() > 0 )
+ if ( programStage != null )
{
- for ( ProgramStageSection section : programStage.getProgramStageSections() )
- {
- List<Field> fields = inputsFromProgramStageDataElements( section.getProgramStageDataElements() );
+ form.getOptions().put( "captureCoordinates", programStage.getCaptureCoordinates() );
+
+ if ( programStage.getProgramStageSections().size() > 0 )
+ {
+ for ( ProgramStageSection section : programStage.getProgramStageSections() )
+ {
+ List<Field> fields = inputsFromProgramStageDataElements( section.getProgramStageDataElements() );
+
+ if ( !fields.isEmpty() )
+ {
+ Group s = new Group();
+ s.setLabel( section.getDisplayName() );
+ s.setFields( fields );
+ form.getGroups().add( s );
+ }
+ }
+ }
+ else
+ {
+ List<Field> fields = inputsFromProgramStageDataElements(
+ new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() ) );
if ( !fields.isEmpty() )
{
Group s = new Group();
- s.setLabel( section.getDisplayName() );
+ s.setLabel( "default" );
s.setFields( fields );
form.getGroups().add( s );
}
}
}
- else
- {
- List<Field> fields = inputsFromProgramStageDataElements(
- new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() ) );
-
- if ( !fields.isEmpty() )
- {
- Group s = new Group();
- s.setLabel( "default" );
- s.setFields( fields );
- form.getGroups().add( s );
- }
- }
return form;
}