dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30691
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15604: Fixed bug - The orders of attributes in TEI registration form are wrong
------------------------------------------------------------
revno: 15604
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-06-09 20:47:03 +0800
message:
Fixed bug - The orders of attributes in TEI registration form are wrong
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java 2014-05-16 07:52:42 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/GetTrackedEntityInstanceAction.java 2014-06-09 12:47:03 +0000
@@ -57,6 +57,7 @@
import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
import org.hisp.dhis.trackedentity.TrackedEntityService;
import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeGroupSortOrderComparator;
+import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeSortOrderInListNoProgramComparator;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
import org.hisp.dhis.user.User;
import org.springframework.beans.factory.annotation.Autowired;
@@ -326,19 +327,10 @@
if ( program == null )
{
- attributes = new ArrayList<TrackedEntityAttribute>( attributeService.getAllTrackedEntityAttributes() );
- Collection<Program> programs = programService.getAllPrograms();
- for ( Program p : programs )
- {
- for ( ProgramTrackedEntityAttribute programAttribute : p.getAttributes() )
- {
- if ( !programAttribute.isDisplayInList() )
- {
- attributes.remove( programAttribute.getAttribute() );
- }
- }
- }
-
+ attributes = new ArrayList<TrackedEntityAttribute>(
+ attributeService.getTrackedEntityAttributesDisplayInList() );
+ Collections.sort( attributes, new TrackedEntityAttributeSortOrderInListNoProgramComparator() );
+
for ( TrackedEntityAttribute attribute : attributes )
{
mandatoryMap.put( attribute.getId(), false );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java 2014-06-09 12:17:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ShowAddTrackedEntityInstanceFormAction.java 2014-06-09 12:47:03 +0000
@@ -55,6 +55,7 @@
import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
import org.hisp.dhis.trackedentity.TrackedEntityService;
import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeGroupSortOrderComparator;
+import org.hisp.dhis.trackedentity.comparator.TrackedEntityAttributeSortOrderInListNoProgramComparator;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
import org.hisp.dhis.user.User;
import org.springframework.beans.factory.annotation.Autowired;
@@ -345,6 +346,8 @@
{
attributes = new ArrayList<TrackedEntityAttribute>(
attributeService.getTrackedEntityAttributesDisplayInList() );
+ Collections.sort( attributes, new TrackedEntityAttributeSortOrderInListNoProgramComparator() );
+
for ( TrackedEntityAttribute attribute : attributes )
{
mandatoryMap.put( attribute.getId(), false );