← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5899: (patient) Don't show dataentry form if the newest event of anonymous program is completed.

 

------------------------------------------------------------
revno: 5899
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-02-09 11:47:14 +0700
message:
  (patient) Don't show dataentry form if the newest event of anonymous program is completed.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js


--
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/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2012-02-09 04:47:14 +0000
@@ -180,10 +180,6 @@
 
         program = programStage.getProgram();
 
-        programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
-
-        Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() );
-
         ProgramInstance programInstance = selectedStateManager.getSelectedProgramInstance();
 
         if ( programInstance != null )
@@ -192,11 +188,20 @@
 
             if ( programStageInstance != null )
             {
+                if( program.getAnonymous() && programStageInstance.isCompleted() )
+                {
+                    return SUCCESS;
+                }
+                
                 selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
                 
                 // ---------------------------------------------------------------------
                 // Get data values
                 // ---------------------------------------------------------------------
+               
+                programStageDataElements = new ArrayList<ProgramStageDataElement>( programStage.getProgramStageDataElements() );
+
+                Collections.sort( programStageDataElements, new ProgramStageDataElementSortOrderComparator() );
 
                 Collection<PatientDataValue> patientDataValues = patientDataValueService
                     .getPatientDataValues( programStageInstance );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-02-01 09:10:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-02-09 04:47:14 +0000
@@ -27,6 +27,7 @@
 			<td><input type="text" id="executionDate" name="executionDate" class='criteria' value="$!format.formatDate( $programStageInstance.executionDate )" >
 				<script type="text/javascript">
 				   datePickerValid( 'executionDate', false );
+				   disable( 'executionDate' );
 				</script>
 			</td>
 		</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-02-08 14:07:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-02-09 04:47:14 +0000
@@ -2,7 +2,9 @@
 <script>
 	jQuery("#entryFormContainer").ready(function(){
 	
-		#if( $programStageInstance )
+		#if( $!programStageInstance.programStage.program.anonymous=="true" && $!programStageInstance.completed=='true')
+			hideById('entryFormContainer');
+		#elseif( $programStageInstance )
 			setFieldValue( 'dueDate', "$!format.formatDate( $programStageInstance.dueDate )" );
 			setFieldValue( 'executionDate', "$!format.formatDate( $programStageInstance.executionDate )" );
 		#elseif( $program.singleEvent == "true" )
@@ -23,6 +25,7 @@
 		{
 			enable('executionDate');
 		}
+		
 		entryFormContainerOnReady();
 		
 		jQuery("#entryForm :input").each(function()

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-01-15 15:59:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-02-09 04:47:14 +0000
@@ -32,14 +32,6 @@
 			{
 				loadEventForm();
 			}
-			else
-			{
-				if( json.programInstances.length > 0 )
-				{
-					enable('createEventBtn');
-				}
-			}
-			
 		} );
 }
 
@@ -51,7 +43,9 @@
 	hideById('dataEntryFormDiv');
 	setFieldValue('executionDate', '');
 	disable( 'executionDate' );
-	
+	disable('createEventBtn');
+	disable('deleteCurrentEventBtn');
+		
 	var programId = getFieldValue('programId');
 	if( programId == '' )
 	{
@@ -108,19 +102,19 @@
 			}
 			else
 			{
+				enable( 'executionDate' );
 				if( getFieldValue('completed') == 'true')
 				{
-					disable( 'executionDate' );
 					enable('createEventBtn');
-					enable('deleteCurrentEventBtn');
+					disable('deleteCurrentEventBtn');
 					disable('completeBtn');
+					jQuery('#executionDate').unbind('change');
 				} 
 				else
 				{
 					disable('createEventBtn');
 					enable('deleteCurrentEventBtn');
 					enable('completeBtn');
-					enable( 'executionDate' );
 					jQuery('#executionDate').bind('change');
 				}
 			}
@@ -151,7 +145,7 @@
 			}
 			else
 			{
-				showWarmingMessage( json.message );
+				showWarningMessage( json.message );
 			}
 			
 		});

=== 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-02-08 14:07:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-02-09 04:47:14 +0000
@@ -99,6 +99,7 @@
 	if( getFieldValue('programStageId') == null
 		|| getFieldValue('programStageId') == 0 )
 	{
+		enable('newEncounterBtn');
 		return;
 	}