From cecf8cb6511b81383f16aaaffeed4602b3c6e90d Mon Sep 17 00:00:00 2001 From: Alicia Zangger Date: Wed, 1 Apr 2020 11:06:02 +0200 Subject: [PATCH] search: fix query with trailing and leading space * Adds a property to set to remove trailing and leading spaces of search text. * Removes previous fix that is useless now. * Closes #213. Co-Authored-by: Alicia Zangger --- .../admin/src/app/circulation/checkin/checkin.component.html | 4 +++- .../admin/src/app/circulation/checkin/checkin.component.ts | 4 +++- .../app/circulation/main-request/main-request.component.html | 1 + .../app/circulation/main-request/main-request.component.ts | 3 +++ .../admin/src/app/circulation/patron/loan/loan.component.html | 1 + .../admin/src/app/circulation/patron/loan/loan.component.ts | 4 +++- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/projects/admin/src/app/circulation/checkin/checkin.component.html b/projects/admin/src/app/circulation/checkin/checkin.component.html index 39816c690..58d298108 100644 --- a/projects/admin/src/app/circulation/checkin/checkin.component.html +++ b/projects/admin/src/app/circulation/checkin/checkin.component.html @@ -21,7 +21,9 @@ [placeholder]="placeholder | translate" [searchText]="searchText" (search)="searchValueUpdated($event)" - [focus]="searchInputFocus"> + [focus]="searchInputFocus" + [trimQueryString]="trimSearchText"> +
diff --git a/projects/admin/src/app/circulation/main-request/main-request.component.ts b/projects/admin/src/app/circulation/main-request/main-request.component.ts index 7c898aaec..b6a9f540c 100644 --- a/projects/admin/src/app/circulation/main-request/main-request.component.ts +++ b/projects/admin/src/app/circulation/main-request/main-request.component.ts @@ -38,6 +38,9 @@ export class MainRequestComponent implements OnInit { /** Focus attribute of the search input */ searchInputFocus = false; + /** Trim search text if true */ + trimSearchText = true; + /** Constructor * @param userService: User Service * @param itemsService: Items Service diff --git a/projects/admin/src/app/circulation/patron/loan/loan.component.html b/projects/admin/src/app/circulation/patron/loan/loan.component.html index 31431500a..b14a08f84 100644 --- a/projects/admin/src/app/circulation/patron/loan/loan.component.html +++ b/projects/admin/src/app/circulation/patron/loan/loan.component.html @@ -23,6 +23,7 @@ [searchText]="searchText" (search)="searchValueUpdated($event)" [focus]="searchInputFocus" + [trimQueryString]="trimSearchText" > diff --git a/projects/admin/src/app/circulation/patron/loan/loan.component.ts b/projects/admin/src/app/circulation/patron/loan/loan.component.ts index fa83a34ee..67adae3d1 100644 --- a/projects/admin/src/app/circulation/patron/loan/loan.component.ts +++ b/projects/admin/src/app/circulation/patron/loan/loan.component.ts @@ -51,6 +51,9 @@ export class LoanComponent implements OnInit { /** Focus attribute of the search input */ searchInputFocus = false; + /** Trim search text if true */ + trimSearchText = true; + /** Library PID of the logged user */ currentLibraryPid: string; @@ -92,7 +95,6 @@ export class LoanComponent implements OnInit { if (!searchText) { return null; } - this.searchText = searchText.trim(); this.getItem(this.searchText); }