← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14000: Fixed bug - Don't display the completed program-instance in Dashboard if a person enrolled that p...

 

------------------------------------------------------------
revno: 14000
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-02-12 23:37:44 +0700
message:
  Fixed bug - Don't display the completed program-instance in Dashboard if a person enrolled that program many times.
modified:
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java
  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/SaveProgramEnrollmentAction.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-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2014-02-08 15:19:56 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2014-02-12 16:37:44 +0000
@@ -55,12 +55,14 @@
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService;
+import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
 import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
 import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService;
 import org.hisp.dhis.trackedentitycomment.TrackedEntityComment;
 import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValue;
 import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService;
 import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -137,6 +139,9 @@
         this.programStageInstanceService = programStageInstanceService;
     }
 
+    @Autowired
+    private TrackedEntityInstanceService entityInstanceService;
+
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -574,6 +579,10 @@
 
         updateProgramInstance( programInstance );
 
+
+        entityInstance.getProgramInstances().add( programInstance );
+        entityInstanceService.updateTrackedEntityInstance( entityInstance );
+
         return programInstance;
     }
 

=== 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-02-10 07:10:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveAttributeAction.java	2014-02-12 16:37:44 +0000
@@ -179,8 +179,6 @@
             for ( TrackedEntityAttribute attribute : attributes )
             {
                 value = request.getParameter( AddTrackedEntityInstanceAction.PREFIX_ATTRIBUTE + attribute.getId() );
- System.out.println("\n\n\n ====== \n value : " + value );
- System.out.println("\n params : " + AddTrackedEntityInstanceAction.PREFIX_ATTRIBUTE + attribute.getId() );
                 attributeValue = attributeValueService.getTrackedEntityAttributeValue( entityInstance, attribute );
                 
                 if ( StringUtils.isNotBlank( value ) )
@@ -197,18 +195,14 @@
                             value = format
                                 .formatDate( TrackedEntityAttribute.getDateFromAge( Integer.parseInt( value ) ) );
                         }
- System.out.println("\n\n attribute.getValueType() : " + attribute.getValueType() );
-
+						
                         if ( TrackedEntityAttribute.TYPE_COMBO.equalsIgnoreCase( attribute.getValueType() ) )
                         {
                             TrackedEntityAttributeOption option = attributeOptionService
                                 .get( Integer.parseInt( value ) );
-
-                            System.out.println("\n\n option : " + option );
-                            
+              
                             if ( option != null )
-                            {  System.out.println("\n\n option : " + option );
-                            
+                            {  
                                 attributeValue.setAttributeOption( option );
                                 attributeValue.setValue( option.getName() );
                             }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveProgramEnrollmentAction.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/SaveProgramEnrollmentAction.java	2014-02-12 16:37:44 +0000
@@ -152,7 +152,6 @@
     public String execute()
         throws Exception
     {
-
         TrackedEntityInstance entityInstance = entityInstanceService.getTrackedEntityInstance( entityInstanceId );
 
         Program program = programService.getProgram( programId );