use base 'OpenILS::WWW::EGCatLoader';
use strict; use warnings;
use XML::Simple;
-use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_INTERNAL_SERVER_ERROR REDIRECT HTTP_BAD_REQUEST);
+use Apache2::Const -compile => qw(OK HTTP_BAD_REQUEST);
use OpenSRF::Utils::Logger qw/$logger/;
use OpenILS::Application::AppUtils;
use OpenILS::Utils::CStoreEditor qw/:funcs/;
# ----------------------------------------------------------------
return $self->redirect_ssl unless $self->cgi->https;
- return $self->load_simple("getit_results") if $path =~ m|kpac/getit_results|;
+ return $self->load_getit_results if $path =~ m|kpac/getit_results|;
return $self->load_getit if $path =~ m|kpac/getit|;
# ----------------------------------------------------------------
if ($bookbag_id) {
# save to existing bookbag
+ $self->cgi->param('record', $rec_id);
+ my $stat = $self->load_myopac_bookbag_update('add_rec', $bookbag_id);
+ # TODO: check for failure
+ (my $new_uri = $self->apache->unparsed_uri) =~ s/getit/getit_results/g;
+ $new_uri .= ($new_uri =~ /\?/) ? "&list=$bookbag_id" : "?list=$bookbag_id";
+ return $self->generic_redirect($new_uri);
} else {
# save to anonymous list
# set some params assumed to exist for load_mylist_add
$self->cgi->param('record', $rec_id);
(my $new_uri = $self->apache->unparsed_uri) =~ s/getit/getit_results/g;
+ $new_uri .= ($new_uri =~ /\?/) ? '&list=anon' : '?list=anon';
$self->cgi->param('redirect_to', $new_uri);
- $self->load_mylist_add;
+ return $self->load_mylist_add;
+ }
+
+ return Apache2::Const::HTTP_BAD_REQUEST;
+}
+
+
+sub load_getit_results {
+ my $self = shift;
+ my $ctx = $self->ctx;
+ my $e = $self->editor;
+ my $list = $self->cgi->param('list');
+ my $hold_id = $self->cgi->param('hold');
+ my $rec_id = $ctx->{page_args}->[0];
+
+ my (undef, @rec_data) = $self->get_records_and_facets([$rec_id]);
+ $ctx->{bre_id} = $rec_data[0]->{id};
+ $ctx->{marc_xml} = $rec_data[0]->{marc_xml};
+
+ if ($list) {
+ if ($list eq 'anon') {
+ $ctx->{anon_list} = 1;
+ } else {
+ $ctx->{list} = $e->retrieve_container_biblio_record_entry_bucket($list);
+ }
+
+ } elsif ($hold_id) {
+
+ # new hold means potential for replication lag
+ $e->xact_start;
+ # fetch the hold...
+ $e->xact_rollback;
}
return Apache2::Const::OK;
[% PROCESS "opac/parts/header.tt2";
PROCESS "kpac/parts/grid.tt2";
WRAPPER "kpac/parts/subpage.tt2";
- ctx.page_title = l('Get it') %]
+ PROCESS "opac/parts/misc_util.tt2"; # MARC
+ attrs = {marc_xml => ctx.marc_xml};
+ PROCESS get_marc_attrs args=attrs;
+ ctx.page_title = l('Get it');
+ kill_params = ['list', 'hold'];
+ title_html = attrs.title | html;
+%]
- <h2 class="sub_header2">You Got It!</h2>
-
- <div class="checkout_res_body">
- <p>Your Request for <a href="javascript:;">Book Name</a> was successful.<br />You will be able to pick up this material at <a href="javascript:;">Fairwood</a>.</p>
- </div>
-
- <div class="sub_navigation2 checkout">
- <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr>
- <td><a href="javascript:;"><img src="[% ctx.media_prefix %]/images/kpac/back_to_results_btn.png" /></a></td>
- <td width="100%" class="nav_mid_bg"> </td>
- <td><img src="[% ctx.media_prefix %]/images/kpac/back_to_book.png" /></td>
- <td nowrap="nowrap"><a class="checkout_res_back" href="javascript:;">Back to <span>Book Name</span></a></td>
- </tr></table>
- </div>
+<h2 class="sub_header2">You Got It!</h2>
+
+<div class="checkout_res_body">
+ [% IF ctx.anon_list %]
+ <p>
+ [% |l(title_html) %]
+ You successfully saved [_1]. <br/>
+ To manage your lists, go to <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {}, 1) %]">My Lists</a>
+ [% END %]
+ <p>
+ [% ELSIF ctx.list %]
+ [% list_html = ctx.list.name | html %]
+ <p>
+ [% |l(title_html, list_html) %]
+ You successfully saved [_1] to [_2]. <br/>
+ To manage your lists, go to <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {}, 1) %]">My Lists</a>
+ [% END %]
+ <p>
+ [% ELSE %]
+ [% lib_html = ctx.get_aou(ctx.hold.pickup_lib).name | html %]
+ <p>
+ [% |l(title_html, lib_html) %]
+ Your request for <a href="[% mkurl(ctx.kpac_root _ '/record/' _ ctx.bre_id, {}, kill_params) %]">[_1]</a> was successful.<br/>
+ You will be able to pick up this material at [_2].
+ [% END %]
+ <p>
+ [% END %]
+</div>
+
+<div class="sub_navigation2 checkout">
+ <table cellpadding="0" cellspacing="0" border="0" width="100%"><tr>
+ <td><a href="[% mkurl(ctx.kpac_root _ '/results', {}, kill_params) %]">
+ <img src="[% ctx.media_prefix %]/images/kpac/back_to_results_btn.png" /></a></td>
+ <td width="100%" class="nav_mid_bg"> </td>
+ <td><img src="[% ctx.media_prefix %]/images/kpac/back_to_book.png" /></td>
+ <td nowrap="nowrap">
+ <a class="checkout_res_back" href="[% mkurl(ctx.kpac_root _ '/record/' _ ctx.bre_id, {}, kill_params) %]">
+ [% title = attrs.title || '';
+ title = title.substr(18, title.length, '...');
+ l('Back to [_1]', title);
+ %]
+ </a>
+ </td>
+ </tr></table>
+</div>
[% END %]