[open-ils-commits] r11174 - trunk/Open-ILS/src/perlmods/OpenILS/Application

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Nov 13 16:21:33 EST 2008


Author: miker
Date: 2008-11-13 16:21:29 -0500 (Thu, 13 Nov 2008)
New Revision: 11174

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
Log:
use distinct flag to force an aggregate workaround check

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2008-11-13 20:26:38 UTC (rev 11173)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm	2008-11-13 21:21:29 UTC (rev 11174)
@@ -335,21 +335,18 @@
 
 	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $o_search = { shortname => $ou };
-	if (!$ou || $ou eq '-') {
-		$o_search = { parent_ou => undef };
+	my @ou_ids;
+	if ($ou && $ou ne '-') {
+		my $orgs = $_storage->request(
+			"open-ils.cstore.direct.actor.org_unit.search",
+			{ shortname => $ou },
+			{ flesh		=> 10,
+			  flesh_fields	=> { aou	=> [qw/children/] }
+			}
+		)->gather(1);
+		@ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
 	}
 
-	my $orgs = $_storage->request(
-		"open-ils.cstore.direct.actor.org_unit.search",
-		$o_search,
-		{ flesh		=> 3,
-		  flesh_fields	=> { aou	=> [qw/children/] }
-		}
-	)->gather(1);
-
-	my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
-
 	$logger->debug("Searching for records with new copies at orgs [".join(',', at ou_ids)."], based on $ou");
 	my $cns = $_storage->request(
 		"open-ils.cstore.json_query.atomic",
@@ -363,7 +360,8 @@
 			}, 
           order_by	=> { acp => { create_date => { transform => 'max', direction => 'desc' } } },
 		  limit		=> $page_size,
-		  offset	=> $offset
+		  offset	=> $offset,
+          distinct  => 1
 		}
 	)->gather(1);
 



More information about the open-ils-commits mailing list