LP1892111 Staff Catalog Digital Bookplates
authorBill Erickson <berickxx@gmail.com>
Wed, 19 Aug 2020 14:54:35 +0000 (10:54 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 22 Sep 2020 14:06:57 +0000 (10:06 -0400)
Support for digital bookplates searching in the staff catalog.

Note to testers, the org setting 'opac.search.enable_bookplate_search'
must be set to true and copy tags must be added and linked to copies.

Included in commit is a minor i18n tweak to address some complaints by
the Angular build.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Rogan Hamby <rogan.hamby@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/share/catalog/search-context.ts
Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html
Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts

index 57d9db6..f669ba0 100644 (file)
@@ -513,6 +513,10 @@ export class CatalogSearchContext {
         const matchOp = ts.matchOp[idx];
         const fieldClass = ts.fieldClass[idx];
 
+        // Bookplates are filters but may be displayed as regular
+        // text search indexes.
+        if (fieldClass === 'bookplate') { return ''; }
+
         let str = '';
         if (!query) { return str; }
 
@@ -601,6 +605,16 @@ export class CatalogSearchContext {
         if (qcount > 1) { str += ')'; }
         // -------
 
+        // Append bookplate queries as filters
+        ts.query.forEach((q, idx) => {
+            const space = str.length > 0 ? ' ' : '';
+            const query = ts.query[idx];
+            const fieldClass = ts.fieldClass[idx];
+            if (query && fieldClass === 'bookplate') {
+                str += `${space}copy_tag(*,${query})`;
+            }
+        });
+
         if (ts.hasBrowseEntry) {
             // stored as a comma-separated string of "entryId,fieldId"
             str += ` has_browse_entry(${ts.hasBrowseEntry})`;
index 95912a4..3b3268c 100644 (file)
@@ -38,6 +38,9 @@ export class StaffCatalogService {
     // during record tab navigation.
     currentDetailRecordSummary: any;
 
+    // Add digital bookplate to search options.
+    enableBookplates = false;
+
     constructor(
         private router: Router,
         private route: ActivatedRoute,
index 842893c..f86a060 100644 (file)
@@ -53,7 +53,8 @@ export class CatalogResolver implements Resolve<Promise<any[]>> {
             'cat.holdings_show_vols',
             'opac.staff_saved_search.size',
             'eg.catalog.search_templates',
-            'opac.staff_saved_search.size'
+            'opac.staff_saved_search.size',
+            'opac.search.enable_bookplate_search'
         ]).then(settings => {
             this.staffCat.defaultSearchOrg =
                 this.org.get(settings['eg.search.search_lib']);
@@ -64,6 +65,8 @@ export class CatalogResolver implements Resolve<Promise<any[]>> {
                this.staffCat.defaultSearchLimit =
                   Number(settings['eg.catalog.results.count']);
             }
+            this.staffCat.enableBookplates =
+                settings['opac.search.enable_bookplate_search'];
         });
     }
 }
index 61c9829..5361992 100644 (file)
@@ -43,6 +43,8 @@
                 <option i18n value='author'>Author</option>
                 <option i18n value='subject'>Subject</option>
                 <option i18n value='series'>Series</option>
+                <option i18n value='bookplate'
+                  *ngIf="showBookplate()">Digital Bookplate</option>
               </select>
             </div>
             <div class="col-lg-2 pl-0 pr-2">
index 043adb0..c09da29 100644 (file)
@@ -279,6 +279,10 @@ export class SearchFormComponent implements OnInit, AfterViewInit {
             }
         }
     }
+
+    showBookplate(): boolean {
+        return this.staffCat.enableBookplates;
+    }
 }