From c16044eda806e800b19cb43e05659458cbb4c149 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 12 May 2020 14:59:32 -0400 Subject: [PATCH] Bug 25429: Implement system preference, remove command line switch --- installer/data/mysql/atomicupdate/bug_25429.perl | 9 +++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/circulation.pref | 6 ++++++ misc/cronjobs/cleanup_database.pl | 3 +-- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_25429.perl diff --git a/installer/data/mysql/atomicupdate/bug_25429.perl b/installer/data/mysql/atomicupdate/bug_25429.perl new file mode 100644 index 0000000000..c9d4222f9c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_25429.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('CleanUpDatabaseReturnClaims', '', '', 'Sets the age of resolved return claims to delete from the database for cleanup_database.pl', 'Integer' ); + }); + + NewVersion( $DBversion, 25429, "Cleanup Database - remove resolved claims returned from db after X days"); +} diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 2ea427bdd2..7d1707e4fd 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -131,6 +131,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ClaimReturnedChargeFee', 'ask', 'ask|charge|no_charge', 'Controls whether or not a lost item fee is charged for return claims', 'Choice'), ('ClaimReturnedLostValue', '', '', 'Sets the LOST AV value that represents "Claims returned" as a lost value', 'Free'), ('ClaimReturnedWarningThreshold', '', '', 'Sets the number of return claims past which the librarian will be warned the patron has many return claims', 'Integer'), +('CleanUpDatabaseReturnClaims', '', '', 'Sets the age of resolved return claims to delete from the database for cleanup_database.pl', 'Integer' ), ('CoceHost', '', NULL, 'Coce server URL', 'Free'), ('CoceProviders', '', 'aws,gb,ol', 'Coce providers', 'multiple'), ('COinSinOPACResults','1','','If ON, use COinS in OPAC search results page. NOTE: this can slow down search response time significantly','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 9bd26d5aa1..c41122a1b2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -1224,3 +1224,9 @@ Circulation: - pref: ClaimReturnedWarningThreshold class: integer - items. + - + - Remove resolved return claims older than + - pref: CleanUpDatabaseReturnClaims + class: integer + - days. + - This system preference is used by the cleanup_database.pl cronjob. diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl index e12e5abf39..ca8adb3b1b 100755 --- a/misc/cronjobs/cleanup_database.pl +++ b/misc/cronjobs/cleanup_database.pl @@ -123,7 +123,7 @@ my $pZ3950; my $pListShareInvites; my $pDebarments; my $allDebarments; -my $return_claims; +my $return_claims = C4::Context->preference('CleanUpDatabaseReturnClaims'); my $pExpSelfReg; my $pUnvSelfReg; my $fees_days; @@ -157,7 +157,6 @@ GetOptions( 'list-invites:i' => \$pListShareInvites, 'restrictions:i' => \$pDebarments, 'all-restrictions' => \$allDebarments, - 'return-claims:i' => \$return_claims, 'del-exp-selfreg' => \$pExpSelfReg, 'del-unv-selfreg' => \$pUnvSelfReg, 'unique-holidays:i' => \$special_holidays_days, -- 2.24.1 (Apple Git-126)