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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jun 16 12:55:25 EDT 2010


Author: miker
Date: 2010-06-16 12:55:21 -0400 (Wed, 16 Jun 2010)
New Revision: 16727

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
add support for status and copy location filters to supercat browse apis for call number, title/author/etc, item age and general tag browsing

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2010-06-16 14:54:40 UTC (rev 16726)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2010-06-16 16:55:21 UTC (rev 16727)
@@ -352,6 +352,8 @@
 	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 @@
                        },
 		  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 @@
 	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 @@
     					  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 @@
 	    				  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
 	    				}

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-06-16 14:54:40 UTC (rev 16726)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-06-16 16:55:21 UTC (rev 16727)
@@ -1387,6 +1387,8 @@
 
     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 @@
 		$string,
 		$site,
 		$page_size,
-		$page
+		$page,
+		$status,
+		$cpLoc
 	)->gather(1);
 
     (my $norm_format = $format) =~ s/(-full|-uris)$//o;
@@ -1453,6 +1457,8 @@
 		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 @@
 		"open-ils.supercat.new_book_list",
 		$site,
 		$page_size,
-		$page
+		$page,
+		$status,
+		$cpLoc
 	)->gather(1);
 
     (my $norm_format = $format) =~ s/(-full|-uris)$//o;



More information about the open-ils-commits mailing list