From 7af529fcd0eef8e73616749b23ea17b89a269b05 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 21 Jul 2016 21:31:04 +0200 Subject: [PATCH] Bug 16955: Internal Server Error while populating new framework While populating a new framework, an internal server error occurs. (Error occurs with plack enabled) Steps to reproduce: - Go to Home > Administration > MARC frameworks - Add framework e.g. TEST, submit - In List of frameworks, go to framework TEST, Actions, MARC Structure - Create framework for... : Select DEFAULT Result: Internal Server Error (rest of screen blank) This patch fixes a variable scope issue and moves 4 lines that should be inside a loop. To test: - Apply patch - Verify that code changes make sense - Try to recreate error Signed-off-by: Josef Moravec --- admin/marctagstructure.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index 27d9592..0f05384 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -342,6 +342,7 @@ sub StringSearch { # the sub used to duplicate a framework from an existing one in MARC parameters tables. # sub duplicate_framework { + my $cache = Koha::Cache->get_instance(); my ($newframeworkcode,$oldframeworkcode) = @_; my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where frameworkcode=?"); @@ -356,10 +357,11 @@ sub duplicate_framework { $sth_insert = $dbh->prepare("insert into marc_subfield_structure (frameworkcode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,authtypecode,value_builder,seealso,hidden) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); while ( my ($frameworkcode, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $kohafield, $tab, $authorised_value, $thesaurus_category, $value_builder, $seealso,$hidden) = $sth->fetchrow) { $sth_insert->execute($newframeworkcode, $tagfield, $tagsubfield, $liblibrarian, $libopac, $repeatable, $mandatory, $kohafield, $tab, $authorised_value, $thesaurus_category, $value_builder, $seealso, $hidden); - } - $cache->clear_from_cache("MarcStructure-0-$newframeworkcode"); - $cache->clear_from_cache("MarcStructure-1-$newframeworkcode"); - $cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode"); - $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); + + $cache->clear_from_cache("MarcStructure-0-$newframeworkcode"); + $cache->clear_from_cache("MarcStructure-1-$newframeworkcode"); + $cache->clear_from_cache("default_value_for_mod_marc-$frameworkcode"); + $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); + } } -- 2.1.4