From 5a80f7dbca4b77e2019d739c2d7269f255a0cc56 Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Fri, 23 Jul 2021 16:37:22 +0200 Subject: [PATCH] Bug 18138: (follow-up) Adjust the system preference editor to allow choosing a modification template Rather than expecting the librarian to add an ID or a name we should provide a dropdown To test: 1 - Apply all patches 2 - Search for sytem preference 'SaveBiblioMarcModificationTemplate' 3 - Note it list all defined Marc modification templates 4 - Select one 5 - confirm value in DB is the template id Works fine for me Signed-off-by: Frank Hansen Signed-off-by: Phil Ringnalda Signed-off-by: Katrin Fischer --- admin/preferences.pl | 4 ++++ ...18138-edit-biblio-marc-modification-template-syspref.sql | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/modules/admin/preferences/cataloguing.pref | 2 +- .../www/EditBiblioMarcModificationTemplatePreference.t | 6 +++--- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index 108aaf41d1..72ff94e2d7 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -29,6 +29,7 @@ use C4::Output qw( output_html_with_http_headers output_and_exit_if_error ); use C4::Templates; use Koha::Acquisition::Currencies; use Koha::Database::Columns; +use Koha::MarcModificationTemplates; use IO::File; use YAML::XS; use Encode; @@ -113,6 +114,9 @@ sub _get_chunk { $options{'choices'} = { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search( { category => $options{'source'} } )->as_list }; $add_blank = 1; } + } elsif ( $options{choices} eq 'modification-templates' ) { + $options{choices} = { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search }; + $add_blank = 1; } else { die 'Unrecognized source of preference values: ' . $options{'choices'}; } diff --git a/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.sql b/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.sql index 07bf6fce9a..e9b564a55a 100644 --- a/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.sql +++ b/installer/data/mysql/atomicupdate/bug_18138-edit-biblio-marc-modification-template-syspref.sql @@ -1 +1 @@ -INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES ('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'Free'); +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type`) VALUES ('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'modification-templates'); diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 6e7cd55f0c..016c7fbd89 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -652,7 +652,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('RoutingListNote','To change this note edit RoutingListNote system preference.','70|10','Define a note to be shown on all routing lists','Textarea'), ('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'), ('SavedSearchFilters', '0', NULL, 'Allow staff with permission to create/edit custom search filters', 'YesNo'), -('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'Free'), +('SaveBiblioMarcModificationTemplate', '', NULL, 'MARC modification template applied when saving bibliographic record in staff client or HTTP API', 'modification-templates'), ('SCOAllowCheckin','0','','If enabled, patrons may return items through the Web-based Self Checkout','YesNo'), ('SCOMainUserBlock','','70|10','Add a block of HTML that will display on the self checkout screen','Textarea'), ('SCOUserCSS','',NULL,'Add CSS to be included in the SCO module in an embedded