From 04db082e71496a802c9a3f7df5c0ae8eec5d204e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 16 Dec 2021 12:48:57 +0100 Subject: [PATCH] Bug 29648: Catalogue detail - no default_display_length On the acquisition table the sort option is not available as we don't offer the ability to selection asc/desc and default to asc. We cannot offer default_display_length for those tables. Signed-off-by: Owen Leonard Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Fridolin Somers --- admin/columns_settings.pl | 8 ++++++-- admin/columns_settings.yml | 2 ++ .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 10 +++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/admin/columns_settings.pl b/admin/columns_settings.pl index 55d312d4f9..d5b0df9dca 100755 --- a/admin/columns_settings.pl +++ b/admin/columns_settings.pl @@ -50,8 +50,12 @@ if ( $action eq 'save' ) { next unless $table_id =~ m|^([^#]*)#(.*)$|; my $default_display_length = $input->param( $table_id . '_default_display_length' ); my $default_sort_order = $input->param( $table_id . '_default_sort_order' ); - if ( defined $default_display_length && $default_display_length ne "" - && defined $default_sort_order && $default_sort_order ne "" ) { + + undef $default_display_length if defined $default_display_length && $default_display_length eq ""; + undef $default_sort_order if defined $default_sort_order && $default_sort_order eq ""; + + if ( defined $default_display_length || defined $default_sort_order ) + { C4::Utils::DataTables::TablesSettings::update_table_settings( { module => $module, diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index 79674077ee..f58b95d8b1 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -341,6 +341,7 @@ modules: catalogue: detail: holdings_table: + default_sort_order: 0 columns: - columnname: holdings_checkbox @@ -398,6 +399,7 @@ modules: cannot_be_modified: 1 otherholdings_table: + default_sort_order: 0 columns: - columnname: otherholdings_checkbox diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 320408596c..95a889f90a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -1367,12 +1367,12 @@ Note that permanent location is a code, and location may be an authval. $(document).ready(function() { var ids = ['holdings_table', 'otherholdings_table']; - var columns_settings = [ [% TablesSettings.GetColumns('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetColumns('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; + var table_settings = [ [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; var has_images = ["[% itemloop_has_images | html %]", "[% otheritemloop_has_images | html %]"]; for (var i in ids) { var id = ids[i]; if ( !has_images[i] ) { // remove the cover_image column - columns_settings.splice(1,1); + table_settings.splice(1,1); } var dt_parameters = { 'sDom': 't', @@ -1381,17 +1381,17 @@ Note that permanent location is a code, and location may be an authval. "bKohaColumnsUseNames": true, "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', }; - var table = KohaTable(id, dt_parameters, columns_settings[i], 'with_filters'); + var table = KohaTable(id, dt_parameters, table_settings[i], 'with_filters'); } [% IF Koha.Preference('AcquisitionDetails') %] - var columns_settings = [% TablesSettings.GetColumns('catalogue', 'detail', 'acquisitiondetails-table', 'json') %]; + var table_settings = [% TablesSettings.GetTableSettings('catalogue', 'detail', 'acquisitiondetails-table', 'json') %]; var acquisitiondetails_table = KohaTable("orders", { "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', 'bPaginate': false, 'bAutoWidth': false, "aaSorting": [[ 4, "desc" ]], - }, columns_settings); + }, table_settings); [% END %] [% IF suggestions.count %] -- 2.39.5