fixing query to look at all libs under depth for nearest hold stalling
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 28 Aug 2007 17:48:58 +0000 (17:48 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 28 Aug 2007 17:48:58 +0000 (17:48 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7728 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm

index f2d8307..54f64f9 100644 (file)
@@ -191,12 +191,12 @@ sub nearest_hold {
                        "actor.org_unit_descendants($pl, $depth)" :
                        "actor.org_unit_descendants($pl)" ;
 
-       my $ids = action::hold_request->db_Main->selectcol_arrayref(<<" SQL", {}, $cp, $age);
+       my $ids = action::hold_request->db_Main->selectcol_arrayref(<<" SQL", {}, $pl, $cp, $age);
                SELECT  h.id
                  FROM  action.hold_request h
                        JOIN action.hold_copy_map hm ON (hm.hold = h.id)
                        JOIN $descendents d ON (d.id = h.pickup_lib)
-                       JOIN actor.org_unit_proximity p ON (p.from_org = d.id AND p.to_org = h.pickup_lib)
+                       JOIN actor.org_unit_proximity p ON (p.from_org = ? AND p.to_org = d.id)
                  WHERE hm.target_copy = ?
                        AND AGE(NOW(),h.request_time) >= CAST(? AS INTERVAL)
                        AND h.capture_time IS NULL