← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7972: Don't save data-value for new event created.

 

------------------------------------------------------------
revno: 7972
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-08-28 16:11:19 +0700
message:
  Don't save data-value for new event created.
modified:
  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/programStageInstanceFlow.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/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-08-22 04:49:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2012-08-28 09:11:19 +0000
@@ -517,6 +517,7 @@
 
 function showCreateNewEvent( programInstanceId, programStageId )
 {
+	setInnerHTML('createEventMessage_' + programInstanceId, '');
 	jQuery('#createNewEncounterDiv_' + programInstanceId ).dialog({
 			title: i18n_create_new_event,
 			maximize: true, 
@@ -556,7 +557,7 @@
 
 function registerIrregularEncounter( programInstanceId, programStageId, programStageName, dueDate )
 {
-	setInnerHTML('createEventMessage_' + programInstanceId,'');
+	setInnerHTML('createEventMessage_' + programInstanceId, '');
 	jQuery.postJSON( "registerIrregularEncounter.action",
 		{ 
 			programInstanceId:programInstanceId,
@@ -570,15 +571,17 @@
 			
 			var elementId = prefixId + programStageInstanceId;
 			var flag = false;
+			var programType = jQuery('.stage-object-selected').attr('type');
+			
 			jQuery("#programStageIdTR_" + programInstanceId + " input[name='programStageBtn']").each(function(i,item){
 				var element = jQuery(item);
 				var dueDateInStage = element.attr('dueDate');
-				
 				if( dueDate < dueDateInStage && !flag)
 				{	
 					jQuery('<td><input name="programStageBtn" '
 						+ 'id="' + elementId + '" ' 
-						+ 'psid="' + programStageInstanceId + '" '
+						+ 'psid="' + programStageId + '" '
+						+ 'programType="' + programType + '" '
 						+ 'psname="' + programStageName + '" '
 						+ 'dueDate="' + dueDate + '" '
 						+ 'value="'+ programStageName + ' ' + dueDate + '" '
@@ -597,7 +600,8 @@
 				jQuery("#programStageIdTR_" + programInstanceId).append('<td><img src="images/rightarrow.png"></td>'
 					+ '<td><input name="programStageBtn" '
 					+ 'id="' + elementId + '" ' 
-					+ 'psid="' + programStageInstanceId + '" '
+					+ 'psid="' + programStageId + '" '
+					+ 'programType="' + programType + '" '
 					+ 'psname="' + programStageName + '" '
 					+ 'dueDate="' + dueDate + '" '
 					+ 'value="'+ programStageName + ' ' + dueDate + '" '

=== 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-08-28 07:59:20 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-08-28 09:11:19 +0000
@@ -96,7 +96,7 @@
 function saveVal( dataElementId )
 {
 	if( jQuery('#entryFormContainer [id=programStageId]') == null) return;
-	var programStageId = jQuery('#entryFormContainer [id=programStageId]').val();
+	var programStageId = jQuery('.stage-object-selected').attr('psid');
         
 	var fieldId = programStageId + '-' + dataElementId + '-val';
 	
@@ -175,7 +175,7 @@
 
 function saveOpt( dataElementId )
 {
-	var programStageId = jQuery('#entryFormContainer [id=programStageId]').val();
+	var programStageId = jQuery('.stage-object-selected').attr('psid');
 	var field = byId( programStageId + '-' + dataElementId + '-val' );	
 	field.style.backgroundColor = SAVING_COLOR;
 	
@@ -570,12 +570,12 @@
 					var programInstanceId = jQuery('#entryFormContainer [id=programInstanceId]').val();
 					if( irregular == 'true' )
 					{
-						var programStageId = jQuery(".stage-object-selected").css('psid');
+						var programStageId = jQuery(".stage-object-selected").attr('psid');
 						showCreateNewEvent( programInstanceId, programStageId );
 					}
 					
-					var selectedProgram = jQuery('#dataRecordingSelectForm [name=programId] option:selected');
-					if( selectedProgram.attr('type')=='2' && irregular == 'false' )
+					var selectedProgram = jQuery('.stage-object-selected');
+					if( selectedProgram.attr('programType')=='2' )
 					{
 						selectedProgram.remove();
 						hideById('programInstanceDiv');
@@ -590,7 +590,6 @@
 					jQuery('#completedTB' ).prepend("<tr><td>" + completedRow + "</td></tr>");
 					hideById('tr1_' + programInstanceId );
 					hideById('tr2_' + programInstanceId );
-					hideById('programEnrollmentDiv');	
 					jQuery('#img_' + programInstanceId).attr('src','');					
 					
 					if( isCreateEvent )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-08-28 05:48:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstanceFlow.vm	2012-08-28 09:11:19 +0000
@@ -18,6 +18,7 @@
 								id="ps_$!programStageInstance.id"
 								psid="$programStageInstance.programStage.id"
 								psname="$programStageName.programStage.name"
+								programType='$programInstance.program.type'
 								dueDate="$format.formatDate( $programStageInstance.dueDate )"
 								class="stage-object" 
 								value="$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )"