← Back to team overview

dhis2-devs team mailing list archive

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

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 10039 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-03-07 13:11:51 +0100
message:
  (PT) Improved validation.
modified:
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/dataelementgroupset.png
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/organisationunitgroupset.png
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/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-pivot/src/main/webapp/dhis-web-pivot/app/images/dataelementgroupset.png'
Binary files dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/dataelementgroupset.png	2013-03-06 13:39:47 +0000 and dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/dataelementgroupset.png	2013-03-07 11:25:34 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/organisationunitgroupset.png'
Binary files dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/organisationunitgroupset.png	2013-03-06 13:39:47 +0000 and dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/organisationunitgroupset.png	2013-03-07 11:25:34 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-03-06 18:25:40 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-03-07 11:07:22 +0000
@@ -2212,23 +2212,41 @@
 			};
 
 			validateSpecialCases = function(settings) {
-				var dimConf = pt.conf.finals.dimension;
-
-				// indicator as filter
+				var dimConf = pt.conf.finals.dimension,
+					settingsNames = [],
+					settingsObjects = [].concat(Ext.clone(settings.col || []), Ext.clone(settings.row || []), Ext.clone(settings.filter || []));
+
+				// Settings names
+				for (var i = 0; i < settingsObjects.length; i++) {
+					settingsNames.push(settingsObjects[i].name);
+				}
+
+				// Indicator as filter
 				if (settings.filter && pt.store.indicatorSelected.data.length) {
 					for (var i = 0; i < settings.filter.length; i++) {
 						if (settings.filter[i].name === dimConf.data.paramName) {
-							alert('Indicators cannot be specified as filter');
+							alert('Indicators cannot be specified as filter'); //i18n
 							return;
 						}
 					}
 				}
 
+				// Categories as filter
 				if (settings.filter && pt.viewport.settingsWindow.filterStore.getById(dimConf.category.paramName)) {
 					alert('Categories cannot be specified as filter');
 					return;
 				}
 
+				// Degs and datasets in the same query
+				if (Ext.Array.contains(settingsNames, dimConf.data.paramName) && pt.store.dataSetSelected.data.length) {
+					for (var i = 0; i < pt.init.degs.length; i++) {
+						if (Ext.Array.contains(settingsNames, pt.init.degs[i].id)) {
+							alert('Data element group sets cannot be specified together with data sets');
+							return;
+						}
+					}
+				}
+
 				return true;
 			};
 

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-03-06 17:24:40 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-03-07 11:07:22 +0000
@@ -1612,20 +1612,21 @@
 				dimConf = pt.conf.finals.dimension;
 
 			if (!(col || row)) {
-				alert('No column or row dimensions selected'); //i18n
+				alert('At least one dimension must be specified as row or column'); //i18n
 				return;
 			}
 
+			// Selected dimensions
 			for (var i = 0; i < a.length; i++) {
 				if (a[i]) {
 					names.push(a[i].name);
 				}
 			}
 
-			if (!Ext.Array.contains(names, dimConf.data.paramName)) {
-				alert('At least one indicator, data element or dataset must be specified as column, row or filter');
-				return;
-			}
+			//if (!Ext.Array.contains(names, dimConf.data.paramName)) {
+				//alert('At least one indicator, data element or dataset must be specified as column, row or filter');
+				//return;
+			//}
 
 			if (!Ext.Array.contains(names, dimConf.period.paramName)) {
 				alert('At least one period must be specified as column, row or filter');