Bugzilla – Attachment 192583 Details for
Bug 41779
Late orders: disable batch controls if no checkboxes are checked
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41779: Late orders: disable batch controls if no checkboxes are checked
24f3369.patch (text/plain), 6.26 KB, created by
David Nind
on 2026-02-06 07:11:29 UTC
(
hide
)
Description:
Bug 41779: Late orders: disable batch controls if no checkboxes are checked
Filename:
MIME Type:
Creator:
David Nind
Created:
2026-02-06 07:11:29 UTC
Size:
6.26 KB
patch
obsolete
>From 24f3369818b05faa507fb41e7bdf5c3f683f7b77 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 5 Feb 2026 13:26:21 -0500 >Subject: [PATCH] Bug 41779: Late orders: disable batch controls if no > checkboxes are checked > >This patch adds JavaScript which changes the enabled or disabled state >of the batch controls on the late orders page: "Export as CSV" and >"Claim order." > >To test you must have more than one late order. > >- Apply the patch and go to Acquisitions -> Late orders. >- At the bottom of the table of late orders you should see the "Export > as CSV" and "Claim order" buttons and they should be disabled. >- Try checking and unchecking boxes, and confirm that the controls are > enabled and disabled as they should be. >- Filter your list of late orders by vendor using the filter form in the > sidebar. >- Test that the "Check all" and "Uncheck all" controls above the table. > The batch controls should be enabled and disabled correctly. > >Sponsored-by: Athens County Public Libraries >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/modules/acqui/lateorders.tt | 44 ++++++++++++------- > 1 file changed, 29 insertions(+), 15 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >index 4fd290a225..761f203dcf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt >@@ -250,8 +250,8 @@ > > <fieldset class="action"> > <div class="btn-group"> >- <a id="exportbutton" class="btn btn-default" href="/cgi-bin/koha/acqui/lateorders-export.pl"><i class="fa fa-download"></i> Export as CSV</a> >- <a class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"></a> >+ <a id="exportbutton" class="btn btn-default disabled" aria-disabled="true" href="/cgi-bin/koha/acqui/lateorders-export.pl"><i class="fa fa-download"></i> Export as CSV</a> >+ <a id="export-csv-trigger" class="btn btn-default dropdown-toggle disabled" aria-disabled="true" data-bs-toggle="dropdown" aria-expanded="false"></a> > <ul class="dropdown-menu" id="export-csv-menu"> > <li><a class="dropdown-item dropdown-menu-end" href="#">Default</a></li> > [% IF csv_profiles.count %] >@@ -262,7 +262,7 @@ > </ul> > </div> > >- <input type="submit" class="btn btn-default" value="Claim order" /> >+ <input id="claim-order" type="submit" class="btn btn-default disabled" aria-disabled="true" disabled value="Claim order" /> > </fieldset> > </form> > [% ELSE %] >@@ -377,37 +377,51 @@ > <script> > var late_orderst; > function check_uncheck() { >- var all_nodes = late_orderst.DataTable().rows().nodes(); >- if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) { >- var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid"); >- $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true); >+ if( typeof late_orderst != 'undefined'){ >+ var all_nodes = late_orderst.DataTable().rows().nodes(); >+ if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) { >+ enableBatchActions(true); >+ var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid"); >+ $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true); >+ } else { >+ enableBatchActions(false); >+ $("input:checkbox[name=ordernumber]").prop('disabled', false); >+ } >+ } >+ } >+ >+ function enableBatchActions( op ){ >+ if( op ){ >+ $("#exportbutton, #export-csv-trigger, #claim-order").prop("disabled", false).removeClass("disabled").attr("aria-disabled", op ); > } else { >- $("input:checkbox[name=ordernumber]").prop('disabled', false); >+ $("#exportbutton, #export-csv-trigger, #claim-order").prop("disabled", true).addClass("disabled").attr("aria-disabled", op ); > } > } > > $(document).ready(function() { >- > var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %]; > late_orderst = $("#late_orders").kohaTable({ > order: [[ 1, "asc" ]], > pagingType: "full", > autoWidth: false, > drawCallback: function() { >- if ( typeof late_orderst != 'undefined' ) { >- check_uncheck(); >- $('input:checkbox[name=ordernumber]').bind('click', check_uncheck); >- }; >+ check_uncheck(); >+ $('input:checkbox[name=ordernumber]').bind('click', check_uncheck); > } > }, table_settings ); >+ >+ check_uncheck(); >+ > $('input:checkbox[name=ordernumber]').bind('click', check_uncheck); > $('#CheckAll').click(function(e){ > e.preventDefault(); >- $("#late_orders input:checkbox").prop("checked", true); >+ $('input:checkbox[name=ordernumber]').prop("checked", true); >+ check_uncheck(); > }); > $('#CheckNone').click(function(e){ > e.preventDefault(); >- $("#late_orders input:checkbox").prop("checked", false); >+ $('input:checkbox[name=ordernumber]').prop("checked", false); >+ check_uncheck(); > }); > > // Generates a dynamic link for exporting the selection's data as CSV >-- >2.39.5 >
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 41779
:
192542
| 192583