[open-ils-commits] r9220 -
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Apr 4 01:21:18 EDT 2008
Author: miker
Date: 2008-04-04 00:44:47 -0400 (Fri, 04 Apr 2008)
New Revision: 9220
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
Log:
adding base-line copy counting for lasso groups
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm 2008-04-04 04:36:51 UTC (rev 9219)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm 2008-04-04 04:44:47 UTC (rev 9220)
@@ -23,12 +23,13 @@
my $org = shift || 1;
my $depth = shift;
- my (@types, at forms);
+ my (@types, at forms, at blvl);
if ($formats) {
- my ($t, $f) = split '-', $formats;
+ my ($t, $f, $b) = split '-', $formats;
@types = split '', $t;
@forms = split '', $f;
+ @blvl = split '', $b;
}
my $descendants =
@@ -140,8 +141,12 @@
$sql .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
}
+ if (@blvl) {
+ $sql .= ' AND rd.bib_level IN ('.join(',',map{'?'}@blvl).')';
+ }
+
$sql .= <<" SQL";
OFFSET 0
) AS x
@@ -177,7 +182,7 @@
quality DESC
SQL
- my $ids = metabib::metarecord_source_map->db_Main->selectcol_arrayref($sql, {}, "$mr", @types, @forms);
+ my $ids = metabib::metarecord_source_map->db_Main->selectcol_arrayref($sql, {}, "$mr", @types, @forms, @blvl);
return $ids if ($self->api_name =~ /atomic$/o);
$client->respond( $_ ) for ( @$ids );
@@ -277,13 +282,15 @@
my $copies_visible = 'AND a.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
$copies_visible = '' if ($self->api_name =~ /staff/o);
- my (@types, at forms);
- my ($t_filter, $f_filter) = ('','');
+ my (@types, at forms, at blvl);
+ my ($t_filter, $f_filter, $b_filter) = ('','','');
if ($args{format}) {
- my ($t, $f) = split '-', $args{format};
+ my ($t, $f, $b) = split '-', $args{format};
@types = split '', $t;
@forms = split '', $f;
+ @blvl = split '', $b;
+
if (@types) {
$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
}
@@ -291,6 +298,10 @@
if (@forms) {
$f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
}
+
+ if (@blvl) {
+ $b_filter .= ' AND rd.bib_level IN ('.join(',',map{'?'}@blvl).')';
+ }
}
my $sql = <<" SQL";
@@ -311,6 +322,7 @@
$copies_visible
$t_filter
$f_filter
+ $b_filter
)
) AS count,
sum(
@@ -329,6 +341,7 @@
$copies_visible
$t_filter
$f_filter
+ $b_filter
)
) AS available,
sum(
@@ -347,6 +360,7 @@
AND cl.opac_visible IS TRUE
$t_filter
$f_filter
+ $b_filter
)
) AS unshadow,
sum(
@@ -367,12 +381,15 @@
$sth->execute( ''.$args{metarecord},
@types,
@forms,
+ @blvl,
''.$args{metarecord},
@types,
@forms,
+ @blvl,
''.$args{metarecord},
@types,
@forms,
+ @blvl,
''.$args{metarecord},
''.$args{org_unit},
);
More information about the open-ils-commits
mailing list