From 48d6918056e44d3cb010a2329fa757be438f43e7 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/src/eg2/src/app/staff/catalog/hold/hold.component.ts | 5 ++++- Open-ILS/web/js/ui/default/staff/circ/patron/holds.js | 2 +- 3 files changed, 12 insertions(+), 4 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/src/eg2/src/app/staff/catalog/hold/hold.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts index a74bc37354..d9c0c31d35 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts @@ -578,7 +578,10 @@ export class HoldComponent implements OnInit { if (!ctx.success) { reset = false; } }); - if (reset) { this.resetRecipient(); } + if (reset) { + this.resetRecipient(); + this.staffCat.clearHoldPatron(); + } } // When placing holds on multiple copies per target, add a hold 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