From 5542ce57ea48c9be8479f6cab66abc41cfa32aaf Mon Sep 17 00:00:00 2001 From: Jessica Woolford Date: Wed, 17 Mar 2021 16:31:30 -0400 Subject: [PATCH] LP1786971 z39.50 using TCN instead of ID This patch switches the target to overlays to the bib ID instead of the TCN. This allows overlays to work for sites where TCN and bib ID are not the same. Signed-off-by: Jessica Woolford LP1786971 Z39.50 TCN-Bib ID display and wording This adds the TCN to the Z39.50 interface when a record is marked for overlay and the TCN does not match the Bib ID. Signed-off-by: Terran McCanna Signed-off-by: Mary Llewellyn Signed-off-by: Bill Erickson --- Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 | 7 ++++-- .../src/templates/staff/cat/z3950/t_overlay.tt2 | 2 +- Open-ILS/web/js/ui/default/staff/cat/z3950/app.js | 26 ++++++++++++++++++---- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 b/Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 index 9d7ef21718..786e026ec1 100644 --- a/Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 +++ b/Open-ILS/src/templates/staff/cat/z3950/t_list.tt2 @@ -73,7 +73,10 @@ [% l('Total hits: [_1]', '{{total_hits}}') %]
- [% l('Record with TCN [_1] marked for overlay.', '{{local_overlay_target}}') %] + [% l('Record [_1] marked for overlay', '{{local_overlay_target}}') %] + + ([% l('TCN [_1]', '{{local_overlay_target_tcn}}') %]) +
[% l('No record marked for overlay.') %] @@ -129,6 +132,6 @@ - + diff --git a/Open-ILS/src/templates/staff/cat/z3950/t_overlay.tt2 b/Open-ILS/src/templates/staff/cat/z3950/t_overlay.tt2 index e471e20ac8..b892bf11fb 100644 --- a/Open-ILS/src/templates/staff/cat/z3950/t_overlay.tt2 +++ b/Open-ILS/src/templates/staff/cat/z3950/t_overlay.tt2 @@ -16,7 +16,7 @@
-
[% l('Replace TCN [_1] ...', '{{overlay_target.id}}') %]
+
[% l('Replace record [_1] ', '{{overlay_target.id}}') %]...
diff --git a/Open-ILS/web/js/ui/default/staff/cat/z3950/app.js b/Open-ILS/web/js/ui/default/staff/cat/z3950/app.js index e2c363c4c3..6a4c250890 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/z3950/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/z3950/app.js @@ -116,6 +116,7 @@ function($scope , $q , $location , $timeout , $window, egCore , egGridDataProvi // case, result.count is not supplied. $scope.total_hits += (result.count || 0); for (var i in result.records) { + result.records[i].mvr['bibid'] = result.records[i].bibid; result.records[i].mvr['service'] = result.service; result.records[i].mvr['index'] = resultIndex++; result.records[i].mvr['marcxml'] = result.records[i].marcxml; @@ -185,7 +186,7 @@ function($scope , $q , $location , $timeout , $window, egCore , egGridDataProvi $scope.showInCatalog = function() { var items = $scope.gridControls.selectedItems(); // relying on cant_showInCatalog to protect us - var url = '/eg2/staff/catalog/record/' + items[0].tcn(); + var url = '/eg2/staff/catalog/record/' + items[0]['bibid']; $timeout(function() { $window.open(url, '_blank') }); }; $scope.cant_showInCatalog = function() { @@ -196,22 +197,39 @@ function($scope , $q , $location , $timeout , $window, egCore , egGridDataProvi }; $scope.local_overlay_target = egCore.hatch.getLocalItem('eg.cat.marked_overlay_record') || 0; + if($scope.local_overlay_target) { + var currTarget = $scope.local_overlay_target; + get_tcn(currTarget); + } $scope.mark_as_overlay_target = function() { var items = $scope.gridControls.selectedItems(); - if ($scope.local_overlay_target == items[0].tcn()) { + if ($scope.local_overlay_target == items[0]['bibid']) { $scope.local_overlay_target = 0; + $scope.local_overlay_target_tcn = 0; } else { - $scope.local_overlay_target = items[0].tcn(); + $scope.local_overlay_target = items[0]['bibid']; + var currTarget = items[0] ['bibid']; + get_tcn(currTarget); } egCore.hatch.setLocalItem('eg.cat.marked_overlay_record',$scope.local_overlay_target); } + + function get_tcn(currTarget) { + egCore.pcrud.retrieve('bre', currTarget, { + select: {bre: ['tcn_value']} + }).then(function(rec) { + $scope.local_overlay_target_tcn = rec.tcn_value(); + }); + return; + }; + $scope.cant_overlay = function() { if (!$scope.local_overlay_target) return true; var items = $scope.gridControls.selectedItems(); if (items.length != 1) return true; if ( items[0]['service'] == 'native-evergreen-catalog' && - items[0].tcn() == $scope.local_overlay_target + items[0]['bibid'] == $scope.local_overlay_target ) return true; return false; } -- 2.11.0