From 5b5710ed52518969ec13171edffcc572e3862a77 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 f02ad89151..fba116506d 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 7947dba987..3f9255df65 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 %] @@ -917,7 +917,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 daa9c20bee..fc5524663a 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') %] @@ -1024,7 +1024,7 @@ } [% 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 2ad20bb340..2881b670cd 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 %] @@ -126,7 +126,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 bf6dac9b8d..fe55512297 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' %] @@ -881,7 +881,7 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone."); - columns_settings_issues_table = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) | $raw %] + columns_settings_issues_table = [% TablesSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) | $raw %] $(document).ready(function() { if ( $('#clubs-tab').length ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt index e2883b371a..d437456325 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -4,7 +4,7 @@ [% USE AuthorisedValues %] [% USE Branches %] [% USE Price %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% USE KohaDates %] [% SET footerjs = 1 %] [% PROCESS 'accounts.inc' %] @@ -219,7 +219,7 @@ $(".add-note").show(); }); - var columns_settings = [% ColumnsSettings.GetColumns('members', 'pay', 'pay-fines-table', 'json') | $raw %]; + var columns_settings = [% TablesSettings.GetColumns('members', 'pay', 'pay-fines-table', 'json') | $raw %]; KohaTable("finest", { "columnDefs": [ { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index 6d7ae6b829..2e45c501f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -4,7 +4,7 @@ [% USE Koha %] [% USE AuthorisedValues %] [% USE Branches %] -[% USE ColumnsSettings %] +[% USE TablesSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Circulation History for [% INCLUDE 'patron-title.inc' no_html = 1 %] @@ -131,7 +131,7 @@ [% INCLUDE 'columns_settings.inc' %] [% 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 %]