From 558c801b28032b18c3e2191f5fc238399cc3d24a Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 24 Jul 2023 12:22:57 -0400 Subject: [PATCH] Bug 21246: (QA follow-up) Add new syspref to control how many previous patrons are displayed Signed-off-by: Katrin Fischer Tidied the atomicupdate file. Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/bug_21246.pl | 18 ++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../prog/en/includes/last-borrower.inc | 3 +++ .../admin/preferences/staff_interface.pref | 5 ++++- .../intranet-tmpl/prog/js/staff-global.js | 4 ++-- 5 files changed, 28 insertions(+), 3 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_21246.pl diff --git a/installer/data/mysql/atomicupdate/bug_21246.pl b/installer/data/mysql/atomicupdate/bug_21246.pl new file mode 100755 index 0000000000..22e281f8c6 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_21246.pl @@ -0,0 +1,18 @@ +use Modern::Perl; + +return { + bug_number => "21246", + description => "A preference to specify how many previous patrons to show for showLastPatron", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do( + q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('showLastPatronCount', '10', NULL, 'How many patrons should showLastPatron remember', 'Integer') + } + ); + say $out "Added new system preference 'showLastPatronCount'"; + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index ce6930ebe9..2b2794106e 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -677,6 +677,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('MaxComponentRecords', '300', '','Max number of component records to display','Integer'), ('ShowHeadingUse', '0', NULL, 'Show whether authority record contains an established heading that conforms to descriptive cataloguing rules, and can therefore be used as a main/added entry, or subject, or series title', 'YesNo'), ('showLastPatron','0','','If ON, enables the last patron feature in the intranet','YesNo'), +('showLastPatronCount', '10', '', 'How many patrons should showLastPatron remember', 'Integer'), ('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'), ('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'), ('ShowReviewerPhoto','1','','If ON, photo of reviewer will be shown beside comments in OPAC','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/last-borrower.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/last-borrower.inc index 7bd739bb4e..844bca2aaa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/last-borrower.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/last-borrower.inc @@ -1,3 +1,6 @@ +
Last patron diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref index 0e5bb27f4c..62dca5a673 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref @@ -162,7 +162,10 @@ Staff interface: choices: 0: "Don't show" 1: Show - - a link to the last searched patron in the staff interface. + - a link to the last + - pref: showLastPatronCount + class: integer + - searched patrons in the staff interface. - - pref: intranetbookbag choices: diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 97267f3557..d16a455c74 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -182,8 +182,8 @@ $(document).ready(function() { }; previous_patrons.unshift( previous_patron ); - // Limit to last 10 patrons - if ( previous_patrons.length > 10 ) previous_patrons.pop(); + // Limit to number of patrons specified in showLastPatronCount + if ( previous_patrons.length > showLastPatronCount ) previous_patrons.pop(); localStorage.setItem("previousPatrons", JSON.stringify(previous_patrons)); } -- 2.39.5