From: Bill Erickson Date: Fri, 17 Mar 2017 19:36:35 +0000 (-0400) Subject: LP#1619703 Transfer ACQ lineitem browser UI X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=31fdfa4dfab2a7e62cfa629a3f153a3d8f4f1264;p=working%2FEvergreen.git LP#1619703 Transfer ACQ lineitem browser UI Supports marking a bib record as a lineitem transfer destination in the web staff bib record detail interface. Found in the 'Mark For:' selector menu. Supports inititiating the transfer from the embedded ACQ purchase order interface. ACQ action is found in the Actions selector for each lineitem. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index 14639b3fdf..b76c719508 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -4242,12 +4242,10 @@ sub transfer_lineitem { where => {lineitem => $li_id} }); - # TODO: Transfer monograph parts. + if (@$acp_ids) { - my $copies = $e->search_asset_copy( - {id => [map {$_->{eg_copy_id}} @$acp_ids]}); - - if (@$copies) { + my $copies = $e->search_asset_copy( + {id => [map {$_->{eg_copy_id}} @$acp_ids]}); # Group copies into call number batches so each call number can # be assessed and processed once. diff --git a/Open-ILS/src/templates/acq/common/li_table.tt2 b/Open-ILS/src/templates/acq/common/li_table.tt2 index 4d4773dc07..e3c551b76a 100644 --- a/Open-ILS/src/templates/acq/common/li_table.tt2 +++ b/Open-ILS/src/templates/acq/common/li_table.tt2 @@ -209,6 +209,7 @@ + diff --git a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 index c2df10ec4a..1398e5c2d7 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 @@ -44,6 +44,8 @@ "[% l('Conjoined Item Target set') %]"; s.MARK_VOL_TARGET = "[% l('Volume Transfer Target set') %]"; + s.MARK_LI_TARGET = + "[% l('Lineitem Transfer Target set') %]"; s.MARK_ITEM_TARGET = "[% l('Item Transfer Target set') %]"; s.MARK_OVERLAY_TARGET = diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 index 0848890f8a..06a0d33eb2 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_catalog.tt2 @@ -58,6 +58,15 @@
  • + + [% l('Lineitem Transfer') %] + + [% l('(Currently [_1])', '{{current_litransfer_target}}') %] + + +
  • + +
  • [% l('Reset Record Marks') %]
  • diff --git a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js index 0947f21e95..ffb60846f1 100644 --- a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js +++ b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js @@ -113,5 +113,7 @@ "ACTIVATE_BIBS_PROCESSED" : "Bib Records Merged/Imported: ${0}", "ACTIVATE_LID_PROCESSED" : "ACQ Copies Processed: ${0}", "ACTIVATE_DEBITS_ACCRUED_PROCESSED" : "Debits Encumbered: ${0}", - "ACTIVATE_COPIES_PROCESSED" : "Real Copies Processed: ${0}" + "ACTIVATE_COPIES_PROCESSED" : "Real Copies Processed: ${0}", + "LI_TRANSFER_NO_TARGET" : "No transfer destination selected", + "LI_TRANSFER_CONFIRM" : "Transfer lineitem #${0} to bib record ID ${1}?\n\nTitle: ${2}" } diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 44e7b974c5..526a119275 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -661,6 +661,46 @@ function AcqLiTable() { ); } + this.transferLiToBib = function(li_id) { + var self = this; + var target = openils.XUL.localStorage().getItem( + 'eg.cat.marked_lineitem_transfer_record'); + + if (!target) { + alert(localeStrings.LI_TRANSFER_NO_TARGET); + return; + } + + // Data stored by the browser client are JSON-encoded. + target = JSON2js(target); + + self.pcrud.retrieve('rmsr', target, { + async : true, + oncomplete : function(r) { + var rec = openils.Util.readResponse(r); + + if (!confirm(dojo.string.substitute( + localeStrings.LI_TRANSFER_CONFIRM, + [li_id, target, rec.title()]))) return; + + console.debug('Transfering lineitem ' + + li_id + ' to bib ' + target); + + fieldmapper.standardRequest( + ['open-ils.acq', + 'open-ils.acq.lineitem.transfer_to_bib'], + { params : [self.authtoken, li_id, target], + oncomplete : function(r) { + var li = openils.Util.readResponse(r); + // no events fired, reload the page. + location.href = location.href; + } + } + ); + } + }); + } + // fetch an updated copy of the lineitem // and add it back to the lineitem table this.refreshLineitem = function(li, focus) { @@ -1238,6 +1278,10 @@ function AcqLiTable() { case 'action_view_history': location.href = oilsBasePath + '/acq/lineitem/history/' + li.id(); break; + case 'action_transfer_to_bib': + self.transferLiToBib(li.id()); + nodeByName("action_none", row).selected = true; + break; } }; var actUpdateBarcodes = nodeByName("action_update_barcodes", row); diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index e71f74f6b0..461985596a 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -364,6 +364,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e $scope.current_overlay_target = egCore.hatch.getLocalItem('eg.cat.marked_overlay_record'); $scope.current_voltransfer_target = egCore.hatch.getLocalItem('eg.cat.marked_volume_transfer_record'); $scope.current_conjoined_target = egCore.hatch.getLocalItem('eg.cat.marked_conjoined_record'); + $scope.current_litransfer_target = egCore.hatch.getLocalItem('eg.cat.marked_lineitem_transfer_record'); $scope.markConjoined = function () { $scope.current_conjoined_target = $scope.record_id; @@ -377,6 +378,16 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e egCore.hatch.setLocalItem('eg.cat.marked_volume_transfer_record',$scope.record_id); }; + $scope.markLiTransfer = function () { + ngToast.create(egCore.strings.MARK_LI_TARGET); + $scope.current_litransfer_target = $scope.record_id; + // Lineitem transfer requires target data to live in localStorage + // and not Hatch, hence setLocalItem(). The legacy ACQ interfaces + // don't have access to Hatch. + egCore.hatch.setLocalItem( + 'eg.cat.marked_lineitem_transfer_record', $scope.record_id); + }; + $scope.markOverlay = function () { $scope.current_overlay_target = $scope.record_id; egCore.hatch.setLocalItem('eg.cat.marked_overlay_record',$scope.record_id); @@ -388,10 +399,12 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e $scope.current_voltransfer_target = null; $scope.current_conjoined_target = null; $scope.current_hold_transfer_dest = null; + $scope.current_litransfer_target = null; egCore.hatch.removeLocalItem('eg.cat.marked_volume_transfer_record'); egCore.hatch.removeLocalItem('eg.cat.marked_conjoined_record'); egCore.hatch.removeLocalItem('eg.cat.marked_overlay_record'); egCore.hatch.removeLocalItem('eg.circ.hold.title_transfer_target'); + egCore.hatch.removeLocalItem('eg.cat.marked_lineitem_transfer_record'); } $scope.stop_unload = false;