From: phasefx Date: Fri, 4 Aug 2006 05:48:44 +0000 (+0000) Subject: lookup and stash X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=367019c1f5848041747e37bc4e494431ecebfc1a;p=Evergreen.git lookup and stash git-svn-id: svn://svn.open-ils.org/ILS/trunk@5277 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index 70a64cce71..a86d501bfd 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -50,6 +50,26 @@ OpenILS.data.prototype = { } }, + 'lookup' : function(key,value) { + try { + var obj = this; var found; + if (obj.hash[key] && obj.hash[key][value]) return obj.hash[key][value]; + switch(key) { + case 'acpl': + found = obj.network.simple_request('FM_ACPL_RETRIEVE_VIA_ID',[ value ]); + break; + default: return undefined; break; + } + if (typeof found.ilsevent != 'undefined') throw(found); + if (!obj.hash[key]) obj.hash[key] = {}; + obj.hash[key][value] = found; obj.list[key].push( found ); obj.stash('hash','list'); + return found; + } catch(E) { + this.error.sdump('D_ERROR','Error in OpenILS.data.lookup('+key+','+value+'): ' + js2JSON(E) ); + return undefined; + } + }, + '_debug_stash' : function() { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");