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

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Apr 5 00:14:06 EDT 2010


Author: miker
Date: 2010-04-05 00:14:03 -0400 (Mon, 05 Apr 2010)
New Revision: 16131

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
be smarter about holdings fleshing, particularly where only URIs are requested

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2010-04-05 03:42:15 UTC (rev 16130)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2010-04-05 04:14:03 UTC (rev 16131)
@@ -704,7 +704,7 @@
 	my $self = shift;
 	my $client = shift;
 	my $cpid = shift;
-	my $args = shift;
+	my $args = shift || {};
 
     return OpenILS::Application::SuperCat::unAPI
         ->new(OpenSRF::AppSession
@@ -747,7 +747,7 @@
 	my $self = shift;
 	my $client = shift;
 	my $cpid = shift;
-	my $args = shift;
+	my $args = shift || {};
 
     return OpenILS::Application::SuperCat::unAPI
         ->new(OpenSRF::AppSession
@@ -790,7 +790,7 @@
 	my $self = shift;
 	my $client = shift;
 	my $cnid = shift;
-	my $args = shift;
+	my $args = shift || {};
 
     return OpenILS::Application::SuperCat::unAPI
         ->new(OpenSRF::AppSession
@@ -932,7 +932,7 @@
 	my $client = shift;
 	my $bib = shift;
 	my $ou = shift;
-	my $hide_copies = shift;
+	my $flesh = shift;
 	my $paging = shift;
 
     $paging = [-1,0] if (!$paging or !ref($paging) or @$paging == 0);
@@ -958,22 +958,38 @@
 
 	$logger->info("Searching for holdings at orgs [".join(',', at ou_ids)."], based on $ou");
 
+    my %subselect = ( '-or' => [
+        { owning_lib => \@ou_ids },
+        { '-exists'  =>
+            { from  => 'acp',
+              where => {
+                call_number => { '=' => {'+acn'=>'id'} },
+                deleted => 'f',
+                circ_lib => \@ou_ids
+              }
+            }
+        }
+    ]);
+
+    if ($flesh and $flesh eq 'uris') {
+        %subselect = (
+            owning_lib => \@ou_ids,
+            '-exists'  => {
+                from  => { auricnm => 'auri' },
+                where => {
+                    call_number => { '=' => {'+acn'=>'id'} },
+                    '+auri' => { active => 't' }
+                }
+            }
+        );
+    }
+
+
 	my $cns = $_storage->request(
 		"open-ils.cstore.direct.asset.call_number.search.atomic",
 		{ record  => $bib,
           deleted => 'f',
-          '-or'   => [
-            { owning_lib => \@ou_ids },
-            { '-exists'  =>
-                { from  => 'acp',
-                  where =>
-                    { call_number => { '=' => {'+acn'=>'id'} },
-                      deleted => 'f',
-                      circ_lib => \@ou_ids
-                  }
-                }
-            }
-          ]
+          %subselect
         },
 		{ flesh		=> 5,
 		  flesh_fields	=> {
@@ -1003,7 +1019,7 @@
         $client->respond(
             OpenILS::Application::SuperCat::unAPI::acn
                 ->new( $cn )
-                ->as_xml( {no_record => 1, no_copies => $hide_copies} )
+                ->as_xml( {no_record => 1, no_copies => ($flesh ? 0 : 1)} )
         );
 	}
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-04-05 03:42:15 UTC (rev 16130)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2010-04-05 04:14:03 UTC (rev 16131)
@@ -547,17 +547,9 @@
 
 	my $method = "open-ils.supercat.$type.$base_format.$command";
 	my @params = ($id);
+	push @params, $lib, $flesh_feed, $paging if ($base_format eq 'holdings_xml');
 
-	if ($base_format eq 'holdings_xml') {
-		push @params, $lib;
-		if ($format !~ /-full$/o) {
-			push @params, 1;
-		} else {
-			push @params, 0;
-        }
-	}
-
-	my $req = $supercat->request($method, at params,$paging);
+	my $req = $supercat->request($method, at params);
 	my $data = $req->gather();
 
 	if ($req->failed || !$data) {
@@ -1336,7 +1328,7 @@
 
 		$xml = '';
 		if ($lib && ($type eq 'marcxml' || $type eq 'atom') &&  $flesh) {
-			my $r = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib, ($flesh_feed eq "uris") ? 1 : 0, $paging );
+			my $r = $supercat->request( "open-ils.supercat.$search.holdings_xml.retrieve", $rec, $lib, $flesh_feed, $paging );
 			while ( !$r->complete ) {
 				$xml .= join('', map {$_->content} $r->recv);
 			}



More information about the open-ils-commits mailing list