From caf6322c13c8a101123e8a83157ba377e795e950 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 12 Sep 2013 12:02:15 -0400 Subject: [PATCH] LP1093856 fix Fast Item Add with Z39.50 import The first time I tried this fix I ran afoul of https://bugs.launchpad.net/evergreen/+bug/787561 But a second attempt worked. So I didn't kill two birds with one stone, but this should take care of 1093856. Signed-off-by: Jason Etheridge Signed-off-by: Mike Rylander --- Open-ILS/xul/staff_client/server/cat/marcedit.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 7694d44fd1..eee677e215 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -991,6 +991,7 @@ function fastItemAdd_attempt(doc_id) { if (!document.getElementById('fastItemAdd_barcode').value) { return; } window.xulG.fast_add_item( doc_id, document.getElementById('fastItemAdd_callnumber').value, document.getElementById('fastItemAdd_barcode').value ); document.getElementById('fastItemAdd_barcode').value = ''; + return true; } catch(E) { alert('fastItemAdd_attempt: ' + E); } @@ -998,11 +999,19 @@ function fastItemAdd_attempt(doc_id) { function save_attempt(xml_string) { try { - var result = window.xulG.save.func( xml_string ); + var result = window.xulG.save.func( xml_string ); + // I'd prefer to pass on_complete on through to fast_item_add, + // but with the way these window scopes get destroyed with + // tab replacement, maybe not a good idea + var replace_on_complete = false; if (result) { oils_unlock_page(); - if (result.id) fastItemAdd_attempt(result.id); - if (typeof result.on_complete == 'function') result.on_complete(); + if (result.id) { + replace_on_complete = fastItemAdd_attempt(result.id); + } + if (!replace_on_complete && typeof result.on_complete == 'function') { + result.on_complete(); + } } } catch(E) { alert('save_attempt: ' + E); -- 2.43.2