← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3738: Fix bug: After selecting a beneficiary and selecting a "report date", it gives a nullpointerexcep...

 

------------------------------------------------------------
revno: 3738
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-05-25 15:44:29 +0700
message:
  Fix bug: After selecting a beneficiary and selecting a "report date", it gives a nullpointerexception.
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/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/dataEntry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.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/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2011-05-20 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java	2011-05-25 08:44:29 +0000
@@ -111,13 +111,6 @@
         this.patientService = patientService;
     }
 
-    //
-    // public void setMinMaxDataElementService( MinMaxDataElementService
-    // minMaxDataElementService )
-    // {
-    // this.minMaxDataElementService = minMaxDataElementService;
-    // }
-
     public void setProgramStageService( ProgramStageService programStageService )
     {
         this.programStageService = programStageService;

=== 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	2011-05-20 03:35:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2011-05-25 08:44:29 +0000
@@ -1,29 +1,40 @@
 
+<p align='right'>
+	<label for="label2">$i18n.getString( "due_date" ) </label>
+	<input type="text" id="dueDate" name="dueDate" value="$!format.formatDate( $programStageInstance.dueDate )" disabled="disabled"/>
+	&nbsp;&nbsp;&nbsp;
+	<label for="label">$i18n.getString( "report_date" ) </label>
+	<input type="text" id="executionDate" name="executionDate" value="$!format.formatDate( $programStageInstance.executionDate )" onChange="saveExecutionDate( getFieldValue('programStageInstanceId'), getFieldValue('programStageInstanceName') );" />
+		<script type="text/javascript">
+			datePickerValid('executionDate', false);
+		</script>
+</p>
+
+<hr style="clear:both">
+
 <span id="startMsg" style="font-style:italic; color:blue"> </span>
 
 <div id='entryForm'>
 	<input type='hidden' id='programStageInstanceId' value='$programStageInstance.id'>
 	<input type='hidden' id='programStageInstanceName' value='$programStageInstance.name'>
 	<input type='hidden' id='incidentDate' value='$!format.formatDate($programStageInstance.programInstance.dateOfIncident)'>
-	<input type='hidden' id='dueDateValue' value='$!format.formatDate( $programStageInstance.dueDate )'>
-	<input type='hidden' id='executionDateValue' value='$!format.formatDate( $programStageInstance.executionDate )'>
 	
-	<div id="dragDiv">
-		<table id="listInfo">
-			<tr><td style="text-align:left"><strong>$i18n.getString("org_unit_name") :</strong></td> <td id="orgUnitNameField" style="text-align:right"></td></tr>
-			<tr><td style="text-align:left"><strong>$i18n.getString("program_stage_name") :</strong></td> <td  id="programStageName" style="text-align:right">$programStageInstance.programStage.name</td></tr>
-			<tr><td style="text-align:left"><strong>$i18n.getString("datae_element_name") :</strong></td> <td id="dataelementName" style="text-align:right"></td></tr>
-		</table>
-	</div>
-
 	<div id="customEntryScreenContainer">
 		#if( $customDataEntryFormCode ) 
+			<div id="dragDiv">
+				<table id="listInfo">
+					<tr><td style="text-align:left"><strong>$i18n.getString("org_unit_name") :</strong></td> <td id="orgUnitNameField" style="text-align:right"></td></tr>
+					<tr><td style="text-align:left"><strong>$i18n.getString("program_stage_name") :</strong></td> <td  id="programStageName" style="text-align:right">$programStageInstance.programStage.name</td></tr>
+					<tr><td style="text-align:left"><strong>$i18n.getString("datae_element_name") :</strong></td> <td id="dataelementName" style="text-align:right"></td></tr>
+				</table>
+			</div>
 		   $customDataEntryFormCode
-		#else <span style="font-style:italic; color:blue"> $i18n.getString( "no_custom_data_entry_exist" )</span>
+		#else 
+			<span style="font-style:italic; color:blue"> $i18n.getString( "no_custom_data_entry_exist" )</span>
 		#end
 	</div>
 
-	<div id="defaultEntryScreenContainer">
+	<div id="defaultEntryScreenContainer" style='display:none;'>
 		<table class="mainPageTable">
 			<col id="noCol">
 			<col id="deCol">    
@@ -91,10 +102,10 @@
 						#if ( $patientDataValue.value )        
 							#if( !$patientDataValue.providedByAnotherFacility )
 								$patientDataValue.organisationUnit.name
-								<input  name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
+								<input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
 							#else
 								$i18n.getString("other_facility")
-								<input  name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
+								<input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
 							#end
 						 #else
 							<input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
@@ -109,7 +120,6 @@
 </div>
 
 <script type="text/javascript"> 
-	//setFieldValue('orgUnitNameField', getFieldValue('orgunitName') );
 	initCustomCheckboxes();
 	DRAG_DIV.init();
 </script>
\ No newline at end of file

=== 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	2011-05-20 03:35:47 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2011-05-25 08:44:29 +0000
@@ -18,7 +18,7 @@
 
 <hr style="clear:both">
 
-<table> 
+<table width='100%'> 
    <tr>
         <td><label for="programId">$i18n.getString( "program" )</label></td>
         <td>
@@ -37,43 +37,19 @@
             <select id="programStageId" name="programStageId" style="min-width:350px" onchange="javascript:loadDataEntry();" >
             </select>
         </td>
-		<td>&nbsp;</td>
-		<td>
-			<label for="dueDate">$i18n.getString( "due_date" ) </label>
-		</td>
-		<td>
-			<input type="text" id="dueDate" name="dueDate" disabled="disabled"/>
-		</td>
-		<td>&nbsp;</td>
-		<td>
-			<label for="executionDate">$i18n.getString( "report_date" ) </label>
-		</td>
-		<td>
-			<input type="text" id="executionDate" name="executionDate" onchange="saveExecutionDate( getFieldValue('programStageInstanceId'), getFieldValue('programStageInstanceName') );" disabled="disabled"/>
-		</td>
-		<script type="text/javascript">
-			datePickerValid('executionDate', false);
-		</script>
     </tr>   
 	<tr>
+		<td></td>
 		<td>
 			<input type="button" id="completeBtn" value="$i18n.getString('complete')" onClick="doComplete()" style="width:12em" disabled="disabled" >
-		</td>
-		<td>
 			<input type="button" id="validationBtn" value="$i18n.getString('validation')" onClick="javascript: runValidation();", '_blank', 'width=800, height=400, scrollbars=yes, resizable=yes' );" style="width:12em " disabled="disabled" >
 		</td>
+		<td align='right'>
+			<input type="checkbox" id="useDefaultForm" name="useDefaultForm" value="true" onclick="selectUseDefaultDataEntryForm();" disabled="disabled" />
+			<label>$i18n.getString( "use_default_form" )</label><br>	
+		</td>
+		</td>
 	</tr>
 </table>
-<p align='right'>
-	<input type="checkbox" id="useDefaultForm" name="useDefaultForm" value="true" onclick="selectUseDefaultDataEntryForm();" disabled="disabled" />
-	<label>$i18n.getString( "use_default_form" )</label><br>	
-	
-	<input type="checkbox" id="useCustomForm" name="useCustomForm" checked onclick="selectUseCustomDataEntryForm();" disabled="disabled" />
-	<label>$i18n.getString( "use_custom_form" )</label><br>	
-</p>
-
-<hr style="clear:both">
-
-<script type="text/javascript">  
-	setFieldValue('patientId', '$patient.id');
-</script>
+
+<input type='hidden' id='patientId' name='patientId' value='$patient.id'>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js	2011-05-25 05:27:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js	2011-05-25 08:44:29 +0000
@@ -18,7 +18,8 @@
 			jQuery('#searchText').removeAttr( 'readonly' );
 			
 			setFieldValue( 'orgunitName', data.getElementsByTagName( "name" )[0].firstChild.nodeValue );
-			
+			setFieldValue( 'orgunitId', data.getElementsByTagName( "id" )[0].firstChild.nodeValue );
+		
 			hideLoader();
 		},'xml');
 }
@@ -83,8 +84,6 @@
 {
 	hideById('dataEntryFormDiv');
 	clearListById('programStageId');
-	setFieldValue('dueDate', '');
-	setFieldValue('executionDate', '');
 		
 	if ( getFieldValue('programId') == 0 )
 	{
@@ -136,7 +135,7 @@
 	
 	// Load data-entry form
 	showLoader();
-	var useDefaultForm = ( jQuery('#useDefaultForm').attr('checked')=='checked')?true:false
+	var useDefaultForm = ( jQuery('#useDefaultForm').attr('checked')== 'checked' ) ? true : false;
 	
 	jQuery('#dataEntryFormDiv').load("dataentryform.action",
 		{
@@ -146,15 +145,8 @@
 		}, 
 		function( )
 		{
-		}).slideDown('slow', function()
+		}).slideDown('fast', function()
 		{
-			setFieldValue('executionDate', getFieldValue('executionDateValue'));
-			setFieldValue('dueDate', getFieldValue('dueDateValue'));
-			enable('executionDate');
-			enable('validationBtn');
-			enable('completeBtn');
-			enable('useDefaultForm');
-			enable('useCustomForm');
 			if ( getFieldValue('executionDate') =='' )
 			{
 				hideById('entryForm');
@@ -166,13 +158,12 @@
 				setInnerHTML('startMsg', '');
 			}
 			
-			if( byId('useCustomForm').checked )
-			{
-				selectUseCustomDataEntryForm();
-			}else
-			{
-				selectUseDefaultDataEntryForm();
-			}
+			selectUseDefaultDataEntryForm();
+			
+			enable('executionDate');
+			enable('validationBtn');
+			enable('completeBtn');
+			enable('useDefaultForm');
 			
 			hideLoader();
 			hideById('contentDiv'); 
@@ -185,16 +176,15 @@
 
 function selectUseDefaultDataEntryForm()
 {
-	byId('useCustomForm').checked = false;
-	hideById( 'customEntryScreenContainer' );
-	showById( 'defaultEntryScreenContainer' );
-}
-
-function selectUseCustomDataEntryForm()
-{
-	byId('useDefaultForm').checked = false;
-	hideById( 'defaultEntryScreenContainer' );
-	showById( 'customEntryScreenContainer' );
+	if( byId('useDefaultForm').checked )
+	{
+		hideById( 'customEntryScreenContainer' );
+		showById( 'defaultEntryScreenContainer' );
+	}else
+	{
+		hideById( 'defaultEntryScreenContainer' );
+		showById( 'customEntryScreenContainer' );
+	}
 }
 
 //-----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm	2011-05-25 05:27:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm	2011-05-25 08:44:29 +0000
@@ -43,8 +43,6 @@
 <div id='dataEntryFormDiv'></div>
 
 <input type='hidden' id='orgunitId' >
-<input type='hidden' id='patientId' name='patientId' >
-<input type="hidden" id="programStageInstanceId" name="programStageInstanceId" />
 
 #parse( "dhis-web-commons/loader/loader.vm" )
 
@@ -73,11 +71,7 @@
     var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
     var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
 	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
-	//var i18n_date_less_incident_date = '$encoder.jsEscape( $i18n.getString( "date_less_incident_date" ) , "'")';
 	var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
-	
-	
-	setFieldValue('orgunitId', '$!organisationUnit.id');
 </script>