LP1956627 Copy editor shows full org path of copy locations
authorBill Erickson <berickxx@gmail.com>
Fri, 8 Jul 2022 21:46:40 +0000 (17:46 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 27 Jul 2022 18:26:53 +0000 (14:26 -0400)
Copy location selector in the copy editor now includes locations from all
org units above, at, and below the workstation org unit.

Previously, copy locations at "lower" org units were not included.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Carol Witt <wittc@cwmars.org>
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts

index 2479ca6..f312fe8 100644 (file)
     <div *ngIf="displayAttr('location')">
       <ng-template #locationTemplate>
         <eg-item-location-select (valueChange)="values['location'] = $event"
-          [contextOrgIds]="affectedOrgIds()"
+          [contextOrgIds]="copyLocationOrgs()"
           domId='location-input' [required]="true" permFilter="UPDATE_COPY">
         </eg-item-location-select>
       </ng-template>
index 805f888..d4f41d4 100644 (file)
@@ -719,9 +719,16 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
         this.batchAttrs.filter(attr => attr.editing).forEach(attr => attr.save());
     }
 
-    affectedOrgIds(): number[] {
+    copyLocationOrgs(): number[] {
         if (!this.context) { return []; }
-        return this.context.orgNodes().map(n => n.target.id());
+
+        // Make sure every org unit represented by the edit batch
+        // is represented.
+        const ids = this.context.orgNodes().map(n => n.target.id());
+
+        // Make sure all locations within the "full path" of our
+        // workstation org unit are included.
+        return ids.concat(this.org.fullPath(this.auth.user().ws_ou()));
     }
 }