add support for status and copy location filters to supercat browse apis for call...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Jun 2010 16:55:21 +0000 (16:55 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Jun 2010 16:55:21 +0000 (16:55 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16727 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm

index a37e588..e787ae1 100644 (file)
@@ -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
                                        }
index 36809bc..e2fa3b0 100644 (file)
@@ -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;