From d75c80bc4df5314ede9407883483d5d4e809fc00 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 23 May 2018 13:39:48 -0400 Subject: [PATCH] start teachng /eg/opac/record/print how to print an entire list If a new is_list CGI parameter has a truthy value, the page argument is interpreted as the key of an anonymous cache entry containing a list of one or more bibliographic records to print (rather than as the ID of a single bib record). Signed-off-by: Galen Charlton --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index 2e48ce394c..f7d4882ff9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -509,13 +509,35 @@ sub get_hold_copy_summary { sub load_print_record { my $self = shift; - my $rec_id = $self->ctx->{page_args}->[0] + my $rec_or_list_id = $self->ctx->{page_args}->[0] or return Apache2::Const::HTTP_BAD_REQUEST; - $self->{ctx}->{bre_id} = $rec_id; + my $is_list = $self->cgi->param('is_list'); + my $list; + if ($is_list) { + + $list = $U->simplereq( + 'open-ils.actor', + 'open-ils.actor.anon_cache.get_value', + $rec_or_list_id, (ref $self)->ANON_CACHE_MYLIST); + + if(!$list) { + $list = []; + } + + { # sanitize + no warnings qw/numeric/; + $list = [map { int $_ } @$list]; + $list = [grep { $_ > 0} @$list]; + }; + } else { + $list = $rec_or_list_id; + $self->{ctx}->{bre_id} = $rec_or_list_id; + } + $self->{ctx}->{printable_record} = $U->simplereq( 'open-ils.search', - 'open-ils.search.biblio.record.print', $rec_id); + 'open-ils.search.biblio.record.print', $list); return Apache2::Const::OK; } -- 2.11.0