← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3176: Don't seach patients by full-name and select a patient from searching result by full-name.

 

------------------------------------------------------------
revno: 3176
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-03-28 14:13:35 +0700
message:
  Don't seach patients by full-name and select a patient from searching result by full-name.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.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/GetPatientsByNameAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java	2011-01-21 09:18:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java	2011-03-28 07:13:35 +0000
@@ -80,28 +80,30 @@
 
     public String execute()
     {
-    	int startIndex = fullName.indexOf( ' ' );
+fullName = fullName.trim();
+        
+        int startIndex = fullName.indexOf( ' ' );
         int endIndex = fullName.lastIndexOf( ' ' );
 
         String firstName = fullName.toString();
         String middleName = "";
         String lastName = "";
 
-        if( startIndex != -1 )
+        if ( fullName.indexOf( ' ' ) != -1 )
         {
             firstName = fullName.substring( 0, startIndex );
             if ( startIndex == endIndex )
             {
                 middleName = "";
-                lastName = fullName.substring( startIndex, fullName.length() );
+                lastName = fullName.substring( startIndex + 1, fullName.length() );
             }
             else
             {
                 middleName = fullName.substring( startIndex + 1, endIndex );
-                lastName = fullName.substring( endIndex, fullName.length() );
+                lastName = fullName.substring( endIndex + 1, fullName.length() );
             }
         }
-        
+       
         patients = new ArrayList<Patient>( patientService.getPatients( firstName + " " + middleName + " " + lastName ) );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm	2011-01-20 02:12:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm	2011-03-28 07:13:35 +0000
@@ -2,18 +2,18 @@
 <p></p>
 <table width='100%' id='searchTable' name='searchTable'>
 #if($!patients)
-	<thread><tr #alternate( true )>
+	<thead><tr #alternate( true )>
 		<th><strong>$i18n.getString('full_name')</strong></th>
 		<th><strong>$i18n.getString( "age" )</strong></th>
 		<th><strong>$i18n.getString( "gender" )</strong></th>
 		<th><strong>$i18n.getString( "dob_type" )</strong></th>
 		<th><strong>$i18n.getString( "date_of_birth" )</strong></th>
 		<th><strong>$i18n.getString( "orgunit" )</strong></th>
-	</tr></thread>
+	</tr></thead>
 	<tbody>
 		#set($mark = false)
 		#foreach( $patient  in $patients )
-			<tr id="tr${patient.id}" #alternate($mark) onclick='window.location.href="showUpdatePatientForm.action?id=$patient.id"' style="cursor:pointer">
+			<tr id="tr${patient.id}" #alternate($mark) onclick='window.parent.location.href="showUpdatePatientForm.action?id=$patient.id"' style="cursor:pointer">
 				<td>$!patient.getFullName()</td>
 				<td>$!patient.getAge()</td>
 				<td>$!patient.gender</td>