From b52dac83fd59f45e94dcf05c5b9c633c4ad05135 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Fri, 30 Mar 2012 15:58:32 -0400 Subject: [PATCH] Stop saving patron barcode in cookies This causes bad interactions between patron windows and normal catalog windows. Examples: Load a patron, load place hold catalog in patron window. Future loads of non-patron catalogs will default to this patron. Load Patron A from written note, and open Place Hold catalog. Start searching for the item Patron A wants. Get interupted by Patron B calling. Load Patron B, and open Place Hold catalog. Search, place a hold for Patron B. Return to Patron A, find item, go to place hold. Find Patron B's barcode populated. Instead, teach the staff javascript, that already knows how to load hold preferences, how to grab the barcode from xulG. This barcode should be specific to the patron window the catalog is embedded in, and won't 'leak' to other catalog interfaces. Signed-off-by: Thomas Berezansky Signed-off-by: Lebbeous Fogle-Weekley --- .../perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 12 -------- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 30 ++++++------------- .../src/templates/opac/parts/place_hold.tt2 | 4 +-- Open-ILS/web/js/ui/default/opac/staff.js | 16 ++++++---- .../xul/staff_client/server/patron/holds.js | 5 +--- 5 files changed, 23 insertions(+), 44 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 2e83f0f013..f41faf838f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -217,18 +217,6 @@ sub load_simple { $self->ctx->{page} = $page; $self->ctx->{search_ou} = $self->_get_search_lib(); - if (my $patron_barcode = $self->cgi->param("patron_barcode")) { - # Special CGI variable from staff client; propagate henceforth as cookie - $self->apache->headers_out->add( - "Set-Cookie" => $self->cgi->cookie( - -name => "patron_barcode", - -path => "/", - -secure => 1, - -value => $patron_barcode, - -expires => undef - ) - ); - } return Apache2::Const::OK; } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index bf01bc4433..76a88d8594 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -608,31 +608,19 @@ sub load_place_hold { $logger->info("Looking at hold_type: " . $ctx->{hold_type} . " and targets: @targets"); - # if the staff client provides a patron barcode, fetch the patron - if (my $bc = $self->cgi->cookie("patron_barcode")) { - $ctx->{patron_recipient} = $U->simplereq( - "open-ils.actor", "open-ils.actor.user.fleshed.retrieve_by_barcode", - $self->editor->authtoken, $bc - ) or return Apache2::Const::HTTP_BAD_REQUEST; - - $ctx->{default_pickup_lib} = $ctx->{patron_recipient}->home_ou; - } else { - $ctx->{staff_recipient} = $self->editor->retrieve_actor_user([ - $e->requestor->id, - { - flesh => 1, - flesh_fields => { - au => ['settings', 'card'] - } + $ctx->{staff_recipient} = $self->editor->retrieve_actor_user([ + $e->requestor->id, + { + flesh => 1, + flesh_fields => { + au => ['settings', 'card'] } - ]) or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; - } + } + ]) or return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; my $user_setting_map = { map { $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) } @{ - $ctx->{patron_recipient} - ? $ctx->{patron_recipient}->settings - : $ctx->{staff_recipient}->settings + $ctx->{staff_recipient}->settings } }; $ctx->{user_setting_map} = $user_setting_map; diff --git a/Open-ILS/src/templates/opac/parts/place_hold.tt2 b/Open-ILS/src/templates/opac/parts/place_hold.tt2 index 71c9bdea42..ec979e311b 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold.tt2 @@ -18,11 +18,11 @@ + /> -
[%# XXX multi-barcode users? %] +