From cc2f85553508ea2d4b4ab71449899b428ff045dd Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 10 Aug 2009 17:55:34 +0000 Subject: [PATCH] deduplicate the list of context orgs to prevent errors inserting into dojo store git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4_0@13806 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/admin/org_unit_settings.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js b/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js index ae664cf645..e9e60a70dc 100644 --- a/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js +++ b/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js @@ -78,7 +78,17 @@ function buildMergedOrgSelector(orgList) { fieldmapper.aou.descendantNodeList(orgList[i])); } - var store = new dojo.data.ItemFileReadStore({data:aou.toStoreData(orgNodeList)}); + // dedeuplicate the list of org units + var newList = []; + dojo.forEach(orgNodeList, + function(node) { + if(!newList.filter( + function(node2) { return (node2.id() == node.id()); })[0]) + newList.push(node); + } + ); + + var store = new dojo.data.ItemFileReadStore({data:aou.toStoreData(newList)}); osContextSelector.store = store; osContextSelector.startup(); osContextSelector.setValue(user.user.ws_ou()); -- 2.11.0