From dffc8cdd2ca85ac919fa8ca3fef3361d1116317c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 19 Sep 2024 09:13:21 +0200 Subject: [PATCH] Bug 37947: (bug 37429 follow-up) Fix addbiblio and frameworkcode="Default" On bug 37429 we reordered the global var to assign them before anything else. The logic is correct except for $frameworkcode, we want to do some processings (like defaulting to "" if eq "Default") BEFORE we retrieve the MARC structure ($tagslib, $usedTagsLib). This patch also moved this code after get_template_and_user (and so authentication), like it should be everywhere. Test plan: 1. Go to Cataloging 2. Click on New from Z39.50/SRU 3. Make a search in the library of congress server for anything (Caroline searched for author: shakespeare) 4. Click on one of the results and choose Import Without this patch the basic editor appears, but not the record With this patch applied the bug is fixed and you can edit the record Signed-off-by: David Nind Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- cataloguing/addbiblio.pl | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 9d41a15a64..397d1c92fe 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -517,6 +517,24 @@ my $fa_duedatespec = $input->param('duedatespec'); my $userflags = 'edit_catalogue'; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "cataloguing/addbiblio.tt", + query => $input, + type => "intranet", + flagsrequired => { editcatalogue => $userflags }, + } +); + +$frameworkcode = &GetFrameworkCode($biblionumber) + if ( $biblionumber and not( defined $frameworkcode) and $op ne 'cud-addbiblio' ); + +if ($frameworkcode eq 'FA'){ + $userflags = 'fast_cataloging'; +} + +$frameworkcode = '' if ( $frameworkcode eq 'Default' ); + # Set default values for global variable $tagslib = &GetMarcStructure( 1, $frameworkcode ); $usedTagsLib = &GetUsedMarcStructure($frameworkcode); @@ -530,23 +548,6 @@ if ( $op eq 'cud-change-framework' ) { $changed_framework = 1; } -$frameworkcode = &GetFrameworkCode($biblionumber) - if ( $biblionumber and not( defined $frameworkcode) and $op ne 'cud-addbiblio' ); - -if ($frameworkcode eq 'FA'){ - $userflags = 'fast_cataloging'; -} - -$frameworkcode = '' if ( $frameworkcode eq 'Default' ); -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "cataloguing/addbiblio.tt", - query => $input, - type => "intranet", - flagsrequired => { editcatalogue => $userflags }, - } -); - my $logged_in_patron = Koha::Patrons->find($loggedinuser); my $biblio; -- 2.39.5