Fix for LP894125 - reshelving interval collab/dyrcona/lp_894125_fix_reshelving
authorBen Shum <bshum@biblio.org>
Wed, 23 Nov 2011 20:14:32 +0000 (15:14 -0500)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 23 Nov 2011 20:57:16 +0000 (15:57 -0500)
Update to reshelving code to utilize actor.org_unit_ancestor_setting function
and properly retrieve org settings for "circ.reshelving_complete.interval" for
org unit or ancestors.

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm

index 2069f58..d58e213 100644 (file)
@@ -161,7 +161,6 @@ sub complete_reshelving {
        throw OpenSRF::EX::InvalidArg ("I need an interval of more than 0 seconds!")
                unless (interval_to_seconds( $window ));
 
        throw OpenSRF::EX::InvalidArg ("I need an interval of more than 0 seconds!")
                unless (interval_to_seconds( $window ));
 
-       my $setting = actor::org_unit_setting->table;
        my $cp = asset::copy->table;
 
        my $sql = <<"   SQL";
        my $cp = asset::copy->table;
 
        my $sql = <<"   SQL";
@@ -170,14 +169,12 @@ sub complete_reshelving {
                  WHERE id IN (
             SELECT cp.id 
             FROM  $cp cp
                  WHERE id IN (
             SELECT cp.id 
             FROM  $cp cp
-                LEFT JOIN $setting setting
-                    ON (cp.circ_lib = setting.org_unit AND setting.name = 'circ.reshelving_complete.interval')
             WHERE cp.status = 7
             WHERE cp.status = 7
-                AND cp.status_changed_time < NOW() - CAST( COALESCE( BTRIM( setting.value,'"' ), ? )  AS INTERVAL)
+                AND cp.status_changed_time < NOW() - CAST( COALESCE( BTRIM( (SELECT value FROM actor.org_unit_ancestor_setting('circ.reshelving_complete.interval', cp.circ_lib)),'"' ), ? )  AS INTERVAL)
                  )
        SQL
        my $sth = action::circulation->db_Main->prepare_cached($sql);
                  )
        SQL
        my $sth = action::circulation->db_Main->prepare_cached($sql);
-       $sth->execute($window, $window, $window);
+       $sth->execute($window);
 
        return $sth->rows;
 
 
        return $sth->rows;