dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30483
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15468: Fixed bug - Some attribute values are deleted after TEI enrolls into a program.
------------------------------------------------------------
revno: 15468
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-05-29 23:19:07 +0800
message:
Fixed bug - Some attribute values are deleted after TEI enrolls into a program.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveAttributeAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm
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/SaveAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveAttributeAction.java 2014-04-12 12:12:30 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveAttributeAction.java 2014-05-29 15:19:07 +0000
@@ -36,8 +36,7 @@
import org.apache.struts2.ServletActionContext;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
-import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
+import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
import org.hisp.dhis.trackedentity.TrackedEntityInstance;
import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
@@ -60,9 +59,7 @@
private TrackedEntityInstanceService entityInstanceService;
private TrackedEntityAttributeValueService attributeValueService;
-
- private TrackedEntityAttributeService attributeService;
-
+
private ProgramService programService;
// -------------------------------------------------------------------------
@@ -84,11 +81,6 @@
this.entityInstanceService = entityInstanceService;
}
- public void setAttributeService( TrackedEntityAttributeService attributeService )
- {
- this.attributeService = attributeService;
- }
-
public void setAttributeValueService( TrackedEntityAttributeValueService attributeValueService )
{
this.attributeValueService = attributeValueService;
@@ -152,16 +144,16 @@
String value = null;
- Collection<TrackedEntityAttribute> attributes = attributeService.getAllTrackedEntityAttributes();
-
+ Collection<ProgramTrackedEntityAttribute> programAttributes = program.getAttributes();
+
TrackedEntityAttributeValue attributeValue = null;
- if ( attributes != null && attributes.size() > 0 )
+ if ( programAttributes != null && programAttributes.size() > 0 )
{
- for ( TrackedEntityAttribute attribute : attributes )
+ for ( ProgramTrackedEntityAttribute programAttribute : programAttributes )
{
- value = request.getParameter( AddTrackedEntityInstanceAction.PREFIX_ATTRIBUTE + attribute.getId() );
- attributeValue = attributeValueService.getTrackedEntityAttributeValue( entityInstance, attribute );
+ value = request.getParameter( AddTrackedEntityInstanceAction.PREFIX_ATTRIBUTE + programAttribute.getAttribute().getId() );
+ attributeValue = attributeValueService.getTrackedEntityAttributeValue( entityInstance, programAttribute.getAttribute() );
if ( StringUtils.isNotBlank( value ) )
{
@@ -169,7 +161,7 @@
{
attributeValue = new TrackedEntityAttributeValue();
attributeValue.setEntityInstance( entityInstance );
- attributeValue.setAttribute( attribute );
+ attributeValue.setAttribute( programAttribute.getAttribute() );
attributeValue.setValue( value.trim() );
attributeValueService.addTrackedEntityAttributeValue( attributeValue );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-05-25 10:52:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2014-05-29 15:19:07 +0000
@@ -553,8 +553,6 @@
<property name="attributeValueService"
ref="org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService" />
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- <property name="attributeService"
- ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
</bean>
<bean
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm 2014-05-26 11:48:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/attributeFormDiv.vm 2014-05-29 15:19:07 +0000
@@ -25,7 +25,7 @@
<input type="text" id="attr$attribute.id" style='width:240px;' name="attr$attribute.id" value='$value' objectId='$attribute.id' objectType='attr' class=' #validate( "default" $mandatory )' >
<script type="text/javascript">
var attrId = 'attr' + '$attribute.id';
- datePickerValid( 'programEnrollmentSelectDiv [id=' + attrId + ']', false, false );
+ datePickerValid( 'identifierAndAttributeDiv [id=' + attrId + ']', false, false );
</script>
#elseif( $attribute.valueType == "optionSet" )
<select id="attr$attribute.id" name="attr$attribute.id" class=' #validate( "default" $mandatory )' >
=== 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-05-26 11:48:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2014-05-29 15:19:07 +0000
@@ -148,7 +148,7 @@
<script type="text/javascript">
jQuery("#propertyForm").ready( function(){
validation( 'propertyForm', function(form){
- saveIdentifierAndAttribute( $programInstance.entityInstance.id, $programInstance.program.id, 'propertyForm' );
+ saveIdentifierAndAttribute( $programInstance.entityInstance.id, '$programInstance.program.uid', 'propertyForm' );
});
validation( 'coordinatesForm', function(form){