From 01fafde94db919b37673fb1db14dda018f0fb3ba Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 15 Aug 2007 21:54:28 +0000 Subject: [PATCH] backport filepicker bug fix, and for Item Status interface, handle VOLUME_LABEL_EXISTS event on callnumber edit git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@7686 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/chrome/content/main/main.js | 3 ++- Open-ILS/xul/staff_client/server/cat/copy_browser.js | 12 ++++++++++-- Open-ILS/xul/staff_client/server/cat/copy_editor.js | 3 ++- Open-ILS/xul/staff_client/server/circ/copy_status.js | 15 ++++++++++++--- .../server/circ/print_list_template_editor.js | 3 ++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/main/main.js b/Open-ILS/xul/staff_client/chrome/content/main/main.js index 384b86323a..cd9916baab 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/main.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/main.js @@ -34,7 +34,8 @@ function pick_file(mode) { mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave ); fp.appendFilters( nsIFilePicker.filterAll ); - if ( fp.show( ) == nsIFilePicker.returnOK && fp.file ) { + var fp_result = fp.show(); + if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) { return fp.file; } else { return null; diff --git a/Open-ILS/xul/staff_client/server/cat/copy_browser.js b/Open-ILS/xul/staff_client/server/cat/copy_browser.js index d3376ed94b..f4b86ea2f0 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.js @@ -572,8 +572,16 @@ cat.copy_browser.prototype = { api.FM_ACN_TREE_UPDATE.method, [ ses(), volumes, true ] ); - if (typeof r.ilsevent != 'undefined') throw(r); - alert('Volumes modified.'); + if (typeof r.ilsevent != 'undefined') { + switch(r.ilsevent) { + case 1705 /* VOLUME_LABEL_EXISTS */ : + alert("Edit failed: You tried to change a volume's callnumber to one that is already in use for the given library. You should transfer the items to the desired callnumber instead."); + break; + default: throw(r); + } + } else { + alert('Volumes modified.'); + } } catch(E) { obj.error.standard_unexpected_error_alert('volume update error: ',E); } 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 f81fc2b58a..8963d04e4f 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -188,7 +188,8 @@ function pick_file(mode) { mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave ); fp.appendFilters( nsIFilePicker.filterAll ); - if ( fp.show( ) == nsIFilePicker.returnOK && fp.file ) { + var fp_result = fp.show(); + if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) { return fp.file; } else { return null; diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.js b/Open-ILS/xul/staff_client/server/circ/copy_status.js index e2d0ccabbd..b08c9f076e 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status.js +++ b/Open-ILS/xul/staff_client/server/circ/copy_status.js @@ -298,7 +298,8 @@ circ.copy_status.prototype = { mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave ); fp.appendFilters( nsIFilePicker.filterAll ); - if ( fp.show( ) == nsIFilePicker.returnOK && fp.file ) { + var fp_result = fp.show(); + if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) { return fp.file; } else { return null; @@ -720,8 +721,16 @@ circ.copy_status.prototype = { api.FM_ACN_TREE_UPDATE.method, [ ses(), volumes, false ] ); - if (typeof r.ilsevent != 'undefined') throw(r); - alert('Volumes modified.'); + if (typeof r.ilsevent != 'undefined') { + switch(r.ilsevent) { + case 1705 /* VOLUME_LABEL_EXISTS */ : + alert("Edit failed: You tried to change a volume's callnumber to one that is already in use for the given library. You should transfer the items to the desired callnumber instead."); + break; + default: throw(r); + } + } else { + alert('Volumes modified.'); + } } catch(E) { obj.error.standard_unexpected_error_alert('volume update error: ',E); } diff --git a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js index 3ca8ce11b9..632f6092d6 100644 --- a/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js +++ b/Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js @@ -366,7 +366,8 @@ circ.print_list_template_editor.prototype = { mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave ); fp.appendFilters( nsIFilePicker.filterAll ); - if ( fp.show( ) == nsIFilePicker.returnOK && fp.file ) { + var fp_result = fp.show(); + if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) { return fp.file; } else { return null; -- 2.11.0