dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27721
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13802: PT, DV, user organisation unit validation.
------------------------------------------------------------
revno: 13802
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-21 16:29:35 +0100
message:
PT, DV, user organisation unit validation.
modified:
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
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/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/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-01-21 11:14:49 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-01-21 15:29:35 +0000
@@ -5740,11 +5740,17 @@
if (organisationUnits.length) {
var ou = organisationUnits[0];
- init.user = {
- ou: ou.id,
- ouc: Ext.Array.pluck(ou.children, 'id')
+ if (ou.id) {
+ init.user = {
+ ou: ou.id
+ };
+
+ init.user.ouc = ou.children ? Ext.Array.pluck(ou.children, 'id') : null;
};
}
+ else {
+ alert('User is not assigned to any organisation units');
+ }
fn();
}
=== 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 2014-01-03 16:26:42 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2014-01-21 15:29:35 +0000
@@ -1110,13 +1110,13 @@
userOuc,
userOugc;
- if (isUserOrgunit) {
+ if (init.user && isUserOrgunit) {
userOu = [{
id: init.user.ou,
name: service.layout.getItemName(xLayout, response, init.user.ou, false)
}];
}
- if (isUserOrgunitChildren) {
+ if (init.user && init.user.ouc && isUserOrgunitChildren) {
userOuc = [];
for (var j = 0; j < init.user.ouc.length; j++) {
@@ -1128,7 +1128,7 @@
support.prototype.array.sort(userOuc);
}
- if (isUserOrgunitGrandChildren) {
+ if (init.user && init.user.ouc && isUserOrgunitGrandChildren) {
var userOuOuc = [].concat(init.user.ou, init.user.ouc),
responseOu = response.metaData[ou];
@@ -2542,7 +2542,9 @@
}
// sort ouc
- support.prototype.array.sort(init.user.ouc);
+ if (init.user && init.user.ouc) {
+ support.prototype.array.sort(init.user.ouc);
+ }
// legend set map
init.idLegendSetMap = {};
=== 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 2014-01-21 11:14:49 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2014-01-21 15:29:35 +0000
@@ -5085,13 +5085,19 @@
if (organisationUnits.length) {
var ou = organisationUnits[0];
- init.user = {
- ou: ou.id,
- ouc: Ext.Array.pluck(ou.children, 'id')
+ if (ou.id) {
+ init.user = {
+ ou: ou.id
+ };
+
+ init.user.ouc = ou.children ? Ext.Array.pluck(ou.children, 'id') : null;
};
+ }
+ else {
+ alert('User is not assigned to any organisation units');
+ }
- fn();
- }
+ fn();
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2014-01-16 12:10:56 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2014-01-21 15:29:35 +0000
@@ -1091,13 +1091,13 @@
userOuc,
userOugc;
- if (isUserOrgunit) {
+ if (init.user && isUserOrgunit) {
userOu = [{
id: init.user.ou,
name: response.metaData.names[init.user.ou]
}];
}
- if (isUserOrgunitChildren) {
+ if (init.user && init.user.ouc && isUserOrgunitChildren) {
userOuc = [];
for (var j = 0; j < init.user.ouc.length; j++) {
@@ -1109,7 +1109,7 @@
support.prototype.array.sort(userOuc);
}
- if (isUserOrgunitGrandChildren) {
+ if (init.user && init.user.ouc && isUserOrgunitGrandChildren) {
var userOuOuc = [].concat(init.user.ou, init.user.ouc),
responseOu = response.metaData[ou];
@@ -2479,7 +2479,9 @@
}
// sort ouc
- support.prototype.array.sort(init.user.ouc);
+ if (init.user && init.user.ouc) {
+ support.prototype.array.sort(init.user.ouc);
+ }
}());
// instance