From b58023ac04cf192239ab39c94d34fe0c770ed966 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 24 Mar 2017 11:35:53 -0400 Subject: [PATCH] webstaff: Allow adding new volumes to libaries that were not selected in the holdings UI (and fix a couple minor bugs) Signed-off-by: Mike Rylander --- .../templates/staff/cat/volcopy/t_edit.tt2 | 7 +++- .../js/ui/default/staff/cat/volcopy/app.js | 36 ++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2 index 30ac2d35a7..526673423e 100644 --- a/Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_edit.tt2 @@ -32,7 +32,7 @@
- +
@@ -73,6 +73,11 @@ allcopies="data.copies" struct="data.tree[lib]"> +
+
+ + +
diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index 92c2201a38..23bd2e82f2 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -728,7 +728,7 @@ function(egCore , $q) { $scope.struct[cn.id()] = [cp]; $scope.allcopies.push(cp); - if (!scope.defaults.classification) { + if (!$scope.defaults.classification) { egCore.org.settings( ['cat.default_classification_scheme'], cn.owning_lib() @@ -795,6 +795,40 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , } }; + $scope.new_lib_to_add = egCore.org.get(egCore.auth.user().ws_ou()); + $scope.changeNewLib = function (org) { + $scope.new_lib_to_add = org; + } + $scope.addLibToStruct = function () { + var newLib = $scope.new_lib_to_add; + var cn = new egCore.idl.acn(); + cn.id( --itemSvc.new_cn_id ); + cn.isnew( true ); + cn.prefix( $scope.defaults.prefix || -1 ); + cn.suffix( $scope.defaults.suffix || -1 ); + cn.label_class( $scope.defaults.classification || 1 ); + cn.owning_lib( newLib.id() ); + cn.record( $scope.record_id ); + + var cp = itemSvc.generateNewCopy( + cn, + newLib.id(), + $scope.fast_add, + true + ); + + $scope.data.addCopy(cp); + + if (!$scope.defaults.classification) { + egCore.org.settings( + ['cat.default_classification_scheme'], + cn.owning_lib() + ).then(function (val) { + cn.label_class(val['cat.default_classification_scheme']); + }); + } + } + $scope.embedded = ($routeParams.mode && $routeParams.mode == 'embedded') ? true : false; $scope.edit_templates = ($location.path().match(/edit_template/)) ? true : false; -- 2.43.2