From 7242c32a1fab642975ab92538438eb13764b4bea Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 7 Jun 2023 14:29:05 -0400 Subject: [PATCH] Bug 33945: Add ability to delay the loading of the current checkouts table on the checkouts page If a librarian has opted to load the checkouts table automatically on the checkouts page, it will trigger a call to svc/checkouts. If a librarian is checkout out 10 items to a patron, that means svc/checkouts is called uselessly 9 times, with only the 10th time being used to display the checkouts table. It would be useful to add a delay such that the table only load if the page has been display for a given number of seconds. That way the continuous scanning does not trigger useless svc/checkouts calls, but the librarian also does not need to click the load checkouts button manually. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Verify "Always show checkouts immediately" retains its' original behavior of loading the checkouts table immediately 4) Set LoadCheckoutsTableDelay to a non-zero integer 5) Verify the automatic table loading is delayed by that number of seconds Signed-off-by: Sam Lau Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/bug_33945.pl | 15 +++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../en/modules/admin/preferences/circulation.pref | 5 +++++ .../prog/en/modules/circ/circulation.tt | 1 + .../prog/en/modules/members/moremember.tt | 1 + koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 9 ++++++++- 6 files changed, 31 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_33945.pl diff --git a/installer/data/mysql/atomicupdate/bug_33945.pl b/installer/data/mysql/atomicupdate/bug_33945.pl new file mode 100755 index 0000000000..c747deec9f --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33945.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "33945", + description => "Add system preference LoadCheckoutsTableDelay", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Do you stuffs here + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`) + VALUES ('LoadCheckoutsTableDelay','0','','Delay before auto-loading checkouts table on checkouts screen','Integer') + }); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index db1dcabd01..8fa1d86120 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -350,6 +350,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('LinkerRelink','1',NULL,'If ON the authority linker will relink headings that have previously been linked every time it runs.','YesNo'), ('ListOwnerDesignated', NULL, NULL, 'Designated list owner at patron deletion', 'Free'), ('ListOwnershipUponPatronDeletion', 'delete', 'delete|transfer', 'Defines the action on their public or shared lists when patron is deleted', 'Choice'), +('LoadCheckoutsTableDelay','0','','Delay before auto-loading checkouts table on checkouts screen','Integer'), ('LoadSearchHistoryToTheFirstLoggedUser', '1', NULL, 'If ON, the next user will automatically get the last searches in their history', 'YesNo'), ('LocalCoverImages','0','1','Display local cover images on intranet details pages.','YesNo'), ('LocalHoldsPriority', '0', NULL, 'Enables the LocalHoldsPriority feature', '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 c5308a8506..f45e71571c 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 @@ -171,6 +171,11 @@ Circulation: - circulation desks with circulation. Checkout policy: + - + - Delay the automatic loading of the checkouts table on the checkouts page by + - pref: LoadCheckoutsTableDelay + class: integer + - seconds when "Always show checkouts immediately" is enabled. - - pref: OnSiteCheckoutAutoCheck choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 6fc4e740c5..681473f491 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1039,6 +1039,7 @@