← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15879: EV improved validation + ER minor fix.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 15879 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-06-27 13:06:50 +0200
message:
  EV improved validation + ER minor fix.
modified:
  dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.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-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js	2014-06-23 09:11:59 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js	2014-06-27 11:04:54 +0000
@@ -450,10 +450,10 @@
 					}
 
 					// at least one period
-					if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
+					//if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
 						//alert(NS.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
 						//return;
-					}
+					//}
 
 					// favorite
 					if (config.id) {

=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js	2014-06-23 11:47:18 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js	2014-06-27 11:04:54 +0000
@@ -487,6 +487,21 @@
 						return;
 					}
 
+					// get object names
+					for (var i = 0, dims = Ext.Array.clean([].concat(config.columns || [], config.rows || [], config.filters || [])); i < dims.length; i++) {
+
+						// Object names
+						if (api.layout.Dimension(dims[i])) {
+							objectNames.push(dims[i].dimension);
+						}
+					}
+
+                    // period
+                    if (!Ext.Array.contains(objectNames, 'pe') && !(config.startDate && config.endDate)) {
+                        alert('At least one fixed period, one relative period or start/end dates must be specified');
+                        return;
+                    }
+                    
 					config.columns = getValidatedDimensionArray(config.columns);
 					config.rows = getValidatedDimensionArray(config.rows);
 					config.filters = getValidatedDimensionArray(config.filters);
@@ -503,8 +518,8 @@
                         config.filters = config.filters.concat(config.columns.splice(1));
                     }
 
-                    // row
-					if (!config.rows && !config.startDate && !config.endDate) {
+					// row
+					if (!config.rows) {
 						alert('No category items selected');
 						return;
 					}
@@ -515,21 +530,6 @@
                         config.filters = config.filters.concat(config.rows.splice(1));
                     }
 
-					// get object names
-					for (var i = 0, dims = Ext.Array.clean([].concat(config.columns || [], config.rows || [], config.filters || [])); i < dims.length; i++) {
-
-						// Object names
-						if (api.layout.Dimension(dims[i])) {
-							objectNames.push(dims[i].dimension);
-						}
-					}
-
-					// at least one period
-					if (!Ext.Array.contains(objectNames, dimConf.period.objectName)) {
-						//alert(NS.i18n.at_least_one_period_must_be_specified_as_column_row_or_filter);
-						//return;
-					}
-
 					// favorite
 					if (config.id) {
 						layout.id = config.id;