From b99b0558af035da287437a2ce37fabd008027349 Mon Sep 17 00:00:00 2001 From: Victoria Lewis Date: Fri, 28 Aug 2015 12:35:59 -0700 Subject: [PATCH] LP1437112 save default search library to local storage. Committed. Will add the code to set default library in advanced search. --- .../staff/admin/workstation/t_search_prefs.tt2 | 3 +- .../js/ui/default/staff/admin/workstation/app.js | 60 ++++++++-------------- .../js/ui/default/staff/circ/in_house_use/app.js | 1 + 3 files changed, 24 insertions(+), 40 deletions(-) diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 index fc6e8f119c..cde8e6811b 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/t_search_prefs.tt2 @@ -34,8 +34,7 @@
diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index ec23e433b6..34142519b9 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -180,58 +180,42 @@ function($scope , $window , $location , egCore , egConfirmDialog) { /* * Search Preferences Controller */ -.controller('SearchPrefsCtrl', +.controller('SearchPrefsCtrl', ['$scope','$window','$location', 'egCore', 'egOrg','egConfirmDialog', 'egAuth', function($scope , $window , $location, egCore, egOrg, egConfirmDialog, egAuth) { console.log('SearchPrefsCtrl'); - -var allOrgs = []; - var permMap = {}; - $scope.contextOrg = egCore.org.get(egCore.auth.user().ws_ou()); - - // fetch the stored search lib info - egCore.hatch.getItem($scope.orgList) - .then(function(all) { - allOrgs = all || []; - $scope.org = - allOrgs.map(function(w) { return w.shortname }); - return egCore.hatch.getItem('eg.search.lib.default'); - }) - .then(function(def) { - if (def == undefined) { - // def = $scope.orgList[0].shortname; - egCore.hatch.setItem( - 'eg.search.lib.default', $scope.orgList[0]); - $scope.defaultSearchLib = $scope.orgList[0]; - def = $scope.orgList[0].shortname; - - //alert(" def " + def); - // $scope.defaultSearchLib = $scope.orgList[0].shortname; - } else { - $scope.defaultSearchLib = def; - //The option initially loaded will be the default Search Library - } - alert(def + "def 214 "); - $scope.activeSearchLib = def; //Should we make this also show default workstation's library if no default search library exists? - $scope.selectedOrg = def; - }); - $scope.orgList = egOrg.list().map(function(org) { return { id : org.id(), shortname : org.shortname(), depth : org.ou_type().depth() + } + }); + + egCore.hatch.getItem('eg.search.lib.default') + .then(function(def) { + if (def == undefined) { + egCore.hatch.setItem( + 'eg.search.lib.default', $scope.orgList[0]); + def = $scope.orgList[0].shortname; + } + //This lets our dropdown auto-select our default search lib. + $scope.selectedOrg = def; + angular.forEach($scope.orgList, function(val, key) { + if(JSON.stringify(def.shortname) == JSON.stringify(val.shortname)){ + $scope.selectedOrg = val.shortname; } }); - - $scope.getOrgLabel = function(org) { - return org == $scope.defaultSearchLib ? - egCore.strings.$replace(egCore.strings.DEFAULT_ORG_LABEL, {org:org}) : org; + }); + + $scope.getOrgLabel = function(org) { + return org == $scope.defaultSearchLib? + egCore.strings.$replace(egCore.strings.DEFAULT_ORG_LABEL, {org:org}) :org; } $scope.setDefaultSearchLib = function() { egCore.hatch.setItem( - 'eg.search.lib.default', $scope.selectedOrg) + 'eg.search.lib.default', JSON.parse($scope.selectedOrg)) .then(function() { $scope.defaultSearchLib = $scope.selectedOrg }); } diff --git a/Open-ILS/web/js/ui/default/staff/circ/in_house_use/app.js b/Open-ILS/web/js/ui/default/staff/circ/in_house_use/app.js index 06a18892e1..f58eab25ec 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/in_house_use/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/in_house_use/app.js @@ -98,6 +98,7 @@ function($scope, egCore, egGridDataProvider , egConfirmDialog) { coArgs, {title : $scope.selectedNcType()} ); } + $scope.args.barcode=' '; } function performCheckout(method, args, data) { -- 2.11.0