From 652d941e9089f844f834e8643988b36f3adcc96b Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 8 Jul 2020 16:26:37 -0400 Subject: [PATCH] improvements to timestamp queries - now work correctly as saved searches or URL parameters - when changing between search fields that are both timestamps, the value is now retained. Signed-off-by: Galen Charlton --- .../app/staff/acq/search/acq-search-form.component.html | 2 ++ .../app/staff/acq/search/acq-search-form.component.ts | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html index 89a8438db1..2443325415 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html @@ -107,11 +107,13 @@ and 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 d9355aa7cf..f17309fce3 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 @@ -142,24 +142,25 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit, OnChanges if (this.searchTerms[0].field && this.searchTermDatatypes[this.searchTerms[0].field] == 'org_unit') { this.searchTerms = [{ field: this.searchTerms[0].field, op: this.searchTerms[0].op, value1: '', value2: ''}]; } + // and timestamps + if (this.searchTerms[0].field && this.searchTermDatatypes[this.searchTerms[0].field] == 'timestamp') { + this.searchTerms = [{ field: this.searchTerms[0].field, op: this.searchTerms[0].op, value1: '', value2: ''}]; + } } else { this.searchTerms.splice(index, 1); } } clearSearchTerm(term: AcqSearchTerm, old?) { - if (!old) { - term.value1 = ''; - term.value2 = ''; - } - term.is_date = false; - // work around fact that org selector doesn't implement ngModel - if (old && this.searchTermDatatypes[old] == this.searchTermDatatypes[term.field] && this.searchTermDatatypes[old] == 'org_unit') { + // and we don't use it for eg-date-select + if (old && this.searchTermDatatypes[old] == this.searchTermDatatypes[term.field] && + (this.searchTermDatatypes[old] == 'org_unit' || this.searchTermDatatypes[old] == 'timestamp')) { // don't change values if we're moving from one - // org_unit field to another + // org_unit or timestamp field to another } else { term.value1 = ''; term.value2 = ''; + term.is_date = false; } // handle change of field type -- 2.11.0