From: Jason Etheridge Date: Tue, 26 Jun 2012 15:39:48 +0000 (-0400) Subject: fix clear hold shelf with 25 or more holds X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=53b25a5068884b49657d2fc862a8d9adf322bc96;p=working%2FEvergreen.git fix clear hold shelf with 25 or more holds When there are 25 or more shelf expired holds to be processed, the API call returns an array of objects instead of an object, which the staff client wasn't prepared to accommodate. This fixes that. Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js index 9b15aef53e..75ceaf0b7e 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds.js +++ b/Open-ILS/xul/staff_client/server/patron/holds.js @@ -1873,9 +1873,21 @@ patron.holds.prototype = { ] ); if (typeof robj.ilsevent != 'undefined') { throw(robj); } - if (typeof robj.cache_key == 'undefined') { throw(robj); } - var cache_key = robj.cache_key; + var cache_key; + if (typeof robj.cache_key != 'undefined') { + cache_key = robj.cache_key; + } else { + if (robj.constructor == Array) { + for (var i = 0; i < robj.length; i++) { + if (typeof robj[i].cache_key != 'undefined') { + cache_key = robj[i].cache_key; + } + } + } + } + + if (!cache_key) { throw(robj); } // id's in xulG.holds will prevent the normal retrieval method from // firing. Let's put our affected hold.id's in here: