From 1c3a11ffced100e97e39ffe6c6931f3e57057538 Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 10 Aug 2007 15:37:57 +0000 Subject: [PATCH] Let's give messagecatalog a spin in remote xul and make the bad status/batch delete error message friendlier in the process... git-svn-id: svn://svn.open-ils.org/ILS/trunk@7658 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../chrome/content/OpenILS/global_util.js | 2 ++ .../xul/staff_client/server/cat/copy_buckets.js | 17 ++++++++++++++++- .../staff_client/server/cat/copy_buckets.xul | 2 ++ .../server/locale/en-US/cat.properties | 2 ++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/xul/staff_client/server/locale/en-US/cat.properties diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js index aa82a3c981..6bf9ddb02f 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -1,3 +1,5 @@ + function $(id) { return document.getElementById(id); } + function ses(a) { JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); switch(a) { diff --git a/Open-ILS/xul/staff_client/server/cat/copy_buckets.js b/Open-ILS/xul/staff_client/server/cat/copy_buckets.js index 945d7ebfa3..a3e3f03383 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_buckets.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_buckets.js @@ -461,7 +461,22 @@ cat.copy_buckets.prototype = { } var robj = obj.network.simple_request('FM_ACP_FLESHED_BATCH_UPDATE',[ ses(), copies, true]); - if (typeof robj.ilsevent != 'undefined') obj.error.standard_unexpected_error_alert('Batch Item Deletion',robj); + if (typeof robj.ilsevent != 'undefined') { + switch(robj.ilsevent) { + case 1227 /* COPY_DELETE_WARNING */ : + var copy; + for (var i = 0; i < copies.length; i++) { if (copies[i].id()==robj.payload) copy = function(a){return a;}(copies[i]); } + /* The copy in question is not in an ideal status for deleting */ + var err = '*** ' + robj.desc + ' ***\n'; + /* The barcode for the item is {1} */ + err += $('catStrings').getFormattedString('cat.barcode_for_item',[ copy.barcode() ]) + '\n'; + /* The whole batch operation failed */ + err += $('catStrings').getString('cat.batch_operation_failed') + '\n'; + alert(err); + break; + default: obj.error.standard_unexpected_error_alert('Batch Item Deletion',robj); + } + } obj.render_pending_copies(); // FIXME -- need a generic refresh for lists setTimeout( 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 f29afffbaa..cb4e801bf4 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_buckets.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_buckets.xul @@ -75,6 +75,8 @@ ]]> + + diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties new file mode 100644 index 0000000000..8cba8ad281 --- /dev/null +++ b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties @@ -0,0 +1,2 @@ +cat.barcode_for_item=The barcode for the item is %1$S +cat.batch_operation_failed=The whole batch operation failed. %1$S -- 2.43.2