[open-ils-commits] r9219 - 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:13:22 EDT 2008


Author: miker
Date: 2008-04-04 00:36:51 -0400 (Fri, 04 Apr 2008)
New Revision: 9219

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
Log:
adding lasso support to copy count calls

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm	2008-04-04 04:32:19 UTC (rev 9218)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/biblio.pm	2008-04-04 04:36:51 UTC (rev 9219)
@@ -23,8 +23,13 @@
 	my $out_table = actor::org_unit_type->table;
 
 	my $descendants = "actor.org_unit_descendants(u.id)";
-	my $ancestors = "actor.org_unit_ancestors(?)";
+	my $ancestors = "actor.org_unit_ancestors(?) u JOIN $out_table t ON (u.ou_type = t.id)";
 
+    if ($args{org_unit} < 0) {
+        $args{org_unit} *= -1;
+	    $ancestors = "(select org_unit as id from actor.org_lasso_map where lasso = ?) u CROSS JOIN (SELECT -1 AS depth) t";
+    }
+
 	my $visible = 'AND a.opac_visible = TRUE AND st.holdable = TRUE AND loc.opac_visible = TRUE AND cp.opac_visible = TRUE';
 	if ($self->api_name =~ /staff/o) {
 		$visible = ''
@@ -79,8 +84,7 @@
                                         AND src.transcendant IS TRUE
                                 )
                         ) AS transcendant
-		  FROM  $ancestors u
-			JOIN $out_table t ON (u.ou_type = t.id)
+		  FROM  $ancestors
 		  GROUP BY 1,2
 	SQL
 

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:32:19 UTC (rev 9218)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm	2008-04-04 04:36:51 UTC (rev 9219)
@@ -265,9 +265,15 @@
 	my $cl_table = asset::copy_location->table;
 	my $cs_table = config::copy_status->table;
 	my $out_table = actor::org_unit_type->table;
+
 	my $descendants = "actor.org_unit_descendants(u.id)";
-	my $ancestors = "actor.org_unit_ancestors(?)";
+	my $ancestors = "actor.org_unit_ancestors(?) u JOIN $out_table t ON (u.ou_type = t.id)";
 
+    if ($args{org_unit} < 0) {
+        $args{org_unit} *= -1;
+        $ancestors = "(select org_unit as id from actor.org_lasso_map where lasso = ?) u CROSS JOIN (SELECT -1 AS depth) t";
+    }
+
 	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);
 
@@ -353,8 +359,7 @@
 				)
 			) AS transcendant
 
-		  FROM  $ancestors u
-			JOIN $out_table t ON (u.ou_type = t.id)
+		  FROM  $ancestors
 		  GROUP BY 1,2
 	SQL
 



More information about the open-ils-commits mailing list