From 115c4f348eb89e6eb0f25a823265d11135d72788 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 5 May 2015 11:12:31 -0300 Subject: [PATCH] Bug 14148: marc import broken if plugins are not enabled Bug 12412 introduced a way to use plugins to generate MARC records out of any arbitrary format. But failed to properly check for a valid configuration (plugins_enabled entry on koha-conf.xml, and even the UseKohaPlugins syspref). This patch makes tools/stage-marc-import.pl test for the required configuration before attempting to create the Koha::Plugins object. To test: 1/ Make sure you don't have a plugins_enabled entry on your koha-conf.xml file 2/ On master, browse to tools/stage-marc-import.pl => FAIL: You get a nasty "Can't call method "GetPlugins"..." error 3/ Apply the patch and reload => SUCCESS: Stage MARC for import page renders correctly Repeat with plugins_enabled == 0 and == 1. Also UseKohaPlugins enabled/disabled. It should work as expected. Regards Tomas Signed-off-by: Bernardo Gonzalez Kriegel Works as described, no koha-qa errors Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- tools/stage-marc-import.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl index 3e9b0ee633..2f4812f201 100755 --- a/tools/stage-marc-import.pl +++ b/tools/stage-marc-import.pl @@ -203,8 +203,12 @@ if ($completedJobID) { my @templates = GetModificationTemplates(); $template->param( MarcModificationTemplatesLoop => \@templates ); - my @plugins = Koha::Plugins->new()->GetPlugins('to_marc'); - $template->param( plugins => \@plugins ); + if ( C4::Context->preference('UseKohaPlugins') && + C4::Context->config('enable_plugins') ) { + + my @plugins = Koha::Plugins->new()->GetPlugins('to_marc'); + $template->param( plugins => \@plugins ); + } } output_html_with_http_headers $input, $cookie, $template->output; -- 2.39.5