← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10546: Fix bug in data entry forms of non-anonymous program.

 

------------------------------------------------------------
revno: 10546
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-04-15 14:46:11 +0700
message:
  Fix bug in data entry forms of non-anonymous program.
modified:
  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/activityPlanRecords.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.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/javascript/form.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm
  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/reportSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.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/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-04-13 05:14:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2013-04-15 07:46:11 +0000
@@ -297,7 +297,6 @@
       class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction">
       <result name="success" type="velocity">/content.vm</result>
       <param name="page">/dhis-web-caseentry/reportDataEntryForm.vm</param>
-      <param name="javascripts">javascript/entry.js,../dhis-web-commons/javascripts/date.js</param>
       <param name="stylesheets">style/style.css</param>
     </action>
 
@@ -376,11 +375,12 @@
       <param name="javascripts">javascript/commons.js,javascript/report.js</param>
       <param name="requiredAuthorities">F_GENERATE_PROGRAM_SUMMARY_REPORT</param>
     </action>
-
+	
     <action name="viewRecords"
-      class="org.hisp.dhis.caseentry.action.report.ViewRecordsAction">
+      class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction">
       <result name="success" type="velocity">/content.vm</result>
-      <param name="page">/dhis-web-caseentry/records.vm</param>
+      <param name="page">/dhis-web-caseentry/reportDataEntryForm.vm</param>
+      <param name="stylesheets">style/style.css</param>
     </action>
 
     <action name="statisticalProgramReportSelect"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2013-03-21 04:37:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanRecords.vm	2013-04-15 07:46:11 +0000
@@ -66,11 +66,11 @@
 			
 			<td>$!patient.phoneNumber</td>
 			
-			<td><a href="javascript:loadDataEntryDialog( $programStageInstance.id );">$programStageInstance.programStage.displayName</a></td>
+			<td><a href="javascript:loadDataEntryDialog( $programStageInstance.id, '$programStageInstance.programStage.uid' );">$programStageInstance.programStage.displayName</a></td>
 			
 			<td>
 				<a href="javascript:isDashboard=false;showPatientDashboardForm( '$patient.id' )" title="$i18n.getString( 'patient_dashboard' )"><img src="../images/enroll.png" alt='$i18n.getString( "patient_dashboard" )'></a>
-				<a href="javascript:loadDataEntryDialog( $programStageInstance.id );" title="$i18n.getString( 'data_entry' )"><img src="images/data_entry.png" alt="$i18n.getString( 'data_entry' )"></a>   
+				<a href="javascript:loadDataEntryDialog( $programStageInstance.id, '$programStageInstance.programStage.uid' );" title="$i18n.getString( 'data_entry' )"><img src="images/data_entry.png" alt="$i18n.getString( 'data_entry' )"></a>   
 				<a href="javascript:showPatientHistory('$patient.id')" title='$i18n.getString( "patient_details_and_history" )'><img src="../images/information.png" alt='$i18n.getString( "patient_details_and_history" )'></a>
 			</td>
 			

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2013-03-05 14:47:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/activityPlanSelect.vm	2013-04-15 07:46:11 +0000
@@ -20,11 +20,13 @@
 	<input type='hidden' id='listAll' name='listAll'>
 	<input type='hidden' id='sendToList' name='sendToList'>
 	<input type='hidden' id='programStageName' name='programStageName'>
+	<input type='hidden' id='programStageInstanceId' name='programStageInstanceId'>
 	<input type='hidden' id='searchByProgramStage' name='searchByProgramStage' value="false">
 	<input type='hidden' id='orgunitId' name='orgunitId' value='$organisationUnit.id' >
 	<input type="hidden" id='hideLink' name='hideLink' value='false'>
 	<input type='hidden' id='isSearchByProgram' name='isSearchByProgram' value='false' >
 	<input type='hidden' id='export' name= 'export'>
+	<input type='hidden' class='stage-object-selected'>
 	<div id='selectDiv' class='advanced-search' style='width:550px;'>
 		<table style="margin-bottom:8px;width:550px;">    
 			<tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-04-13 05:15:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm	2013-04-15 07:46:11 +0000
@@ -1,5 +1,5 @@
 CACHE MANIFEST
-# 2.12-SNAPSHOT V6
+# 2.12-SNAPSHOT V7
 NETWORK:
 *
 CACHE:

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2013-03-21 08:01:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/activityPlan.js	2013-04-15 07:46:11 +0000
@@ -102,12 +102,15 @@
 // Patient program tracking
 // --------------------------------------------------------------------
 
-function loadDataEntryDialog( programStageInstanceId ) 
+function loadDataEntryDialog( programStageInstanceId, programStageUid ) 
 {
-	$('#contentDataRecord' ).load("viewProgramStageRecords.action",
+	jQuery('[id=programStageInstanceId]').val(programStageInstanceId);
+	jQuery('.stage-object-selected').attr('psuid',programStageUid);
+	$('#contentDataRecord' ).load("dataentryform.action",
 		{
 			programStageInstanceId: programStageInstanceId
 		}, function(){	
+			jQuery('#programStageUid').val(programStageUid);
 			showById('reportDateDiv');
 			showById('patientInforTB');
 			showById('postCommentTbl');
@@ -241,5 +244,3 @@
 	var m = date.getMonth();
 	var y= date.getFullYear();
 }
-
-function entryFormContainerOnReady (){}

=== 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	2013-04-15 04:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-04-15 07:46:11 +0000
@@ -1,4 +1,3 @@
-
 //------------------------------------------------------------------------------
 // Save value
 //------------------------------------------------------------------------------
@@ -349,8 +348,7 @@
 					box.css('border-color', COLOR_LIGHTRED);
 					box.css('background-color', COLOR_LIGHT_LIGHTRED);
 					disableCompletedButton(false);
-					enable('validationBtn');
-					setFieldValue( 'programStageUid', selectedProgramStageInstance.attr('psid') );
+					setFieldValue( 'programStageUid', selectedProgramStageInstance.attr('psuid') );
 					
 					var fieldId = "value_" + programStageInstanceId + "_date";
 					jQuery("#" + fieldId).val(executionDate);
@@ -509,7 +507,7 @@
 					var programInstanceId = jQuery('#entryFormContainer [id=programInstanceId]').val();
 					if( irregular == 'true' && displayGenerateEventBox=="true" )
 					{
-						var programStageUid = jQuery(".stage-object-selected").attr('psid');
+						var programStageUid = jQuery(".stage-object-selected").attr('psuid');
 						showCreateNewEvent( programInstanceId, programStageUid );
 					}
 					
@@ -531,7 +529,6 @@
 					}
 					
 					disableCompletedButton(true);
-					enable('validationBtn');
 					var eventBox = jQuery('#ps_' + getFieldValue('programStageInstanceId'));
 					eventBox.attr('status',1);
 					resetActiveEvent( eventBox.attr("pi") );
@@ -634,35 +631,31 @@
         type: 'GET',
         dataType: 'json'
     } ).done(function(data) {
-        $( "#entryFormContainer input[id='programId']" ).val( data.program.id );
-        $( "#entryFormContainer input[id='blockEntryForm']" ).val( data.program.blockEntryForm );
-        $( "#entryFormContainer input[id='remindCompleted']" ).val( data.program.remindCompleted );
-
+        $( "#programStageInstanceId" ).val( data.id );
+        $( "#entryFormContainer input[id='programStageInstanceId']" ).val( data.id );
+        $( "#entryFormContainer input[id='incidentDate']" ).val( data.programInstance.dateOfIncident );
+        $( "#entryFormContainer input[id='programInstanceId']" ).val( data.programInstance.id );
         $( "#entryFormContainer input[id='irregular']" ).val( data.programStage.irregular );
         $( "#entryFormContainer input[id='displayGenerateEventBox']" ).val( data.programStage.displayGenerateEventBox );
+        $( "#entryFormContainer input[id='completed']" ).val( data.completed );
         $( "#entryFormContainer input[id='programStageId']" ).val( data.programStage.id  );
         $( "#entryFormContainer input[id='programStageUid']" ).val( data.programStage.uid  );
+        $( "#entryFormContainer input[id='programId']" ).val( data.program.id );
         $( "#entryFormContainer input[id='validCompleteOnly']" ).val( data.programStage.validCompleteOnly );
-
-        $( "#programStageInstanceId" ).val( data.id );
-        $( "#entryFormContainer input[id='programStageInstanceId']" ).val( data.id );
-        $( "#entryFormContainer input[id='completed']" ).val( data.completed );
         $( "#entryFormContainer input[id='currentUsername']" ).val( data.currentUsername );
-        $( "#entryFormContainer input[id='dueDate']" ).val( data.dueDate );
-        $( "#entryFormContainer input[id='executionDate']" ).val( data.executionDate );
-
-        $( "#entryFormContainer input[id='incidentDate']" ).val( data.programInstance.dateOfIncident );
-        $( "#entryFormContainer input[id='programInstanceId']" ).val( data.programInstance.id );
-
+        $( "#entryFormContainer input[id='blockEntryForm']" ).val( data.program.blockEntryForm );
+        $( "#entryFormContainer input[id='remindCompleted']" ).val( data.program.remindCompleted );
+
+        $( "input[id='dueDate']" ).val( data.dueDate );
+        $( "input[id='executionDate']" ).val( data.executionDate );
+		
         if ( data.program.type != '1' ) {
             hideById( 'newEncounterBtn' );
         }
 
-        if ( data.program.type == '1' && data.programInstance.status == '1' ) {
-            jQuery("[id=entryFormContainer] :input").prop('disabled', true);
-            jQuery("[id=entryFormContainer] :input").datepicker("destroy");
-            jQuery("[id=executionDate]").prop('disabled', true);
-            jQuery("[id=executionDate]").datepicker("destroy");
+        if(data.executionDate) {
+            $( '#entryForm' ).removeClass( 'hidden' ).addClass( 'visible' );
+            $( '#inputCriteriaDiv' ).removeClass( 'hidden' );
         }
 
         if ( data.programStage.captureCoordinates ) {
@@ -670,12 +663,6 @@
             $( '#latitude' ).val( data.latitude );
         }
 
-        if(data.executionDate) {
-            $( '#executionDate' ).val(data.executionDate);
-            $( '#entryForm' ).removeClass( 'hidden' ).addClass( 'visible' );
-            $( '#inputCriteriaDiv' ).removeClass( 'hidden' );
-        }
-
         if(data.comments.length > 0) {
             $.each(data.comments, function(idx, item) {
                 var comment = [
@@ -689,8 +676,15 @@
                 $( '#commentTB' ).append( comment )
             });
         }
+
+        if ( data.program.type == '1' && data.programInstance.status == '1' ) {
+            jQuery("[id=entryFormContainer] :input").prop('disabled', true);
+            jQuery("[id=entryFormContainer] :input").datepicker("destroy");
+            jQuery("[id=executionDate]").prop('disabled', true);
+            jQuery("[id=executionDate]").datepicker("destroy");
+        }
     } ).fail(function() {
-        $('#commentInput').attr('disabled', true);
+        $('#commentInput').attr('disabled', true)
     });
 }
 
@@ -698,11 +692,15 @@
 {
 	var currentFocus = undefined;
     var programStageInstanceId = getFieldValue( 'programStageInstanceId' );
-
-    loadProgramStageInstance( programStageInstanceId ).done(function() {
+	
+    loadProgramStageInstance(programStageInstanceId ).done(function() {
         if( jQuery("#entryFormContainer") ) {
-
-            if( jQuery("#executionDate").val() != '' )
+		
+			if( jQuery("#executionDate").val() == '' )
+			{
+				hideById('entryForm');
+			}
+            else if( jQuery("#executionDate").val() != '' )
             {
                 toggleContentForReportDate(true);
             }
@@ -717,17 +715,18 @@
 
             TOGGLE.init();
 
-    		jQuery("#entryForm :input").each(function()
-    		{
-    			if( jQuery(this).attr( 'options' )!= null && jQuery(this).attr( 'options' )== 'true' )
-    			{
-    				autocompletedField(jQuery(this).attr('id'));
-    			}
-    			else if( jQuery(this).attr( 'username' )!= null && jQuery(this).attr( 'username' )== 'true' )
-    			{
-    				autocompletedUsernameField(jQuery(this).attr('id'));
-    			}
-    		});
+			jQuery("#entryForm :input").each(function()
+			{
+				if( jQuery(this).attr( 'options' )!= null && jQuery(this).attr( 'options' )== 'true' )
+				{
+					autocompletedField(jQuery(this).attr('id'));
+				}
+				else if( jQuery(this).attr( 'username' )!= null && jQuery(this).attr( 'username' )== 'true' )
+				{
+					autocompletedUsernameField(jQuery(this).attr('id'));
+				}
+			});
+			
         }
     } ).fail(function() {
         console.log("failed, do something smart")

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2012-12-10 12:54:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js	2013-04-15 07:46:11 +0000
@@ -25,10 +25,10 @@
 	showById('dataEntryFormDiv');
 	setFieldValue( 'dueDate', '' );
 	setFieldValue( 'executionDate', '' );
-	disable('validationBtn');
 	disableCompletedButton(true);
 	disable('uncompleteBtn');
-	
+	jQuery( 'input[id=programStageInstanceId]').val(programStageInstanceId );
+			
 	showLoader();	
 	$( '#dataEntryFormDiv' ).load( "dataentryform.action", 
 		{ 
@@ -39,12 +39,7 @@
 			var completed = jQuery('#entryFormContainer input[id=completed]').val();
 			var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
 			showById('inputCriteriaDiv');
-			enable('validationBtn');
-			if( executionDate == '' )
-			{
-				disable('validationBtn');
-			}
-			else if( executionDate != '' && completed == 'false' )
+			if( executionDate != '' && completed == 'false' )
 			{
 				disableCompletedButton(false);
 			}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js	2013-03-21 15:18:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js	2013-04-15 07:46:11 +0000
@@ -122,6 +122,7 @@
 			programStageInstanceId: programStageInstanceId
 		},function()
 		{
+			setFieldValue( 'programStageInstanceId', programStageInstanceId );
 			showById('patientInforTB');
 			showById('postCommentTbl');
 		}).dialog(

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2013-03-13 09:10:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js	2013-04-15 07:46:11 +0000
@@ -286,7 +286,8 @@
 	disable('validationBtn');
 	disableCompletedButton(true);
 	disable('uncompleteBtn');
-	
+	setFieldValue( 'programStageInstanceId', programStageInstanceId );
+			
 	$('#executionDate').unbind("change");
 	$('#executionDate').change(function() {
 		saveExecutionDate( getFieldValue('programId'), programStageInstanceId, byId('executionDate') );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2012-12-14 17:07:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/report.js	2013-04-15 07:46:11 +0000
@@ -32,11 +32,16 @@
 
 function loadDataEntry( programStageInstanceId ) 
 {
+	isReport = false;
 	jQuery('#viewRecordsDiv' )
-		.load( 'viewProgramStageRecords.action?programStageInstanceId=' + programStageInstanceId
+		.load( 'viewRecords.action?programStageInstanceId=' + programStageInstanceId
 		,function(){
+			showById('entryForm');
 			jQuery("#viewRecordsDiv :input" ).attr("disabled", true);
 			jQuery("#viewRecordsDiv :input" ).datepicker("destroy");
+			jQuery("#viewRecordsDiv :input" ).removeAttr("onclick");
+			jQuery("#viewRecordsDiv :input" ).removeAttr("onchange");
+			jQuery("#viewRecordsDiv" ).find('img').removeAttr("onclick");
 			showById("reportTitle");
 			hideById("patientInforTB");
 			jQuery(".ui-combobox" ).hide();

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2013-04-11 08:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/smsReminder.js	2013-04-15 07:46:11 +0000
@@ -196,6 +196,7 @@
 	disable('validationBtn');
 	disableCompletedButton(true);
 	disable('uncompleteBtn');
+	jQuery( 'input[id=programStageInstanceId]').val( programStageInstanceId );
 	
 	$('#executionDate').unbind("change");
 	$('#executionDate').change(function() {
@@ -213,6 +214,7 @@
 			programStageInstanceId: programStageInstanceId
 		},function()
 		{
+			setFieldValue( 'programStageInstanceId', programStageInstanceId );
 			var executionDate = jQuery('#executionDate').val();
 			var completed = jQuery('#entryFormContainer input[id=completed]').val();
 			var irregular = jQuery('#entryFormContainer input[id=irregular]').val();

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm	2013-04-15 04:08:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm	2013-04-15 07:46:11 +0000
@@ -3,27 +3,15 @@
 #set( $psize = $programs.size() )
 #foreach( $program in $programs )
 "${program.id}":{
-    "name":"$encoder.jsonEncode( ${program.displayName} )",
-    "description":"$encoder.jsonEncode( ${program.description} )",
-    "enrollmentDescription":"$encoder.jsonEncode( ${program.dateOfEnrollmentDescription} )",
-    "incidentDescription":"$encoder.jsonEncode( ${program.dateOfIncidentDescription} )",
-    "type": "$!program.type",
-    "blockEntryForm": $!program.blockEntryForm,
-    "remindCompleted": $!program.remindCompleted,
-    "programStages":[#set( $pssize = $program.programStages.size() )
-    #foreach( $ps in $program.programStages )
-    {
-        "id": "${ps.id}",
-        "uid": "$encoder.jsonEncode( $!ps.uid )",
-        "name": "$encoder.jsonEncode( ${ps.displayName} )",
-        "reportDateDescription": "$encoder.jsonEncode( ${ps.reportDateDescription} )",
-        "irregular": $!ps.irregular,
-        "displayGenerateEventBox": $!ps.displayGenerateEventBox,
-        "validCompleteOnly": $!ps.validCompleteOnly,
-        "captureCoordinates": $!ps.captureCoordinates
-    }#if( $velocityCount < $pssize ),#end
-    #end],
-    "programAssociations": $programAssociations.get(${program.id})
+"name":"$encoder.jsonEncode( ${program.displayName} )",
+"description":"$encoder.jsonEncode( ${program.description} )",
+"enrollmentDescription":"$encoder.jsonEncode( ${program.dateOfEnrollmentDescription} )",
+"incidentDescription":"$encoder.jsonEncode( ${program.dateOfIncidentDescription} )",
+"programStages":[#set( $pssize = $program.programStages.size() )
+#foreach( $ps in $program.programStages )
+{ "id": "${ps.id}", "name": "$encoder.jsonEncode( ${ps.displayName} )", "reportDateDescription": "$encoder.jsonEncode( ${ps.reportDateDescription} )" }#if( $velocityCount < $pssize ),#end
+#end],
+"programAssociations": $programAssociations.get(${program.id})
 }#if( $velocityCount < $psize ),#end
 #end }
 }}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm	2013-04-13 08:38:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramStageInstance.vm	2013-04-15 07:46:11 +0000
@@ -2,7 +2,7 @@
     "currentUsername": "$encoder.jsonEncode( $currentUsername )",
     "id": "$!programStageInstance.id",
     "dueDate": "$format.formatDate( $!programStageInstance.dueDate )",
-    "executionDate": "$format.formatDate( $!programStageInstance.executionDate )",
+    "executionDate": "$!format.formatDate( $programStageInstance.executionDate )",
     "status": "$!programStageInstance.getEventStatus()",
     "completed": "$!programStageInstance.completed",
     #if($programStageInstance.programStage.captureCoordinates)

=== 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	2013-04-10 03:13:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm	2013-04-15 07:46:11 +0000
@@ -2,6 +2,7 @@
 #set($noGroup = $attributeGroups.size() )
 #if( $programInstance || $hasDataEntry=='true' )
 <input type='hidden' id='programInstanceId' name='programInstanceId' value='$programInstance.id' />
+<input type='hidden' id='programStageInstanceId' name='programStageInstanceId' value='0'>
 <input type='hidden' id='patientId' name='patientId' value='$programInstance.patient.id' />
 <input type='hidden' id='hasDataEntry' name='hasDataEntry' value='$hasDataEntry' />
 <div id="tabs">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm	2013-01-23 10:27:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportSelect.vm	2013-04-15 07:46:11 +0000
@@ -4,7 +4,7 @@
 			loadGeneratedReport();
 		}); 
 		datePickerInRange( 'startDate' , 'endDate' );
-	});		
+	});
 </script>
 
 <h3>$i18n.getString( "program_summary_report" ) #openHelp('program_summary_report')</h3>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-04-10 04:35:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-04-15 07:46:11 +0000
@@ -23,6 +23,7 @@
 <input type='hidden' id='listAll' name='listAll'>
 <select class='hidden' id='repeatableProgramStageId' name='repeatableProgramStageId'></select>
 <input type='hidden' id='patientId' name= 'patientId'>
+<input type='hidden' id='programStageInstanceId' name= 'programStageInstanceId' value='0'>
 
 <div id='searchDiv'>
 	#parse( "dhis-web-caseentry/searchPatientCriteria.vm" )