LP1904036 Patron UI lint repairs; sanity checks
authorBill Erickson <berickxx@gmail.com>
Thu, 12 Nov 2020 16:36:52 +0000 (11:36 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:23 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts
Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts
Open-ILS/src/eg2/src/app/staff/share/patron/search.component.ts

index c65d4d8..2e2f089 100644 (file)
@@ -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() {
index eaef4a1..78f25ad 100644 (file)
@@ -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) {
index 3a8dee7..4920a5a 100644 (file)
@@ -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.
index 01418f7..2434156 100644 (file)
@@ -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];
             }
         });