← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7089: (patient) Removed locking from data entry.

 

------------------------------------------------------------
revno: 7089
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-30 10:30:10 +0700
message:
  (patient) Removed locking from data entry.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
  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/dataRecordingSelect.vm
  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/programStageDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-05-29 19:37:01 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java	2012-05-30 03:30:10 +0000
@@ -88,6 +88,8 @@
         executeSql( "ALTER TABLE program DROP COLUMN singleevent" );
         executeSql( "ALTER TABLE program DROP COLUMN anonymous" );
         executeSql( "UPDATE program SET type=1 where type is null" );
+        
+        executeSql( "UPDATE programstage set irregular=false where irregular is null" );
 
         executeSql( "DROP TABLE programattributevalue" );
         executeSql( "DROP TABLE programinstance_attributes" );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-03-05 07:32:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-05-30 03:30:10 +0000
@@ -171,7 +171,6 @@
 
             if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
-
                 // -------------------------------------------------------------
                 // Get data element ID of data element
                 // -------------------------------------------------------------
@@ -340,7 +339,6 @@
         Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
         ProgramStageInstance programStageInstance, Map<Integer, Collection<PatientDataValue>> mapDataValue )
     {
-
         // ---------------------------------------------------------------------
         // Inline Javascript to add to HTML before outputting
         // ---------------------------------------------------------------------
@@ -507,7 +505,7 @@
                 // -----------------------------------------------------------
 
                 disabled = "";
-                if ( programStageId != programStage.getId() || programStageInstance.isCompleted() )
+                if ( programStageId != programStage.getId() )
                 {
                     disabled = "disabled";
                 }
@@ -710,7 +708,7 @@
                 // -----------------------------------------------------------
 
                 disabled = "";
-                if ( programStageId != programStage.getId() || programStageInstance.isCompleted() )
+                if ( programStageId != programStage.getId() )
                 {
                     disabled = "disabled=\"\"";
                 }
@@ -909,7 +907,7 @@
                 // -------------------------------------------------------------
 
                 disabled = "";
-                if ( programStageId != programStage.getId() || programStageInstance.isCompleted() )
+                if ( programStageId != programStage.getId() )
                 {
                     disabled = "disabled=\"\"";
                 }

=== 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-05-23 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-05-30 03:30:10 +0000
@@ -54,7 +54,7 @@
 					#end
 				#else
 					$i18n.getString( "provided_elsewhere" ) 
-					<input type="checkbox" id='$id' onclick="updateProvidingFacility();" #if($programStageInstance.completed) disabled="disabled" #end >
+					<input type="checkbox" id='$id' onclick="updateProvidingFacility();">
 				#end
 			</th>
 		</tr>
@@ -105,22 +105,20 @@
 					#set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
 					#if( $!programStageDataElement.dataElement.optionSet )
 						#set( $optionId = $id + '-options')
-						<input class='optionset' name="entryselect" options='$programStageDataElement.dataElement.optionSet.options' id='$id' value='$!patientDataValue.value' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id-options" dataElementId="$programStageDataElement.dataElement.id" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" />
+						<input class='optionset' name="entryselect" options='$programStageDataElement.dataElement.optionSet.options' id='$id' value='$!patientDataValue.value' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id-options" dataElementId="$programStageDataElement.dataElement.id" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" />
 					#elseif( $programStageDataElement.dataElement.type == "bool" )
-						<select name="entryselect" #if($programStageInstance.completed) disabled="disabled" #end data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex"> 
+						<select name="entryselect" data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex"> 
 							<option value="">[$i18n.getString( "select_value" )]</option>
 							<option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
 							<option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
 						</select> 
 					#elseif( $programStageDataElement.dataElement.type == "date" )
-						<input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
-						#if(!$programStageInstance.completed)
-							<script type="text/javascript">
-								datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
-							</script>   
-						#end
+						<input type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+						<script type="text/javascript">
+							datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
+						</script> 
 					#else
-						<input name="entryfield" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
+						<input name="entryfield" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
 					#end
 				</td>  
 			</tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2012-05-30 03:30:10 +0000
@@ -89,7 +89,7 @@
 			<td>$i18n.getString( 'due_date' )</td>
 			<td><input id='dueDateNewEncounter' name='dueDateNewEncounter' ></td>
 			<script type="text/javascript">
-			   datePickerValid( 'dueDateNewEncounter', false );
+			   datePicker( 'dueDateNewEncounter', false );
 			</script>
 		</tr>
 		<tr>

=== 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-05-23 16:19:55 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-05-30 03:30:10 +0000
@@ -13,7 +13,6 @@
 	disable('completeBtn');
 	disable('validationBtn');
 	disable('newEncounterBtn');
-	disable('executionDate');
 		
 	var programId = jQuery('#dataRecordingSelectDiv [name=programId]').val();
 	if ( programId == 0 )
@@ -24,7 +23,7 @@
 	jQuery.getJSON( "loadProgramStages.action",
 		{
 			programId: programId
-		}, 
+		},  
 		function( json ) 
 		{    
 			addOptionById( 'programStageId', "0", i18n_select );
@@ -35,6 +34,7 @@
 			
 			var type = jQuery('#dataRecordingSelectDiv [name=programId] option:selected').attr('type');
 				
+			// Single-event program or normal program with only one program-stage
 			if( type=='2' || type=='3' || json.programStages.length == 1)
 			{
 				byId('programStageId').selectedIndex = 1;
@@ -47,7 +47,6 @@
 			}
 			else
 			{
-				
 				// show history / plan
 				setInnerHTML( 'currentSelection', '' ); 
 				var history = '<table class="history">';
@@ -126,17 +125,13 @@
 			var completed = jQuery('#entryFormContainer input[id=completed]').val();
 			var irregular = jQuery('#entryFormContainer input[id=irregular]').val();
 			
-			enable('executionDate');
 			if( executionDate != '' && completed == 'false' )
 			{
-				enable('validationBtn');
 				enable('completeBtn');
 			}
 			else if( completed == 'true' )
 			{
-				disable('validationBtn');
 				disable('completeBtn');
-				disable('executionDate');
 			}
 			
 			if( completed == 'true' && irregular == 'true' )
@@ -593,12 +588,8 @@
 {
     if( show ){
         jQuery("#entryForm").show();
-        jQuery("#completeBtn").removeAttr('disabled');
-		jQuery("#validationBtn").removeAttr('disabled');
     }else {
         jQuery("#entryForm").hide();
-        jQuery("#completeBtn").attr('disabled', 'disabled');
-		jQuery("#validationBtn").attr('disabled', 'disabled');
     }
 }
 
@@ -629,19 +620,7 @@
 				},
 				function (data)
 				{
-					jQuery("#dataEntryFormDiv :input").each(function()
-					{
-						disable( jQuery(this).attr('id') );
-					});
-					
-					jQuery("#dataEntryFormDiv").find(".ui-button").each(function()
-					{
-						jQuery(this).autocomplete( "option", "disabled" );
-					});
-					
-					disable('validationBtn');
 					disable('completeBtn');
-					disable('executionDate');
 					var irregular = jQuery('#entryFormContainer [name=irregular]').val();
 					if( irregular == 'true' )
 					{
@@ -656,14 +635,13 @@
 							}).show('fast');
 							
 						var standardInterval =  jQuery('#dataRecordingSelectDiv [name=programStageId] option:selected').attr('standardInterval');
-						
 						var date = new Date();
-						var d = date.getDate();
+						var d = date.getDate() + eval(standardInterval);
 						var m = date.getMonth();
 						var y = date.getFullYear();
-						var edate= new Date(y, m, d+standardInterval);						
+						var edate= new Date(y, m, d);
+												
 						jQuery('#dueDateNewEncounter').datepicker( "setDate" , edate )
-	 
 					}
 					
 					var selectedProgram = jQuery('#dataRecordingSelectForm [name=programId] option:selected');
@@ -682,6 +660,11 @@
     }
 }
 
+function closeDueDateDiv()
+{
+	jQuery('#createNewEncounterDiv').dialog('close');
+}
+
 TOGGLE = {
     init : function() {
         jQuery(".togglePanel").each(function(){

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm	2012-03-05 04:22:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageDataEntryForm.vm	2012-05-30 03:30:10 +0000
@@ -63,7 +63,7 @@
     </tr>   
     <tr>
 		<td>&nbsp;</td>
-		<td><input type="button" id="completeBtn" value="$i18n.getString('complete')" onClick="doComplete()" #if($programStageInstance.executionDate) #else disabled #end>
+		<td><input type="button" id="completeBtn" value="$i18n.getString('complete')" onClick="doComplete()" #if($programStageInstance.completed=='true') disabled #end>
 			<input type="button" id="validationBtn" value="$i18n.getString('run_validation')" onClick="javascript: runValidation();" style="width:12em " #if($programStageInstance.executionDate) #else disabled #end>
 		</td>
 		<td></td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2012-05-26 17:38:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2012-05-30 03:30:10 +0000
@@ -32,7 +32,7 @@
 		  
 			<tr>
 				<td><label>$i18n.getString( "standard_interval_days" )</label></td>
-				<td><input type="text" id="standardInterval" name="standardInterval" value='$!programStage.standardInterval' class="{validate:{required:true,number:true}}" #if( $programStage.irregular=='false' ) disabled #end /></td>
+				<td><input type="text" id="standardInterval" name="standardInterval" value='$!programStage.standardInterval' class="{validate:{required:true,number:true}}" #if( $programStage.irregular=='true' ) disabled #end /></td>
 			</tr>
 			<tr><td>&nbsp;</td></tr>