$cache{list} = {}; # public object lists
# fetch-on-demand-and-cache subs for commonly used public data
- my @public_classes = qw/ccs aout/;
+ my @public_classes = qw/ccs aout cifm citm clm/;
for my $hint (@public_classes) {
$Fieldmapper::fieldmap->{$_}->{hint} eq $hint
} keys %{ $Fieldmapper::fieldmap };
+ my $ident_field = $Fieldmapper::fieldmap->{$class}->{identity};
+
$class =~ s/Fieldmapper:://o;
$class =~ s/::/_/g;
$ctx->{$find_key} = sub {
my $id = shift;
return $cache{map}{$hint}{$id} if $cache{map}{$hint}{$id};
- ($cache{map}{$hint}{$id}) = grep { $_->id == $id } @{$ctx->{$list_key}->()};
+ ($cache{map}{$hint}{$id}) = grep { $_->$ident_field eq $id } @{$ctx->{$list_key}->()};
return $cache{map}{$hint}{$id};
};
my $self = shift;
my $ctx = $self->ctx;
my $e = $self->editor;
+ my $cgi = $self->cgi;
$self->ctx->{page} = 'place_hold';
- $ctx->{hold_target} = $self->cgi->param('hold_target');
- $ctx->{hold_type} = $self->cgi->param('hold_type');
+ $ctx->{hold_target} = $cgi->param('hold_target');
+ $ctx->{hold_type} = $cgi->param('hold_type');
$ctx->{default_pickup_lib} = $e->requestor->home_ou; # XXX staff
if($ctx->{hold_type} eq 'T') {
$ctx->{marc_xml} = XML::LibXML->new->parse_string($ctx->{record}->marc);
- if(my $pickup_lib = $self->cgi->param('pickup_lib')) {
+ if(my $pickup_lib = $cgi->param('pickup_lib')) {
my $args = {
patronid => $e->requestor->id,
);
if($stat and $stat > 0) {
- $ctx->{hold_success} = 1;
+
+ # if successful, return the user to the requesting page
+ $self->apache->print($cgi->redirect(-url => $cgi->referer));
+ return Apache2::Const::REDIRECT;
+
} else {
$ctx->{hold_failed} = 1; # XXX process the events, etc
}
}
-
- # place the hold and deliver results
}
return Apache2::Const::OK;
+++ /dev/null
-[% WRAPPER "default/opac/base.tt2" %]
-[% ctx.page_title = "Results" %]
-[% page = ctx.cgi.param('page') || 0; %]
-<a href='?page=[% page - 1 %]'>Prev</a> <a href='?page=[% page + 1 %]'>Next</a>
-<br/>
-
-<table>
-[%
- e = ctx.editor;
- idx = 0;
- WHILE idx < 10;
- id = idx + page * 10;
- attrs = e.search_acq_lineitem_attr({lineitem => id});
- isbn = '';
- FOR attr IN attrs;
- IF attr.attr_name == 'isbn';
- isbn = attr.attr_value;
- LAST;
- END;
- END;
- idx = idx + 1;
-%]
-
-<tr>
- <td><img width='65' height='90' src='/opac/extras/ac/jacket/small/[% isbn %]'/></td>
- <td>[% FOR attr IN attrs; attr.attr_value _ ' / '; END; %]</td>
-</tr>
-
- [% END %]
-</table>
-[% END %]
[% END %]
</td>
<td width='auto'>
- <div>
- <a href='record/[% rec.bre.id %]'>[% attrs.title %]</a>
- <span style='padding-left:10px;'>[% rec.copy_counts.available %] / [% rec.copy_counts.visible %]</span>
- </div>
+ <div width='99%'>
+ <div style='float:left'>
+ <a href='record/[% rec.bre.id %]'>[% attrs.title %]</a>
+ </div>
+ <div style='float:right'>
+ <span>[% rec.copy_counts.available %] / [% rec.copy_counts.visible %]</span>
+ <span style='padding-left:10px;'><a href='place_hold?hold_target=[% rec.bre.id %]&hold_type=T'>Place Hold</a></span>
+ </div>
+ </div><br/>
<div>[% attrs.author %]</div>
<div>[% attrs.isbn || attrs.issn || attrs.upc %] [% attrs.publisher %] [% attrs.pubdate %]</div>
</td>
+++ /dev/null
-<div style='position:absolute; top:0px; right:0px; border-left:1px solid #9A9; border-bottom:1px solid #9A9; padding: 10px; background:#ded'>
- [% IF ctx.user; %]
- <table>
- <tr>
- <td colspan='2' style='border-bottom:1px solid #9A9'>Welcome, [% ctx.user.usrname %]!</td>
- </tr>
- <tr>
- <td>Total Holds</td><td>[% ctx.user_stats.holds.total %]</td>
- </tr>
- <tr>
- <td>Ready Holds</td><td>[% ctx.user_stats.holds.ready %]</td>
- </tr>
- <tr>
- <td>Items Out</td><td>[% ctx.user_stats.checkouts.out %]</td>
- </tr>
- <tr>
- <td>Fines</td><td>$[% ctx.user_stats.fines.balance_owed %]</td>
- </tr>
- <tr>
- <td><a href='logout'>Logout</a></td>
- <td><a href='myopac/main'>Account</a></td>
- </tr>
- </table>
- [% ELSE %]
- <a href='[% ctx.base_url.replace('^http:', 'https:') _ ctx.base_path _ '/opac/login' %]'>Login</a>
- [% END %]
-</div>