LP1956627 Copy editor shows full org path of copy locations user/berick/lp1956627-volcopy-locations-full-org-path
authorBill Erickson <berickxx@gmail.com>
Fri, 8 Jul 2022 21:46:40 +0000 (17:46 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 8 Jul 2022 21:46:42 +0000 (17:46 -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>
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 e04a2bc..c41831d 100644 (file)
@@ -661,9 +661,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()));
     }
 }