Bug 30922: Make the "Relative's checkouts" table configurable by the table settings
authorShi Yao Wang <shi-yao.wang@inlibro.com>
Wed, 6 Jul 2022 14:47:03 +0000 (10:47 -0400)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 16 Aug 2022 13:26:18 +0000 (10:26 -0300)
Adds "relatives-issues-table" in table settings.

Test plan:
1- Apply the patch
2- Check out an item to a patron with a guarantor
3- Go to the guarantor's "details" and "check out" page > relatives'
checkouts and look at the different columns (you should see collection
and location)
4- Go to
    admin > table settings > patron > moremember > relatives-issues-table
 or
    admin > table settings > circulation > circulation >
relatives-issues-table
to hide some columns (e.g. collection and location) and click save
5- Do step 3 again and notice some columns (e.g. collection and location) are hidden
6- Also notice the "Columns" and "Export" buttons that should work as
intended

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
admin/columns_settings.yml
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
koha-tmpl/intranet-tmpl/prog/js/checkouts.js

index cc51d00..18b2f23 100644 (file)
@@ -960,6 +960,47 @@ modules:
               cannot_be_toggled: 1
               cannot_be_modified: 1
 
+      relatives-issues-table:
+        columns:
+            -
+              columnname: due_date_unformatted
+              cannot_be_toggled: 1
+              cannot_be_modified: 1
+              is_hidden: 1
+            -
+              columnname: due_date
+            -
+              columnname: title
+            -
+              columnname: record_type
+            -
+              columnname: item_type
+            -
+              columnname: collection
+            -
+              columnname: location
+            -
+              columnname: checkout_on_unformatted
+              cannot_be_toggled: 1
+              cannot_be_modified: 1
+              is_hidden: 1
+            -
+              columnname: checkout_on
+            -
+              columnname: checkout_from
+            -
+              columnname: callno
+            -
+              columnname: copynumber
+            -
+              columnname: charge
+            -
+              columnname: fine
+            -
+              columnname: price
+            -
+              columnname: patron
+
     holdshistory:
       holdshistory-table:
         default_display_length: 20
@@ -1231,6 +1272,47 @@ modules:
               cannot_be_toggled: 1
               cannot_be_modified: 1
 
+      relatives-issues-table:
+        columns:
+            -
+              columnname: due_date_unformatted
+              cannot_be_toggled: 1
+              cannot_be_modified: 1
+              is_hidden: 1
+            -
+              columnname: due_date
+            -
+              columnname: title
+            -
+              columnname: record_type
+            -
+              columnname: item_type
+            -
+              columnname: collection
+            -
+              columnname: location
+            -
+              columnname: checkout_on_unformatted
+              cannot_be_toggled: 1
+              cannot_be_modified: 1
+              is_hidden: 1
+            -
+              columnname: checkout_on
+            -
+              columnname: checkout_from
+            -
+              columnname: callno
+            -
+              columnname: copynumber
+            -
+              columnname: charge
+            -
+              columnname: fine
+            -
+              columnname: price
+            -
+              columnname: patron
+
       table_borrowers:
         columns:
             -
index 49b9a30..992a1d2 100644 (file)
     [% INCLUDE 'calendar.inc' %]
     <script>
         table_settings_issues_table = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'issues-table', 'json' ) | $raw %]
+        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'relatives-issues-table', 'json' ) | $raw %]
         table_settings_borrowers_table = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %]
 
         [% IF borrowernumber and patron %]
index 1f81893..2dda38b 100644 (file)
     <script>
 
         table_settings_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'issues-table', 'json' ) | $raw %]
+        table_settings_relatives_issues_table = [% TablesSettings.GetTableSettings( 'members', 'moremember', 'relatives-issues-table', 'json' ) | $raw %]
 
         $(document).ready(function() {
             $("#info_digests").tooltip();
index 3c737ec..0afb451 100644 (file)
@@ -703,9 +703,9 @@ $(document).ready(function() {
     var relativesIssuesTable;
     $("#relatives-issues-tab").click( function() {
         if ( ! relativesIssuesTable ) {
-            relativesIssuesTable = $("#relatives-issues-table").dataTable($.extend(true, {}, dataTablesDefaults, {
+            relativesIssuesTable = KohaTable("relatives-issues-table", {
                 "bAutoWidth": false,
-                "sDom": "rt",
+                "dom": 'B<"clearfix">rt',
                 "aaSorting": [],
                 "aoColumns": [
                     {
@@ -868,7 +868,7 @@ $(document).ready(function() {
                         fnCallback(json)
                     } );
                 },
-            }));
+            }, table_settings_relatives_issues_table);
         }
     });