← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12735: Allow dimemsion fields without filter-values in tabular repott,

 

------------------------------------------------------------
revno: 12735
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-10-16 22:24:26 +0700
message:
  Allow dimemsion fields without filter-values in tabular repott,
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js


--
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/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-10-16 10:03:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-10-16 15:24:26 +0000
@@ -1998,6 +1998,42 @@
 						TR.util.notification.error(TR.i18n.em_no_data_element, TR.i18n.em_no_data_element);
 						return false;
 					}
+					else
+					{
+						var isvalid = true;
+						TR.cmp.params.dataelement.selected.store.each( function(r) {
+							var valueType = r.data.valueType;
+							var deId = r.data.id;
+							var length = Ext.getCmp('filterPanel_' + deId).items.length/5;
+							var hidden = TR.state.caseBasedReport.isColHidden(deId);
+							var dimensionOption = 'dimension';
+							
+							for(var idx=0;idx<length;idx++)
+							{
+								var id = deId + '_' + idx;
+								if(Ext.getCmp('filter_' + id)!=undefined)
+								{
+									if( idx==0 )
+									{
+										dimensionOption = Ext.getCmp('filter_dimension_' + deId ).getValue();
+										if( dimensionOption=='filter' ){
+											var filterValue = Ext.getCmp('filter_' + id).rawValue.toLowerCase();
+											if(filterValue==null ||filterValue=='' ){
+												isvalid = false;
+											}
+										}
+									}
+									
+								}
+							}
+						});
+						
+						if(	!isvalid ){
+							TR.util.notification.error(TR.i18n.fill_filter_values_for_all_selected_data_elements, TR.i18n.fill_filter_values_for_all_selected_data_elements);
+							return false;
+						}
+					}
+				
 					return true;
 				},
 				response: function(r) {
@@ -2270,32 +2306,48 @@
 					
 					// Validate data element
 					
-					var isValid = true;
-					TR.cmp.params.dataelement.selected.store.each( function(r) {
-						var deId = r.data.id;
-						var length = Ext.getCmp('filterPanel_' + deId).items.length/4;
-						for(var idx=0;idx<length;idx++)
-						{
-							var id = deId + '_' + idx;
-							if(Ext.getCmp('filter_' + id)!=undefined)
+					if(TR.cmp.params.dataelement.selected.store.data.items.length == 0 )
+					{
+						TR.util.notification.error(TR.i18n.em_no_data_element, TR.i18n.em_no_data_element);
+						return false;
+					}
+					else
+					{
+						var isvalid = true;
+						TR.cmp.params.dataelement.selected.store.each( function(r) {
+							var valueType = r.data.valueType;
+							var deId = r.data.id;
+							var length = Ext.getCmp('filterPanel_' + deId).items.length/5;
+							var hidden = TR.state.caseBasedReport.isColHidden(deId);
+							var dimensionOption = 'dimension';
+							
+							for(var idx=0;idx<length;idx++)
 							{
-								var filterValue = Ext.getCmp('filter_' + id).rawValue;
-								if(filterValue==null || filterValue==TR.i18n.please_select){
-									filterValue = Ext.getCmp('filter_' + id).getValue();
-								}
-								if( filterValue == null 
-									|| filterValue == ''
-									|| filterValue==TR.i18n.please_select ){
-									isValid = false;
+								var id = deId + '_' + idx;
+								if(Ext.getCmp('filter_' + id)!=undefined)
+								{
+									if( idx==0 )
+									{
+										dimensionOption = Ext.getCmp('filter_dimension_' + deId ).getValue();
+										if( dimensionOption=='filter' ){
+											var filterValue = Ext.getCmp('filter_' + id).rawValue.toLowerCase();
+											if(filterValue==null ||filterValue=='' ){
+												isvalid = false;
+											}
+										}
+									}
+									
 								}
 							}
+						});
+						
+						if(	!isvalid ){
+							TR.util.notification.error(TR.i18n.fill_filter_values_for_all_selected_data_elements, TR.i18n.fill_filter_values_for_all_selected_data_elements);
+							return false;
 						}
-					});
-					if( !isValid){
-						TR.util.notification.error(TR.i18n.fill_filter_values_for_all_selected_data_elements, TR.i18n.fill_filter_values_for_all_selected_data_elements);
-						return false;		
 					}
 					
+					
 					var periodInt = 0;
 					if( TR.cmp.settings.startDate.rawValue!="" 
 						&& TR.cmp.settings.endDate.rawValue!="")