From 30a1bd485688868c5d8175a3440cf2e5788e646a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 4 Feb 2019 17:10:10 -0500 Subject: [PATCH] JBAS-2832 Trim copy editor shelf locations Only show copy locations for workstation and parent org units in the browser client copy edit UI, regardless of which orgs the user has access to edit. KCLS maintains a duplicate array of copy location for each org and performs nightly jobs to ensure the location match the copy's circ lib. Becuase of this, only a single list of locations need be displayed. If a copy links to a location outside of the scope of here + parent org units, add its copy location to the list as well, suffixed by owning lib to differentiate. Signed-off-by: Bill Erickson --- .../templates/staff/cat/volcopy/t_attr_edit.tt2 | 2 +- .../web/js/ui/default/staff/cat/volcopy/app.js | 53 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 index 7e58ebb731..c8fe573c9a 100644 --- a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 @@ -195,7 +195,7 @@
diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index 22a41eac02..76dfb08475 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -1897,6 +1897,59 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , $scope.location_list = []; createSimpleUpdateWatcher('location'); + // KCLS JBAS-2184 + // Limit copy location selector to locations at the current + // workstation (and parent orgs) regardless of the copy's + // circ/owning lib. Nightly CRON job applies the correct + // location (matching by name) to any copies whose circ_lib + // does not match the location's owning lib. + $scope.selectableLocations = function() { + var orgs = egCore.org.fullPath(egCore.auth.user().ws_ou(), true) + .map(function(o) { return Number(o); }); + + var locs = $scope.location_list.filter(function(loc) { + return orgs.indexOf(Number(loc.owning_lib().id())) >= 0; + }); + + // See if the current working location points to a copy location + // that is outside of the set of local copy locations. + if ($scope.working && $scope.working.location) { + var curLoc = Number($scope.working.location); + + var exists = locs.filter( + function(l) {return Number(l.id()) === curLoc})[0]; + + if (!exists) { + // The current working location points to a remote copy + // location, add the remote copy location to the selector + // so we can accurately represent the current copy location + // value for the copy. + + var remoteLoc = $scope.location_list.filter( + function(l) {return Number(l.id()) === curLoc})[0]; + + if (remoteLoc) { + if (!remoteLoc.name().match(/\)$/)) { // boo hack + // When adding a remote copy location back to the + // list, append the location name with the owning + // library to differentiate it from the set of + // local copy locations. This helps avoid + // confusing duplicates. + remoteLoc.name(remoteLoc.name() + + ' (' + remoteLoc.owning_lib().shortname() + ')'); + } + locs.push(remoteLoc); + locs.sort(function(a, b) { + // Ensure the new copy location is sorted into place + return a.name().toUpperCase() < b.name().toUpperCase() ? -1 : 1 + }); + } + } + } + + return locs; + } + $scope.status_list = []; itemSvc.get_magic_statuses().then(function(list){ $scope.magic_status_list = list; -- 2.11.0