← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12695: Fix bug in advanced-search-persons function.

 

------------------------------------------------------------
revno: 12695
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-10-16 01:26:58 +0700
message:
  Fix bug in advanced-search-persons function.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.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/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-10-14 17:16:30 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-10-15 18:26:58 +0000
@@ -451,19 +451,13 @@
             {
 
                 String[] keyValues = id.split( " " );
-                patientWhere += patientOperator + " pi.patientidentifiertypeid is not null AND (";
+                patientWhere += patientOperator + " (";
                 String opt = "";
                 for ( String v : keyValues )
                 {
-                    patientWhere += opt + " lower( p.name ) like '%" + v + "%' or lower(pi.identifier) like '%" + v + "%' ";
+                    patientWhere += opt + " lower( p.name ) like '%" + v + "%' or ( lower(pi.identifier) like '%" + v + "%' and pi.patientidentifiertypeid is not null ) ";
                     opt = "or";
                 }
-
-                if ( keyValues.length == 2 )
-                {
-                    String otherId = keyValues[0] + "  " + keyValues[1];
-                    patientWhere += " or lower( p.name ) like '%" + otherId + "%'  ";
-                }
                 
                 patientWhere += ")";
                 patientOperator = " and ";
@@ -713,10 +707,9 @@
             }
             
             sql = sql + subSQL + from + " inner join programinstance pgi on " + " (pgi.patientid=p.patientid) "
-                + " inner join programstageinstance psi on " + " (psi.programinstanceid=pgi.programinstanceid) "
+                + " inner join programstageinstance psi on (psi.programinstanceid=pgi.programinstanceid) "
                 + " inner join programstage pgs on (pgs.programstageid=psi.programstageid) ";
 
-            //patientGroupBy += ",psi.programstageinstanceid, pgs.name ";
             patientGroupBy += ",psi.programstageinstanceid, pgs.name, psi.duedate ";
 
             from = " ";

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-09-20 15:13:05 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/singleEventSelect.vm	2013-10-15 18:26:58 +0000
@@ -149,6 +149,7 @@
 	var i18n_comment_added = '$encoder.jsEscape( $i18n.getString( "comment_added" ) , "'")';
 	var i18n_main_form_link = '$encoder.jsEscape( $i18n.getString( "single_event_with_registration" ) , "'")';
 	var i18n_insert_a_report_date = '$encoder.jsEscape( $i18n.getString( "insert_a_report_date" ) , "'")';
+	var i18n_list_all_patients = '$encoder.jsEscape( $i18n.getString( "list_all_patients" ), "'")';
 	
 	datePickerValid( 'executionDateNewEvent', true );
 </script>
\ No newline at end of file