[open-ils-commits] [GIT] Evergreen ILS branch rel_3_0 updated. 1f57c68b7dafb2c0d88ed2573b5499563b67818c

Evergreen Git git at git.evergreen-ils.org
Wed Jul 11 11:11:59 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_0 has been updated
       via  1f57c68b7dafb2c0d88ed2573b5499563b67818c (commit)
      from  567b33f0d6410202be1bdf00d1999f88e8429843 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1f57c68b7dafb2c0d88ed2573b5499563b67818c
Author: Jeff Davis <jdavis at sitka.bclibraries.ca>
Date:   Tue Mar 6 10:46:49 2018 -0800

    LP#1738499: barcode completion for copy buckets
    
    Signed-off-by: Jeff Davis <jdavis at sitka.bclibraries.ca>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js b/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js
index 151fe91..9d6a8d7 100644
--- a/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js
+++ b/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js
@@ -390,6 +390,72 @@ function($scope,  $routeParams,  bucketSvc , egGridDataProvider,   egCore) {
         }
     }
 
+    $scope.handle_barcode_completion = function(barcode) {
+        return egCore.net.request(
+            'open-ils.actor',
+            'open-ils.actor.get_barcodes',
+            egCore.auth.token(), egCore.auth.user().ws_ou(), 
+            'asset', barcode)
+
+        .then(function(resp) {
+            // TODO: handle event during barcode lookup
+            if (evt = egCore.evt.parse(resp)) {
+                console.error(evt.toString());
+                return $q.reject();
+            }
+
+            // no matching barcodes: return the barcode as entered
+            // by the user (so that, e.g., checkout can fall back to
+            // precat/noncat handling)
+            if (!resp || !resp[0]) {
+                return barcode;
+            }
+
+            // exactly one matching barcode: return it
+            if (resp.length == 1) {
+                return resp[0].barcode;
+            }
+
+            // multiple matching barcodes: let the user pick one 
+            console.debug('multiple matching barcodes');
+            var matches = [];
+            var promises = [];
+            var final_barcode;
+            angular.forEach(resp, function(cp) {
+                promises.push(
+                    egCore.net.request(
+                        'open-ils.circ',
+                        'open-ils.circ.copy_details.retrieve',
+                        egCore.auth.token(), cp.id
+                    ).then(function(r) {
+                        matches.push({
+                            barcode: r.copy.barcode(),
+                            title: r.mvr.title(),
+                            org_name: egCore.org.get(r.copy.circ_lib()).name(),
+                            org_shortname: egCore.org.get(r.copy.circ_lib()).shortname()
+                        });
+                    })
+                );
+            });
+            return $q.all(promises)
+            .then(function() {
+                return $uibModal.open({
+                    templateUrl: './circ/share/t_barcode_choice_dialog',
+                    controller:
+                        ['$scope', '$uibModalInstance',
+                        function($scope, $uibModalInstance) {
+                        $scope.matches = matches;
+                        $scope.ok = function(barcode) {
+                            $uibModalInstance.close();
+                            final_barcode = barcode;
+                        }
+                        $scope.cancel = function() {$uibModalInstance.dismiss()}
+                    }],
+                }).result.then(function() { return final_barcode });
+            })
+        });
+    }
+
     $scope.search = function() {
         bucketSvc.barcodeRecords = [];
         $scope.context.itemNotFound = false;
@@ -397,19 +463,22 @@ function($scope,  $routeParams,  bucketSvc , egGridDataProvider,   egCore) {
         // clear selection so re-selecting can have an effect
         $scope.context.selectPendingBC = false;
 
-        egCore.pcrud.search(
-            'acp',
-            {barcode : bucketSvc.barcodeString, deleted : 'f'},
-            {}
-        ).then(function(copy) {
-            if (copy) {
-                bucketSvc.pendingList.push(copy.id());
-                $scope.gridControls.setQuery({id : bucketSvc.pendingList});
-                bucketSvc.barcodeString = ''; // clear form on valid copy
-            } else {
-                $scope.context.itemNotFound = true;
-                $scope.context.selectPendingBC = true;
-            }
+        return $scope.handle_barcode_completion(bucketSvc.barcodeString)
+        .then(function(actual_barcode) {
+            egCore.pcrud.search(
+                'acp',
+                {barcode : actual_barcode, deleted : 'f'},
+                {}
+            ).then(function(copy) {
+                if (copy) {
+                    bucketSvc.pendingList.push(copy.id());
+                    $scope.gridControls.setQuery({id : bucketSvc.pendingList});
+                    bucketSvc.barcodeString = ''; // clear form on valid copy
+                } else {
+                    $scope.context.itemNotFound = true;
+                    $scope.context.selectPendingBC = true;
+                }
+            });
         });
     }
 

-----------------------------------------------------------------------

Summary of changes:
 .../web/js/ui/default/staff/cat/bucket/copy/app.js |   95 +++++++++++++++++---
 1 files changed, 82 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list