← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14704: Fixed bug - Error when to click Attribue tab in TEI Dashboard.

 

------------------------------------------------------------
revno: 14704
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-04-06 22:57:21 +0700
message:
  Fixed bug - Error when to click Attribue tab in TEI Dashboard.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm


--
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/ProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java	2014-04-06 15:48:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/ProgramEnrollmentAction.java	2014-04-06 15:57:21 +0000
@@ -45,6 +45,7 @@
 import org.hisp.dhis.program.ProgramInstance;
 import org.hisp.dhis.program.ProgramInstanceService;
 import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
 import org.hisp.dhis.program.comparator.ProgramStageInstanceVisitDateComparator;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup;
@@ -86,7 +87,7 @@
 
     private Boolean hasDataEntry;
 
-    private List<TrackedEntityAttribute> attributes;
+    private List<ProgramTrackedEntityAttribute> attributes;
 
     private ProgramInstance programInstance;
 
@@ -144,7 +145,7 @@
         return hasDataEntry;
     }
 
-    public List<TrackedEntityAttribute> getAttributes()
+    public List<ProgramTrackedEntityAttribute> getAttributes()
     {
         return attributes;
     }
@@ -190,7 +191,7 @@
         // Load attributes of the selected program
         // ---------------------------------------------------------------------
 
-        attributes = new ArrayList<TrackedEntityAttribute>( programInstance.getProgram().getTrackedEntityAttributes() );
+        attributes = new ArrayList<ProgramTrackedEntityAttribute>( programInstance.getProgram().getAttributes() );
 
         if ( attributes != null )
         {
@@ -199,8 +200,7 @@
 
             for ( TrackedEntityAttributeValue attributeValue : attributeValues )
             {
-                if ( attributes.contains( attributeValue.getAttribute() ) )
-                {
+                
                     String value = attributeValue.getValue();
                     if ( attributeValue.getAttribute().getValueType().equals( TrackedEntityAttribute.TYPE_AGE ) )
                     {
@@ -209,7 +209,6 @@
                     }
 
                     attributeValueMap.put( attributeValue.getAttribute().getId(), value );
-                }
             }
         }
     }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2014-03-19 06:44:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2014-04-06 15:57:21 +0000
@@ -58,11 +58,12 @@
 				<table>
 					#set( $mark = false ) 
 					<!-- ATTRIBUTES IN GROUPS -->
-					#foreach($attribute in $attributes )
+					#foreach($programAttribute in $attributes )
 						#set( $attributeValue = '')
+						#set($attribute = $programAttribute.attribute)
 						#set( $attributeValue = $!attributeValueMap.get( $attribute.id ) )
 						<tr name='attributesFields'>
-							#set($mandatory = $attribute.mandatory )
+							#set($mandatory = $programAttribute.mandatory )
 							<td class='text-column'><label>$attribute.displayName #if($mandatory)<em title="$i18n.getString( "required" )" class="required">*</em> #end</label></td>
 							<td class="input-column" >
 								#if( $attribute.valueType == "bool" )