From 744d0d344cde7357dbd53eb89a43de7bf1ea4830 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 5 Dec 2019 17:40:08 +0100 Subject: [PATCH] Bug 24156: move ColumnsSettings to TablesSettings We are preparing the ground with this patch. As the "Columns settings" page will now add the ability to modify settings for the whole table, it makes sense to rename the file and the variables. Note that the controller script (admin/columns_settings.pl) and the yml (admin/columns_settings.yml) files have not been moved to not break shortcuts and abits people could have. But if QA decides, it could be easy to do. Signed-off-by: Liz Rea --- .../{ColumnsSettings.pm => TablesSettings.pm} | 8 +++---- .../{ColumnsSettings.pm => TablesSettings.pm} | 24 +++++++++---------- admin/columns_settings.pl | 6 ++--- .../prog/en/includes/columns_settings.inc | 3 ++- .../en/includes/str/cataloging_additem.inc | 2 +- .../prog/en/modules/acqui/basket.tt | 4 ++-- .../prog/en/modules/acqui/duplicate_orders.tt | 2 +- .../prog/en/modules/acqui/histsearch.tt | 4 ++-- .../prog/en/modules/acqui/lateorders.tt | 4 ++-- .../prog/en/modules/admin/branches.tt | 4 ++-- .../prog/en/modules/admin/categories.tt | 4 ++-- .../prog/en/modules/admin/currency.tt | 4 ++-- .../prog/en/modules/admin/itemtypes.tt | 4 ++-- .../prog/en/modules/catalogue/detail.tt | 6 ++--- .../prog/en/modules/catalogue/issuehistory.tt | 4 ++-- .../prog/en/modules/cataloguing/additem.tt | 2 +- .../en/modules/cataloguing/z3950_search.tt | 4 ++-- .../prog/en/modules/circ/circulation.tt | 6 ++--- .../prog/en/modules/circ/overdue.tt | 4 ++-- .../prog/en/modules/circ/pendingreserves.tt | 4 ++-- .../prog/en/modules/circ/reserveratios.tt | 4 ++-- .../prog/en/modules/circ/returns.tt | 4 ++-- .../prog/en/modules/circ/view_holdsqueue.tt | 4 ++-- .../prog/en/modules/circ/waitingreserves.tt | 6 ++--- .../modules/course_reserves/course-details.tt | 4 ++-- .../course_reserves/course-reserves.tt | 4 ++-- .../prog/en/modules/ill/ill-requests.tt | 4 ++-- .../prog/en/modules/members/boraccount.tt | 4 ++-- .../prog/en/modules/members/holdshistory.tt | 4 ++-- .../prog/en/modules/members/ill-requests.tt | 4 ++-- .../prog/en/modules/members/member.tt | 4 ++-- .../prog/en/modules/members/moremember.tt | 4 ++-- .../prog/en/modules/members/pay.tt | 4 ++-- .../prog/en/modules/members/readingrec.tt | 4 ++-- .../prog/en/modules/patron_lists/list.tt | 4 ++-- .../modules/reports/guided_reports_start.tt | 4 ++-- .../prog/en/modules/reports/itemslost.tt | 4 ++-- .../prog/en/modules/reserve/request.tt | 2 +- .../en/modules/serials/subscription-detail.tt | 4 ++-- .../prog/en/modules/suggestion/suggestion.tt | 4 ++-- .../prog/en/modules/tools/letter.tt | 4 ++-- .../prog/en/modules/tools/stockrotation.tt | 6 ++--- .../en/includes/columns_settings.inc | 2 +- .../en/modules/opac-course-details.tt | 4 ++-- .../en/modules/opac-course-reserves.tt | 4 ++-- .../bootstrap/en/modules/opac-detail.tt | 10 ++++---- .../{ColumnsSettings.t => TablesSettings.t} | 10 ++++---- 47 files changed, 112 insertions(+), 111 deletions(-) rename C4/Utils/DataTables/{ColumnsSettings.pm => TablesSettings.pm} (90%) rename Koha/Template/Plugin/{ColumnsSettings.pm => TablesSettings.pm} (71%) rename t/db_dependent/{ColumnsSettings.t => TablesSettings.t} (94%) diff --git a/C4/Utils/DataTables/ColumnsSettings.pm b/C4/Utils/DataTables/TablesSettings.pm similarity index 90% rename from C4/Utils/DataTables/ColumnsSettings.pm rename to C4/Utils/DataTables/TablesSettings.pm index 8713489b0c..1c52dbbba8 100644 --- a/C4/Utils/DataTables/ColumnsSettings.pm +++ b/C4/Utils/DataTables/TablesSettings.pm @@ -1,4 +1,4 @@ -package C4::Utils::DataTables::ColumnsSettings; +package C4::Utils::DataTables::TablesSettings; use Modern::Perl; use List::Util qw( first ); @@ -10,13 +10,13 @@ use Koha::Caches; sub get_yaml { my $yml_path = C4::Context->config('intranetdir') . '/admin/columns_settings.yml'; my $cache = Koha::Caches->get_instance(); - my $yaml = $cache->get_from_cache('ColumnsSettingsYaml'); + my $yaml = $cache->get_from_cache('TablesSettingsYaml'); unless ($yaml) { $yaml = eval { YAML::LoadFile($yml_path) }; - warn "ERROR: the yaml file for DT::ColumnsSettings is not correctly formated: $@" + warn "ERROR: the yaml file for DT::TablesSettings is not correctly formated: $@" if $@; - $cache->set_in_cache( 'ColumnsSettingsYaml', $yaml, { expiry => 3600 } ); + $cache->set_in_cache( 'TablesSettingsYaml', $yaml, { expiry => 3600 } ); } return $yaml; diff --git a/Koha/Template/Plugin/ColumnsSettings.pm b/Koha/Template/Plugin/TablesSettings.pm similarity index 71% rename from Koha/Template/Plugin/ColumnsSettings.pm rename to Koha/Template/Plugin/TablesSettings.pm index 50c2131ece..2ed567c7cd 100644 --- a/Koha/Template/Plugin/ColumnsSettings.pm +++ b/Koha/Template/Plugin/TablesSettings.pm @@ -1,4 +1,4 @@ -package Koha::Template::Plugin::ColumnsSettings; +package Koha::Template::Plugin::TablesSettings; # This file is part of Koha. # @@ -19,28 +19,28 @@ package Koha::Template::Plugin::ColumnsSettings; =head1 NAME -Koha::Template::Plugin::ColumnsSettings +Koha::Template::Plugin::TablesSettings =head2 SYNOPSYS - [% USE ColumnsSettings %] + [% USE TablesSettings %] . . . - [% UNLESS ColumnsSettings.is_hidden( 'module', 'page', 'table', 'column') %] + [% UNLESS TablesSettings.is_hidden( 'module', 'page', 'table', 'column') %] Column title [% END %] . . . - [% UNLESS ColumnsSettings.is_hidden( 'module', 'page', 'table', 'column') %] + [% UNLESS TablesSettings.is_hidden( 'module', 'page', 'table', 'column') %] [% row.column %] [% END %] . . . @@ -58,15 +58,15 @@ use YAML qw( LoadFile ); use JSON qw( to_json ); use C4::Context qw( config ); -use C4::Utils::DataTables::ColumnsSettings; +use C4::Utils::DataTables::TablesSettings; =head1 FUNCTIONS =head2 GetColumns Used to get the full column settings configuration for datatables, usually requires a format of 'json' to pass into @@ -78,7 +78,7 @@ sub GetColumns { my ( $self, $module, $page, $table, $format ) = @_; $format //= q{}; - my $columns = C4::Utils::DataTables::ColumnsSettings::get_columns( $module, $page, $table ); + my $columns = C4::Utils::DataTables::TablesSettings::get_columns( $module, $page, $table ); return $format eq 'json' ? to_json( $columns ) @@ -87,7 +87,7 @@ sub GetColumns { =head2 is_hidden - [% UNLESS ColumnsSettings.is_hidden( 'module', 'page', 'table', 'column') %] + [% UNLESS TablesSettings.is_hidden( 'module', 'page', 'table', 'column') %] Column title [% END %] @@ -98,7 +98,7 @@ it may contain confidential information and should be fully hidden rather than j sub is_hidden { my ( $self, $module, $page, $table, $column_name ) = @_; - my $columns = C4::Utils::DataTables::ColumnsSettings::get_columns( $module, $page, $table ); + my $columns = C4::Utils::DataTables::TablesSettings::get_columns( $module, $page, $table ); foreach my $keys(@$columns){ if($keys->{'columnname'} eq $column_name){ return $keys->{'is_hidden'}; diff --git a/admin/columns_settings.pl b/admin/columns_settings.pl index 5283963184..11117de41a 100755 --- a/admin/columns_settings.pl +++ b/admin/columns_settings.pl @@ -6,7 +6,7 @@ use YAML qw( LoadFile ); use C4::Auth; use C4::Context; use C4::Output; -use C4::Utils::DataTables::ColumnsSettings qw( get_modules ); +use C4::Utils::DataTables::TablesSettings qw( get_modules ); my $input = new CGI; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -42,7 +42,7 @@ if ( $action eq 'save' ) { }; } - C4::Utils::DataTables::ColumnsSettings::update_columns( + C4::Utils::DataTables::TablesSettings::update_columns( { columns => \@columns, } @@ -52,7 +52,7 @@ if ( $action eq 'save' ) { } if ( $action eq 'list' ) { - my $modules = C4::Utils::DataTables::ColumnsSettings::get_modules; + my $modules = C4::Utils::DataTables::TablesSettings::get_modules; $template->param( panel => ( $input->param('panel') || 0 ), modules => $modules, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc index d863b1e9cc..c8b01e089a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc @@ -1,5 +1,6 @@ -[% USE ColumnsSettings %] +[% USE TablesSettings %] + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index fedd90c118..e709ec845b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -19,7 +19,7 @@ [% USE Branches %] [% USE Price %] [% USE AuthorisedValues %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › [% UNLESS ( basketno ) %]New [% END %]Basket [% basketname | html %] ([% basketno | html %]) for [% booksellername | html %] @@ -924,7 +924,7 @@ [% END %] [% END %] [% Asset.js("js/categories.js") | $raw %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt index e16313110b..874ae51daa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt @@ -1,7 +1,7 @@ [% USE raw %] [% USE Asset %] [% USE KohaDates %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% USE HtmlTags %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] @@ -246,7 +246,7 @@ } $(document).ready(function() { - columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'currency', 'currencies-table', 'json' ) | $raw %] + columns_settings = [% TablesSettings.GetColumns( 'admin', 'currency', 'currencies-table', 'json' ) | $raw %] var issuest = KohaTable("currencies-table", { dom: 'B<"clearfix">t', "columnDefs": [ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index 9045f6c712..e28d7e17ed 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -3,7 +3,7 @@ [% USE Koha %] [% USE AuthorisedValues %] [% USE Price %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › Item types [% IF op == 'add_form' %]› @@ -483,7 +483,7 @@ Item types administration <script> $(document).ready(function() { $('#icons').tabs(); - var columns_settings = [% ColumnsSettings.GetColumns( 'admin', 'itemtypes', 'table_item_type', 'json' ) | $raw %]; + var columns_settings = [% TablesSettings.GetColumns( 'admin', 'itemtypes', 'table_item_type', 'json' ) | $raw %]; [% IF ( Koha.Preference('noItemTypeImages') && Koha.Preference('OpacNoItemTypeImages') ) %] columns_settings.shift(); // Remove item type image column from configuration [% END %] 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 d58edcf514..fd1dbe9a10 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -5,7 +5,7 @@ [% USE AuthorisedValues %] [% USE Branches %] [% USE Biblio %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% PROCESS 'i18n.inc' %] [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %] [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %] @@ -1122,7 +1122,7 @@ 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 = [ [% ColumnsSettings.GetColumns('catalogue', 'detail','holdings_table','json') | $raw %], [% ColumnsSettings.GetColumns('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; + var columns_settings = [ [% TablesSettings.GetColumns('catalogue', 'detail','holdings_table','json') | $raw %], [% TablesSettings.GetColumns('catalogue', 'detail','otherholdings_table','json') | $raw %] ]; for (var i in ids) { var id = ids[i]; var dt_parameters = { @@ -1140,7 +1140,7 @@ Note that permanent location is a code, and location may be an authval. } [% IF Koha.Preference('AcquisitionDetails') %] - var columns_settings = [% ColumnsSettings.GetColumns('catalogue', 'detail', 'acquisitiondetails-table', 'json') %]; + var columns_settings = [% TablesSettings.GetColumns('catalogue', 'detail', 'acquisitiondetails-table', 'json') %]; var acquisitiondetails_table = KohaTable("orders", { "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>', 'bPaginate': false, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt index 9320d9251a..7ced03d39f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt @@ -3,7 +3,7 @@ [% USE Koha %] [% USE KohaDates %] [% USE Branches %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] <title>Koha › Catalog › Checkout history for [% INCLUDE 'biblio-title-head.inc' %] @@ -110,7 +110,7 @@ [% INCLUDE 'columns_settings.inc' %] [% INCLUDE 'ill-list-table-strings.inc' %] [% Asset.js("js/ill-list-table.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index 209932b7a6..1d2609b0ac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -1,7 +1,7 @@ [% USE raw %] [% USE Asset %] [% USE Koha %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% USE Branches %] [% USE Categories %] [% SET footerjs = 1 %] @@ -364,7 +364,7 @@ }); // Apply DataTables on the results table - var columns_settings = [% ColumnsSettings.GetColumns( 'members', 'member', 'memberresultst', 'json' ) | $raw %]; + var columns_settings = [% TablesSettings.GetColumns( 'members', 'member', 'memberresultst', 'json' ) | $raw %]; [% UNLESS CAN_user_borrowers_edit_borrowers OR CAN_user_tools_manage_patron_lists %] [%# Remove the first column if we do not display the checkbox %] columns_settings.splice(0, 1); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index a03c1bd5e4..0757ae74fd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -4,7 +4,7 @@ [% USE Branches %] [% USE KohaDates %] [% USE AuthorisedValues %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% USE Price %] [% PROCESS 'member-display-address-style.inc' %] [% PROCESS 'member-display-alt-address-style.inc' %] @@ -907,7 +907,7 @@ [% Asset.js("js/messaging-preference-form.js") | $raw %] [% Asset.js("js/letter.js") | $raw %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt index 9c092235ed..754e833e26 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt @@ -3,7 +3,7 @@ [% USE Koha %] [% USE Branches %] [% USE KohaDates %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Stock rotation @@ -573,8 +573,8 @@ [% INCLUDE 'columns_settings.inc' %] [% Asset.js("js/pages/stockrotation.js") | $raw %]