using batch version of perm org fetcher. added onload callback option
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Aug 2008 19:41:38 +0000 (19:41 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Aug 2008 19:41:38 +0000 (19:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10453 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 35af359..748f3bc 100644 (file)
@@ -59,15 +59,19 @@ function fetchHighestPermOrgs( session, userId, perms ) {
        return orgs;
 }
 
-function fetchHighestWorkPermOrgs(session, userId, perms) {
-    for(var i = 0; i < perms.length; i++) {
-        var perm = perms[i];
-        var req = new RemoteRequest(
-            'open-ils.actor',
-            'open-ils.actor.user.work_perm.highest_org_set',
-            session, perm);
+function fetchHighestWorkPermOrgs(session, userId, perms, onload) {
+    var req = new RemoteRequest(
+        'open-ils.actor',
+        'open-ils.actor.user.work_perm.highest_org_set.batch',
+        session, perms);
+    if(onload) {
+        req.setCompleteCallback(function(r){
+            onload(OILS_WORK_PERMS = r.getResultObject());
+        });
+        req.send()
+    } else {
         req.send(true);
-        OILS_WORK_PERMS[perm] = req.getResultObject();
+        return OILS_WORK_PERMS = req.getResultObject();
     }
 }