Let's give messagecatalog a spin in remote xul and make the bad status/batch delete...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Aug 2007 15:37:57 +0000 (15:37 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 10 Aug 2007 15:37:57 +0000 (15:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7658 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
Open-ILS/xul/staff_client/server/cat/copy_buckets.js
Open-ILS/xul/staff_client/server/cat/copy_buckets.xul
Open-ILS/xul/staff_client/server/locale/en-US/cat.properties [new file with mode: 0644]

index aa82a3c..6bf9ddb 100644 (file)
@@ -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) {
index 945d7eb..a3e3f03 100644 (file)
@@ -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(
index f29afff..cb4e801 100644 (file)
@@ -75,6 +75,8 @@
        ]]>
        </script>
 
+       <messagecatalog id="catStrings" src="/server/xul/locale/<!--#echo var='locale' -->/cat.properties"/>
+
        <commandset id="copy_buckets_cmds">
                <command id="sel_clip1" />
                <command id="save_columns1" />
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 (file)
index 0000000..8cba8ad
--- /dev/null
@@ -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