From: Mike Rylander Date: Tue, 8 Sep 2015 19:27:22 +0000 (-0400) Subject: webstaff: Conjoined item attach-inator X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5a91eb9905ae934ede77bbdcd3f919f8349d264b;p=Evergreen.git webstaff: Conjoined item attach-inator Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_conjoined_selector.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_conjoined_selector.tt2 new file mode 100644 index 0000000000..377c42684b --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/catalog/t_conjoined_selector.tt2 @@ -0,0 +1,25 @@ +
+ + + +
diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 index c5ab768fc6..c7a1142206 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 @@ -35,6 +35,8 @@ + 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 5c8f917407..a5331d7e1f 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 @@ -814,6 +814,49 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e }); } + $scope.attach_to_peer_bib = function() { + var copy_list = gatherSelectedHoldingsIds(); + if (copy_list.length == 0) return; + + egCore.hatch.getItem('eg.cat.marked_conjoined_record').then(function(target_record) { + if (!target_record) return; + + return $modal.open({ + templateUrl: './cat/catalog/t_conjoined_selector', + animation: true, + controller: + ['$scope','$modalInstance', + function($scope , $modalInstance) { + $scope.peer_type = null; + $scope.peer_type_list = []; + holdingsSvc.get_peer_types().then(function(list){ + $scope.peer_type_list = list; + }); + + $scope.ok = function(type) { + var promises = []; + + angular.forEach(copy_list, function (cp) { + var n = new egCore.idl.bpbcm(); + n.isnew(true); + n.peer_record(target_record); + n.target_copy(cp); + n.peer_type(type); + promises.push(egCore.pcrud.create(n)); + }); + + return $q.all(promises).then(function(){$modalInstance.close()}); + } + + $scope.cancel = function($event) { + $modalInstance.dismiss(); + $event.preventDefault(); + } + }] + }); + }); + } + // ------------------------------------------------------------------ // Holds @@ -1285,6 +1328,18 @@ function(egCore , $q) { ); } + // returns a promise resolved with the list of peer bib types + service.get_peer_types = function() { + if (egCore.env.bpt) + return $q.when(egCore.env.bpt.list); + + return egCore.pcrud.retrieveAll('bpt', null, {atomic : true}) + .then(function(list) { + egCore.env.absorbList(list, 'bpt'); + return list; + }); + }; + return service; }])