From 64e0ec0bd2a999f04da9a43a97c42d5abf9e8baf Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 12 Nov 2020 11:36:52 -0500 Subject: [PATCH] LP1904036 Patron UI lint repairs; sanity checks Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../eg2/src/app/staff/circ/patron/patron.component.ts | 6 ++++-- .../eg2/src/app/staff/circ/patron/patron.service.ts | 8 ++++---- .../eg2/src/app/staff/share/holds/grid.component.ts | 2 +- .../src/app/staff/share/patron/search.component.ts | 19 +++++++++++-------- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts index c65d4d8f84..2e2f089a72 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts @@ -147,9 +147,11 @@ export class PatronComponent implements OnInit, AfterViewInit { } disablePurge(): boolean { - return + return ( + !this.context.patron || this.context.patron.super_user() === 't' || - this.patronId === this.auth.user().id(); + this.patronId === this.auth.user().id() + ); } purgeAccount() { diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts index eaef4a13a1..78f25ad686 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts @@ -38,7 +38,7 @@ interface PatronStats { holds: { ready: number; total: number; - } + }; } @Injectable() @@ -121,14 +121,14 @@ export class PatronManagerService { stats.checkouts[key] = Number(stats.checkouts[key])); stats.checkouts.total_out = stats.checkouts.out + - stats.checkouts.overdue + stats.checkouts.long_overdue + stats.checkouts.overdue + stats.checkouts.long_overdue; if (!this.noTallyClaimsReturned) { stats.checkouts.total_out += stats.checkouts.claims_returned; } if (this.tallyLost) { - stats.checkouts.total_out += stats.checkouts.lost + stats.checkouts.total_out += stats.checkouts.lost; } this.patronStats = stats; @@ -140,7 +140,7 @@ export class PatronManagerService { return this.net.request( 'open-ils.circ', 'open-ils.circ.open_non_cataloged_circulation.user.authoritative', - this.auth.token(), id).toPromise() + this.auth.token(), id).toPromise(); }).then(noncats => { if (noncats && this.patronStats) { diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts index 3a8dee7afe..4920a5ada7 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts @@ -119,7 +119,7 @@ export class HoldsGridComponent implements OnInit { } // If true, show recently canceled holds only. - @Input() showRecentlyCanceled: boolean = false; + @Input() showRecentlyCanceled = false; // Include holds fulfilled on or after hte provided date. // If no value is passed, fulfilled holds are not displayed. diff --git a/Open-ILS/src/eg2/src/app/staff/share/patron/search.component.ts b/Open-ILS/src/eg2/src/app/staff/share/patron/search.component.ts index 01418f7bb8..24341568dd 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/patron/search.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/patron/search.component.ts @@ -28,17 +28,17 @@ const EXPAND_FORM = 'eg.circ.patron.search.show_extras'; const INCLUDE_INACTIVE = 'eg.circ.patron.search.include_inactive'; export interface PatronSearchField { - value: any, - group?: number + value: any; + group?: number; } export interface PatronSearchFieldSet { - [field: string]: PatronSearchField + [field: string]: PatronSearchField; } export interface PatronSearch { - search: PatronSearchFieldSet, - orgId: number + search: PatronSearchFieldSet; + orgId: number; } @Component({ @@ -157,7 +157,7 @@ export class PatronSearchComponent implements OnInit, AfterViewInit { return user; } - // Absorbe a patron search object into the search form. + // Absorb a patron search object into the search form. absorbPatronSearch(pSearch: PatronSearch) { if (pSearch.orgId) { @@ -222,8 +222,11 @@ export class PatronSearchComponent implements OnInit, AfterViewInit { Object.keys(this.search).forEach(field => { search[field] = this.mapSearchField(field); - if (field !== 'inactive') { // one filter is not enough - if (search[field]) { hasSearch = true; } + if (search[field]) { + // one filter is not enough + if (field !== 'inactive') { hasSearch = true; } + } else { + delete search[field]; } }); -- 2.11.0