Bug 26150: Remove the use of jquery.checkboxes plugin from inventory page
authorOwen Leonard <oleonard@myacpl.org>
Wed, 5 Aug 2020 17:00:26 +0000 (17:00 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 24 Aug 2020 09:19:03 +0000 (11:19 +0200)
This patch removes the use of the jquery.checkboxes plugin from the
inventory page and replaces it with custom JS.

To test, apply the patch and go to Tools -> Inventory.

 - Submit the form with some selections which will return results on the
   following page. I filtered by library.
 - On the page showing results, test that the "Select all" and "Clear
   all" links work correctly.

Signed-off-by: Brandon J <brandon.jimenez@inLibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt

index 18379a1..2db78af 100644 (file)
     [% Asset.js("js/tools-menu.js") | $raw %]
     [% INCLUDE 'datatables.inc' %]
     [% INCLUDE 'calendar.inc' %]
-    [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
     <script type="text/javascript">
         function checkForm() {
             if ( $('#uploadbarcodes').val() ) {
                 return false;
             });
 
-
-            $(".checkall").click(function(){
-                    $(".checkboxed").checkCheckboxes();
-                    return false;
+            var checkboxes = $("#inventoryt input:checkbox");
+            $(".checkall").click(function(e){
+                e.preventDefault();
+                checkboxes.each(function(){
+                    $(this).prop("checked", true);
                 });
-            $(".clearall").click(function(){
-                    $(".checkboxed").unCheckCheckboxes();
-                    return false;
+            });
+            $(".clearall").click(function(e){
+                e.preventDefault();
+                checkboxes.each(function(){
+                    $(this).prop("checked", false);
                 });
+            });
             $("#inventory_form").on("submit",function(){
                 return checkForm();
             });