deduplicate the list of context orgs to prevent errors inserting into dojo store
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Aug 2009 17:54:36 +0000 (17:54 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Aug 2009 17:54:36 +0000 (17:54 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4@13805 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/admin/org_unit_settings.js

index ae664cf..e9e60a7 100644 (file)
@@ -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());