Exclude transits for items miscataloged at the system level.
authorChris Sharp <csharp@georgialibraries.org>
Fri, 1 Dec 2017 19:35:50 +0000 (14:35 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Fri, 1 Dec 2017 19:35:50 +0000 (14:35 -0500)
While not a common issue, if any items that are miscataloged
with an owning library of a PINES system rather than branch,
the consolidation step fails because there's more than one
row returned from a subquery expecting a single value.  Explicitly
exclude any items owned by units with a parent_ou of 1 (PINES).

perl/execreports/erqueries.pl

index 816b0dd..52dbc79 100755 (executable)
@@ -615,7 +615,8 @@ FROM        action.hold_transit_copy
                JOIN actor.org_unit r on (r.id = action.hold_transit_copy.dest) 
                JOIN actor.org_unit p on (r.parent_ou = p.id) 
 WHERE  s.id in (SELECT id from actor.org_unit WHERE ou_type=3)
-               AND s.parent_ou <> r.parent_ou 
+               AND s.parent_ou <> r.parent_ou
+        AND p.id <> 1
                AND source_send_time BETWEEN '$start_date' AND '$end_date'
 GROUP BY r.id
 )