← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2018: Fix bug: Can't execute "Check Duplication".

 

------------------------------------------------------------
revno: 2018
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2010-11-09 16:07:39 +0700
message:
  Fix bug: Can't execute "Check Duplication".
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.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-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java	2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/UpdatePatientAction.java	2010-11-09 09:07:39 +0000
@@ -141,8 +141,8 @@
         patient.setGender( gender );
         patient.setUnderAge( underAge );
         patient.setOrganisationUnit( organisationUnit );
-
-        if ( birthDate != null )
+        
+        if ( birthDate != null && !birthDate.isEmpty() )
         {
             birthDate = birthDate.trim();
             patient.setBirthDate( format.parseDate( birthDate ) );
@@ -178,10 +178,7 @@
                 {
                     value = request.getParameter( AddPatientAction.PREFIX_IDENTIFIER + identifierType.getId() );
                 }
-                // value = request.getParameter(
-                // AddPatientAction.PREFIX_IDENTIFIER + identifierType.getId()
-                // );
-
+                
                 if ( StringUtils.isNotBlank( value ) )
                 {
                     value = value.trim();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java	2010-10-28 09:17:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/ValidatePatientAction.java	2010-11-09 09:07:39 +0000
@@ -84,7 +84,7 @@
     private String middleName;
 
     private String lastName;
-    
+
     private Character dobType;
 
     private String birthDate;
@@ -171,8 +171,8 @@
 
             return INPUT;
         }
-        
-        if ( dobType == 'V' || dobType == 'D')
+
+        if ( dobType != null && (dobType == 'V' || dobType == 'D') )
         {
             birthDate = birthDate.trim();
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2010-11-09 07:42:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2010-11-09 09:07:39 +0000
@@ -33,12 +33,17 @@
 					}
 				,beforeValidateHandler: function(form)
 					{
-						var birthDate = $('#birthDate').val();
-						var age = $('#age').val();
-						if(age !=''){
-							$( "#memberValidator").val(age);
+						var dobType = $('#dobType').val();
+						
+						if( dobType=='V' || dobType=='D' ) 
+						{
+							var birthDate = $('#birthDate').val();
+							if( birthDate != '' ){
+								$("#memberValidator").val(birthDate);
+							}
 						}else{
-							$( "#memberValidator").val(birthDate);
+							var age = $('#age').val();
+							$("#memberValidator").val(age);
 						}
 					}
 			});
@@ -48,7 +53,7 @@
 
 <h3>$i18n.getString( "add_new_patient" )</h3>	
 																			
-<form id="addPatientForm" name="addPatientForm" action="addPatient.action" method="get">
+<form id="addPatientForm" name="addPatientForm" action="addPatient.action" method="post">
 <input type="hidden" id="representativeId" name="representativeId"/> 
 <input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
 <table>
@@ -125,6 +130,7 @@
 		<td></td>
 		<td><input id="memberValidator" style="display:none" class="{validate:{required:true}}"/></td>
 	</tr>
+	
  	<tr>
 		<td><label for="bloodGroup">$i18n.getString( "blood_group" )</label></td>
 		<td class="input-column">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2010-11-09 02:09:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2010-11-09 09:07:39 +0000
@@ -472,6 +472,7 @@
 				'&firstName=' + getFieldValue( 'firstName' ) +
 				'&middleName=' + getFieldValue( 'middleName' ) +
 				'&lastName=' + getFieldValue( 'lastName' ) +
+				'&dobType=' + getFieldValue( 'dobType' ) +
 				'&gender=' + getFieldValue( 'gender' ) +
 				'&birthDate=' + getFieldValue( 'birthDate' ) +	        
 				'&age=' + getFieldValue( 'age' ) ;
@@ -492,12 +493,11 @@
     
     if( type == 'success')
     {
-    	alert(i18n_no_duplicate_found);
+    	showSuccessMessage(i18n_no_duplicate_found);
     }
     if ( type == 'input' )
     {
-        document.getElementById( 'message' ).innerHTML = message;
-        document.getElementById( 'message' ).style.display = 'block';
+        showWarningMessage(message);
     }
     else if( type == 'duplicate' )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2010-11-09 07:42:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientForm.vm	2010-11-09 09:07:39 +0000
@@ -9,18 +9,67 @@
 #end
 
 <script>
-	jQuery(document).ready(	function(){
+	/* jQuery(document).ready(	function(){
 		validation( 'updatePatientForm', validateUpdatePatient );		
 		datePickerValid( 'birthDate' );
 		jQuery("#birthDate").rules("add",{required:true,dateISO:true,datelessthanequaltoday:true});		
 		jQuery("#btnRepresentativeInfo").cluetip({local:"#representativeInfo"});	
-	});		
+	}); */
+
+	/* jQuery(document).ready(	function(){
+
+		jQuery("#birthDate").rules("add",{required:true,dateISO:true,datelessthanequaltoday:true});		
+		jQuery("#btnRepresentativeInfo").cluetip({local:"#representativeInfo"});
+		
+		jQuery("#updatePatientForm").validate({
+				 meta:"validate"
+				,errorElement:"span"
+				,submitHandler: function(form)
+					{
+						validateUpdatePatient();
+					}
+			});
+	});		*/
+
+	jQuery(document).ready(	function(){
+
+		datePickerValid( 'birthDate' );	
+		jQuery("#btnRepresentativeInfo").cluetip({local:"#representativeInfo"});
+		
+		jQuery("#updatePatientForm").validate({
+				 meta:"validate"
+				,errorElement:"span"
+				,submitHandler: function(form)
+					{
+						validateUpdatePatient();
+					}
+				,beforeValidateHandler: function(form)
+					{
+						var dobType = $('#dobType').val();
+						
+						if( dobType=='V' || dobType=='D' ) 
+						{
+							var birthDate = $('#birthDate').val();
+							if( birthDate != '' ){
+								$("#memberValidator").val(birthDate);
+							}
+						}else{
+							var age = $('#age').val();
+							$("#memberValidator").val(age);
+						}
+						
+					}
+			});
+					
+	});
+	
+	
 </script>
 
 
 <h3>$i18n.getString( "update_patient" )</h3>
 
-<form id="updatePatientForm" action="updatePatient.action" method="post">
+<form id="updatePatientForm" name="updatePatientForm" action="updatePatient.action" method="post">
 <input type="hidden" id="representativeId" name="representativeId"/> 
 <input type="hidden" id="relationshipTypeId" name="relationshipTypeId"/>
 <div>
@@ -90,12 +139,17 @@
 				<option value="M"> $i18n.getString('month')</option>
 				<option value="Y"> $i18n.getString('year')</option>
 			</select>
-			<input type="text" id="age" name="age" value="$patient.getAge()" style="width:14.5em"  style="width:12em" onchange="ageOnchange()" class="{validate:{number:true, alphanumeric: true}}">
+			<input type="text" id="age" name="age" value="$patient.getIntegerValueOfAge()" style="width:14.5em"  style="width:12em" onchange="ageOnchange()" class="{validate:{number:true, alphanumeric: true}}">
 		</td>
 		<td></td>
 	</tr>
 	
 	<tr>
+		<td></td>
+		<td><input id="memberValidator" style="display:none" class="{validate:{required:true}}"/></td>
+	</tr>
+	
+	<tr>
 		<td><label for="bloodGroup">$i18n.getString( "blood_group" )</label></td>
 		<td>
 			<select type="text" id="bloodGroup" name="bloodGroup" style="width:30em" >