=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2012-05-24 13:53:25 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientattributevalue/hibernate/HibernatePatientAttributeValueStore.java 2012-05-24 14:36:15 +0000 @@ -294,7 +294,7 @@ else if ( patientAttributeId == -1 ) { hql += " ( SELECT p" + index + " FROM Patient AS p" + index - + " WHERE p" + index + ".birthDate='" + searchText+ "'"; + + " WHERE p" + index + ".birthDate " + searchText; isSearchByAttribute = false; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-05-03 10:18:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-05-24 14:36:15 +0000 @@ -59,7 +59,7 @@ function removeAttributeOption( rowId ) { jQuery( '#' + rowId ).remove(); -} +} //------------------------------------------------------------------------------ // Search patients by selected attribute @@ -69,15 +69,19 @@ { var container = jQuery(this_).parent().parent().attr('id'); var attributeId = jQuery('#' + container+ ' [id=searchingAttributeId]').val(); - var element = jQuery('#' + container+ ' [id=searchText]'); + var element = jQuery('#' + container + ' [id=searchText]'); var valueType = jQuery('#' + container+ ' [id=searchingAttributeId] option:selected').attr('valueType'); if( attributeId == '-1' ) { element.replaceWith( getDateField( container ) ); - datePickerValid( 'searchDateField-' + container + ' [id=searchText]' ); + datePickerValid( container + ' [id=searchText]' ); + return; } - else if( attributeId == '0' ) + + $('#' + container+ ' [id=searchText]').datepicker("destroy"); + $('#' + container+ ' [id=dateOperator]').replaceWith(""); + if( attributeId == '0' ) { element.replaceWith( programComboBox ); } @@ -93,7 +97,8 @@ function getDateField( container ) { - var dateField = '
'; + var dateField = ''; + dateField += ''; return dateField; } @@ -164,6 +169,7 @@ function getParamsForDiv( patientDiv) { var params = ''; + var dateOperator = ''; jQuery("#" + patientDiv + " :input").each(function() { var elementId = $(this).attr('id'); @@ -173,6 +179,10 @@ var checked = jQuery(this).attr('checked') ? true : false; params += elementId + "=" + checked + "&"; } + else if( elementId =='dateOperator' ) + { + dateOperator = jQuery(this).val(); + } else if( $(this).attr('type') != 'button' ) { var value = ""; @@ -180,6 +190,11 @@ { value = htmlEncode(jQuery(this).val()); } + if( dateOperator != '' ) + { + value = dateOperator + "'" + value + "'"; + dateOperator = ""; + } params += elementId + "="+ value + "&"; } });