itemSvc.add_copies_to_bucket([$scope.args.copyId]);
}
+ $scope.add_records_to_bucket = function() {
+ itemSvc.add_records_to_bucket([$scope.args.recordId], 'biblio');
+ }
+
$scope.show_in_catalog = function() {
window.open('/eg/staff/cat/catalog/record/' + $scope.args.recordId + '/catalog', '_blank');
}
return cp_id_list;
}
+ function gatherSelectedHoldingsRecords() {
+ var record_id_list = [];
+ angular.forEach(
+ copyGrid.selectedItems(),
+ function (item) {
+ record_id_list.push(item['call_number.record.id']);
+ }
+ )
+ return record_id_list;
+ }
+
$scope.refreshGridData = function() {
var chain = $q.when();
var all_items = itemSvc.copies.map(function(item) {
itemSvc.add_copies_to_bucket(copy_list);
}
+ $scope.add_records_to_bucket = function() {
+ var record_list = gatherSelectedHoldingsRecords();
+ itemSvc.add_copies_to_bucket(record_list, 'biblio');
+ }
+
$scope.locateAcquisition = function() {
if (gatherSelectedHoldingsIds) {
var cp_list = gatherSelectedHoldingsIds();
});
}
- service.add_copies_to_bucket = function(copy_list) {
- if (copy_list.length == 0) return;
+ service.add_copies_to_bucket = function(list, bucket_type) {
+ if (list.length == 0) return;
+ if (!bucket_type) bucket_type = 'copy';
return $uibModal.open({
templateUrl: './cat/catalog/t_add_to_bucket',
'open-ils.actor',
'open-ils.actor.container.retrieve_by_class.authoritative',
egCore.auth.token(), egCore.auth.user().id(),
- 'copy', 'staff_client'
+ bucket_type, 'staff_client'
).then(function(buckets) { $scope.allBuckets = buckets; });
$scope.add_to_bucket = function() {
var promises = [];
- angular.forEach(copy_list, function (cp) {
- var item = new egCore.idl.ccbi()
+ angular.forEach(list, function (entry) {
+ var item = bucket_type == 'copy' ? new egCore.idl.ccbi() : new egCore.idl.cbrebi();
item.bucket($scope.bucket_id);
- item.target_copy(cp);
+ if (bucket_type == 'copy') item.target_copy(entry);
+ if (bucket_type == 'biblio') item.target_biblio_record_entry(entry);
promises.push(
egCore.net.request(
'open-ils.actor',
'open-ils.actor.container.item.create',
- egCore.auth.token(), 'copy', item
+ egCore.auth.token(), bucket_type, item
)
);
}
$scope.add_to_new_bucket = function() {
- var bucket = new egCore.idl.ccb();
+ var bucket = bucket_type == 'copy' ? new egCore.idl.ccb() : new egCore.idl.cbreb();
bucket.owner(egCore.auth.user().id());
bucket.name($scope.newBucketName);
bucket.description('');
return egCore.net.request(
'open-ils.actor',
'open-ils.actor.container.create',
- egCore.auth.token(), 'copy', bucket
+ egCore.auth.token(), bucket_type, bucket
).then(function(bucket) {
$scope.bucket_id = bucket;
$scope.add_to_bucket();