From 8edc62ace7dfa5583826f42505a2a4d92992c4b8 Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 16 Jun 2010 16:55:21 +0000 Subject: [PATCH] add support for status and copy location filters to supercat browse apis for call number, title/author/etc, item age and general tag browsing git-svn-id: svn://svn.open-ils.org/ILS/trunk@16727 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/SuperCat.pm | 25 +++++++++++++++++++--- Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm | 12 +++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index a37e588a7..e787ae1b9 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -352,6 +352,8 @@ sub new_books_by_item { my $ou = shift; my $page_size = shift || 10; my $page = shift || 1; + my $statuses = shift || []; + my $copy_locations = shift || []; my $offset = $page_size * ($page - 1); @@ -377,7 +379,12 @@ sub new_books_by_item { }, from => { 'acn' => { 'acp' => { field => call_number => fkey => 'id' } } }, where => - { '+acp' => { deleted => 'f', (@ou_ids) ? ( circ_lib => \@ou_ids) : () }, + { '+acp' => + { deleted => 'f', + ((@ou_ids) ? ( circ_lib => \@ou_ids) : ()), + ((@$statuses) ? ( status => $statuses) : ()), + ((@$copy_locations) ? ( location => $copy_locations) : ()) + }, '+acn' => { record => { '>' => 0 } }, }, order_by => { acp => { create_date => { transform => 'max', direction => 'desc' } } }, @@ -513,6 +520,8 @@ sub tag_sf_browse { my $ou = shift; my $page_size = shift || 9; my $page = shift || 0; + my $statuses = shift || []; + my $copy_locations = shift || []; my ($before_limit,$after_limit) = (0,0); my ($before_offset,$after_offset) = (0,0); @@ -561,7 +570,12 @@ sub tag_sf_browse { from => { acn => { acp => { field => 'call_number', fkey => 'id' } } }, where => { '+acn' => { record => { '=' => { '+mfr' => 'record' } } }, - '+acp' => { deleted => 'f', (@ou_ids) ? ( circ_lib => \@ou_ids) : () } + '+acp' => + { deleted => 'f', + ((@ou_ids) ? ( circ_lib => \@ou_ids) : ()), + ((@$statuses) ? ( status => $statuses) : ()), + ((@$copy_locations) ? ( location => $copy_locations) : ()) + } }, limit => 1 } @@ -603,7 +617,12 @@ sub tag_sf_browse { from => { acn => { acp => { field => 'call_number', fkey => 'id' } } }, where => { '+acn' => { record => { '=' => { '+mfr' => 'record' } } }, - '+acp' => { deleted => 'f', (@ou_ids) ? ( circ_lib => \@ou_ids) : () } + '+acp' => + { deleted => 'f', + ((@ou_ids) ? ( circ_lib => \@ou_ids) : ()), + ((@$statuses) ? ( status => $statuses) : ()), + ((@$copy_locations) ? ( location => $copy_locations) : ()) + } }, limit => 1 } diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm index 36809bc89..e2fa3b031 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm @@ -1387,6 +1387,8 @@ sub string_browse { return item_age_browse($apache) if ($axis eq 'item-age'); # short-circut to the item-age sub + my $status = [$cgi->param('status')]; + my $cpLoc = [$cgi->param('copyLocation')]; $site ||= $cgi->param('searchOrg'); $page ||= $cgi->param('startPage') || 0; $page_size ||= $cgi->param('count') || 9; @@ -1411,7 +1413,9 @@ sub string_browse { $string, $site, $page_size, - $page + $page, + $status, + $cpLoc )->gather(1); (my $norm_format = $format) =~ s/(-full|-uris)$//o; @@ -1453,6 +1457,8 @@ sub item_age_browse { return undef; } + my $status = [$cgi->param('status')]; + my $cpLoc = [$cgi->param('copyLocation')]; $site ||= $cgi->param('searchOrg') || '-'; $page ||= $cgi->param('startPage') || 1; $page_size ||= $cgi->param('count') || 10; @@ -1466,7 +1472,9 @@ sub item_age_browse { "open-ils.supercat.new_book_list", $site, $page_size, - $page + $page, + $status, + $cpLoc )->gather(1); (my $norm_format = $format) =~ s/(-full|-uris)$//o; -- 2.11.0