From 7a5a78f17db37f1c3b8adb4819486420b9f9508a 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. --- C4/Utils/DataTables/{ColumnsSettings.pm => TablesSettings.pm} | 8 ++++---- Koha/Template/Plugin/{ColumnsSettings.pm => TablesSettings.pm} | 10 +++++----- admin/columns_settings.pl | 6 +++--- koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc | 2 +- .../intranet-tmpl/prog/en/includes/str/cataloging_additem.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 4 ++-- .../intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 4 ++-- .../intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 2 +- .../intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 6 +++--- koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt | 4 ++-- .../intranet-tmpl/prog/en/modules/circ/pendingreserves.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt | 4 ++-- .../intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt | 4 ++-- .../prog/en/modules/course_reserves/course-details.tt | 4 ++-- .../prog/en/modules/course_reserves/course-reserves.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt | 4 ++-- .../intranet-tmpl/prog/en/modules/members/holdshistory.tt | 4 ++-- .../intranet-tmpl/prog/en/modules/members/ill-requests.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt | 4 ++-- .../prog/en/modules/reports/guided_reports_start.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt | 2 +- .../prog/en/modules/serials/subscription-detail.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/tools/stockrotation.tt | 6 +++--- koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 6 +++--- t/db_dependent/{ColumnsSettings.t => TablesSettings.t} | 10 +++++----- 43 files changed, 92 insertions(+), 92 deletions(-) rename C4/Utils/DataTables/{ColumnsSettings.pm => TablesSettings.pm} (90%) rename Koha/Template/Plugin/{ColumnsSettings.pm => TablesSettings.pm} (75%) 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 75% rename from Koha/Template/Plugin/ColumnsSettings.pm rename to Koha/Template/Plugin/TablesSettings.pm index 4617969d3a..84c2dcafcf 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. # @@ -26,7 +26,7 @@ use YAML qw( LoadFile ); use JSON qw( to_json ); use C4::Context qw( config ); -use C4::Utils::DataTables::ColumnsSettings; +use C4::Utils::DataTables::TablesSettings; =pod @@ -35,9 +35,9 @@ This plugin allows to get the column configuration for a table. First, include the line '[% USE Tables %]' at the top of the template to enable the plugin. -To use, call ColumnsSettings.GetColumns with the module, the page and the table where the template is called. +To use, call TablesSettings.GetColumns with the module, the page and the table where the template is called. -For example: [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'holdst' ) %] +For example: [% TablesSettings.GetColumns( 'circ', 'circulation', 'holdst' ) %] =cut @@ -45,7 +45,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 ) 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 1117050110..70e16dc349 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/columns_settings.inc @@ -1,4 +1,4 @@ -[% 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 c4d4d178dd..9e4334fe24 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 %] @@ -918,7 +918,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 71dbe498f6..00a2a912e3 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' %]› @@ -465,7 +465,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') %] 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 05a6cb50e4..bbb9acebbf 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 %] [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %] [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %] @@ -1050,7 +1050,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/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt index c93eb6fa09..dcaa831bc6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -3,7 +3,7 @@ [% USE Koha %] [% USE Branches %] [% USE KohaDates %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% USE AuthorisedValues %] [% USE Price %] [% USE Branches %] @@ -265,7 +265,7 @@ var txtActivefilter = _("Filter paid transactions"); var txtInactivefilter = _("Show all transactions"); - var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %]; + var columns_settings = [% TablesSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %]; var table_account_fines = KohaTable("table_account_fines", { "sPaginationType": "full", 'aaSorting': [[0, 'desc']], diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt index 9510750cbe..5b93bce7b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt @@ -4,7 +4,7 @@ [% USE Koha %] [% USE AuthorisedValues %] [% USE Branches %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% USE ItemTypes %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] @@ -130,7 +130,7 @@ [% Asset.js("js/members-menu.js") | $raw %] [% 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 3d79c56b3b..e0bffe5dae 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 %] @@ -401,7 +401,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 19e573752d..cdb1f9809d 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 %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] @@ -885,7 +885,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 %]