From ecde1b1b907b2bb6ab4041524a41b314f87ec948 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 Signed-off-by: Terran McCanna --- .../app/staff/catalog/record/record.component.html | 2 +- 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 ++++++++++++++++++---- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html index 0630d3b6d8..ab19a9a126 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html @@ -1,6 +1,6 @@ - + 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..89a36f997e 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 [_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