From 3d06623543fa676b67bde8e04c8b5e82e301bce9 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 6 Oct 2015 13:56:45 -0400 Subject: [PATCH 1/1] webstaff: Allow editing of empty volumes Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- .../web/js/ui/default/staff/cat/catalog/app.js | 15 +++++++++++++++ .../js/ui/default/staff/cat/services/holdings.js | 1 + .../web/js/ui/default/staff/cat/volcopy/app.js | 15 +++++++++------ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index bdcacfcc8a..a933876388 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -796,6 +796,18 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e return cp_list; } + function gatherSelectedEmptyVolumeIds () { + var cn_id_list = []; + angular.forEach( + $scope.holdingsGridControls.selectedItems(), + function (item) { + if (item.copy_count == 0) + cn_id_list.push(item.call_number.id) + } + ); + return cn_id_list; + } + function gatherSelectedVolumeIds () { var cn_id_list = []; angular.forEach( @@ -919,6 +931,9 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e null, 'edit-these-copies', { record_id: $scope.record_id, copies: gatherSelectedHoldingsIds(), + raw: gatherSelectedEmptyVolumeIds().map( + function(v){ return { callnumber : v } } + ), hide_vols : hide_vols, hide_copies : hide_copies } diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js b/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js index 0bebe6cf31..a0806c5c53 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js @@ -259,6 +259,7 @@ function(egCore , $q) { svc.copies = svc.copies.concat(flat); } else if (empty) { svc.copies.push({ + id_list : [], owner_id : owner_id, owner_list : owner_name_list, call_number: egCore.idl.toHash(cn), 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 013b744b5e..d76847f182 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 @@ -974,11 +974,8 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , $scope.record_id = data.record_id; - if (data.copies && data.copies.length) - return itemSvc.fetchIds(data.copies); - - if (data.raw && data.raw.length) { - $scope.dirty = true; + function fetchRaw () { + if (!$scope.only_vols) $scope.dirty = true; $scope.add_vols_copies = true; /* data.raw data structure looks like this: @@ -1001,7 +998,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , var cp = new egCore.idl.acp(); cp.call_number( cn ); cp.id( --itemSvc.new_cp_id ); - cp.isnew( true ); + if (!$scope.only_vols) cp.isnew( true ); cp.circ_lib( proto.owner || egCore.auth.user().ws_ou() ); cp.deposit(0); @@ -1059,6 +1056,12 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , return itemSvc.copies; } + + if (data.copies && data.copies.length) + return itemSvc.fetchIds(data.copies).then(fetchRaw); + + return fetchRaw(); + } }).then( function() { -- 2.43.2