From cd40c3653e2d05f8039abff81d5a434b956c553d Mon Sep 17 00:00:00 2001
From: Devinim <kohadevinim@devinim.com.tr>
Date: Tue, 12 Nov 2019 09:58:37 +0000
Subject: [PATCH] Bug 22773: The deprecated plugin is removed

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Christopher Kellermeyer <ckellermeyer@altadenalibrary.org>
---
 .../lib/jquery/plugins/dataTables.fnFilterAll.js   | 39 ----------------------
 .../prog/en/modules/acqui/invoices.tt              | 17 +++++-----
 2 files changed, 9 insertions(+), 47 deletions(-)
 delete mode 100644 koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js

diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js
deleted file mode 100644
index 91c9d2093e..0000000000
--- a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/dataTables.fnFilterAll.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Apply the same filter to all DataTable instances on a particular page. The
- * function call exactly matches that used by `fnFilter()` so regular expression
- * and individual column sorting can be used.
- *
- * DataTables 1.10+ provides this ability through its new API, which is able to
- * to control multiple tables at a time.
- * `$('.dataTable').DataTable().search( ... )` for example will apply the same
- * filter to all tables on the page. The new API should be used in preference
- * to this older method if at all possible.
- *
- *  @name fnFilterAll
- *  @summary Apply a common filter to all DataTables on a page
- *  @author [Kristoffer Karlström](http://www.kmmtiming.se/)
- *  @deprecated
- *
- *  @param {string} sInput Filtering input
- *  @param {integer} [iColumn=null] Column to apply the filter to
- *  @param {boolean} [bRegex] Regular expression flag
- *  @param {boolean} [bSmart] Smart filtering flag
- *
- *  @example
- *    $(document).ready(function() {
- *      var table = $(".dataTable").dataTable();
- *
- *      $("#search").keyup( function () {
- *        // Filter on the column (the index) of this element
- *        table.fnFilterAll(this.value);
- *      } );
- *    });
- */
-
-jQuery.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bRegex, bSmart) {
-    var settings = $.fn.dataTableSettings;
-
-    for ( var i=0 ; i<settings.length ; i++ ) {
-        settings[i].oInstance.fnFilter( sInput, iColumn, bRegex, bSmart);
-    }
-};
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
index 7f5e08ac2a..ff96042a28 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
@@ -23,16 +23,16 @@
       <h1>Invoices</h1>
       [% IF ( do_search ) %]
         [% IF invoices %]
-          <label for="show_only_subscription">
-            <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
-            Show only subscriptions
-          </label>
           [% BLOCK invoices_table %]
             [% IF closed %]
                 [% SET tab = 'closed' %]
             [% ELSE %]
                 [% SET tab = 'opened' %]
             [% END %]
+          <label for="show_only_subscription">
+            <input type="checkbox" style="vertical-align: middle;" class="show_only_subscription" data-tableid="[% tab %]resultst"/>
+            Show only subscriptions
+          </label>
           <table id="[% tab %]resultst" class="result">
             <thead>
               <tr>
@@ -357,13 +357,14 @@
                 autoWidth: false
             }));
 
-            $("#show_only_subscription").prop("checked", false);
+            $(".show_only_subscription").prop("checked", false);
 
-            $("#show_only_subscription").click(function(){
+            $(".show_only_subscription").click(function(){
+                var table_id = $(this).attr("data-tableid");
                 if ( $(this).prop("checked") ) {
-                    resultst.fnFilterAll( "1", 0, true );
+                    $('#'+table_id).dataTable().fnFilter( "1", 0, true );
                 } else {
-                    resultst.fnFilterAll( '', 0 );
+                    $('#'+table_id).dataTable().fnFilter( '', 0 );
                 }
             });
 
-- 
2.11.0