From 32f5a2ac686b67eb8a8f37bef23559b8eaa1c9fa Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 26 Feb 2020 15:55:37 -0500 Subject: [PATCH] acq search: implement hard-coded fallback searches Signed-off-by: Galen Charlton --- .../src/app/staff/acq/search/acq-search-form.component.ts | 4 ++++ .../src/app/staff/acq/search/invoice-results.component.html | 1 + .../src/app/staff/acq/search/invoice-results.component.ts | 12 ++++++++++++ .../src/app/staff/acq/search/picklist-results.component.html | 1 + .../src/app/staff/acq/search/picklist-results.component.ts | 7 +++++++ .../staff/acq/search/purchase-order-results.component.html | 3 ++- .../app/staff/acq/search/purchase-order-results.component.ts | 12 ++++++++++++ 7 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts index 65a39ed612..5f0ac6a9ac 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts @@ -19,6 +19,7 @@ import {ServerStoreService} from '@eg/core/server-store.service'; export class AcqSearchFormComponent implements OnInit, AfterViewInit, OnChanges { @Input() initialSearchTerms: AcqSearchTerm[] = []; + @Input() fallbackSearchTerms: AcqSearchTerm[] = []; @Input() defaultSearchSetting = ''; @Input() runImmediatelySetting = ''; @Input() searchTypeLabel = ''; @@ -106,6 +107,9 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit, OnChanges if (defaultSearch) { this.searchTerms = JSON.parse(JSON.stringify(defaultSearch.terms)); this.searchConjunction = defaultSearch.conjunction; + } else if (this.fallbackSearchTerms.length) { + this.searchTerms.length = 0; + this.fallbackSearchTerms.forEach(term => this.searchTerms.push(term)); } else { this.addSearchTerm(); } diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html index 9c39fc5276..5436176621 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.html @@ -1,5 +1,6 @@ diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts index 4df4c3b9aa..f921ac04fd 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/invoice-results.component.ts @@ -31,6 +31,18 @@ export class InvoiceResultsComponent implements OnInit { cellTextGenerator: GridCellTextGenerator; + fallbackSearchTerms: AcqSearchTerm[] = [{ + field: 'acqinv:receiver', + op: '', + value1: this.auth.user() ? this.auth.user().ws_ou() : '', + value2: '' + }, { + field: 'acqinv:close_date', + op: '', + value1: null, + value2: '' + }]; + constructor( private router: Router, private route: ActivatedRoute, diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html index 6fd569e94f..a6b46637a3 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html @@ -1,5 +1,6 @@ diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts index 33f2356f2b..4eb8413a56 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts @@ -48,6 +48,13 @@ export class PicklistResultsComponent implements OnInit { cellTextGenerator: GridCellTextGenerator; + fallbackSearchTerms: AcqSearchTerm[] = [{ + field: 'acqpl:owner', + op: '', + value1: this.auth.user() ? this.auth.user().id() : '', + value2: '' + }]; + constructor( private router: Router, private route: ActivatedRoute, diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html index 93a0a7e86f..b1413c3712 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html @@ -1,6 +1,7 @@ + [fallbackSearchTerms]="fallbackSearchTerms" + defaultSearchSetting="eg.acq.search.default.purchaseorders">