From 240685d185761087aba05b48efccc7796d91aecb Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 2 Nov 2011 11:28:57 -0400 Subject: [PATCH] TPac; hold success confirmation; redirect repairs 1. After a successful hold placement, provide feedback to the user that the hold placement succeeded. After placement, the user is taken to a page (same page for failed holds) where the title(s) are listed along with the success/failure information for each. 2. In some cases, the user may be redirected to the my account page instead of the point of origin for holds placement. This occurs generally when the user is not already logged in and is asked to log in prior to holds placement. 3. As a side effect, this change replaces one of the ornery history.go(-1) actions with a true href/URL. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 48 +++++-------------- .../src/templates/opac/parts/place_hold.tt2 | 13 ++--- .../opac/parts/place_hold_result.tt2 | 12 +++-- .../templates/opac/parts/record/issues.tt2 | 3 +- .../templates/opac/parts/record/summary.tt2 | 9 ++-- .../src/templates/opac/parts/result/table.tt2 | 3 +- 6 files changed, 34 insertions(+), 54 deletions(-) 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 21c08abbb4..e97f499ac8 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -530,7 +530,7 @@ sub load_place_hold { $ctx->{hold_type} = $cgi->param('hold_type'); $ctx->{default_pickup_lib} = $e->requestor->home_ou; # unless changed below - return $self->post_hold_redirect unless @targets; + return $self->generic_redirect unless @targets; $logger->info("Looking at hold targets: @targets"); @@ -715,45 +715,19 @@ sub load_place_hold { $bses->kill_me; } - # stay on the current page and display the results - return Apache2::Const::OK if - (grep {$_->{hold_failed}} @hold_data) or $ctx->{general_hold_error}; + # NOTE: we are leaving the staff-placed patron barcode cookie + # in place. Otherwise, it's not possible to place more than + # one hold for the patron within a staff/patron session. This + # does leave the barcode to linger longer than is ideal, but + # normal staff work flow will cause the cookie to be replaced + # with each new patron anyway. + # TODO: See about getting the staff client to clear the cookie - # if successful, do some cleanup and return the - # user to the requesting page. - - return $self->post_hold_redirect; -} - -sub post_hold_redirect { - my $self = shift; - - # XXX: Leave the barcode cookie in place. Otherwise, it's not - # possible to place more than one hold for the patron within - # a staff/patron session. This does leave the barcode to linger - # longer than is ideal, but normal staff work flow will cause the - # cookie to be replaced with each new patron anyway. - # TODO: See about getting the staff client to clear the cookie - return $self->generic_redirect; - - # We also clear the patron_barcode (from the staff client) - # cookie at this point (otherwise it haunts the staff user - # later). XXX todo make sure this is best; also see that - # template when staff mode calls xulG.opac_hold_placed() - - return $self->generic_redirect( - undef, - $self->cgi->cookie( - -name => "patron_barcode", - -path => "/", - -secure => 1, - -value => "", - -expires => "-1h" - ) - ); + # return to the place_hold page so the results of the hold + # placement attempt can be reported to the user + return Apache2::Const::OK; } - sub fetch_user_circs { my $self = shift; my $flesh = shift; # flesh bib data, etc. diff --git a/Open-ILS/src/templates/opac/parts/place_hold.tt2 b/Open-ILS/src/templates/opac/parts/place_hold.tt2 index 6da63da8fd..4580b9cba4 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold.tt2 @@ -6,15 +6,12 @@

[% l('Place Hold') %]

- [%# - new_redirect_to = ctx.referer; - IF new_redirect_to.match('redirect_to'); - new_redirect_to = 'https://' _ ctx.hostname _ ctx.opac_root _ '/home'; - ELSE; - new_redirect_to = new_redirect_to | replace('^http:', 'https:'); - END; + [% + redirect = CGI.param('hold_source_page') || CGI.param('redirect_to') || CGI.referer; + # since we have to be logged in to get this far, return to a secure page + redirect = redirect.replace('^http:', 'https:') %] - + [% IF ctx.is_staff %]

diff --git a/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 b/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 index 7ff5541d78..f92c38f261 100644 --- a/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 +++ b/Open-ILS/src/templates/opac/parts/place_hold_result.tt2 @@ -1,6 +1,7 @@ [% PROCESS "opac/parts/misc_util.tt2"; PROCESS "opac/parts/hold_error_messages.tt2"; override_possible = 0; + any_failures = 0; %] @@ -37,9 +38,9 @@

[% IF hdata.hold_success %] -
[% l("Hold was successfully placed"); %]
+
[% l("Hold was successfully placed"); %]
- [% ELSIF hdata.hold_failed %] + [% ELSIF hdata.hold_failed; any_failures = 1 %]
[% l("Hold was not successfully placed"); %]
[% IF hdata.hold_local_block %] @@ -90,8 +91,11 @@ [% END %] - + [% IF any_failures OR ctx.general_hold_error %] + [% l('Cancel') %] + [% ELSE %] + [% l('Continue') %] + [% END %]
diff --git a/Open-ILS/src/templates/opac/parts/record/issues.tt2 b/Open-ILS/src/templates/opac/parts/record/issues.tt2 index 00a3ecab59..4ed20aff2c 100644 --- a/Open-ILS/src/templates/opac/parts/record/issues.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/issues.tt2 @@ -14,7 +14,8 @@ FOREACH type IN ctx.holding_summaries.keys; [% blob.issuance.label | html %] [% IF blob.has_units %] - [% l("Place Hold") %] + [% l("Place Hold") %] [% END %] diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2 index 490a860e59..bbfb1c14f6 100644 --- a/Open-ILS/src/templates/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2 @@ -23,7 +23,8 @@
@@ -137,11 +138,13 @@ copy_info.status_holdable == 't'); IF overall_holdable; l("Place on"); %] - [% l("copy") %] + [% l("copy") %] [%- IF copy_info.call_number != last_cn; last_cn = copy_info.call_number; l(" / "); %] - [% l("volume") %] + [% l("volume") %] [%- END; ELSE; l("No"); diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index 83e69b9f9b..422a378a52 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -208,7 +208,8 @@