Bugzilla – Attachment 170098 Details for
Bug 14180
Make "Always show checkouts immediately" a global setting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14180: Add option to always load the issues table
Bug-14180-Add-option-to-always-load-the-issues-tab.patch (text/plain), 9.56 KB, created by
Nick Clemens (kidclamp)
on 2024-08-06 13:15:02 UTC
(
hide
)
Description:
Bug 14180: Add option to always load the issues table
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-08-06 13:15:02 UTC
Size:
9.56 KB
patch
obsolete
>From 09bb28f25280c4231386cd992039642c040ba8ac Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 26 Jan 2024 17:35:38 +0000 >Subject: [PATCH] Bug 14180: Add option to always load the issues table > >To test: > 1. APPLY PATCH, updatedatebase, restart_all > 2. Search for the system preference 'AlwaysLoadCheckoutsTable' and set it to 'Do'. > 3. Go to 'circ/circulation.pl?borrowernumber=X' for a patron with checkouts. ( Check out tab ). > 4. The table should load right away. > 5. Go to 'members/moremember.pl?borrowernumber=X' for a patron with checkouts. ( Details tab ). > 6. The table should load right way. > 7. Set a value in the 'LoadCheckoutsTableDelay' system preference. > 8. Back on 'circ/circulation.pl?borrowernumber=X', make sure the delay is honored. You should see a message like "Checkouts table will automatically load in X seconds". > 9. The delay should NOT be honored on'members/moremember.pl?borrowernumber=X', that table should load right away/ >10. Turn off 'AlwaysLoadCheckoutsTable' and make sure the table does not load, or loads according to the cookie set when checking the 'Always show checkouts automatically' checkbox. > >Signed-off-by: Kelly <kelly@bywatersolutions.com> >--- > .../prog/en/includes/checkouts-table.inc | 9 +-- > .../admin/preferences/circulation.pref | 8 ++- > .../prog/en/modules/circ/circulation.tt | 1 + > .../prog/en/modules/members/moremember.tt | 3 +- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 62 +++++++++++-------- > 5 files changed, 50 insertions(+), 33 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >index 8bae177e8fa..d95ace2ac13 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >@@ -7,7 +7,7 @@ > <p> > <a id="issues-table-load-now-button" href="#" class="btn btn-default"><i class="fa fa-book"></i> Show checkouts</a> > [% SET LoadCheckoutsTableDelay = Koha.Preference('LoadCheckoutsTableDelay') %] >- [% IF LoadCheckoutsTableDelay && page == 'circulation' %] >+ [% IF LoadCheckoutsTableDelay && patronpage == 'circ' %] > <span id="issues-table-load-delay"> > <i id="issues-table-load-delay-spinner" class="fa fa-spinner fa-pulse fa-fw"></i> > <span id="issues-table-load-delay-message">Checkouts table will show automatically in [% LoadCheckoutsTableDelay | html %] seconds...</span> >@@ -46,9 +46,10 @@ > </thead> > [% INCLUDE 'checkouts-table-footer.inc' %] > </table> >- >- <label for="issues-table-load-immediately">Always show checkouts automatically</label> >- <input id="issues-table-load-immediately" type="checkbox" /> >+ [% UNLESS Koha.Preference( 'AlwaysLoadCheckoutsTable' ) %] >+ <label for="issues-table-load-immediately">Always show checkouts automatically</label> >+ <input id="issues-table-load-immediately" type="checkbox" /> >+ [% END %] > > <div id="issues-table-actions" style="display: none;"> > <fieldset class="action"> >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 76983576a6a..dd0b6717365 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,11 +171,17 @@ Circulation: > 0: "Don't use" > - circulation desks. > Checkout policy: >+ - >+ - pref: AlwaysLoadCheckoutsTable >+ choices: >+ 1: "Do" >+ 0: "Don't" >+ - always load the checksouts table. > - > - Delay the automatic loading of the checkouts table on the checkouts page by > - pref: LoadCheckoutsTableDelay > class: integer >- - seconds when "Always show checkouts automatically" is enabled. >+ - seconds when "Always show checkouts automatically" or <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=AlwaysLoadCheckoutsTable">AlwaysLoadCheckoutsTable</a> are 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 e596daec917..576919315af 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1000,6 +1000,7 @@ > <script> > /* Set some variable needed in circulation.js */ > const LoadCheckoutsTableDelay = [% Koha.Preference('LoadCheckoutsTableDelay') || 0 | html %]; >+ const AlwaysLoadCheckoutsTable = [% Koha.Preference('AlwaysLoadCheckoutsTable') | html %]; > var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]"; > var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]"; > var ClaimReturnedChargeFee = "[% Koha.Preference('ClaimReturnedChargeFee') | html %]"; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 4debd1abda8..760f635bb8f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -761,7 +761,6 @@ > var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %]; > </script> > [% Asset.js("js/pages/circulation.js") | $raw %] >- [% Asset.js("js/checkouts.js") | $raw %] > [% IF Koha.Preference('ClaimReturnedLostValue') %] > [% Asset.js("js/resolve_claim_modal.js") | $raw %] > [% END %] >@@ -774,6 +773,7 @@ > [% Asset.js("js/recalls.js") | $raw %] > <script> > const LoadCheckoutsTableDelay = 0; >+ const AlwaysLoadCheckoutsTable = [% Koha.Preference('AlwaysLoadCheckoutsTable') | html %]; > > table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %] > table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %] >@@ -830,6 +830,7 @@ > }); > }); > </script> >+ [% Asset.js("js/checkouts.js") | $raw %] > [% Asset.js("js/tables/bookings.js") | $raw %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index a2b540e971b..bfa6a1be8a3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -469,12 +469,41 @@ function LoadIssuesTable() { > var loadIssuesTableDelayTimeoutId; > var barcodefield = $("#barcode"); > >-$('#issues-table-load-now-button').click(function(){ >- if ( loadIssuesTableDelayTimeoutId ) clearTimeout(loadIssuesTableDelayTimeoutId); >- LoadIssuesTable(); >- barcodefield.focus(); >- return false; >-}); >+if ( AlwaysLoadCheckoutsTable ) { >+ if ( LoadCheckoutsTableDelay ) { >+ setTimeout( function(){ LoadIssuesTable() }, LoadCheckoutsTableDelay * 1000); >+ } else { >+ LoadIssuesTable(); >+ } >+ >+} else { >+ $('#issues-table-load-immediately').change(function(){ >+ if ( this.checked && typeof issuesTable === 'undefined') { >+ $('#issues-table-load-now-button').click(); >+ } >+ barcodefield.focus(); >+ }); >+ $('#issues-table-load-now-button').click(function(){ >+ if ( loadIssuesTableDelayTimeoutId ) clearTimeout(loadIssuesTableDelayTimeoutId); >+ LoadIssuesTable(); >+ barcodefield.focus(); >+ return false; >+ }); >+ >+ if ( Cookies.get("issues-table-load-immediately-" + script) == "true" ) { >+ if ( LoadCheckoutsTableDelay ) { >+ setTimeout( function(){ LoadIssuesTable() }, LoadCheckoutsTableDelay * 1000); >+ } else { >+ LoadIssuesTable(); >+ } >+ $('#issues-table-load-immediately').prop('checked', true); >+ } else { >+ $('#issues-table-load-delay').hide(); >+ } >+ $('#issues-table-load-immediately').on( "change", function(){ >+ Cookies.set("issues-table-load-immediately-" + script, $(this).is(':checked'), { expires: 365, sameSite: 'Lax' }); >+ }); >+} > > $(document).ready(function() { > >@@ -766,27 +795,6 @@ $(document).ready(function() { > > var ymd = flatpickr.formatDate(new Date(), "Y-m-d"); > >- $('#issues-table-load-immediately').change(function(){ >- if ( this.checked && typeof issuesTable === 'undefined') { >- $('#issues-table-load-now-button').click(); >- } >- barcodefield.focus(); >- }); >- >- if ( Cookies.get("issues-table-load-immediately-" + script) == "true" ) { >- if ( LoadCheckoutsTableDelay ) { >- loadIssuesTableDelayTimeoutId = setTimeout( function(){ LoadIssuesTable() }, LoadCheckoutsTableDelay * 1000); >- } else { >- LoadIssuesTable(); >- } >- $('#issues-table-load-immediately').prop('checked', true); >- } else { >- $('#issues-table-load-delay').hide(); >- } >- $('#issues-table-load-immediately').on( "change", function(){ >- Cookies.set("issues-table-load-immediately-" + script, $(this).is(':checked'), { expires: 365, sameSite: 'Lax' }); >- }); >- > // Don't load relatives' issues table unless it is clicked on > var relativesIssuesTable; > $("#relatives-issues-tab").click( function() { >-- >2.39.2
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 14180
:
161548
|
161549
|
161550
|
161551
|
161554
|
161555
|
161556
|
170095
|
170096
|
170097
|
170098
|
173382
|
173383
|
173384