From 13d59fe66766e3c53d384b78ee8ce91ce7168cf4 Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> Date: Wed, 5 Aug 2020 18:53:46 +0000 Subject: [PATCH] Bug 26154: Remove the use of jquery.checkboxes plugin from batch item deletion and modification This patch removes the use of the jquery.checkboxes plugin from the batch item modification and batch item deletion pages. To test, apply the patch and go to Tools -> Batch item modification. - Submit a batch of barcodes. - On the results page, test the "Select all" and "Clear all" controls at the top of the page. These should work correctly on the checkboxes in the table of results. - Test that the "Clear on loan" control still works to uncheck checkboxes corresponding to items which are checked out. - Test the "Show all columns" and "Hide all columns" checkboxes in the "Show/hide columns" section. These should work correctly on the checkboxes for showing and hiding columns in the table. - Go to Tools -> Batch item deletion. - Submit a batch of barcodes. - Repeat the same testing steps above (except the "Clear on loan" step). --- .../prog/en/modules/tools/batchMod-del.tt | 1 - .../prog/en/modules/tools/batchMod-edit.tt | 1 - koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js | 24 ++++++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt index eb5ddd82c6..3df7096449 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt @@ -288,7 +288,6 @@ [% Asset.js("js/tools-menu.js") | $raw %] [% INCLUDE 'datatables.inc' %] [% Asset.js("js/pages/batchMod.js") | $raw %] - [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] <script type="text/javascript"> // Prepare array of all column headers, incrementing each index by // two to accommodate control and title columns diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt index 283ef381ef..ed1331a7ad 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -8,7 +8,6 @@ [% Asset.js("js/background-job-progressbar.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %] [% INCLUDE 'datatables.inc' %] -[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] [% Asset.js("js/pages/batchMod.js") | $raw %] <script type="text/javascript"> //<![CDATA[ diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js b/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js index c20a415eb1..4d15973fd1 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js @@ -80,14 +80,18 @@ function showColumn(num){ } } function showAllColumns(){ - $("#selections").checkCheckboxes(); + $("#selections input:checkbox").each(function(){ + $(this).prop("checked", true); + }); $("#selections span").addClass("selected"); $("#itemst td:nth-child(3),#itemst tr th:nth-child(3)").nextAll().show(); $.removeCookie("showColumns", { path: '/' }); $("#hideall").prop("checked", false).parent().removeClass("selected"); } function hideAllColumns(){ - $("#selections").unCheckCheckboxes(); + $("#selections input:checkbox").each(function(){ + $(this).prop("checked", false); + }); $("#selections span").removeClass("selected"); $("#itemst td:nth-child(3),#itemst th:nth-child(3)").nextAll().hide(); $("#hideall").prop("checked", true).parent().addClass("selected"); @@ -105,13 +109,17 @@ function hideAllColumns(){ ], "bPaginate": false, })); - $("#selectallbutton").click(function(){ - $("#itemst").checkCheckboxes(); - return false; + $("#selectallbutton").click(function(e){ + e.preventDefault(); + $("#itemst input:checkbox").each(function(){ + $(this).prop("checked", true); + }); }); - $("#clearallbutton").click(function(){ - $("#itemst").unCheckCheckboxes(); - return false; + $("#clearallbutton").click(function(e){ + e.preventDefault(); + $("#itemst input:checkbox").each(function(){ + $(this).prop("checked", false); + }); }); $("#clearonloanbutton").click(function(){ $("#itemst input[name='itemnumber'][data-is-onloan='1']").each(function(){ -- 2.11.0