From f812c043f229e6cae3550e3168bc2a5f230d929a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 19 Aug 2020 10:54:35 -0400 Subject: [PATCH] LP1892111 Staff Catalog Digital Bookplates 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 Signed-off-by: Rogan Hamby Signed-off-by: Galen Charlton --- Open-ILS/src/eg2/src/app/share/catalog/search-context.ts | 14 ++++++++++++++ Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts | 3 +++ Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts | 5 ++++- .../eg2/src/app/staff/catalog/search-form.component.html | 2 ++ .../src/eg2/src/app/staff/catalog/search-form.component.ts | 4 ++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts b/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts index 57d9db6573..f669ba0ad6 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/search-context.ts @@ -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})`; diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts index 95912a4285..3b3268c4e3 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.service.ts @@ -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, diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts index 842893cf11..f86a060653 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts @@ -53,7 +53,8 @@ export class CatalogResolver implements Resolve> { '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> { this.staffCat.defaultSearchLimit = Number(settings['eg.catalog.results.count']); } + this.staffCat.enableBookplates = + settings['opac.search.enable_bookplate_search']; }); } } diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html index 61c9829676..5361992852 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.html @@ -43,6 +43,8 @@ +
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts index 043adb0ed1..c09da29785 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/search-form.component.ts @@ -279,6 +279,10 @@ export class SearchFormComponent implements OnInit, AfterViewInit { } } } + + showBookplate(): boolean { + return this.staffCat.enableBookplates; + } } -- 2.11.0