dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17925
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7335: Don't fill date into the birthdate fields in searching key.
------------------------------------------------------------
revno: 7335
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-06-20 16:46:37 +0700
message:
Don't fill date into the birthdate fields in searching key.
modified:
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/form.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
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/selectPatient.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/webapp/dhis-web-caseentry/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-06-20 06:32:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2012-06-20 09:46:37 +0000
@@ -82,19 +82,19 @@
function searchingAttributeOnChange( this_ )
{
var container = jQuery(this_).parent().parent().attr('id');
- var attributeId = jQuery('#' + container+ ' [id=searchingAttributeId]').val();
+ var attributeId = jQuery('#' + container + ' [id=searchingAttributeId]').val();
var element = jQuery('#' + container + ' [id=searchText]');
var valueType = jQuery('#' + container+ ' [id=searchingAttributeId] option:selected').attr('valueType');
if( attributeId == '-1' )
{
element.replaceWith( getDateField( container ) );
- datePickerValid( container + ' [id=searchText]' );
+ datePickerValid( 'searchText_' + container );
return;
}
- $('#' + container+ ' [id=searchText]').datepicker("destroy");
- $('#' + container+ ' [id=dateOperator]').replaceWith("");
+ $( '#searchText_' + container ).datepicker("destroy");
+ $('#' + container + ' [id=dateOperator]').replaceWith("");
if( attributeId == '0' )
{
element.replaceWith( programComboBox );
@@ -116,7 +116,7 @@
function getDateField( container )
{
var dateField = '<select id="dateOperator" style="width:30px;" name="dateOperator" ><option value=">"> > </option><option value="="> = </option><option value="<"> < </option></select>';
- dateField += '<input type="text" id="searchText" name="searchText" maxlength="30" style="width:15.6em" onkeyup="searchPatientsOnKeyUp( event );">';
+ dateField += '<input type="text" id="searchText_' + container + '" name="searchText" maxlength="30" style="width:15.6em" onkeyup="searchPatientsOnKeyUp( event );">';
return dateField;
}
@@ -141,25 +141,48 @@
return (e)? e.which : null;
}
-function searchAdvancedPatients()
+function validateAdvancedPatients()
{
hideById( 'listPatientDiv' );
- var searchTextFields = jQuery('[name=searchText]');
var flag = true;
- jQuery( searchTextFields ).each( function( i, item )
+ var params = '';
+ var dateOperator = '';
+ jQuery("#searchPatientDiv :input").each( function( i, item )
{
if( jQuery( item ).val() == '' )
{
showWarningMessage( i18n_specify_search_criteria );
flag = false;
}
+
+ var elementId = $(this).attr('id');
+ var elementName = $(this).attr('name');
+ if( elementId =='dateOperator' )
+ {
+ dateOperator = jQuery(this).val();
+ }
+ else if( jQuery(this).val()!= null && jQuery(this).val() != '' )
+ {
+ var value =jQuery(this).val();
+ if( dateOperator != '' )
+ {
+ value = dateOperator + "'" + value + "'";
+ dateOperator = "";
+ }
+ if( elementName=='searchText')
+ params += "searchText=";
+ else
+ params += elementId + "=";
+
+ params += htmlEncode(value) + "&";
+ }
});
if(!flag) return;
contentDiv = 'listPatientDiv';
jQuery( "#loaderDiv" ).show();
- searchPatient();
+ searchAdvancedPatient( params );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js 2012-05-24 13:53:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js 2012-06-20 09:46:37 +0000
@@ -148,12 +148,12 @@
});
}
-function searchPatient()
+function searchAdvancedPatient( params )
{
$.ajax({
url: 'searchPatient.action',
type:"POST",
- data: getParamsForDiv('searchPatientDiv'),
+ data: params,
success: function( html ){
statusSearching = 1;
setInnerHTML( 'contentDiv', html );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-06-14 13:19:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-06-20 09:46:37 +0000
@@ -820,12 +820,12 @@
});
}
-function searchPatient()
+function searchAdvancedPatient( params )
{
$.ajax({
url: 'searchRegistrationPatient.action',
type:"POST",
- data: getParamsForDiv('searchPatientDiv'),
+ data: params,
success: function( html ){
statusSearching = 1;
setInnerHTML( 'listPatientDiv', html );
=== 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 2012-06-08 07:22:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/select.vm 2012-06-20 09:46:37 +0000
@@ -45,7 +45,7 @@
<input type='checkbox' id='searchBySelectedOrgunit' name='searchBySelectedOrgunit' value='true' />
</td>
<td>
- <input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='searchAdvancedPatients();'>
+ <input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='validateAdvancedPatients();'>
</td>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-06-14 03:58:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-06-20 09:46:37 +0000
@@ -43,7 +43,7 @@
<input type='checkbox' id='searchBySelectedOrgunit' name='searchBySelectedOrgunit' value='true' />
</td>
<td>
- <input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='searchAdvancedPatients();'>
+ <input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='validateAdvancedPatients();'>
</td>
<td> </td>
</tr>