LP1786971 z39.50 using TCN instead of ID
authorJessica Woolford <jwoolford@biblio.org>
Wed, 17 Mar 2021 20:31:30 +0000 (16:31 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 20 Sep 2021 15:28:27 +0000 (11:28 -0400)
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 <jwoolford@biblio.org>
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 <tmccanna@georgialibraries.org>
Signed-off-by: Mary Llewellyn <mllewell@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/cat/z3950/t_list.tt2
Open-ILS/src/templates/staff/cat/z3950/t_overlay.tt2
Open-ILS/web/js/ui/default/staff/cat/z3950/app.js

index 9d7ef21..786e026 100644 (file)
         [% l('Total hits: [_1]', '{{total_hits}}') %]
     </div>
     <div class="col-md-6 text-right" ng-if="local_overlay_target">
-        [% l('Record with TCN [_1] marked for overlay.', '{{local_overlay_target}}') %]
+        [% l('Record [_1] marked for overlay', '{{local_overlay_target}}') %]
+        <span ng-if="local_overlay_target != local_overlay_target_tcn">
+            ([% l('TCN [_1]', '{{local_overlay_target_tcn}}') %])
+        </span>
     </div>
     <div class="col-md-6 text-right" ng-if="!local_overlay_target">
         [% l('No record marked for overlay.') %]
     <eg-grid-field label="[% l('Publication Date') %]" path="pubdate" visible></eg-grid-field>
     <eg-grid-field label="[% l('Publisher') %]" path="publisher" visible></eg-grid-field>
     <eg-grid-field label="[% l('Service') %]" path="service" visible></eg-grid-field>
-    <eg-grid-field label="[% l('TCN') %]" path="tcn" visible></eg-grid-field>
+    <eg-grid-field label="[% l('Record') %]" path="tcn" visible></eg-grid-field>
     <eg-grid-field path="*" hidden></eg-grid-field>
 </eg-grid>
index e471e20..b892bf1 100644 (file)
@@ -16,7 +16,7 @@
       </div>
       <div class="row">
           <div class="col-xs-6">
-              <div>[% l('Replace TCN [_1] ...', '{{overlay_target.id}}') %]</div>
+              <div>[% l('Replace record [_1] ', '{{overlay_target.id}}') %]...</div>
               <eg-record-breaker marc-xml="overlay_target.orig_marc_xml"></eg-record-breaker>
           </div>
           <div class="col-xs-6">
index e2c363c..6a4c250 100644 (file)
@@ -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;
     }