← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8018: Note status of program-instance after complete a stage.

 

------------------------------------------------------------
revno: 8018
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-09-07 16:53:13 +0700
message:
  Note status of program-instance after complete  a stage.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonResponseProgramCompleted.vm
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.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/caseentry/CompleteDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java	2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/CompleteDataEntryAction.java	2012-09-07 09:53:13 +0000
@@ -99,11 +99,6 @@
         ProgramStageInstance programStageInstance = programStageInstanceService
             .getProgramStageInstance( programStageInstanceId );
 
-        if ( programStageInstance == null )
-        {
-            return SUCCESS;
-        }
-
         programStageInstance.setCompleted( true );
 
         programStageInstanceService.updateProgramStageInstance( programStageInstance );
@@ -113,7 +108,8 @@
         // ProgramInstance
         // ----------------------------------------------------------------------
 
-        if ( !programStageInstance.getProgramInstance().getProgram().getType().equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) )
+        if ( !programStageInstance.getProgramInstance().getProgram().getType()
+            .equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) )
         {
             ProgramInstance programInstance = programStageInstance.getProgramInstance();
 
@@ -121,7 +117,7 @@
 
             for ( ProgramStageInstance stageInstance : stageInstances )
             {
-                if ( !stageInstance.isCompleted() || stageInstance.getProgramStage().getIrregular()  )
+                if ( !stageInstance.isCompleted() || stageInstance.getProgramStage().getIrregular() )
                 {
                     return SUCCESS;
                 }
@@ -132,7 +128,7 @@
 
             programInstanceService.updateProgramInstance( programInstance );
         }
-        
-        return SUCCESS;
+
+        return "programcompleted";
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-09-07 09:18:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-09-07 09:53:13 +0000
@@ -423,7 +423,7 @@
 please_select_program_stage = Please select program stage
 comment_added = Comment added
 enroll_program = Enroll program
-comments_and_sms_message = Comments and SMS messages
+comments_and_sms_message = Comments and messages
 no_message = No message
 program_reports = Program reports
 show_hide_content = Show/Hide content

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-09-07 07:57:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-09-07 09:53:13 +0000
@@ -68,9 +68,8 @@
 
 		<action name="completeDataEntry"
 			class="org.hisp.dhis.caseentry.action.caseentry.CompleteDataEntryAction">
-			<result name="success" type="velocity-json">
-				/dhis-web-commons/ajax/jsonResponseSuccess.vm
-			</result>
+			<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<result name="programcompleted" type="velocity-json">/dhis-web-caseentry/jsonResponseProgramCompleted.vm</result>
 			<param name="requiredAuthorities">F_PATIENT_DATAVALUE_ADD,F_PATIENT_DATAVALUE_UPDATE,F_PATIENT_DATAVALUE_DELETE</param>
 		</action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-09-07 09:18:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-09-07 09:53:13 +0000
@@ -701,7 +701,6 @@
 		}, function()
 		{	
 			showById('patientDashboard');
-			hideById('enrollProgramBtn');
 			jQuery('#loaderDiv').hide();
 		});
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-09-07 09:29:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-09-07 09:53:13 +0000
@@ -554,7 +554,7 @@
 				{
 					programStageInstanceId: getFieldValue('programStageInstanceId')
 				},
-				function (data)
+				function (json)
 				{
 					jQuery(".stage-object-selected").css('border-color', COLOR_GREEN);
 					jQuery(".stage-object-selected").css('background-color', COLOR_LIGHT_GREEN);
@@ -569,7 +569,7 @@
 					}
 					
 					var selectedProgram = jQuery('.stage-object-selected');
-					if( selectedProgram.attr('programType')=='2' )
+					if( selectedProgram.attr('programType')=='2' || json.response == 'programcompleted' )
 					{
 						selectedProgram.remove();
 						hideById('programInstanceDiv');

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonResponseProgramCompleted.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonResponseProgramCompleted.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonResponseProgramCompleted.vm	2012-09-07 09:53:13 +0000
@@ -0,0 +1,4 @@
+{
+  "response": "programcompleted",
+  "message": "$!encoder.jsonEncode( ${message} )"
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-09-07 07:57:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm	2012-09-07 09:53:13 +0000
@@ -119,7 +119,7 @@
 								</table>
 							</div>
 						</div>
-						<br><input type='button' value='$i18n.getString("enroll_program")' id="enrollProgramBtn" name="enrollProgramBtn" onclick='showProgramEnrollmentForm( "$patient.id" )'/>
+						<br><input type='button' value='$i18n.getString("enroll_program")' onclick='showProgramEnrollmentForm( "$patient.id" )'/>
 					</td>
 					<td>
 						<div class="link-area">