From 697d86d25dab0553f2518993cf2d64ce660a278c Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 8 Jun 2018 17:14:01 -0400 Subject: [PATCH] implement warning if attempting action from cart view with nothing selected Signed-off-by: Galen Charlton --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm | 8 ++++++++ Open-ILS/src/templates/opac/parts/anon_list.tt2 | 5 ++++- Open-ILS/src/templates/opac/parts/header.tt2 | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm index 3976e5f90e..07f1aabe73 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm @@ -236,6 +236,14 @@ sub load_mylist_move { my $action = $self->cgi->param('action') || ''; my ($cache_key, $list) = $self->fetch_mylist; + + if ((scalar(@rec_ids) == 0) || + ($self->cgi->param('entire_list') && scalar(@$list) == 0)) { + my $url = $self->ctx->{referer}; + $url .= ($url =~ /\?/ ? '&' : '?') . 'cart_none_selected=1'; + return $self->generic_redirect($url); + } + if ($action eq 'place_hold') { if ($self->cgi->param('entire_list')) { @rec_ids = @$list; diff --git a/Open-ILS/src/templates/opac/parts/anon_list.tt2 b/Open-ILS/src/templates/opac/parts/anon_list.tt2 index d1374116c8..caf6f0ad52 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 @@
- +
[%- INCLUDE "opac/parts/preserve_params.tt2"; %] + [% IF CGI.param('cart_none_selected') %] + [% l('No items were selected') %] + [% END %]
diff --git a/Open-ILS/src/templates/opac/parts/header.tt2 b/Open-ILS/src/templates/opac/parts/header.tt2 index d5c0871b64..12fbda7fd2 100644 --- a/Open-ILS/src/templates/opac/parts/header.tt2 +++ b/Open-ILS/src/templates/opac/parts/header.tt2 @@ -64,6 +64,7 @@ # some standing, hardcoded parameters to always clear # because they're used for specific, transitory purposes cgi.delete('move_cart_by_default'); + cgi.delete('cart_none_selected'); # x and y are artifacts of using tags # instead of true submit buttons, and their values are never used. -- 2.11.0