From 8eae009b8c16f5e3b876ca9ba848e635a732b38d Mon Sep 17 00:00:00 2001 From: Dan Briem Date: Thu, 19 Jan 2023 10:33:00 -0500 Subject: [PATCH] LP#1996818 Issues Placing Holds from the Patron Record 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 --- Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts | 9 +++++++-- Open-ILS/web/js/ui/default/staff/circ/patron/holds.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts index 340a28dba2..f5d9677695 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.component.ts @@ -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(); + } } diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js index 3173bfdb70..795455df79 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js @@ -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'; -- 2.11.0