LP#1996818 Issues Placing Holds from the Patron Record user/dbriem/lp1996818_holds_from_patron_record
authorDan Briem <dbriem@wlsmail.org>
Thu, 19 Jan 2023 15:33:00 +0000 (10:33 -0500)
committerDan Briem <dbriem@wlsmail.org>
Fri, 26 May 2023 17:58:21 +0000 (17:58 +0000)
This clears the patron hold target cookie when navigating from
the staff/catalog route, when the window is closed, and when
holds are successfully placed.

This also changes the AngularJS patron interface to set the
same session cookie as the Angular interface.

Signed-off-by: Dan Briem <dbriem@wlsmail.org>
Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts
Open-ILS/web/js/ui/default/staff/circ/patron/holds.js

index 340a28d..f5d9677 100644 (file)
@@ -1,4 +1,4 @@
-import {Component, OnInit} from '@angular/core';
+import {Component, HostListener, OnDestroy, OnInit} from '@angular/core';
 import {IdlObject} from '@eg/core/idl.service';
 import {StaffCatalogService} from './catalog.service';
 import {BasketService} from '@eg/share/catalog/basket.service';
@@ -6,7 +6,7 @@ import {BasketService} from '@eg/share/catalog/basket.service';
 @Component({
   templateUrl: 'catalog.component.html'
 })
-export class CatalogComponent implements OnInit {
+export class CatalogComponent implements OnInit, OnDestroy {
 
     constructor(
         private basket: BasketService,
@@ -34,5 +34,10 @@ export class CatalogComponent implements OnInit {
     clearHoldPatron() {
         this.staffCat.clearHoldPatron();
     }
+
+    @HostListener('window:beforeunload')
+    ngOnDestroy(): void {
+        this.clearHoldPatron();
+    }
 }
 
index 3173bfd..795455d 100644 (file)
@@ -146,7 +146,7 @@ function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,
 
     $scope.place_hold = function() {
 
-        egCore.hatch.setLocalItem(
+        egCore.hatch.setLoginSessionItem(
             'eg.circ.patron_hold_target', patronSvc.current.card().barcode());
 
         $window.location.href = '/eg2/staff/catalog';