volume transfer, waiting for middle layer
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 26 Jul 2006 12:22:58 +0000 (12:22 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 26 Jul 2006 12:22:58 +0000 (12:22 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5109 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/cat/copy_browser.js
Open-ILS/xul/staff_client/server/cat/copy_browser.xul

index 9c29e42..982ccc9 100644 (file)
@@ -24,6 +24,7 @@ const api = {
        'FM_ACN_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.retrieve' },
        'FM_ACN_TREE_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.fleshed.batch.update' },
        'FM_ACN_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy_tree.retrieve' },
+       'FM_ACN_TRANSFER' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.batch.transfer' },
        'FM_ACP_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.retrieve' },
        'FM_ACP_RETRIEVE_VIA_BARCODE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.find_by_barcode' },
        'FM_ACP_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.batch.retrieve' },
index e8d9ced..8bcc6fd 100644 (file)
@@ -513,6 +513,37 @@ cat.copy_browser.prototype = {
 
                                                        }
                                                ],
+                                               'cmd_mark_library' : [
+                                                       ['command'],
+                                                       function() {
+                                                               try {
+                                                                       var list = util.functional.filter_list(
+                                                                               obj.sel_list,
+                                                                               function (o) {
+                                                                                       return o.split(/_/)[0] == 'aou';
+                                                                               }
+                                                                       );
+
+                                                                       list = util.functional.map_list(
+                                                                               list,
+                                                                               function (o) {
+                                                                                       return o.split(/_/)[1];
+                                                                               }
+                                                                       );
+
+                                                                       if (list.length == 1) {
+                                                                               obj.data.marked_library = { 'lib' : list[0], 'docid' : obj.docid };
+                                                                               obj.data.stash('marked_library');
+                                                                               alert('Library + Record marked as Volume Transfer Destination');
+                                                                       } else {
+                                                                               obj.error.yns_alert('Choose just one Library to mark as Volume Transfer Destination','Limit Selection','OK',null,null,'Check here to confirm this dialog');
+                                                                       }
+                                                               } catch(E) {
+                                                                       obj.error.standard_unexpected_error_alert('copy browser -> mark library',E);
+                                                               }
+                                                       }
+                                               ],
+
                                                'cmd_mark_volume' : [
                                                        ['command'],
                                                        function() {
@@ -549,6 +580,74 @@ cat.copy_browser.prototype = {
                                                                obj.refresh_list();
                                                        }
                                                ],
+                                               'cmd_transfer_volume' : [
+                                                       ['command'],
+                                                       function() {
+                                                               try {
+                                                                       obj.data.stash_retrieve();
+                                                                       if (!obj.data.marked_library) {
+                                                                               alert('Please mark a library as the destination from within the copy browser and then try this again.');
+                                                                               return;
+                                                                       }
+                                                                       
+                                                                       JSAN.use('util.functional');
+
+                                                                       var list = util.functional.filter_list(
+                                                                               obj.sel_list,
+                                                                               function (o) {
+                                                                                       return o.split(/_/)[0] == 'acn';
+                                                                               }
+                                                                       );
+
+                                                                       list = util.functional.map_list(
+                                                                               list,
+                                                                               function (o) {
+                                                                                       return o.split(/_/)[1];
+                                                                               }
+                                                                       );
+
+                                                                       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+                                                                       var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto">';
+                                                                       xml += '<description>Transfer volumes ';
+
+                                                                       xml += util.functional.map_list(
+                                                                               list,
+                                                                               function (o) {
+                                                                                       return obj.map_acn[ 'acn_' + o ].label();
+                                                                               }
+                                                                       ).join(", ");
+
+                                                                       xml += ' to library ' + obj.data.hash.aou[ obj.data.marked_library.lib ].shortname();
+                                                                       xml += ' on the following record?</description>';
+                                                                       xml += '<hbox><button label="Transfer" name="fancy_submit"/>';
+                                                                       xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
+                                                                       xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + obj.data.marked_library.docid + '"/>';
+                                                                       xml += '</vbox>';
+                                                                       obj.data.temp_transfer = xml; obj.data.stash('temp_transfer');
+                                                                       window.open(
+                                                                               urls.XUL_FANCY_PROMPT
+                                                                               + '?xml_in_stash=temp_transfer'
+                                                                               + '&title=' + window.escape('Volume Transfer'),
+                                                                               'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
+                                                                       );
+                                                                       JSAN.use('OpenILS.data');
+                                                                       var data = new OpenILS.data(); data.init({'via':'stash'});
+                                                                       if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
+
+                                                                       var robj = obj.network.simple_request('FM_ACN_TRANSFER', [ ses(), { 'docid' : obj.data.marked_library.docid, 'lib' : obj.data.marked_library.lib, 'volumes' : list } ]);
+
+                                                                       if (typeof robj.ilsevent != 'undefined') {
+                                                                               throw(robj);
+                                                                       } else {
+                                                                               alert('Volumes transferred.');
+                                                                       }
+
+                                                               } catch(E) {
+                                                                       obj.error.standard_unexpected_error_alert('Volumes not likely transferred.',E);
+                                                               }
+                                                               obj.refresh_list();
+                                                       }
+                                               ],
                                        }
                                }
                        );
@@ -1124,17 +1223,21 @@ cat.copy_browser.prototype = {
                        obj.controller.view.cmd_delete_items.setAttribute('disabled','true');
                        obj.controller.view.cmd_print_spine_labels.setAttribute('disabled','true');
                        obj.controller.view.cmd_add_volumes.setAttribute('disabled','true');
+                       obj.controller.view.cmd_mark_library.setAttribute('disabled','true');
                        obj.controller.view.cmd_edit_volumes.setAttribute('disabled','true');
                        obj.controller.view.cmd_delete_volumes.setAttribute('disabled','true');
                        obj.controller.view.cmd_mark_volume.setAttribute('disabled','true');
+                       obj.controller.view.cmd_transfer_volume.setAttribute('disabled','true');
                        if (found_aou) {
                                obj.controller.view.cmd_add_volumes.setAttribute('disabled','false');
+                               obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
                        }
                        if (found_acn) {
                                obj.controller.view.cmd_edit_volumes.setAttribute('disabled','false');
                                obj.controller.view.cmd_delete_volumes.setAttribute('disabled','false');
                                obj.controller.view.cmd_mark_volume.setAttribute('disabled','false');
                                obj.controller.view.cmd_add_items.setAttribute('disabled','false');
+                               obj.controller.view.cmd_transfer_volume.setAttribute('disabled','false');
                        }
                        if (found_acp) {
                                obj.controller.view.cmd_add_items_to_buckets.setAttribute('disabled','false');
index cba3c68..6b6c18e 100644 (file)
@@ -78,6 +78,8 @@
                <command id="cmd_edit_volumes"/>
                <command id="cmd_delete_volumes"/>
                <command id="cmd_mark_volume"/>
+               <command id="cmd_mark_library"/>
+               <command id="cmd_transfer_volume"/>
                <command id="cmd_refresh_list"/>
        </commandset>
 
                        <menuitem command="cmd_print_spine_labels" label="Print Item Spine Labels" accesskey="P"/>
                        <menuseparator/>
                        <menuitem command="cmd_add_volumes" label="Add Volumes" accesskey="V"/>
+                       <menuitem command="cmd_mark_library" label="Mark Library as Volume Transfer Destination" accesskey="M"/>
+                       <menuseparator/>
                        <menuitem command="cmd_edit_volumes" label="Edit Volumes" accesskey=""/>
                        <menuitem command="cmd_delete_volumes" label="Delete Volumes" accesskey=""/>
                        <menuitem command="cmd_mark_volume" label="Mark Volume as Item Transfer Destination" accesskey="M"/>
+                       <menuitem command="cmd_transfer_volume" label="Transfer Volume to Previously Marked Library" accesskey=""/>
                        <menuseparator/>
                        <menuitem command="cmd_refresh_list" label="Refresh Listing" accesskey="R"/>
                </popup>
                                                        <menuitem command="cmd_print_spine_labels" label="Print Item Spine Labels" accesskey="P"/>
                                                        <menuseparator/>
                                                        <menuitem command="cmd_add_volumes" label="Add Volumes" accesskey="V"/>
+                                                       <menuitem command="cmd_mark_library" label="Mark Library as Volume Transfer Destination" accesskey="M"/>
+                                                       <menuseparator/>
                                                        <menuitem command="cmd_edit_volumes" label="Edit Volumes" accesskey=""/>
                                                        <menuitem command="cmd_delete_volumes" label="Delete Volumes" accesskey=""/>
                                                        <menuitem command="cmd_mark_volume" label="Mark Volume as Item Transfer Destination" accesskey="M"/>
+                                                       <menuitem command="cmd_transfer_volume" label="Transfer Volume to Previously Marked Library" accesskey=""/>
                                                        <menuseparator/>
                                                        <menuitem command="cmd_refresh_list" label="Refresh Listing" accesskey="R"/>
                                        </menupopup>