2 * Common code for mananging holdings
4 import {Injectable, EventEmitter} from '@angular/core';
5 import {NetService} from '@eg/core/net.service';
6 import {AnonCacheService} from '@eg/share/util/anon-cache.service';
7 import {AuthService} from '@eg/core/auth.service';
8 import {EventService} from '@eg/core/event.service';
10 interface NewCallNumData {
18 export class HoldingsService {
21 private net: NetService,
22 private auth: AuthService,
23 private evt: EventService,
24 private anonCache: AnonCacheService
27 // Open the holdings editor UI in a new browser window/tab.
29 recordId: number, // Bib record ID
30 addToCallNums?: number[], // Add copies to / modify existing CNs
31 callNumData?: NewCallNumData[], // Creating new call numbers
32 hideCopies?: boolean) { // Hide the copy edit pane
34 const raw: any[] = [];
37 addToCallNums.forEach(callNumId => raw.push({callnumber: callNumId}));
38 } else if (callNumData) {
39 callNumData.forEach(data => raw.push(data));
42 if (raw.length === 0) { raw.push({}); }
44 this.anonCache.setItem(null, 'edit-these-copies', {
48 hide_copies : hideCopies ? true : false
51 console.error('Could not create holds cache key!');
55 const url = `/eg/staff/cat/volcopy/${key}`;
56 window.open(url, '_blank');