From 6749bb4e360501e065d62711715ef7a9b579f6a7 Mon Sep 17 00:00:00 2001 From: Terran McCanna Date: Thu, 18 Aug 2022 16:17:23 -0400 Subject: [PATCH] LP1821950 Allow saving without call number label Checks value of Require Call Number Label YAOUS and allows saving if call number label is not required. (This is for Angular holdings editor only.) Signed-off-by: Terran McCanna --- .../app/staff/cat/volcopy/vol-edit.component.ts | 24 +++++++++++++++++++--- .../src/app/staff/cat/volcopy/volcopy.component.ts | 9 -------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts index 9baf350890..d5fae89a42 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts @@ -54,6 +54,9 @@ export class VolEditComponent implements OnInit { deleteVolCount: number = null; deleteCopyCount: number = null; + // Set default for Call Number Label requirement + requireCNL = true; + // When adding multiple vols via add-many popover. addVolCount: number = null; @@ -96,6 +99,13 @@ export class VolEditComponent implements OnInit { // It's possible the loaded data is not strictly allowed, // e.g. empty string call number labels .then(_ => this.emitSaveChange(true)); + + // Check to see if call number label is required + this.org.settings('cat.require_call_number_labels') + .then(settings => {this.requireCNL = + Boolean(settings['cat.require_call_number_labels']); + console.log('CALL NUMBER REQUIRED: ' + this.requireCNL); + }); } copyStatLabel(copy: IdlObject): string { @@ -582,9 +592,17 @@ export class VolEditComponent implements OnInit { const badVols = this.context.volNodes().filter(volNode => { const vol = volNode.target; - return !( - vol.prefix() && vol.label() && vol.suffix && vol.label_class() - ); + + // Set badVols only if call number label is required but blank + if (this.requireCNL == true) { + return !( + vol.prefix() && vol.label() && vol.suffix && vol.label_class() + ); + } else { + return !( + vol.prefix() && vol.suffix && vol.label_class() + ); + } }).length > 0; return !badVols; 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 f63801a4db..612b2e352d 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 @@ -65,7 +65,6 @@ export class VolCopyComponent implements OnInit { attrsCanSave = true; changesPending = false; routingAllowed = false; - requireCN = true; @ViewChild('pendingChangesDialog', {static: false}) pendingChangesDialog: ConfirmDialogComponent; @@ -90,14 +89,6 @@ export class VolCopyComponent implements OnInit { ngOnInit() { this.route.paramMap.subscribe( (params: ParamMap) => this.negotiateRoute(params)); - - this.org.settings('cat.require_call_number_labels') - .then(settings => {this.requireCN = - Boolean(settings['cat.require_call_number_labels']); - console.log('TESTING:' + this.requireCN); - }); - - } -- 2.11.0