LP1904036 Angular Patron edit/search repairs
authorBill Erickson <berickxx@gmail.com>
Tue, 17 Aug 2021 15:06:31 +0000 (11:06 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:36 +0000 (20:13 -0400)
* Fix inactive patron search
* New patrons are active by default
* Ensure new cards are correctly linked to new patrons.

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/edit.component.ts
Open-ILS/src/eg2/src/app/staff/share/patron/search.component.ts

index e0ab319..64c2531 100644 (file)
@@ -746,6 +746,7 @@ export class EditComponent implements OnInit, AfterViewInit {
         patron.isnew(true);
         patron.id(-1);
         patron.home_ou(this.auth.user().ws_ou());
+        patron.active('t');
         patron.settings([]);
         patron.waiver_entries([]);
         patron.stat_cat_entries([]);
@@ -753,6 +754,7 @@ export class EditComponent implements OnInit, AfterViewInit {
         const card = this.idl.create('ac');
         card.isnew(true);
         card.usr(-1);
+        card.id(this.autoId--);
         patron.card(card);
         patron.cards([card]);
 
index 9e73b28..46c07bc 100644 (file)
@@ -222,7 +222,7 @@ export class PatronSearchComponent implements OnInit, AfterViewInit {
             pSearch.search,
             pager.limit,
             sorter,
-            null, // ?
+            this.search.inactive,
             pSearch.orgId,
             DEFAULT_FLESH,
             pager.offset
@@ -250,10 +250,10 @@ export class PatronSearchComponent implements OnInit, AfterViewInit {
         const search: PatronSearchFieldSet = {};
 
         Object.keys(this.search).forEach(field => {
+            if (field === 'inactive') { return; }
             search[field] = this.mapSearchField(field);
-            if (search[field]) {
-                // one filter is not enough
-                if (field !== 'inactive') { hasSearch = true; }
+            if (search[field] !== null) {
+                hasSearch = true;
             } else {
                 delete search[field];
             }
@@ -276,7 +276,6 @@ export class PatronSearchComponent implements OnInit, AfterViewInit {
         switch (field) {
 
             case 'name': // name keywords
-            case 'inactive':
                 delete chunk.group;
                 break;