=== 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 2012-07-24 07:37:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-10-06 04:54:55 +0000
@@ -38,6 +38,7 @@
import java.util.Map;
import java.util.Set;
+import org.hibernate.exception.SQLGrammarException;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
@@ -262,6 +263,13 @@
return mapSuggestedValues;
}
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
// -------------------------------------------------------------------------
// Implementation Action
// -------------------------------------------------------------------------
@@ -301,7 +309,8 @@
}
else
{
- organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( orgunitId ));
+ organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren(
+ orgunitId ) );
}
}
}
@@ -321,27 +330,33 @@
// ---------------------------------------------------------------------
// Generate tabular report
// ---------------------------------------------------------------------
-
- if ( type == null ) // Tabular report
- {
- totalRecords = programStageInstanceService.getTabularReportCount( programStage, columns, organisationUnits,
- level, startValue, endValue );
-
- total = getNumberOfPages( totalRecords );
-
- this.paging = createPaging( totalRecords );
- // total = paging.getTotal(); //TODO
-
- grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
- startValue, endValue, !orderByOrgunitAsc, paging.getStartPos(), paging.getPageSize() );
- }
- else
- // Download as Excel
- {
- grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
- startValue, endValue, !orderByOrgunitAsc, null, null );
- }
-
+ try
+ {
+ if ( type == null ) // Tabular report
+ {
+ totalRecords = programStageInstanceService.getTabularReportCount( programStage, columns,
+ organisationUnits, level, startValue, endValue );
+
+ total = getNumberOfPages( totalRecords );
+
+ this.paging = createPaging( totalRecords );
+ // total = paging.getTotal(); //TODO
+
+ grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
+ startValue, endValue, !orderByOrgunitAsc, paging.getStartPos(), paging.getPageSize() );
+ }
+ else
+ // Download as Excel
+ {
+ grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
+ startValue, endValue, !orderByOrgunitAsc, null, null );
+ }
+ }
+ catch ( SQLGrammarException ex )
+ {
+ message = i18n.getString("failed_to_get_events");
+ }
+
return type == null ? SUCCESS : type;
}
@@ -364,26 +379,26 @@
for ( String searchValue : searchingValues )
{
String[] values = searchValue.split( "_" );
-
+
if ( values != null && values.length >= 3 )
{
String prefix = values[0];
-
+
TabularReportColumn column = new TabularReportColumn();
column.setPrefix( prefix );
column.setIdentifier( values[1] );
column.setHidden( Boolean.parseBoolean( values[2] ) );
column.setQuery( values.length == 4 ? TextUtils.lower( values[3] ) : null );
-
+
if ( PREFIX_FIXED_ATTRIBUTE.equals( prefix ) )
{
column.setName( values[1] );
}
else if ( PREFIX_IDENTIFIER_TYPE.equals( prefix ) )
{
- PatientIdentifierType identifierType = patientIdentifierTypeService.getPatientIdentifierType( column
- .getIdentifierAsInt() );
-
+ PatientIdentifierType identifierType = patientIdentifierTypeService
+ .getPatientIdentifierType( column.getIdentifierAsInt() );
+
column.setName( identifierType.getName() );
}
else if ( PREFIX_PATIENT_ATTRIBUTE.equals( prefix ) )
@@ -391,10 +406,10 @@
int objectId = Integer.parseInt( values[1] );
PatientAttribute attribute = patientAttributeService.getPatientAttribute( objectId );
patientAttributes.add( attribute );
-
+
valueTypes.add( attribute.getValueType() );
mapSuggestedValues.put( index, getSuggestedAttributeValues( attribute ) );
-
+
column.setName( attribute.getName() );
}
else if ( PREFIX_DATA_ELEMENT.equals( prefix ) )
@@ -402,16 +417,17 @@
int objectId = Integer.parseInt( values[1] );
DataElement dataElement = dataElementService.getDataElement( objectId );
dataElements.add( dataElement );
-
- String valueType = dataElement.getOptionSet() != null ? VALUE_TYPE_OPTION_SET : dataElement.getType();
+
+ String valueType = dataElement.getOptionSet() != null ? VALUE_TYPE_OPTION_SET : dataElement
+ .getType();
valueTypes.add( valueType );
mapSuggestedValues.put( index, getSuggestedDataElementValues( dataElement ) );
-
+
column.setName( dataElement.getName() );
}
-
+
columns.add( column );
-
+
index++;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-10-05 03:50:06 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-10-06 04:54:55 +0000
@@ -462,4 +462,5 @@
location = Location
some_data_element_not_exist = Some data elements not exist
guardian=Guardian/caretaker
-of = of
\ No newline at end of file
+of = of
+failed_to_get_events = Failed to get events. Please generate resource tables before.
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-09-21 07:44:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-10-06 04:54:55 +0000
@@ -34,7 +34,7 @@
|
- $i18n.getString('from_to') |
- |
- |
+ $i18n.getString('report_date') $i18n.getString('from_to') |
+
+
+
+ |
|
-
- $i18n.getString('data_elements') |
-
-
- |
-
+
+
+
+
+
+ |
+
+
+
+ |
+
+
@@ -160,6 +156,8 @@
var i18n_no_compulsary_data_elements = '$encoder.jsEscape( $i18n.getString( "no_compulsary_data_elements" ) , "'")';
var i18n_remove_empty_events_success = '$encoder.jsEscape( $i18n.getString( "remove_empty_events_success" ) , "'")';
var i18n_confirm_remove_empty_events = '$encoder.jsEscape( $i18n.getString( "confirm_remove_empty_events" ) , "'")';
+ var i18n_report_date = '$encoder.jsEscape( $i18n.getString( "report_date" ) , "'")';
+
isAjax = true;
contentDiv = '';
var unSave = false;
=== 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 2012-08-02 20:08:19 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-10-06 04:54:55 +0000
@@ -742,42 +742,48 @@
params: this.getParams(),
success: function(r) {
var json = Ext.JSON.decode(r.responseText);
- TR.state.total = json.total;
- TR.value.columns = json.columns;
- TR.value.values = json.items;
-
- // Get fields
- var fields = [];
- fields[0] = 'id';
- var record = new Array();
- for( var index=1; index < TR.value.columns.length; index++ )
- {
- fields[index] = 'col' + index;
- record.push('');
- }
- TR.value.fields = fields;
- TR.value.values.unshift(record);
-
- // Set data for grid
- TR.store.getDataTableStore();
- TR.datatable.getDataTable();
- if ( json.items.length > 1 )
- {
- TR.datatable.setPagingToolbarStatus();
- Ext.getCmp('btnClean').enable();
- Ext.getCmp('btnSortBy').enable();
- }
- else
- {
- Ext.getCmp('currentPage').setValue('');
- Ext.getCmp('currentPage').disable();
- Ext.getCmp('firstPageBtn').disable();
- Ext.getCmp('previousPageBtn').disable();
- Ext.getCmp('nextPageBtn').disable();
- Ext.getCmp('lastPageBtn').disable();
-
- Ext.getCmp('btnClean').disable();
- Ext.getCmp('btnSortBy').disable();
+ if(json.message!=""){
+ //TR.util.notification.warning(json.message);
+ TR.util.notification.error(TR.i18n.error, json.message);
+ }
+ else{
+ TR.state.total = json.total;
+ TR.value.columns = json.columns;
+ TR.value.values = json.items;
+
+ // Get fields
+ var fields = [];
+ fields[0] = 'id';
+ var record = new Array();
+ for( var index=1; index < TR.value.columns.length; index++ )
+ {
+ fields[index] = 'col' + index;
+ record.push('');
+ }
+ TR.value.fields = fields;
+ TR.value.values.unshift(record);
+
+ // Set data for grid
+ TR.store.getDataTableStore();
+ TR.datatable.getDataTable();
+ if ( json.items.length > 1 )
+ {
+ TR.datatable.setPagingToolbarStatus();
+ Ext.getCmp('btnClean').enable();
+ Ext.getCmp('btnSortBy').enable();
+ }
+ else
+ {
+ Ext.getCmp('currentPage').setValue('');
+ Ext.getCmp('currentPage').disable();
+ Ext.getCmp('firstPageBtn').disable();
+ Ext.getCmp('previousPageBtn').disable();
+ Ext.getCmp('nextPageBtn').disable();
+ Ext.getCmp('lastPageBtn').disable();
+
+ Ext.getCmp('btnClean').disable();
+ Ext.getCmp('btnSortBy').disable();
+ }
}
TR.util.mask.hideMask();
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm 2012-07-24 07:37:03 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm 2012-10-06 04:54:55 +0000
@@ -91,5 +91,6 @@
false_value:'$encoder.jsEscape($i18n.getString( 'false_value' ) , "'")',
value_is_invalid:'$encoder.jsEscape($i18n.getString( 'value_is_invalid' ) , "'")',
value_is_valid:'$encoder.jsEscape($i18n.getString( 'value_is_valid' ) , "'")',
-em_no_program_stage: '$encoder.jsEscape($i18n.getString( 'em_no_program_stage' ) , "'")'
+em_no_program_stage: '$encoder.jsEscape($i18n.getString( 'em_no_program_stage' ) , "'")',
+error: '$encoder.jsEscape($i18n.getString( 'error' ) , "'")'
};
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-09-14 13:48:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2012-10-06 04:54:55 +0000
@@ -11,9 +11,9 @@
clearListById('compulsoryDE');
clearListById('programId');
- jQuery( '#programId').append( '' );
+ jQuery( '#programId').append( '' );
for ( i in json.programs ) {
- jQuery( '#programId').append( '' );
+ jQuery( '#programId').append( '' );
}
disableCriteriaDiv();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm 2012-06-27 05:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonSingleEventPrograms.vm 2012-10-06 04:54:55 +0000
@@ -6,10 +6,10 @@
"id": ${program.id} ,
"name": "$!encoder.jsonEncode( ${program.name} )",
"type": "$program.type",
- "programStageId":
- #foreach( $programStage in $program.programStages )
- "$programStage.id"
- #end
+ #foreach( $programStage in $program.programStages )
+ "reportDateDescription": "$programStage.reportDateDescription",
+ "programStageId": "$programStage.id"
+ #end
}#if( $velocityCount < $size ),#end
#end]
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm 2012-07-12 02:49:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm 2012-10-06 04:54:55 +0000
@@ -3,6 +3,7 @@
{
#set( $noHeader = $grid.getHeaders().size() )
#set( $metaData = $noHeader - $valueTypes.size() )
+"message": "$!message",
"total": "$total",
"columns":[
#set($index = 0)
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm 2012-08-01 18:20:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programStageInstancesList.vm 2012-10-06 04:54:55 +0000
@@ -1,78 +1,82 @@
-
-
- $i18n.getString( "search_result_matching_the_search_criteria" ): |
- |
- |
- |
-
-
-
- $i18n.getString( "total_result" ) |
- |
- |
- $!totalRecords |
-
-
+#if($!message)
+ $message
+#else
+
+
+ $i18n.getString( "search_result_matching_the_search_criteria" ): |
+ |
+ |
+ |
+
+
+
+ $i18n.getString( "total_result" ) |
+ |
+ |
+ $!totalRecords |
+
+
-
-
-
-
-
-
- # |
- #set($index = 0)
- #foreach( $col in $grid.getHeaders() )
- #if( $index > 0 )
- $col.name |
+
+
+
+ |
+
+
+ #set( $noCol = $grid.getHeaders().size() + 3 )
+
+
+
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+
+ |
+ |
+
+
+#end