From: phasefx Date: Fri, 25 Mar 2011 17:30:54 +0000 (+0000) Subject: data.lookup was broken for cases where data.list[key] didn't exist for a given key X-Git-Url: http://git.equinoxoli.org/?p=evergreen-equinox.git;a=commitdiff_plain;h=b83a77ad253e473b3129059ed29b3ec825a48d1a data.lookup was broken for cases where data.list[key] didn't exist for a given key Signed-off-by: Jason Etheridge git-svn-id: svn://svn.open-ils.org/ILS/trunk@19860 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 978be55..6db3c02 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -186,17 +186,20 @@ OpenILS.data.prototype = { break; case 'actsc': found = obj.network.simple_request('FM_ACTSC_RETRIEVE_VIA_PCRUD',[ ses(), { 'id' : { '=' : value } }]); - if (typeof found.ilsevent != 'undefined') throw(found); + if (typeof found.ilsevent != 'undefined') throw(js2JSON(found)); found = found[0]; 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'); + obj.hash[key][value] = found; + if (!obj.list[key]) obj.list[key] = []; + 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) ); + alert('Error in OpenILS.data.lookup('+key+','+value+'): ' + E ); return undefined; } },