LP1821950 Allow saving without call number label user/mccanna/lp1821950-call-number-labels-not-required
authorTerran McCanna <tmccanna@georgialibraries.org>
Thu, 18 Aug 2022 20:17:23 +0000 (16:17 -0400)
committerTerran McCanna <tmccanna@georgialibraries.org>
Thu, 18 Aug 2022 20:17:23 +0000 (16:17 -0400)
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 <tmccanna@georgialibraries.org>
Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts
Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts

index 9baf350..d5fae89 100644 (file)
@@ -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;
index f63801a..612b2e3 100644 (file)
@@ -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);
-                       });
-
-
     }