From 4609c1ffebe9b4e133eef2d43faba517cb40f8be Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 27 Jan 2011 14:55:44 -0500 Subject: [PATCH] more holds work; added item form/type/lang maps to list of public access classes; removed some unused test tempates --- Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm | 21 +++++++++------ Open-ILS/web/templates/default/opac/place_hold.tt2 | 1 + Open-ILS/web/templates/default/opac/records.tt2 | 31 ---------------------- Open-ILS/web/templates/default/opac/results.tt2 | 13 ++++++--- Open-ILS/web/templates/default/opac/welcome.tt2 | 27 ------------------- 5 files changed, 23 insertions(+), 70 deletions(-) delete mode 100644 Open-ILS/web/templates/default/opac/records.tt2 delete mode 100644 Open-ILS/web/templates/default/opac/welcome.tt2 diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm index 167f408d8c..aabc73d60c 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/EGCatLoader.pm @@ -104,7 +104,7 @@ sub load_helpers { $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) { @@ -112,6 +112,8 @@ sub load_helpers { $Fieldmapper::fieldmap->{$_}->{hint} eq $hint } keys %{ $Fieldmapper::fieldmap }; + my $ident_field = $Fieldmapper::fieldmap->{$class}->{identity}; + $class =~ s/Fieldmapper:://o; $class =~ s/::/_/g; @@ -130,7 +132,7 @@ sub load_helpers { $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}; }; @@ -547,10 +549,11 @@ sub load_place_hold { 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') { @@ -560,7 +563,7 @@ sub load_place_hold { $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, @@ -592,13 +595,15 @@ sub load_place_hold { ); 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; diff --git a/Open-ILS/web/templates/default/opac/place_hold.tt2 b/Open-ILS/web/templates/default/opac/place_hold.tt2 index b92315bd75..71810a736d 100644 --- a/Open-ILS/web/templates/default/opac/place_hold.tt2 +++ b/Open-ILS/web/templates/default/opac/place_hold.tt2 @@ -25,6 +25,7 @@ + [% END %] diff --git a/Open-ILS/web/templates/default/opac/records.tt2 b/Open-ILS/web/templates/default/opac/records.tt2 deleted file mode 100644 index 7d53268286..0000000000 --- a/Open-ILS/web/templates/default/opac/records.tt2 +++ /dev/null @@ -1,31 +0,0 @@ -[% WRAPPER "default/opac/base.tt2" %] -[% ctx.page_title = "Results" %] -[% page = ctx.cgi.param('page') || 0; %] -Prev Next -
- - -[% - 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; -%] - - - - - - - [% END %] -
[% FOR attr IN attrs; attr.attr_value _ ' / '; END; %]
-[% END %] diff --git a/Open-ILS/web/templates/default/opac/results.tt2 b/Open-ILS/web/templates/default/opac/results.tt2 index fa09ccaa3d..700010e825 100644 --- a/Open-ILS/web/templates/default/opac/results.tt2 +++ b/Open-ILS/web/templates/default/opac/results.tt2 @@ -88,10 +88,15 @@ [% END %] -
- [% attrs.title %] - [% rec.copy_counts.available %] / [% rec.copy_counts.visible %] -
+
+
+ [% attrs.title %] +
+
+ [% rec.copy_counts.available %] / [% rec.copy_counts.visible %] + Place Hold +
+

[% attrs.author %]
[% attrs.isbn || attrs.issn || attrs.upc %] [% attrs.publisher %] [% attrs.pubdate %]
diff --git a/Open-ILS/web/templates/default/opac/welcome.tt2 b/Open-ILS/web/templates/default/opac/welcome.tt2 deleted file mode 100644 index 0cccd3fb34..0000000000 --- a/Open-ILS/web/templates/default/opac/welcome.tt2 +++ /dev/null @@ -1,27 +0,0 @@ -
- [% IF ctx.user; %] - - - - - - - - - - - - - - - - - - - - -
Welcome, [% ctx.user.usrname %]!
Total Holds[% ctx.user_stats.holds.total %]
Ready Holds[% ctx.user_stats.holds.ready %]
Items Out[% ctx.user_stats.checkouts.out %]
Fines$[% ctx.user_stats.fines.balance_owed %]
LogoutAccount
- [% ELSE %] - Login - [% END %] -
-- 2.11.0