LP1955065 Item note dialog close value repairs
authorBill Erickson <berickxx@gmail.com>
Fri, 8 Jul 2022 19:10:51 +0000 (15:10 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Mon, 11 Jul 2022 13:56:09 +0000 (09:56 -0400)
Handle cases where the copy note dialog is closed via Cancel actions and
emits no data.

Also be sure the dialog emits consistently shaped data when it does emit
data.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts

index 4abf63b..41adfb5 100644 (file)
@@ -470,6 +470,8 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
         this.copyNotesDialog.copyIds = this.context.copyList().map(c => c.id());
 
         this.copyNotesDialog.open({size: 'lg'}).subscribe(changes => {
+            if (!changes) { return; }
+
             if ((!changes.newNotes || changes.newNotes.length === 0) &&
                 (!changes.delNotes || changes.delNotes.length === 0)
                ) {
index 57b9981..62fa86f 100644 (file)
@@ -971,6 +971,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
         this.copyNotesDialog.copyIds = copyIds;
         this.copyNotesDialog.open({size: 'lg'}).subscribe(
             changes => {
+                if (!changes) { return; }
                 if (changes.newNotes.length > 0 || changes.delNotes.length > 0) {
                     this.hardRefresh();
                 }
index a62dd4f..a5fffd0 100644 (file)
@@ -168,7 +168,7 @@ export class CopyNotesDialogComponent
             }
         }).then(_ => {
             this.successMsg.current().then(msg => this.toast.success(msg));
-            this.close(this.newNotes.length > 0 || this.delNotes.length > 0);
+            this.close({ newNotes: this.newNotes, delNotes: this.delNotes });
         });
     }
 }