LP1891960: Angular patron search org is sticky
authorJane Sandberg <sandbej@linnbenton.edu>
Mon, 24 Aug 2020 11:56:25 +0000 (04:56 -0700)
committerBill Erickson <berickxx@gmail.com>
Mon, 24 Aug 2020 14:29:37 +0000 (10:29 -0400)
Also removes some unused dependencies and adds
a new org setting to the database:
eg.orgselect.patron.search

To test:
1) Find a title in the staff catalog.
2) Click Place Hold.
3) Search for a Patron.
4) Notice that the search org is initially
your root org (Consortium-level).
5) Select a different value.
6) Leave and come back to this screen.  Note
that the value you selected remains.
7) Perform a search to make sure that the
search is limited to the org you selected.
8) Click the Clear button.  Note that the
value you selected still remains.
9) Perform anoter search to make sure that the
search is limited to the org you selected.

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/share/patron/search.component.html
Open-ILS/src/eg2/src/app/staff/share/patron/search.component.ts
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.patron-search-org-select.sql [new file with mode: 0644]

index f2e3632..3636b31 100644 (file)
       </div>
       <div class="col-lg-2">
         <eg-org-select (onChange)="searchOrg = $event"
-          [applyOrgId]="searchOrg ? searchOrg.id() : null"
+          persistKey="patron.search"
+          [fallbackOrg]="org.root()"
           i18n-placeholder placeholder="Home Library">
         </eg-org-select>
         <!-- home org -->
index 43f4fe1..004f684 100644 (file)
@@ -2,16 +2,11 @@ import {Component, Input, Output, OnInit, AfterViewInit,
     EventEmitter, ViewChild, Renderer2} from '@angular/core';
 import {Observable, of} from 'rxjs';
 import {map} from 'rxjs/operators';
-import {IdlService, IdlObject} from '@eg/core/idl.service';
-import {EventService} from '@eg/core/event.service';
+import {IdlObject} from '@eg/core/idl.service';
 import {NetService} from '@eg/core/net.service';
 import {AuthService} from '@eg/core/auth.service';
 import {OrgService} from '@eg/core/org.service';
-import {PcrudService} from '@eg/core/pcrud.service';
 import {ServerStoreService} from '@eg/core/server-store.service';
-import {ToastService} from '@eg/share/toast/toast.service';
-import {StringComponent} from '@eg/share/string/string.component';
-import {ComboboxEntry, ComboboxComponent} from '@eg/share/combobox/combobox.component';
 import {GridComponent} from '@eg/share/grid/grid.component';
 import {GridDataSource} from '@eg/share/grid/grid';
 import {Pager} from '@eg/share/util/pager';
@@ -53,7 +48,7 @@ export class PatronSearchComponent implements OnInit, AfterViewInit {
     constructor(
         private renderer: Renderer2,
         private net: NetService,
-        private org: OrgService,
+        public org: OrgService,
         private auth: AuthService,
         private store: ServerStoreService
     ) {
@@ -109,7 +104,6 @@ export class PatronSearchComponent implements OnInit, AfterViewInit {
 
     clear() {
         this.search = {profile: null};
-        this.searchOrg = this.org.root();
     }
 
     getRows(pager: Pager, sort: any[]): Observable<any> {
index 19398d4..36e655d 100644 (file)
@@ -20447,5 +20447,12 @@ VALUES (
         'Default org unit for catalog holds org unit selector',
         'cwst', 'label'
     )
+), (
+    'eg.orgselect.patron.search', 'gui', 'integer',
+    oils_i18n_gettext(
+        'eg.orgselect.patron.search',
+        'Default org unit for patron search',
+        'cwst', 'label'
+    )
 );
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.patron-search-org-select.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.patron-search-org-select.sql
new file mode 100644 (file)
index 0000000..2e6e3a9
--- /dev/null
@@ -0,0 +1,17 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.workstation_setting_type (name, grp, datatype, label)
+VALUES (
+    'eg.orgselect.patron.search', 'gui', 'integer',
+    oils_i18n_gettext(
+        'eg.orgselect.patron.search',
+        'Default org unit for patron search',
+        'cwst', 'label'
+    )
+);
+
+COMMIT;
+
+