[open-ils-commits] r9846 - in trunk/Open-ILS/src:
perlmods/OpenILS/Application/Storage/Publisher sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jun 18 12:19:11 EDT 2008
Author: miker
Date: 2008-06-18 12:19:09 -0400 (Wed, 18 Jun 2008)
New Revision: 9846
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Log:
add copy locations as a search filter
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm 2008-06-18 05:24:09 UTC (rev 9845)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm 2008-06-18 16:19:09 UTC (rev 9846)
@@ -2346,12 +2346,17 @@
die "No search arguments were passed to ".$self->api_name;
}
- my (@statuses, at types, at forms, at lang, at aud, at lit_form, at vformats, at bib_level);
+ my (@statuses, at locations, at types, at forms, at lang, at aud, at lit_form, at vformats, at bib_level);
if ($args{available}) {
@statuses = (0,7);
}
+ if (my $s = $args{locations}) {
+ $s = [$s] if (!ref($s));
+ @locations = @$s;
+ }
+
if (my $s = $args{statuses}) {
$s = [$s] if (!ref($s));
@statuses = @$s;
@@ -2444,6 +2449,7 @@
my $param_depth = $args{depth}; $param_depth = 'NULL' unless (defined($param_depth) and length($param_depth) > 0 );
my $param_searches = OpenSRF::Utils::JSON->perl2JSON( \%stored_proc_search_args ); $param_searches =~ s/\$//go; $param_searches = '$$'.$param_searches.'$$';
my $param_statuses = '$${' . join(',', map { s/\$//go; "\"$_\""} @statuses) . '}$$';
+ my $param_locations = '$${' . join(',', map { s/\$//go; "\"$_\""} @locations) . '}$$';
my $param_audience = '$${' . join(',', map { s/\$//go; "\"$_\"" } @aud) . '}$$';
my $param_language = '$${' . join(',', map { s/\$//go; "\"$_\""} @lang) . '}$$';
my $param_lit_form = '$${' . join(',', map { s/\$//go; "\"$_\"" } @lit_form) . '}$$';
@@ -2468,6 +2474,7 @@
$param_depth,
$param_searches,
$param_statuses,
+ $param_locations,
$param_audience,
$param_language,
$param_lit_form,
Modified: trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql 2008-06-18 05:24:09 UTC (rev 9845)
+++ trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql 2008-06-18 16:19:09 UTC (rev 9846)
@@ -49,6 +49,7 @@
param_depth INT,
param_searches TEXT, -- JSON hash, to be turned into a resultset via search.parse_search_args
param_statuses INT[],
+ param_locations INT[],
param_audience TEXT[],
param_language TEXT[],
param_lit_form TEXT[],
@@ -429,6 +430,26 @@
END IF;
+ IF param_locations IS NOT NULL AND array_upper(param_locations, 1) > 0 THEN
+
+ PERFORM 1
+ FROM asset.call_number cn
+ JOIN asset.copy cp ON (cp.call_number = cn.id)
+ WHERE NOT cn.deleted
+ AND NOT cp.deleted
+ AND cp.location IN ( SELECT * FROM search.explode_array( param_locations ) )
+ AND cn.record IN ( SELECT * FROM search.explode_array( core_result.records ) )
+ AND cp.circ_lib IN ( SELECT * FROM search.explode_array( search_org_list ) )
+ LIMIT 1;
+
+ IF NOT FOUND THEN
+ -- RAISE NOTICE ' % were all copy_location-excluded ... ', core_result.records;
+ excluded_count := excluded_count + 1;
+ CONTINUE;
+ END IF;
+
+ END IF;
+
IF staff IS NULL OR NOT staff THEN
PERFORM 1
More information about the open-ils-commits
mailing list