From 9cc650fb92140aa95b8dd0c2bd88b82e4b01f71c Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 8 Jun 2018 17:31:22 -0400 Subject: [PATCH] and have list actions check for zero-selection actions Signed-off-by: Galen Charlton --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 10 ++++++++++ Open-ILS/src/templates/opac/myopac/lists.tt2 | 5 ++++- Open-ILS/src/templates/opac/parts/anon_list.tt2 | 2 +- Open-ILS/src/templates/opac/parts/header.tt2 | 1 + 4 files changed, 16 insertions(+), 2 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 3ea7d7944b..b0d39ce9a7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -2496,6 +2496,16 @@ sub load_myopac_bookbag_update { my $success = 0; my $list; + # bail out if user is attempting an action that requires + # that at least one list item be selected + if ((scalar(@selected_item) == 0) && + ($action eq 'place_hold' || $action eq 'print' || + $action eq 'email' || $action eq 'del_item')) { + my $url = $self->ctx->{referer}; + $url .= ($url =~ /\?/ ? '&' : '?') . 'list_none_selected=1' unless $url =~ /list_none_selected/; + return $self->generic_redirect($url); + } + # This url intentionally leaves off the edit_notes parameter, but # may need to add some back in for paging. diff --git a/Open-ILS/src/templates/opac/myopac/lists.tt2 b/Open-ILS/src/templates/opac/myopac/lists.tt2 index d46dc345fb..0830cd3c9a 100644 --- a/Open-ILS/src/templates/opac/myopac/lists.tt2 +++ b/Open-ILS/src/templates/opac/myopac/lists.tt2 @@ -300,7 +300,7 @@
- +
[% IF bbag.items.size %]
@@ -313,6 +313,9 @@ [%- INCLUDE "opac/parts/preserve_params.tt2"; %] + [% IF CGI.param('list_none_selected') %] + [% l('No items were selected') %] + [% END %]
[% END %] diff --git a/Open-ILS/src/templates/opac/parts/anon_list.tt2 b/Open-ILS/src/templates/opac/parts/anon_list.tt2 index caf6f0ad52..0f2bacbf2f 100644 --- a/Open-ILS/src/templates/opac/parts/anon_list.tt2 +++ b/Open-ILS/src/templates/opac/parts/anon_list.tt2 @@ -13,7 +13,7 @@ - +
tags # instead of true submit buttons, and their values are never used. -- 2.11.0