From 71d9f5488e5a01005a887292d75c329c33e63b04 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 23 May 2018 21:41:01 -0400 Subject: [PATCH] add print and email actions to list and cart pages Signed-off-by: Galen Charlton --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 8 +++++++- .../lib/OpenILS/WWW/EGCatLoader/Container.pm | 21 ++++++++++++++++++++- Open-ILS/src/templates/opac/myopac/lists.tt2 | 3 +++ Open-ILS/src/templates/opac/parts/anon_list.tt2 | 5 ++++- 4 files changed, 34 insertions(+), 3 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 b6305175ed..9b9cd062ba 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -2473,7 +2473,7 @@ sub load_myopac_bookbags { } -# actions are create, delete, show, hide, rename, add_rec, delete_item, place_hold +# actions are create, delete, show, hide, rename, add_rec, delete_item, place_hold, print, email # CGI is action, list=list_id, add_rec/record=bre_id, del_item=bucket_item_id, name=new_bucket_name sub load_myopac_bookbag_update { my ($self, $action, $list_id, @hold_recs) = @_; @@ -2557,6 +2557,12 @@ sub load_myopac_bookbag_update { } return $self->generic_redirect($url); + } elsif ($action eq 'print') { + my $temp_cache_key = $self->_stash_record_list_in_anon_cache(@selected_item); + return $self->load_mylist_print($temp_cache_key); + } elsif ($action eq 'email') { + my $temp_cache_key = $self->_stash_record_list_in_anon_cache(@selected_item); + return $self->load_mylist_email($temp_cache_key); } else { $list = $e->retrieve_container_biblio_record_entry_bucket($list_id); 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 eb818ec5ef..d2cb53ec30 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Container.pm @@ -170,7 +170,7 @@ sub _do_mylist_delete { sub load_mylist_print { my $self = shift; - my $cache_key = $self->cgi->cookie((ref $self)->COOKIE_ANON_CACHE); + my $cache_key = shift // $self->cgi->cookie((ref $self)->COOKIE_ANON_CACHE); if (!$cache_key) { return $self->generic_redirect; @@ -219,6 +219,17 @@ sub load_mylist_email { return $self->generic_redirect($url); } +sub _stash_record_list_in_anon_cache { + my $self = shift; + my @rec_ids = @_; + + my $cache_key = $U->simplereq( + 'open-ils.actor', + 'open-ils.actor.anon_cache.set_value', + undef, (ref $self)->ANON_CACHE_MYLIST, [ @rec_ids ]); + return $cache_key; +} + sub load_mylist_move { my $self = shift; my @rec_ids = $self->cgi->param('record'); @@ -231,6 +242,14 @@ sub load_mylist_move { } return $self->load_myopac_bookbag_update('place_hold', undef, @rec_ids); } + if ($action eq 'print') { + my $temp_cache_key = $self->_stash_record_list_in_anon_cache(@rec_ids); + return $self->load_mylist_print($temp_cache_key); + } + if ($action eq 'email') { + my $temp_cache_key = $self->_stash_record_list_in_anon_cache(@rec_ids); + return $self->load_mylist_email($temp_cache_key); + } return $self->mylist_action_redirect unless $cache_key; diff --git a/Open-ILS/src/templates/opac/myopac/lists.tt2 b/Open-ILS/src/templates/opac/myopac/lists.tt2 index c8bee08572..53b604aa4f 100644 --- a/Open-ILS/src/templates/opac/myopac/lists.tt2 +++ b/Open-ILS/src/templates/opac/myopac/lists.tt2 @@ -287,12 +287,15 @@
+
[% IF bbag.items.size %]
[%- INCLUDE "opac/parts/preserve_params.tt2"; %] diff --git a/Open-ILS/src/templates/opac/parts/anon_list.tt2 b/Open-ILS/src/templates/opac/parts/anon_list.tt2 index 78887926e7..d1374116c8 100644 --- a/Open-ILS/src/templates/opac/parts/anon_list.tt2 +++ b/Open-ILS/src/templates/opac/parts/anon_list.tt2 @@ -12,11 +12,14 @@
-
+ +