fetchItemByIdentity now returns null immediately upon null identity
authorgmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 18 Nov 2010 16:28:19 +0000 (16:28 +0000)
committergmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 18 Nov 2010 16:28:19 +0000 (16:28 +0000)
Besides being trivially more efficient, this avoids a situation
where pcrud can sometimes time out when attempting to retrieve
a row by a null PK value.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18784 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/PermaCrud/Store.js

index 19250e0..205cc38 100644 (file)
@@ -613,6 +613,11 @@ if (!dojo._hasResource["openils.PermaCrud.Store"]) {
             //      the *onItem* callback from the *keywordArgs* object.  If we
             //      tried to retrieve the item with pcrud but didn't get an item
             //      back, issue the *onError* callback.
+           if (keywordArgs.identity == undefined)
+                return null; // Identity API spec unclear whether error callback
+                             // would need to be run, so we won't.  Matters
+                             // because in some cases pcrud times out when attempting
+                             // to retrieve by a null PK value
             var callback_scope = keywordArgs.scope || dojo.global;
             var test_item = this._stored_items[keywordArgs.identity];