LP#1927527 Catalog: Root OU shelving locations do not display
authorDan Briem <dbriem@wlsmail.org>
Tue, 11 May 2021 00:08:42 +0000 (20:08 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 14 May 2021 21:03:12 +0000 (17:03 -0400)
When the top level org unit is selected in the staff catalog you
only have the option to search all shelving locations.

This allows you to filter on the root org unit's shelving
locations, which is the same behavior as the OPAC.

To test:
1. Make sure the top level org unit has shelving locations
   (Local Administration->Shelving Locations Editor)
2. In the staff catalog, select the top level org unit
3. Click the three dot icon next to the query text input
4. The root org unit's shelving location options display

Signed-off-by: Dan Briem <dbriem@wlsmail.org>
Signed-off-by: Garry Collum <gcollum@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>

Open-ILS/src/eg2/src/app/share/catalog/catalog.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts

index 36c3ead..64ff132 100644 (file)
@@ -414,7 +414,12 @@ export class CatalogService {
     }
 
     fetchCopyLocations(contextOrg: number | IdlObject): Promise<any> {
-        const orgIds = this.org.fullPath(contextOrg, true);
+        const contextOrgId: any = this.org.get(contextOrg).id();
+
+        const orgIds: any[] = contextOrgId === this.org.root().id()
+            ? [contextOrgId]
+            : this.org.fullPath(contextOrg, true);
+
         this.copyLocations = [];
 
         return this.pcrud.search('acpl',
index 4e37e5a..6b0e37c 100644 (file)
@@ -201,14 +201,7 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
     refreshCopyLocations() {
         if (!this.showFilters()) { return; }
 
-        // TODO: is this how we avoid displaying too many locations?
-        const org = this.context.searchOrg;
-        if (org.id() === this.org.root().id()) {
-            this.copyLocations = [];
-            return;
-        }
-
-        this.cat.fetchCopyLocations(org).then(() =>
+        this.cat.fetchCopyLocations(this.context.searchOrg).then(() =>
             this.copyLocations = this.cat.copyLocations
         );
     }