From 10a80157f61601383dfc4832afb7bf4fcabe478f Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 13 Jul 2006 22:18:09 +0000 Subject: [PATCH] preventing old copies from showing up in new copy editor. stash needs to be able to create uniquely identified temporary spaces on demand to prevent possible collisions git-svn-id: svn://svn.open-ils.org/ILS/trunk@5000 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/cat/copy_buckets.xul | 4 ++-- Open-ILS/xul/staff_client/server/cat/copy_buckets_quick.xul | 4 ++-- Open-ILS/xul/staff_client/server/cat/copy_editor.js | 2 +- Open-ILS/xul/staff_client/server/cat/util.js | 10 +++++----- Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js | 7 ++++--- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/copy_buckets.xul b/Open-ILS/xul/staff_client/server/cat/copy_buckets.xul index 931f2396c6..c292a55dcb 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_buckets.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_buckets.xul @@ -47,9 +47,9 @@ if (g.cgi.param('copy_ids')) copy_ids = copy_ids.concat( JSON2js( g.cgi.param('copy_ids') ) ); if (typeof window.xuLG == 'object' && typeof window.xulG.copy_ids != 'undefined') copy_ids = copy_ids.concat( window.xulG.copy_ids ); - if (g.data.temp_copy_ids != 'undefined' && g.data.temp_copy_ids != null) { + if (typeof g.data.temp_copy_ids != 'undefined' && g.data.temp_copy_ids != null) { copy_ids = copy_ids.concat( JSON2js( g.data.temp_copy_ids ) ); - g.data.temp_copy_ids = null; g.data.stash('temp_copy_ids'); + g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids'); } JSAN.use('cat.copy_buckets'); g.copy_buckets = new cat.copy_buckets(); diff --git a/Open-ILS/xul/staff_client/server/cat/copy_buckets_quick.xul b/Open-ILS/xul/staff_client/server/cat/copy_buckets_quick.xul index 566a8edcb7..e4a9541a2f 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_buckets_quick.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_buckets_quick.xul @@ -50,9 +50,9 @@ if (g.cgi.param('copy_ids')) g.copy_ids = g.copy_ids.concat( JSON2js( g.cgi.param('copy_ids') ) ); if (typeof window.xuLG == 'object' && typeof window.xulG.copy_ids != 'undefined') g.copy_ids = g.copy_ids.concat( window.xulG.copy_ids ); - if (g.data.temp_copy_ids != 'undefined' && g.data.temp_copy_ids != null) { + if (typeof g.data.temp_copy_ids != 'undefined' && g.data.temp_copy_ids != null) { g.copy_ids = g.copy_ids.concat( JSON2js( g.data.temp_copy_ids ) ); - g.data.temp_copy_ids = null; g.data.stash('temp_copy_ids'); + g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids'); } $('desc').appendChild( document.createTextNode( diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js index 25389f6173..36553c26f7 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -27,7 +27,7 @@ function my_init() { var copy_ids = []; if (g.cgi.param('copy_ids')) copy_ids = JSON2js( g.cgi.param('copy_ids') ); if (window.xulG && window.xulG.copy_ids) copy_ids = copy_ids.concat( window.xulG.copy_ids ); - if (g.data.temp_copy_ids != 'undefined') copy_ids = copy_ids.concat( JSON2js( g.data.temp_copy_ids ) ); + if (typeof g.data.temp_copy_ids != 'undefined' && g.data.temp_copy_ids != null) copy_ids = copy_ids.concat( JSON2js( g.data.temp_copy_ids ) ); if (!copy_ids) copy_ids = []; if (copy_ids.length > 0) g.copies = g.network.request( diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js index 5dfa04f4c6..fcd10485ee 100644 --- a/Open-ILS/xul/staff_client/server/cat/util.js +++ b/Open-ILS/xul/staff_client/server/cat/util.js @@ -90,8 +90,8 @@ cat.util.spawn_copy_editor = function(list,edit) { title += ' Copy Attributes'; JSAN.use('util.window'); var win = new util.window(); - obj.data.temp = ''; - obj.data.stash('temp'); + obj.data.temp_copies = undefined; obj.data.stash('temp_copies'); + obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers'); obj.data.temp_copy_ids = js2JSON(list); obj.data.stash('temp_copy_ids'); var w = win.open( @@ -104,9 +104,9 @@ cat.util.spawn_copy_editor = function(list,edit) { obj.data.stash_retrieve(); if (!obj.data.temp_copies) return; var copies = JSON2js( obj.data.temp_copies ); - obj.data.temp_copies = null; obj.data.stash('temp_copies'); - obj.data.temp_callnumbers = null; obj.data.stash('temp_callnumbers'); - obj.data.temp_copy_ids = null; obj.data.stash('temp_copy_ids'); + obj.data.temp_copies = undefined; obj.data.stash('temp_copies'); + obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers'); + obj.data.temp_copy_ids = undefined; obj.data.stash('temp_copy_ids'); obj.error.sdump('D_CAT','in cat/copy_status, copy editor, copies =\n<<' + copies + '>>'); if (edit=='1' && copies!='' && typeof copies != 'undefined') { try { diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js index c5315c31a4..93cdfa13bd 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js @@ -352,6 +352,7 @@ g.stash_and_close = function() { JSAN.use('util.window'); var win = new util.window(); if (copies.length > 0) { g.data.temp_copies = js2JSON(copies); g.data.stash('temp_copies'); + g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids'); g.data.temp_callnumbers = js2JSON(volume_labels); g.data.stash('temp_callnumbers'); var w = win.open( urls.XUL_COPY_EDITOR @@ -361,10 +362,10 @@ g.stash_and_close = function() { ); /* FIXME -- need to unique the temp space, and not rely on modalness of window */ g.data.stash_retrieve(); - g.data.temp_copy_ids = null; g.data.stash('temp_copy_ids'); copies = JSON2js( g.data.temp_copies ); - g.data.temp_copies = null; g.data.stash('temp_copies'); - g.data.temp_callnumbers = null; g.data.stash('temp_callnumbers'); + g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids'); + g.data.temp_copies = undefined; g.data.stash('temp_copies'); + g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers'); if (!copies) { alert('Items were not created.'); return; -- 2.11.0