[open-ils-commits] r16863 - in trunk/Open-ILS/src/perlmods/OpenILS: Application WWW (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jul 6 20:29:38 EDT 2010


Author: miker
Date: 2010-07-06 20:29:37 -0400 (Tue, 06 Jul 2010)
New Revision: 16863

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
adding status/copy_location filter support to call number browse

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2010-07-06 21:08:08 UTC (rev 16862)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2010-07-07 00:29:37 UTC (rev 16863)
@@ -244,6 +244,8 @@
 	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 @@
 
 	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 @@
 			{ 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 @@
 				{ 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',

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-07-06 21:08:08 UTC (rev 16862)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-07-07 00:29:37 UTC (rev 16863)
@@ -1432,7 +1432,7 @@
 
 	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;
 	}
 



More information about the open-ils-commits mailing list