From c265428e13cbac7a09ebcdec3ec548cf9159db5c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 21 May 2021 18:10:14 +0000 Subject: [PATCH] Bug 28418: Show template_id of MARC modification templates This patch adds an "id" column to the table of MARC modification templates. The table is now a DataTable with table settings, with the new column hidden by default to preserve the existing configuration. To test, apply the patch and restart services. - Go to Administration -> MARC modification templates. - If necessary, add two or more templates. - Confirm that table of templates displays as a DataTable, with all associated sorting, filtering, export, etc. - The "id" column should be hidden by default. - Confirm that column visibility controls work correctly. - Confirm that the table settings found under Administration -> Table settings work correctly to set the default visibility of the table columns. Signed-off-by: Barbara Johnson Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- admin/columns_settings.yml | 12 ++++++++++++ .../en/modules/tools/marc_modification_templates.tt | 10 ++++++++-- .../prog/js/marc_modification_templates.js | 8 ++++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml index a4986652b6..b6eee4fb28 100644 --- a/admin/columns_settings.yml +++ b/admin/columns_settings.yml @@ -1525,6 +1525,18 @@ modules: columnname: info - columnname: interface + marc-modification-templates: + templatest: + columns: + - + columnname: id + is_hidden: 1 + - + columnname: template + - + columnname: actions + cannot_be_toggled: 1 + cannot_be_modified: 1 notices: lettert: columns: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt index 6459266260..ba67ec7622 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt @@ -1,6 +1,7 @@ [% USE raw %] [% USE JSON.Escape %] [% USE Asset %] +[% USE TablesSettings %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] MARC modification templates › Tools › Koha @@ -86,13 +87,15 @@ + - + [% FOREACH TemplatesLoo IN TemplatesLoop %] +
Id TemplateActionsActions
[% TemplatesLoo.template_id | html %] [% TemplatesLoo.name | html %] Edit actions @@ -352,12 +355,15 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/tools-menu.js") | $raw %] - [% Asset.js("js/marc_modification_templates.js") | $raw %] + [% INCLUDE 'datatables.inc' %] + [% INCLUDE 'columns_settings.inc' %] + [% Asset.js("js/marc_modification_templates.js") | $raw %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js b/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js index 4f33c33ccd..b7565b734e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js +++ b/koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js @@ -1,4 +1,4 @@ -/* global __ */ +/* global __ KohaTable columns_settings */ $(document).ready(function() { window.modaction_legend_innerhtml = $("#modaction_legend").text(); window.action_submit_value = $("#action_submit").val(); @@ -49,7 +49,7 @@ $(document).ready(function() { } if ( $("#conditional_comparison").val() == '' ) { alert( __("The conditional comparison operator should be filled.") ); - return false + return false; } if ( $("#conditional_value").val() == '' && ( $("#conditional_comparison").val() == 'equals' || $("#conditional_comparison").val() == 'not_equals' ) ) { @@ -108,6 +108,10 @@ $(document).ready(function() { editAction( mmta[0] ); updateAllEvery(); }); + + KohaTable("templatest", { + }, columns_settings); + }); function updateAllEvery(){ -- 2.39.5