Bugzilla – Attachment 191187 Details for
Bug 41582
Tidy kohaTable block - opac
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41582: Tidy kohaTable - sco/sco-main.tt
0e46f25.patch (text/plain), 12.12 KB, created by
Jonathan Druart
on 2026-01-09 14:55:01 UTC
(
hide
)
Description:
Bug 41582: Tidy kohaTable - sco/sco-main.tt
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2026-01-09 14:55:01 UTC
Size:
12.12 KB
patch
obsolete
>From 0e46f25b39c2cf46f3accdb32a44a55c234846b8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 9 Jan 2026 12:26:57 +0100 >Subject: [PATCH] Bug 41582: Tidy kohaTable - sco/sco-main.tt > >--- > .../bootstrap/en/modules/sco/sco-main.tt | 218 ++++++++++-------- > 1 file changed, 117 insertions(+), 101 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >index e1b5c9d5ef4..259b7dd7c04 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >@@ -406,121 +406,137 @@ > [% BLOCK jsinclude %] > [% INCLUDE 'datatables.inc' %] > <script> >- function mungeHistory() { >- // prevent back button from allowing form resubmission >- if (history && history.pushState) { >- history.replaceState(null, document.title, window.location.href); >+ addPrefs({ >+ SelfCheckTimeout: "[% Koha.Preference('SelfCheckTimeout') | html %]", >+ SelfCheckReceiptPrompt: [% Koha.Preference('SelfCheckReceiptPrompt') ? 1 : 0 | html %], >+ }); >+ const logged_in_user_cardnumber = "[% patronid | html %]"; >+ </script> >+ [% IF Koha.Preference('AudioAlerts') %] >+ <script> >+ var AUDIO_ALERTS = JSON.parse( "[% To.json(AudioAlerts.AudioAlerts) | $raw %]" ); >+ $( document ).ready(function() { >+ if ( AUDIO_ALERTS ) { >+ for ( var k in AUDIO_ALERTS ) { >+ var alert = AUDIO_ALERTS[k]; >+ if ( $( alert.selector ).length ) { >+ playSound( alert.sound ); >+ break; >+ } >+ } > } >+ }); >+ function playSound( sound ) { >+ if (!(sound.indexOf("http://") === 0 || sound.indexOf("https://") === 0)) { >+ sound = '[% interface | html %]' + '/bootstrap/sound/' + sound; >+ } >+ document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>'; > } >- var mainTimeout; >- function sco_init() { >- mainTimeout = setTimeout(function() { >- location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; >- }, [% SelfCheckTimeout | html %]); >+ </script> >+ [% END %] >+ <script> >+ function mungeHistory() { >+ // prevent back button from allowing form resubmission >+ if (history && history.pushState) { >+ history.replaceState(null, document.title, window.location.href); > } >- function dofocus() { // named function req'd for body onload event by some FF and IE7 security models >- // alert("dofocus called"); >- $(".focus:last").select(); >+ } >+ var mainTimeout; >+ function sco_init() { >+ mainTimeout = setTimeout(function () { >+ location.href = "/cgi-bin/koha/sco/sco-main.pl?op=logout"; >+ }, prefs.SelfCheckTimeout); >+ } >+ function dofocus() { >+ // named function req'd for body onload event by some FF and IE7 security models >+ // alert("dofocus called"); >+ $(".focus:last").select(); >+ } >+ var slip_re = /slip/; >+ function printx_window(print_type) { >+ var handler = print_type.match(slip_re) ? "printslip" : "moremember"; >+ >+ return false; >+ } >+ function checkout_confirm(patronid) { >+ var barcode = $("#barcode").val(); >+ // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'"); >+ if (!barcode) { >+ dofocus(); >+ return false; >+ } // no barcode >+ if (barcode == "__KOHA_NEW_CIRC__") { >+ // magic barcode >+ window.location.href = "/cgi-bin/koha/sco/sco-main.pl?op=logout"; >+ return false; > } >- var slip_re = /slip/; >- function printx_window(print_type) { >- var handler = print_type.match(slip_re) ? "printslip" : "moremember"; >+ return true; >+ } > >- return false; >- } >- function checkout_confirm(patronid) { >- var barcode = $("#barcode").val(); >- // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'"); >- if (! barcode) { dofocus(); return false; } // no barcode >- if (barcode == "__KOHA_NEW_CIRC__") { // magic barcode >- window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout'; >- return false; >- } >- return true; >+ $(window).on("load", function () { >+ dofocus(); >+ }); >+ >+ $(window).on("unload", function () { >+ mungeHistory(); >+ }); >+ >+ $(document).ready(function () { >+ dofocus(); >+ if (logged_in_user_cardnumber) { >+ sco_init(); > } >- [% IF Koha.Preference('AudioAlerts') %] >- var AUDIO_ALERTS = JSON.parse( "[% To.json(AudioAlerts.AudioAlerts) | $raw %]" ); >- $( document ).ready(function() { >- if ( AUDIO_ALERTS ) { >- for ( var k in AUDIO_ALERTS ) { >- var alert = AUDIO_ALERTS[k]; >- if ( $( alert.selector ).length ) { >- playSound( alert.sound ); >- break; >- } >- } >- } >- }); >- function playSound( sound ) { >- if (!(sound.indexOf("http://") === 0 || sound.indexOf("https://") === 0)) { >- sound = '[% interface | html %]' + '/bootstrap/sound/' + sound; >- } >- document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>'; >- } >- [% END %] > >- $( window ).on( "load", function() { >- dofocus(); >+ var dTables = $("#loanTable, #holdst, #finestable"); >+ dTables.each(function () { >+ var thIndex = $(this).find("th.psort").index(); >+ $(this).kohaTable({ >+ order: [[thIndex, "asc"]], >+ dom: '<"top"<"table_entries"><"table_controls"f>>t<"clear">', >+ columnDefs: [ >+ { targets: ["noshow"], visible: false, searchable: false }, >+ { visible: false, targets: ["hidden"] }, >+ { className: "dtr-control", orderable: false, targets: -1 }, >+ ], >+ language: { >+ search: "_INPUT_", >+ searchPlaceholder: _("Search"), >+ }, >+ responsive: { >+ details: { >+ type: "column", >+ target: -1, >+ }, >+ }, >+ }); > }); > >- $( window ).on( "unload", function() { >- mungeHistory(); >+ $('a[data-bs-toggle="tab"]').on("shown.bs.tab", function (event) { >+ dTables.DataTable().responsive.recalc(); > }); > >- $(document).ready(function() { >- dofocus(); >- [% IF ( patronid ) %]sco_init();[% END %] >- >- var dTables = $("#loanTable, #holdst, #finestable"); >- dTables.each(function(){ >- var thIndex = $(this).find("th.psort").index(); >- $(this).kohaTable({ >- order: [[thIndex, "asc"]], >- dom: '<"top"<"table_entries"><"table_controls"f>>t<"clear">', >- columnDefs: [ >- { targets: ["noshow"], visible: false, searchable: false }, >- { visible: false, targets: ["hidden"] }, >- { className: "dtr-control", orderable: false, targets: -1 }, >- ], >- language: { >- search: "_INPUT_", >- searchPlaceholder: _("Search"), >- }, >- responsive: { >- details: { >- type: "column", >- target: -1, >- }, >- }, >+ $("#logout_form").on("click", function (e) { >+ e.preventDefault(e); >+ clearTimeout(mainTimeout); >+ if (prefs.SelfCheckReceiptPrompt) { >+ confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function (result) { >+ if (result) { >+ var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip"); >+ location.href = "/cgi-bin/koha/sco/sco-main.pl?op=logout"; >+ } else { >+ location.href = "/cgi-bin/koha/sco/sco-main.pl?op=logout"; >+ } > }); >- }); >- >- $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (event) { >- dTables.DataTable().responsive.recalc(); >- } ); >- >- $("#logout_form").on("click", function(e){ >- e.preventDefault(e); >- clearTimeout(mainTimeout); >- [% IF Koha.Preference('SelfCheckReceiptPrompt') %] >- confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) { >- if ( result ){ >- var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip"); >- location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; >- } else { >- location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; >- } >- }); >- [% ELSE %] >- location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; >- [% END %] >+ } else { >+ location.href = "/cgi-bin/koha/sco/sco-main.pl?op=logout"; >+ } > >- return true; >- }); >+ return true; >+ }); > >- $("#scan_form").on("submit", function(){ >- return checkout_confirm('[% patronid | html %]'); >- }); >+ $("#scan_form").on("submit", function () { >+ return checkout_confirm(logged_in_user_cardnumber); >+ }); > }); > </script> > [% Asset.js("js/holds.js") | $raw %] >-- >2.43.0 >
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 41582
:
191174
|
191175
|
191176
|
191177
|
191178
|
191179
|
191180
|
191181
|
191182
|
191183
|
191184
|
191185
|
191186
| 191187 |
191188