From 2c0f722a3ad944a3811199e67ab88af9cd55328b Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 1 Oct 2021 08:45:48 +0000 Subject: [PATCH] Bug 25429: (QA follow-up) Add extra variable for days I think it is a bit more clear to use another variable for the number of days from the preferences than overwriting the flag variable. Signed-off-by: Marcel de Rooy Tested by adding an authval for LOST. Filling prefs ClaimReturnedLostValue, CleanUpDatabaseReturnClaims. Claiming a return, resolving it. Setting date back via SQL. Running the script with -v --return-claims, toggling --confirm. The claim is counted and deleted with confirm. Signed-off-by: Jonathan Druart --- misc/cronjobs/cleanup_database.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index 84db2b9210..2adccfda04 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -530,14 +530,13 @@ if ($pStatistics) { } } -$return_claims = C4::Context->preference('CleanUpDatabaseReturnClaims') if $return_claims; -if ($return_claims) { - print "Purging return claims older than $return_claims days.\n" if $verbose; +if( $return_claims && ( my $days = C4::Context->preference('CleanUpDatabaseReturnClaims') )) { + print "Purging return claims older than $days days.\n" if $verbose; $return_claims = Koha::Checkouts::ReturnClaims->filter_by_last_update( { timestamp_column_name => 'resolved_on', - days => $return_claims + days => $days, } ); -- 2.39.5