dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21549
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10221: Allow to enter custom filter values for string-fields in tabular report.
------------------------------------------------------------
revno: 10221
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-14 20:30:46 +0700
message:
Allow to enter custom filter values for string-fields in tabular report.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.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-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java 2012-10-16 04:05:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/TabularReportColumn.java 2013-03-14 13:30:46 +0000
@@ -18,6 +18,8 @@
private String query;
private String name;
+
+ private boolean dateType = false;
// -------------------------------------------------------------------------
// Constructor
@@ -133,4 +135,14 @@
{
this.name = name;
}
+
+ public boolean isDateType()
+ {
+ return dateType;
+ }
+
+ public void setDateType( boolean dateType )
+ {
+ this.dateType = dateType;
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-03-14 05:03:19 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-03-14 13:30:46 +0000
@@ -674,7 +674,7 @@
sql = getAggregateReportSQL8( programStage, orgunitIds, facilityLB, filterSQL, deGroupBy, periods
.iterator().next(), aggregateType, limit, useCompletedEvents, format );
}
-
+
if ( !sql.isEmpty() )
{
SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
@@ -875,7 +875,14 @@
if ( column.hasQuery() )
{
- where += operator + "lower(" + column.getIdentifier() + ") " + column.getQuery() + " ";
+ if ( column.isDateType() )
+ {
+ where += operator + column.getIdentifier() + " " + column.getQuery() + " ";
+ }
+ else
+ {
+ where += operator + "lower(" + column.getIdentifier() + ") " + column.getQuery() + " ";
+ }
operator = "and ";
}
}
@@ -890,7 +897,15 @@
if ( column.hasQuery() )
{
- where += operator + "lower(identifier_" + column.getIdentifier() + ") " + column.getQuery() + " ";
+ if ( column.isDateType() )
+ {
+ where += operator + "identifier_" + column.getIdentifier() + " " + column.getQuery() + " ";
+ }
+ else
+ {
+ where += operator + "lower(identifier_" + column.getIdentifier() + ") " + column.getQuery()
+ + " ";
+ }
operator = "and ";
}
}
@@ -905,7 +920,15 @@
if ( column.hasQuery() )
{
- where += operator + "lower(attribute_" + column.getIdentifier() + ") " + column.getQuery() + " ";
+ if ( column.isDateType() )
+ {
+ where += operator + "attribute_" + column.getIdentifier() + " " + column.getQuery() + " ";
+ }
+ else
+ {
+ where += operator + "lower(attribute_" + column.getIdentifier() + ") " + column.getQuery()
+ + " ";
+ }
operator = "and ";
}
}
@@ -939,7 +962,14 @@
if ( column.hasQuery() )
{
- where += operator + "lower(element_" + column.getIdentifier() + ") " + column.getQuery() + " ";
+ if ( column.isDateType() )
+ {
+ where += operator + "element_" + column.getIdentifier() + " " + column.getQuery() + " ";
+ }
+ else
+ {
+ where += operator + "lower(element_" + column.getIdentifier() + ") " + column.getQuery() + " ";
+ }
operator = "and ";
}
}
@@ -990,7 +1020,7 @@
sql += where; // filters
sql = sql.substring( 0, sql.length() - 1 ) + " "; // Remove last comma
sql += (min != null && max != null) ? statementBuilder.limitRecord( min, max ) : "";
-
+
return sql;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2013-03-10 04:31:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2013-03-14 13:30:46 +0000
@@ -471,6 +471,10 @@
if ( PREFIX_FIXED_ATTRIBUTE.equals( prefix ) )
{
column.setName( values[1] );
+ if ( column.getIdentifier().equals( "birthDate" ) || column.getIdentifier().equals( "deathdate" ) )
+ {
+ column.setDateType( true );
+ }
accessPrivateInfo = true;
}
else if ( PREFIX_IDENTIFIER_TYPE.equals( prefix ) )
@@ -490,6 +494,10 @@
mapSuggestedValues.put( index, getSuggestedAttributeValues( attribute ) );
column.setName( attribute.getName() );
+ if ( attribute.getValueType().equals( PatientAttribute.TYPE_DATE ) )
+ {
+ column.setDateType( true );
+ }
accessPrivateInfo = true;
}
else if ( PREFIX_DATA_ELEMENT.equals( prefix ) )
@@ -506,7 +514,10 @@
.getType();
valueTypes.add( valueType );
mapSuggestedValues.put( index, getSuggestedDataElementValues( dataElement ) );
-
+ if ( dataElement.getType().equals( DataElement.VALUE_TYPE_DATE ) )
+ {
+ column.setDateType( true );
+ }
column.setName( dataElement.getFormNameFallback() );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-03-14 05:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2013-03-14 13:30:46 +0000
@@ -469,10 +469,21 @@
params.value = '=';
if(valueType == 'string' || valueType == 'list' || valueType == 'username' ){
- params.store = new Ext.data.ArrayStore({
- fields: ['value','name'],
- data: [ ['=','='],['like',TR.i18n.like],['in',TR.i18n.in] ]
- });
+ var fixedId = id.substring(0, id.lastIndexOf('_') );
+ if( fixedId=='fixedAttr_gender' || fixedId=='fixedAttr_dobType')
+ {
+ params.store = new Ext.data.ArrayStore({
+ fields: ['value','name'],
+ data: [ ['=','='],['in',TR.i18n.in] ]
+ });
+ }
+ else
+ {
+ params.store = new Ext.data.ArrayStore({
+ fields: ['value','name'],
+ data: [ ['=','='],['like',TR.i18n.like],['in',TR.i18n.in] ]
+ });
+ }
}
else if( valueType == 'trueOnly' || valueType == 'bool' ){
params.store = new Ext.data.ArrayStore({
@@ -513,7 +524,7 @@
var deId = id.split('_')[1];
var fixedId = id.substring(0, id.lastIndexOf('_') );
params.typeAhead = true;
- params.forceSelection = true;
+ params.editable = true;
if( valueType == 'bool' || fixedId=='fixedAttr_gender' || fixedId=='fixedAttr_dobType')
{
params.queryMode = 'local';
@@ -522,9 +533,11 @@
params.editable = false;
if( fixedId=='fixedAttr_gender')
{
+ params.forceSelection = true;
+ params.multiSelect = true;
params.store = new Ext.data.ArrayStore({
fields: ['value', 'name'],
- data: [['', TR.i18n.filter_value],
+ data: [['', TR.i18n.please_select],
['M', TR.i18n.male],
['F', TR.i18n.female],
['T', TR.i18n.transgender]]
@@ -532,9 +545,12 @@
}
else if( fixedId=='fixedAttr_dobType')
{
+ params.forceSelection = true;
+ params.editable = false;
+ params.multiSelect = true;
params.store = new Ext.data.ArrayStore({
fields: ['value', 'name'],
- data: [['', TR.i18n.filter_value],
+ data: [['', TR.i18n.please_select],
['V', TR.i18n.verified],
['D', TR.i18n.declared],
['A', TR.i18n.approximated]]
@@ -542,9 +558,10 @@
}
else if (valueType == 'bool')
{
+ params.forceSelection = true;
params.store = new Ext.data.ArrayStore({
fields: ['value', 'name'],
- data: [['', TR.i18n.filter_value],
+ data: [['', TR.i18n.please_select],
['true', TR.i18n.yes],
['false', TR.i18n.no]]
});
@@ -558,13 +575,14 @@
params.editable = false;
params.store = new Ext.data.ArrayStore({
fields: ['value', 'name'],
- data: [['', TR.i18n.filter_value],['true', TR.i18n.yes]]
+ data: [['', TR.i18n.please_select],['true', TR.i18n.yes]]
});
}
else if(valueType=='username'){
params.queryMode = 'remote';
params.valueField = 'u';
params.displayField = 'u';
+ params.multiSelect = true;
params.store = Ext.create('Ext.data.Store', {
fields: ['u'],
data:[],
@@ -1720,6 +1738,7 @@
{
p.useCompletedEvents = Ext.getCmp('completedEventsOpt').getValue();
}
+
// Get searching values
p.searchingValues = [];
@@ -1734,11 +1753,20 @@
for(var idx=0;idx<length;idx++)
{
var id = propId + '_' + idx;
- var filterValue = Ext.getCmp('filter_' + id).rawValue;
- if( valueType == 'bool' || propId=='fixedAttr_gender' || propId=='fixedAttr_dobType')
+ var filterField = Ext.getCmp('filter_' + id);
+ var filterValue = "";
+ if( filterField.xtype == 'combobox' )
{
- filterValue = Ext.getCmp('filter_' + id).getValue();
- }
+ var values = Ext.getCmp('filter_' + id).getValue();
+ for( var i in values ){
+ filterValue += values[i] + ";";
+ }
+ filterValue = filterValue.substring(0,filterValue.length - 1 );
+ }
+ else{
+ filterValue = filterField.rawValue;
+ }
+
var filter = propId + '_' + hidden
if( filterValue!=null && filterValue!=''){
var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
@@ -1772,24 +1800,12 @@
{
var id = deId + '_' + idx;
- var filterField = Ext.getCmp('filter_' + id);
- var filterValue = "";
- if( filterField.xtype == 'combobox' )
- {
- var values = Ext.getCmp('filter_' + id).getValue();
- for( var i in values ){
- filterValue += values[i] + ";";
- }
- filterValue = filterValue.substring(0,filterValue.length - 1 );
- }
- else{
- filterValue = filterField.rawValue;
- }
-
+ var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
+ var filterValue = Ext.getCmp('filter_' + id).rawValue;
var filter = deId + '_' + hidden + '_';
+
if( filterValue!='' ){
filterValue = filterValue.toLowerCase();
- var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
filter += filterOpt + ' ';
if( filterOpt == 'IN' )
{
@@ -1888,20 +1904,9 @@
for(var idx=0;idx<length;idx++)
{
var id = deId + '_' + idx;
-
var filterField = Ext.getCmp('filter_' + id);
- var filterValue = "";
- if( filterField.xtype == 'combobox' )
- {
- var values = Ext.getCmp('filter_' + id).getValue();
- for( var i in values ){
- filterValue += values[i] + ";";
- }
- filterValue = filterValue.substring(0,filterValue.length - 1 );
- }
- else{
- filterValue = filterField.rawValue;
- }
+ var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
+ var filterValue = Ext.getCmp('filter_' + id).rawValue;
var filter = deId + '_' + hidden + '_';
if( filterValue!=''){
@@ -2158,21 +2163,7 @@
{
var id = deId + '_' + idx;
var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
-
- var filterField = Ext.getCmp('filter_' + id);
- var filterValue = "";
- if( filterField.xtype == 'combobox' )
- {
- var values = Ext.getCmp('filter_' + id).getValue();
- for( var i in values ){
- filterValue += values[i] + ";";
- }
- filterValue = filterValue.substring(0,filterValue.length - 1 );
- }
- else{
- filterValue = filterField.rawValue;
- }
-
+ var filterValue = Ext.getCmp('filter_' + id).rawValue;
var filter = deId.split('_')[1] + "_" + filterOpt + '_';
if( filterValue!=TR.i18n.please_select)
@@ -2289,21 +2280,8 @@
for(var idx=0;idx<length;idx++)
{
var id = deId + '_' + idx;
- var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
-
- var filterField = Ext.getCmp('filter_' + id);
- var filterValue = "";
- if( filterField.xtype == 'combobox' )
- {
- var values = Ext.getCmp('filter_' + id).getValue();
- for( var i in values ){
- filterValue += values[i] + ";";
- }
- filterValue = filterValue.substring(0,filterValue.length - 1 );
- }
- else{
- filterValue = filterField.rawValue;
- }
+ var filterOpt = Ext.getCmp('filter_opt_' + id).rawValue;
+ var filterValue = Ext.getCmp('filter_' + id).rawValue;
var filter = deId.split('_')[1] + "_" + filterOpt + '_';
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm 2013-03-14 09:06:32 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm 2013-03-14 13:30:46 +0000
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# 2.11-SNAPSHOT V31
+# 2.11-SNAPSHOT V30
NETWORK:
*
CACHE:
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm 2013-02-28 06:45:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonPatientProperties.vm 2013-03-14 13:30:46 +0000
@@ -17,7 +17,7 @@
{
"id": "fixedAttr_gender",
"name": "$i18n.getString('gender')",
- "valueType": "string"
+ "valueType": "list"
},
{
"id": "fixedAttr_birthDate",
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2013-03-14 07:36:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm 2013-03-14 13:30:46 +0000
@@ -28,12 +28,13 @@
<td><input type="text" id="minDaysFromStart" name="minDaysFromStart" class="{validate:{number:true,min:0}}"/></td>
</tr>
+ #if( $program.type == 1 )
+
<tr>
<td><label>$i18n.getString( "auto_generate_event" )</label></td>
<td><input type="checkbox" id="autoGenerateEvent" name="autoGenerateEvent" value='true' checked /></td>
</tr>
- #if( $program.type == 1 )
<tr><th colspan="2">$i18n.getString( "repeatable_program_stage_details" )</th></tr>
<tr>
@@ -50,6 +51,7 @@
<td><label>$i18n.getString( "standard_interval_days" )</label></td>
<td><input type="text" id="standardInterval" name="standardInterval" class="{validate:{number:true}}" disabled /></td>
</tr>
+
#end
<tr><th colspan="2">$i18n.getString( "form_details" )</th></tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2013-03-14 07:36:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm 2013-03-14 13:30:46 +0000
@@ -29,28 +29,30 @@
<td><input type="text" id="minDaysFromStart" name="minDaysFromStart" value="$programStage.minDaysFromStart" class="{validate:{number:true,min:0}}"/></td>
</tr>
+ #if($programStage.program.type==1)
+
<tr>
<td><label>$i18n.getString( "auto_generate_event" )</label></td>
<td><input type="checkbox" id="autoGenerateEvent" name="autoGenerateEvent" value='true' #if( $programStage.autoGenerateEvent && $programStage.autoGenerateEvent=='true' ) checked #end /></td>
</tr>
- #if($programStage.program.type==1)
- <tr><th colspan="2">$i18n.getString( "repeatable_program_stage_details" )</th></tr>
-
- <tr>
- <td><label>$i18n.getString( "repeatable" )</label></td>
- <td><input type="checkbox" id="irregular" name="irregular" value='true' #if( $programStage.irregular && $programStage.irregular=='true' ) checked #end onchange='repeatableOnChange();' /></td>
- </tr>
-
- <tr>
- <td><label>$i18n.getString( "display_generate_event_box_after_completed" )</label></td>
- <td><input type="checkbox" id="displayGenerateEventBox" name="displayGenerateEventBox" value='true' #if( $programStage.displayGenerateEventBox && $programStage.displayGenerateEventBox=='true' ) checked #end #if($programStage.irregular!='true' ) disabled checked #end /></td>
- </tr>
+ <tr><th colspan="2">$i18n.getString( "repeatable_program_stage_details" )</th></tr>
- <tr>
- <td><label>$i18n.getString( "standard_interval_days" )</label></td>
- <td><input type="text" id="standardInterval" name="standardInterval" value='$!programStage.standardInterval'class="{validate:{number:true}}" #if($programStage.irregular!='true' ) disabled #end /></td>
- </tr>
+ <tr>
+ <td><label>$i18n.getString( "repeatable" )</label></td>
+ <td><input type="checkbox" id="irregular" name="irregular" value='true' #if( $programStage.irregular && $programStage.irregular=='true' ) checked #end onchange='repeatableOnChange();' /></td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "display_generate_event_box_after_completed" )</label></td>
+ <td><input type="checkbox" id="displayGenerateEventBox" name="displayGenerateEventBox" value='true' #if( $programStage.displayGenerateEventBox && $programStage.displayGenerateEventBox=='true' ) checked #end #if($programStage.irregular!='true' ) disabled checked #end /></td>
+ </tr>
+
+ <tr>
+ <td><label>$i18n.getString( "standard_interval_days" )</label></td>
+ <td><input type="text" id="standardInterval" name="standardInterval" value='$!programStage.standardInterval'class="{validate:{number:true}}" #if($programStage.irregular!='true' ) disabled #end /></td>
+ </tr>
+
#end
<tr><th colspan="2">$i18n.getString( "form_details" )</th></tr>