LP#1904244: item-location-select: include ancestors
authorGalen Charlton <gmc@equinoxOLI.org>
Tue, 20 Apr 2021 21:00:26 +0000 (17:00 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 12 Aug 2021 19:29:26 +0000 (15:29 -0400)
Specifically, when using permFilter, include locations at ancestors of
permitted OUs.

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/item-location-select/item-location-select.component.ts

index 2f41a10..ceea201 100644 (file)
@@ -157,7 +157,14 @@ export class ItemLocationSelectComponent
     setFilterOrgs(): Promise<number[]> {
         if (this.permFilter) {
             return this.perm.hasWorkPermAt([this.permFilter], true)
-                .then(values => this.filterOrgs = values[this.permFilter]);
+                .then(values => {
+                    this.filterOrgs = values[this.permFilter];
+                    // then include ancestors
+                    this.filterOrgs.forEach(ou => {
+                        this.org.ancestors(ou, true).forEach(anc => this.filterOrgs.push(anc));
+                    });
+                    return this.filterOrgs;
+                });
         }
 
         const org = this.contextOrgId || this.auth.user().ws_ou();