← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10790: (DV) Improved validation.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 10790 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-05-10 07:43:26 +0200
message:
  (DV) Improved validation.
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/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-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-05-09 21:53:03 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-05-10 05:41:52 +0000
@@ -3710,7 +3710,13 @@
 			};
 
 			validateSpecialCases = function(layout) {
-				var dimConf = dv.conf.finals.dimension;
+				var dimConf = dv.conf.finals.dimension,
+					dimensions = [].concat(layout.columns, layout.rows, layout.filters),
+					objectNameDimensionMap = {};
+
+				for (var i = 0; i < dimensions.length; i++) {
+					objectNameDimensionMap[dimensions[i].dimension] = dimensions[i];
+				}
 
 				// Indicator as filter
 				for (var i = 0; i < layout.filters.length; i++) {
@@ -3720,6 +3726,18 @@
 					}
 				}
 
+				// dc and in
+				if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) {
+					alert('Indicators and detailed data elements cannot be specified together');
+					return;
+				}
+
+				// dc and de
+				if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) {
+					alert('Detailed data elements and totals cannot be specified together');
+					return;
+				}
+
 				// Categories as filter
 				//if (layout.filter && dv.viewport.layoutWindow.filterStore.getById(dimConf.category.dimensionName)) {
 					//alert(DV.i18n.categories_cannot_be_specified_as_filter);