[open-ils-commits] [GIT] Evergreen ILS branch rel_3_5 updated. 6ff6e8cd5413306663065e70ee84e581894bb767
Evergreen Git
git at git.evergreen-ils.org
Fri Jul 10 22:51:30 EDT 2020
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_3_5 has been updated
via 6ff6e8cd5413306663065e70ee84e581894bb767 (commit)
from 298d252f426a793362f549e9457bba54b732b190 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6ff6e8cd5413306663065e70ee84e581894bb767
Author: Bill Erickson <berickxx at gmail.com>
Date: Tue Mar 10 10:48:27 2020 -0400
LP1866546 MARC edit support authority record (un)delete
Teaches the Angular MARC editor to use PCRUD for deleting and undeleting
authority records instead of erroneously using the bib record delete /
undelete APIs.
Signed-off-by: Bill Erickson <berickxx at gmail.com>
Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>
diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts
index 0bc308a6cc..241379f382 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editor.component.ts
@@ -291,50 +291,109 @@ export class MarcEditorComponent implements OnInit {
.then(yes => {
if (!yes) { return; }
- return this.net.request('open-ils.cat',
- 'open-ils.cat.biblio.record_entry.delete',
- this.auth.token(), this.record.id).toPromise()
-
- .then(resp => {
-
- const evt = this.evt.parse(resp);
- if (evt) {
- if (evt.textcode === 'RECORD_NOT_EMPTY') {
- return this.cannotDelete.open().toPromise();
- } else {
- console.error(evt);
- return alert(evt);
- }
- }
- return this.fromId(this.record.id)
- .then(_ => this.recordSaved.emit(
- {marcXml: this.record.toXml(), recordId: this.recordId}));
+ let promise;
+ if (this.recordType === 'authority') {
+ promise = this.deleteAuthorityRecord();
+ } else {
+ promise = this.deleteBibRecord();
+ }
+
+ return promise.then(ok => {
+ if (!ok) { return; }
+
+ return this.fromId(this.record.id).then(_ => {
+ this.recordSaved.emit({
+ marcXml: this.record.toXml(),
+ recordId: this.recordId
+ });
+ });
});
});
}
+ deleteAuthorityRecord(): Promise<boolean> {
+ return this.pcrud.retrieve('are', this.record.id).toPromise()
+ .then(rec => this.pcrud.remove(rec).toPromise())
+ .then(resp => resp !== null);
+ }
+
+ deleteBibRecord(): Promise<boolean> {
+
+ return this.net.request('open-ils.cat',
+ 'open-ils.cat.biblio.record_entry.delete',
+ this.auth.token(), this.record.id).toPromise()
+
+ .then(resp => {
+
+ const evt = this.evt.parse(resp);
+ if (evt) {
+ if (evt.textcode === 'RECORD_NOT_EMPTY') {
+ return this.cannotDelete.open().toPromise()
+ .then(_ => false);
+ } else {
+ console.error(evt);
+ alert(evt);
+ return false;
+ }
+ }
+
+ return true;
+ });
+ }
+
undeleteRecord(): Promise<any> {
return this.confirmUndelete.open().toPromise()
.then(yes => {
if (!yes) { return; }
- return this.net.request('open-ils.cat',
- 'open-ils.cat.biblio.record_entry.undelete',
- this.auth.token(), this.record.id).toPromise()
-
- .then(resp => {
-
- const evt = this.evt.parse(resp);
- if (evt) { console.error(evt); return alert(evt); }
+ let promise;
+ if (this.recordType === 'authority') {
+ promise = this.undeleteAuthorityRecord();
+ } else {
+ promise = this.undeleteBibRecord();
+ }
+ return promise.then(ok => {
+ if (!ok) { return; }
return this.fromId(this.record.id)
- .then(_ => this.recordSaved.emit(
- {marcXml: this.record.toXml(), recordId: this.recordId}));
+ .then(_ => {
+ this.recordSaved.emit({
+ marcXml: this.record.toXml(),
+ recordId: this.recordId
+ });
+ });
});
});
}
+ undeleteAuthorityRecord(): Promise<any> {
+ return this.pcrud.retrieve('are', this.record.id).toPromise()
+ .then(rec => {
+ rec.deleted('f');
+ return this.pcrud.update(rec).toPromise();
+ }).then(resp => resp !== null);
+ }
+
+ undeleteBibRecord(): Promise<any> {
+
+ return this.net.request('open-ils.cat',
+ 'open-ils.cat.biblio.record_entry.undelete',
+ this.auth.token(), this.record.id).toPromise()
+
+ .then(resp => {
+
+ const evt = this.evt.parse(resp);
+ if (evt) {
+ console.error(evt);
+ alert(evt);
+ return false;
+ }
+
+ return true;
+ });
+ }
+
// Spawns the copy editor with the requested barcode and
// call number label. Called after our record is saved.
fastAdd() {
-----------------------------------------------------------------------
Summary of changes:
.../app/staff/share/marc-edit/editor.component.ts | 115 ++++++++++++++++-----
1 file changed, 87 insertions(+), 28 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list