offline: Use the workstation org unit as the default home library; copy barcode to...
authorMike Rylander <mrylander@gmail.com>
Thu, 8 Jun 2017 19:54:01 +0000 (15:54 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 8 Jun 2017 19:54:01 +0000 (15:54 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/web/js/ui/default/staff/offline.js

index bb4b201..1c08568 100644 (file)
@@ -240,6 +240,7 @@ function($routeProvider , $locationProvider , $compileProvider) {
         $scope.bad_barcode = null;
         $scope.focusMe = true;
         $scope.shared = { due_date : null, due_date_offset : '' };
+        $scope.workstation_obj = null;
         $scope.workstation = '';
         $scope.workstation_owner = '';
         $scope.workstations = [];
@@ -299,6 +300,7 @@ function($routeProvider , $locationProvider , $compileProvider) {
                             return ws == w.name
                         })[0];
 
+                        $scope.workstation_obj = ws_obj;
                         $scope.workstation = ws_obj.id;
                         $scope.workstation_owner = ws_obj.owning_lib;
 
@@ -1288,7 +1290,7 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
          patronSvc , patronRegSvc , egUnloadPrompt, egAlertDialog ,
          egWorkLog , $timeout , egLovefield) {
 
-    patronRegSvc.org = $scope.workstation.owning_lib;
+    patronRegSvc.org = $scope.workstation_obj.owning_lib;
     $scope.offline = true;
 
     $scope.page_data_loaded = false;
@@ -1404,8 +1406,6 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
         prs.set_field_patterns(field_patterns);
         apply_username_regex();
     });
-    
-
 
     // update the currently displayed field documentation
     $scope.set_selected_field_doc = function(cls, field) {
@@ -1607,23 +1607,9 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
     }
 
     $scope.barcode_changed = function(bc) {
-        if ($scope.offline) return;
         if (!bc) return;
-        $scope.dupe_barcode = false;
-        egCore.net.request(
-            'open-ils.actor',
-            'open-ils.actor.barcode.exists',
-            egCore.auth.token(), bc
-        ).then(function(resp) {
-            if (resp == '1') { // duplicate card
-                $scope.dupe_barcode = true;
-                console.log('duplicate barcode detected: ' + bc);
-            } else {
-                if (!$scope.patron.usrname)
-                    $scope.patron.usrname = bc;
-                // No dupe -- A-OK
-            }
-        });
+        if (!$scope.patron.usrname)
+            $scope.patron.usrname = bc;
     }
 
     $scope.cards_dialog = function() {
@@ -1877,6 +1863,7 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
 
             case 'barcode':
                 apply_username_regex();
+                $scope.barcode_changed(value);
                 break;
 
             case 'dob':