From 610e507e7ffc1d37e005b623c5363cf7a58c7343 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 5 Mar 2025 13:54:36 +0100 Subject: [PATCH] Bug 39239: Speed up loading suggestions with manageddate filter Content-Type: text/plain; charset=utf-8 --- .../intranet-tmpl/prog/en/modules/suggestion/suggestion.tt | 3 +++ suggestion/suggestion.pl | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index c50da2d860..430428e4e5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1546,6 +1546,9 @@ return true; }); }); + [% IF manageddate_from %] + $("fieldset.suggestion_information").toggle(); + [% END %] [% END %] [% IF op == 'save' %] diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 362cac0a0e..2306b57a25 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -451,6 +451,10 @@ if ( $op eq 'else' ) { my $from_dt = $from && eval { dt_from_string($from) }; my $to_dt = $to && eval { dt_from_string($to) }; + if ( ( my $from_pref = C4::Context->preference('SuggestionsDefaultManagedFrom') ) && $field eq 'manageddate' ) { + $from_dt ||= dt_from_string()->subtract( days => $from_pref ); + $template->param( "${field}_from" => $from_dt ); + } if ( $from_dt || $to_dt ) { my $dtf = Koha::Database->new->schema->storage->datetime_parser; if ( $from_dt && $to_dt ) { -- 2.39.5