From a12a7ad653631ec09ee690571f9ec265e06c801b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 8 Jul 2022 16:43:42 -0400 Subject: [PATCH] LP1959716 Follow up to allow managing/deleting in-place copies Fixes a thinko which prevented management / deletion of existing copies in the copy editor. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- .../src/app/staff/share/holdings/copy-alerts-dialog.component.ts | 8 +++++++- .../src/app/staff/share/holdings/copy-notes-dialog.component.ts | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-alerts-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-alerts-dialog.component.ts index b5a0cd54c0..85960fc305 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-alerts-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-alerts-dialog.component.ts @@ -79,7 +79,8 @@ export class CopyAlertsDialogComponent // In manage mode, we can only manage a single copy. // But in create mode, we can add alerts to multiple copies. - if (this.copyIds.length === 1 && !this.inPlaceCreateMode) { + // We can only manage copies that already exist in the database. + if (this.copyIds.length === 1 && this.copyIds[0] > 0) { this.mode = 'manage'; } else { this.mode = 'create'; @@ -109,6 +110,11 @@ export class CopyAlertsDialogComponent } getCopies(): Promise { + + // Avoid fetch if we're only adding notes to isnew copies. + const ids = this.copyIds.filter(id => id > 0); + if (ids.length === 0) { return Promise.resolve(); } + return this.pcrud.search('acp', {id: this.copyIds}, {}, {atomic: true}) .toPromise().then(copies => { this.copies = copies; diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts index a5fffd0a68..dffa22789f 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts @@ -84,8 +84,8 @@ export class CopyNotesDialogComponent // In manage mode, we can only manage a single copy. // But in create mode, we can add notes to multiple copies. - - if (this.copyIds.length === 1 && !this.inPlaceCreateMode) { + // We can only manage copies that already exist in the database. + if (this.copyIds.length === 1 && this.copyIds[0] > 0) { this.mode = 'manage'; } else { this.mode = 'create'; @@ -99,6 +99,11 @@ export class CopyNotesDialogComponent } getCopies(): Promise { + + // Avoid fetch if we're only adding notes to isnew copies. + const ids = this.copyIds.filter(id => id > 0); + if (ids.length === 0) { return Promise.resolve(); } + return this.pcrud.search('acp', {id: this.copyIds}, {flesh: 1, flesh_fields: {acp: ['notes']}}, {atomic: true} -- 2.11.0