reshelving for items just out of in-process
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 30 Oct 2006 23:53:20 +0000 (23:53 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 30 Oct 2006 23:53:20 +0000 (23:53 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6530 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 610b4c4..1a27fa0 100644 (file)
@@ -135,12 +135,19 @@ sub complete_reshelving {
                                        AND cp.status = 7
                                  GROUP BY 1
                                        HAVING MAX(circ.checkin_time) < NOW() - CAST(? AS INTERVAL)
-                       ) AS foo
-               )
+                         ) AS foo
+                       )
+                       OR id IN
+                       ( SELECT        cp.id
+                           FROM        $cp cp 
+                                       LEFT JOIN $circ circ ON (circ.target_copy = cp.id AND circ.id IS NULL)
+                           WHERE       cp.status = 7
+                                       AND cp.create_date > NOW() - CAST(? AS INTERVAL)
+                       )
        SQL
 
        my $sth = action::circulation->db_Main->prepare_cached($sql);
-       $sth->execute($window);
+       $sth->execute($window, $window);
 
        return $sth->rows;