From: Bill Erickson Date: Thu, 21 May 2020 22:17:00 +0000 (-0400) Subject: LPXXX MARC Batch update Angular port X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a6c482d2ad624f096d4ee9f842fde24d5f6df970;p=working%2FEvergreen.git LPXXX MARC Batch update Angular port Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/marcbatch/marcbatch.component.html b/Open-ILS/src/eg2/src/app/staff/cat/marcbatch/marcbatch.component.html index aeaf002726..0bd0bdeab3 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/marcbatch/marcbatch.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/marcbatch/marcbatch.component.html @@ -85,7 +85,7 @@
@@ -104,7 +104,7 @@
-
Template Preview
+
Merge Template Preview
@@ -191,10 +191,16 @@
-
+
Processing Complete
-
Success count: {{this.numSucceeded}}
-
Failed count: {{this.numFailed}}
+
+
Success count:
+
{{this.numSucceeded}}
+
+
+
Failed count:
+
{{this.numFailed}}
+
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/marcbatch/marcbatch.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/marcbatch/marcbatch.component.ts index 478aa2f42f..2a83825808 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/marcbatch/marcbatch.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/marcbatch/marcbatch.component.ts @@ -68,6 +68,8 @@ export class MarcBatchComponent implements OnInit { this.templateRules.forEach(rule => { + if (!rule.marcTag) { return; } + let ruleText = rule.marcTag + (rule.marcSubfields || ''); if (rule.advSubfield) { ruleText += @@ -84,10 +86,13 @@ export class MarcBatchComponent implements OnInit { this.record.insertOrderedFields(ruleTag); - if (rule.ruleType === 'd') { return; } + if (rule.ruleType === 'd') { + rule.marcData = ''; + return; + } const dataRec = new MarcRecord(); - if (resetRuleData) { + if (resetRuleData || !rule.marcData) { // Build a new value for the 'MARC Data' field based on // changes to the selected tag or subfields. @@ -150,12 +155,12 @@ export class MarcBatchComponent implements OnInit { 'open-ils.actor', 'open-ils.actor.container.retrieve_by_class', this.auth.token(), this.auth.user().id(), - 'biblio', ['staff_client','vandelay_queue'] + 'biblio', ['staff_client', 'vandelay_queue'] ).pipe(tap(buckets => { this.buckets = buckets .sort((b1, b2) => b1.name() < b2.name() ? -1 : 1) - .map(b => ({id: b.id(), label: b.name()})) + .map(b => ({id: b.id(), label: b.name()})); })).toPromise(); } @@ -173,11 +178,6 @@ export class MarcBatchComponent implements OnInit { return true; } - if (!this.processing && this.progressMax) { - // Just completed a session. - return true; - } - if (this.source === 'b') { return !this.bucket; @@ -189,17 +189,30 @@ export class MarcBatchComponent implements OnInit { } } - process() { this.processing = true; this.progressValue = null; this.progressMax = null; this.numSucceeded = 0; this.numFailed = 0; - + this.setReplaceMode(); this.postForm().then(_ => this.pollProgress()); } + setReplaceMode() { + if (this.record.subfield('905', 'r').length === 0) { + // Force replace mode w/ no-op replace rule. + this.record.appendFields( + this.record.newField({ + tag : '905', + ind1 : ' ', + ind2 : ' ', + subfields : [['r', '901c']] + }) + ); + } + } + postForm(): Promise { const formData: FormData = new FormData(); diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/marcrecord.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/marcrecord.ts index 4ba850bd17..493eaadcbe 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/marcrecord.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/marcrecord.ts @@ -191,5 +191,10 @@ export class MarcRecord { subfields.forEach(sf => root.push([].concat(sf))); return root; } + + // Returns a list of values for the tag + subfield combo + subfield(tag: string, subfield: string): string { + return this.record.subfield(tag, subfield); + } }