fix clear hold shelf with 25 or more holds
authorJason Etheridge <jason@esilibrary.com>
Tue, 26 Jun 2012 15:39:48 +0000 (11:39 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 2 Jul 2013 13:22:27 +0000 (09:22 -0400)
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 <jason@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/xul/staff_client/server/patron/holds.js

index b8d151a..67ad4a9 100644 (file)
@@ -1903,9 +1903,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: