Bugzilla – Attachment 153625 Details for
Bug 34075
Allow specifying default tab view for authorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34075: Add DefaultAuthorityTab system preference
Bug-34075-Add-DefaultAuthorityTab-system-preferenc.patch (text/plain), 5.83 KB, created by
Jonathan Druart
on 2023-07-19 07:32:46 UTC
(
hide
)
Description:
Bug 34075: Add DefaultAuthorityTab system preference
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-07-19 07:32:46 UTC
Size:
5.83 KB
patch
obsolete
>From ebb5194a6778d68fcb01c3221137386049884d80 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 21 Jun 2023 12:41:21 +0000 >Subject: [PATCH] Bug 34075: Add DefaultAuthorityTab system preference > >This patch adds a new system preference, DefaultAuthorityTab. >When set, this will choose the default display on the authorities details >page. > >To test: >1 - Apply patch, update database >2 - View an authority detail >3 - You should default to the 0XX or first tab >4 - Set DefaultAuthorityTab to a number that there is no tab for in your authority >5 - Reload and verify details page loads the first tba >6 - Set DefaultAuthorityTab to 1XX or another tab that exists in your record >7 - Reload the details and confirm the correct tab is selected > >Signed-off-by: Sam Lau <samalau@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > installer/data/mysql/atomicupdate/bug_34075.pl | 15 +++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../modules/admin/preferences/authorities.pref | 17 ++++++++++++++++- > .../prog/en/modules/authorities/detail.tt | 14 +++++++++++++- > 4 files changed, 45 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_34075.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_34075.pl b/installer/data/mysql/atomicupdate/bug_34075.pl >new file mode 100755 >index 00000000000..fe83258dfef >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_34075.pl >@@ -0,0 +1,15 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "34075", >+ description => "Add DefaultAuthorityTab system preference", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+ ('DefaultAuthorityTab','0','0|1|2|3|4|5|6|7|8|9','Default tab to shwo when displaying authorities','Choice') >+ }); >+ say $out "Added new system preference 'DefaultAuthorityTab'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 30197591a8b..279e390f3da 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -172,6 +172,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'), > ('decreaseLoanHighHoldsIgnoreStatuses', '', 'damaged|itemlost|notforloan|withdrawn', "Ignore items with these statuses for dynamic high holds checking", 'Choice'), > ('decreaseLoanHighHoldsValue',NULL,'','Specifies a threshold for the minimum number of holds needed to trigger a reduction in loan duration (used with decreaseLoanHighHolds)','Integer'), >+('DefaultAuthorityTab','0','0|1|2|3|4|5|6|7|8|9','Default tab to shwo when displaying authorities','Choice'), > ('DefaultClassificationSource','ddc',NULL,'Default classification scheme used by the collection. E.g., Dewey, LCC, etc.','ClassSources'), > ('DefaultCountryField008','','','Fill in the default country code for field 008 Range 15-17 of MARC21 - Place of publication, production, or execution. See <a href=\"http://www.loc.gov/marc/countries/countries_code.html\">MARC Code List for Countries</a>','Free'), > ('DefaultHoldExpirationdate','0','','Automatically set expiration date for holds','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >index 787906e1cc2..eabea67147a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >@@ -75,7 +75,22 @@ Authorities: > default: "Work cat." > type: textarea > class: code >- >+ - >+ - When viewing authority details default to the >+ - pref: DefaultAuthorityTab >+ default: "0" >+ choices: >+ "0": 0XX >+ "1": 1XX >+ "2": 2XX >+ "3": 3XX >+ "4": 4XX >+ "5": 5XX >+ "6": 6XX >+ "7": 7XX >+ "8": 8XX >+ "9": 9XX >+ - tab. If the selected tab does not exist, the view will default to the first tab. > Linker: > - > - Use the >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt >index 95390901cf2..d5ad806a28d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/detail.tt >@@ -1,4 +1,5 @@ > [% USE raw %] >+[% USE Koha %] > [% USE Asset %] > [% SET footerjs = 1 %] > [% PROCESS 'authorities.inc' %] >@@ -132,7 +133,18 @@ > <script> > $(document).ready(function() { > if( $("#authoritiestabs .tab-pane.active").length < 1 ){ >- $("#authoritiestabs a:first").tab("show"); >+ [% SET DefaultAuthorityTab = Koha.Preference('DefaultAuthorityTab') %] >+ [% IF DefaultAuthorityTab %] >+ let default_tab = "#tab" + [% DefaultAuthorityTab %] + "XX-tab"; >+ let tab_object = $("#authoritiestabs "+default_tab) >+ if( tab_object.length > 0 ){ >+ tab_object.tab("show"); >+ } else { >+ $("#authoritiestabs a:first").tab("show"); >+ } >+ [% ELSE %] >+ $("#authoritiestabs a:first").tab("show"); >+ [% END %] > } > > var editAuth = $("#editAuth"); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34075
:
152518
|
152582
|
152584
|
152633
| 153625 |
153626
|
153627