From 215cf73b5c06c5dc6b6d45f844b0f2a942d36eb2 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 19 Apr 2022 12:49:38 -0400 Subject: [PATCH] LP1956626 experiment Signed-off-by: Bill Erickson --- .../eg2/src/app/staff/cat/volcopy/volcopy.component.ts | 7 +++++++ .../eg2/src/app/staff/cat/volcopy/volcopy.service.ts | 7 +++---- Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm | 17 ++++++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts index e288b8df6a..17a719544e 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts @@ -133,8 +133,15 @@ export class VolCopyComponent implements OnInit { this.loading = true; this.context.reset(); + /* return this.volcopy.load() .then(_ => this.fetchHoldings(copyIds)) + */ + return this.fetchHoldings(copyIds) + .then(_ => this.volcopy.load()) + .then(_ => { + console.log('ORG UNITS IS', this.context.orgNodes().map(n => n.target.id())); + }) .then(_ => this.volcopy.applyVolLabels( this.context.volNodes().map(n => n.target))) .then(_ => this.context.sortHoldings()) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts index d898c3e27f..33bafb527f 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts @@ -29,7 +29,6 @@ export class VolCopyService { autoId = -1; - localOrgs: number[]; defaults: VolCopyDefaults = null; copyStatuses: {[id: number]: IdlObject} = {}; bibParts: {[bibId: number]: IdlObject[]} = {}; @@ -72,13 +71,13 @@ export class VolCopyService { if (this.commonData.acp_item_type_map) { return Promise.resolve(); } - this.localOrgs = this.org.fullPath(this.auth.user().ws_ou(), true); - this.hideVolOrgs = this.org.list() .filter(o => !this.org.canHaveVolumes(o)).map(o => o.id()); + const orgIds: number[] = this.currentContext.orgNodes().map(n => n.target.id()); + return this.net.request( - 'open-ils.cat', 'open-ils.cat.volcopy.data', this.auth.token() + 'open-ils.cat', 'open-ils.cat.volcopy.data', this.auth.token(), orgIds ).pipe(tap(dataset => { const key = Object.keys(dataset)[0]; this.commonData[key] = dataset[key]; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm index deb7ad4036..1921fc6db0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat.pm @@ -1967,18 +1967,29 @@ __PACKAGE__->register_method( desc => q|Returns a batch of org-scoped data types needed by the volume/copy editor|, params => [ - {desc => 'Authtoken', type => 'string'} + {desc => 'Authtoken', type => 'string'}, + {desc => 'Alt Org Units. This overrides using just the authtoken org unit', + type => 'array'} ] }, return => {desc => 'Stream of various object type lists', type => 'array'} ); sub volcopy_data { - my ($self, $client, $auth) = @_; + my ($self, $client, $auth, $alt_orgs) = @_; my $e = new_editor(authtoken => $auth); $e->checkauth or return $e->event; - my $org_ids = $U->get_org_ancestors($e->requestor->ws_ou); + + my $org_ids = []; + + if ($alt_orgs) { + for my $org_id (@$alt_orgs) { + push(@$org_ids, @{$U->get_org_ancestors($org_id)}); + } + } else { + $org_ids = $U->get_org_ancestors($e->requestor->ws_ou); + } $client->respond({ acp_location => $e->search_asset_copy_location([ -- 2.11.0