From 21fbd106fb8270d2fe2af3cf856f91e56e9fb54e Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 7 Jul 2010 00:29:37 +0000 Subject: [PATCH] adding status/copy_location filter support to call number browse git-svn-id: svn://svn.open-ils.org/ILS/trunk@16863 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/SuperCat.pm | 25 ++++++++++++++++++++++ Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index d8d2571423..da605194a7 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -244,6 +244,8 @@ sub cn_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); @@ -278,12 +280,28 @@ sub cn_browse { my @list = (); + my @cp_filter = (); + if (@$statuses || @$copy_locations) { + @cp_filter = ( + '-exists' => { + from => 'acp', + where => { + call_number => { '=' => { '+acn' => 'id' } }, + deleted => 'f', + ((@$statuses) ? ( status => $statuses) : ()), + ((@$copy_locations) ? ( location => $copy_locations) : ()) + } + } + ); + } + if ($page <= 0) { my $before = $_storage->request( "open-ils.cstore.direct.asset.call_number.search.atomic", { label => { "<" => { transform => "upper", value => ["upper", $label] } }, owning_lib => \@ou_ids, deleted => 'f', + @cp_filter }, { flesh => 1, flesh_fields => { acn => [qw/record owning_lib/] }, @@ -301,6 +319,7 @@ sub cn_browse { { label => { ">=" => { transform => "upper", value => ["upper", $label] } }, owning_lib => \@ou_ids, deleted => 'f', + @cp_filter }, { flesh => 1, flesh_fields => { acn => [qw/record owning_lib/] }, @@ -337,6 +356,12 @@ Returns the XML representation of the requested bibliographic record's holdings { name => 'page', desc => 'The page of call numbers to retrieve, calculated based on page_size. Can be positive, negative or 0.', type => 'number' }, + { name => 'statuses', + desc => 'Array of statuses to filter copies by, optional and can be undef.', + type => 'array' }, + { name => 'locations', + desc => 'Array of copy locations to filter copies by, optional and can be undef.', + type => 'array' }, ], 'return' => { desc => 'Call numbers with owning_lib and record fleshed', diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm index 65d4eae0df..a8a4c6e58d 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm @@ -1432,7 +1432,7 @@ sub string_browse { unless ($string and $axis and grep { $axis eq $_ } keys %browse_types) { warn "something's wrong..."; - warn " >>> $format -> $axis -> $site -> $string -> $page -> $page_size "; + warn " >>> format: $format -> axis: $axis -> site: $site -> string: $string -> page: $page -> page_size: $page_size "; return undef; } -- 2.11.0