From e369f74bcec0399b3c9fab2c1985d5d42d70fc29 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 8 Jul 2022 16:19:44 -0400 Subject: [PATCH] LP1975879 Holdings editor allows owning lib changed A new edit (pencil) icon appears to the left of the first call number field in the 'holdings' tab of the copy edit. When clicked, the user has a chance to enter a new org unit value to act as the owning lib of the affected call number. If the "Change Circ Lib When Owning Lib Changes" preference is set, then any copies linked to the affected call number within the current edit session will have their circ libs updated to match the new owning lib of the call number. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- .../app/staff/cat/volcopy/vol-edit.component.html | 58 ++++++++++++++-------- .../app/staff/cat/volcopy/vol-edit.component.ts | 48 ++++++++++++++++++ 2 files changed, 86 insertions(+), 20 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html index 5926461ec4..1eaa072938 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html @@ -245,27 +245,45 @@ {{orgNode.target.shortname()}} -
- - - - - + +
+ + + + - - -
+ +
+ + +
+ + + + + + +
+
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 ab9309cf09..9baf350890 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 @@ -518,6 +518,54 @@ export class VolEditComponent implements OnInit { } } + editVolOwner(volNode: HoldingsTreeNode, org: IdlObject) { + if (!org) { return; } + + const orgId = org.id(); + const vol = volNode.target; + + vol.owning_lib(orgId); + vol.ischanged(true); + + // Move the vol node away from its previous org node and append + // it to the children list of the target node. + let targetOrgNode: HoldingsTreeNode; + this.context.orgNodes().forEach(orgNode => { + + if (orgNode.target.id() === orgId) { + targetOrgNode = orgNode; + return; + } + + orgNode.children.forEach((vNode, volIdx) => { + if (vol.id() === vNode.target.id()) { + orgNode.children.splice(volIdx, 1); + } + }); + }); + + if (!targetOrgNode) { + targetOrgNode = this.context.findOrCreateOrgNode(orgId); + } + + targetOrgNode.children.push(volNode); + + // If configured to do so, also update the circ_lib for any + // copies linked to this call number in this edit session. + if (this.volcopy.defaults.values.circ_lib_mod_with_owning_lib) { + volNode.children.forEach(copyNode => { + const copy = copyNode.target; + if (copy.circ_lib() !== orgId) { + copy.circ_lib(orgId); + copy.ischanged(true); + } + }); + } + + this.emitSaveChange(); + } + + displayColumn(field: string): boolean { return this.volcopy.defaults.hidden[field] !== true; } -- 2.11.0