<div class="col-lg-12 d-flex justify-content-end">
<button class="btn btn-outline-danger label-with-material-icon"
(click)="removeRule(idx)" i18n>
- <span>Remove this Template Rule</span>
+ <span>Remove this Merge Rule</span>
<span class="material-icons ml-2">delete</span>
</button>
</div>
<div class="col-lg-5">
<div class="row pb-2 pt-2 border">
<div class="col-lg-12">
- <div class="font-weight-bold" i18n>Template Preview</div>
+ <div class="font-weight-bold" i18n>Merge Template Preview</div>
<div>
<textarea class="form-control" [ngModel]="breaker()"
disabled rows="{{breakerRows()}}"></textarea>
</div>
</div>
<div class="row mt-2 p-2" *ngIf="!processing && progressMax">
- <div class="col-lg-10 offset-lg-1">
+ <div class="col-lg-12 alert alert-success">
<div i18n>Processing Complete</div>
- <div i18n>Success count: {{this.numSucceeded}}</div>
- <div i18n>Failed count: {{this.numFailed}}</div>
+ <div class="row">
+ <div class="col-lg-3" i18n>Success count: </div>
+ <div class="col-lg-3">{{this.numSucceeded}}</div>
+ </div>
+ <div class="row">
+ <div class="col-lg-3" i18n>Failed count: </div>
+ <div class="col-lg-3">{{this.numFailed}}</div>
+ </div>
</div>
</div>
</div>
this.templateRules.forEach(rule => {
+ if (!rule.marcTag) { return; }
+
let ruleText = rule.marcTag + (rule.marcSubfields || '');
if (rule.advSubfield) {
ruleText +=
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.
'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();
}
return true;
}
- if (!this.processing && this.progressMax) {
- // Just completed a session.
- return true;
- }
-
if (this.source === 'b') {
return !this.bucket;
}
}
-
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<any> {
const formData: FormData = new FormData();