LP1813633 TCN search can find deleted records
authorBill Erickson <berickxx@gmail.com>
Tue, 14 May 2019 17:03:35 +0000 (13:03 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 16 May 2019 15:30:24 +0000 (11:30 -0400)
As with the XUL client, when performing a bib record TCN search
(Cataloging -> Retrieve Record By TCN), first look for non-deleted
records with the requested TCN.  When none are found, perform a
secondary search for deleted records with the requested TCN.

To test in concerto:

[1] Navigate to Cataloging -> Retrieve Record By TCN
[2] Search for TCN value "10", which is deleted by default in Concerto.
[3] Confirm the deleted record is loaded.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Garry Collum <gcollum@gmail.com>

Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index 8d3ed24..2988d95 100644 (file)
@@ -181,24 +181,29 @@ function($scope , $routeParams , $location , $q , egCore ) {
 
         .then(function(resp) { // get_barcodes
 
-            if (evt = egCore.evt.parse(resp)) {
-                alert(evt); // FIXME
-                return;
+            if (resp.count) {
+                return $q.when(resp);
+            } else {
+                // Search again including deleted records
+                return egCore.net.request('open-ils.search', 
+                    'open-ils.search.biblio.tcn', args.record_tcn, true);
             }
 
-            if (!resp.count) {
+        }).then(function(resp2) {
+
+            if (!resp2.count) {
                 $scope.recordNotFound = args.record_tcn;
                 $scope.selectMe = true;
                 return;
             }
 
-            if (resp.count > 1) {
+            if (resp2.count > 1) {
                 $scope.moreRecordsFound = args.record_tcn;
                 $scope.selectMe = true;
                 return;
             }
 
-            var record_id = resp.ids[0];
+            var record_id = resp2.ids[0];
             return loadRecord(record_id);
         });
     }