From 7fe1a8492c356ad0c736f7bb1a0480ba6db15905 Mon Sep 17 00:00:00 2001 From: Mark Hofstetter Date: Wed, 8 Nov 2023 15:03:39 +0100 Subject: [PATCH] Bug 35289: addbiblio.pl calls generate_subfield_form with inconsistent parameters ApplyFrameworkDefaults works only for tags smaller than 10 this seems to be because addbiblio.pl calls $biblio_form_builder->generate_subfield_form 4 times(!) three of them are missing (at least) the following 3 paramters op => scalar $input->param('op'), changed_framework => scalar $input->param('changed_framework'), breedingid => scalar $input->param('breedingid'), so Koha::UI::Form::Builder::Biblio checks for ( $applydefaults =~ /new/ && !$self->{biblionumber} ) || ( $applydefaults =~ /duplicate/ && $op eq 'duplicate' ) || ( $applydefaults =~ /changed/ && $changed_framework ) || ( $applydefaults =~ /imported/ && $breedingid ) and this works only for the "new" case, this patch fixes this error To test: 1) you need: one record, two frameworks including both of them including a marc field X (tag > 10) 2) record should be in framework A, marcfield X should be empty 3) define a defaultvalue for marcfield X in framework B 4) "edit record", change framework (setting) to framework B 5) marcfield X remains emtpy, which is an error imho 6) Apply patch 7) repeat step 4 8) marcfield X should now have the default value 9) please Sign off Sponsored-by: Styrian State Library Co-authored-by: Thomas Klausner --- cataloguing/addbiblio.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index a11711afd3..793a7e2c20 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -342,6 +342,9 @@ sub build_tabs { index_tag => $index_tag, record => $record, hostitemnumber => scalar $input->param('hostitemnumber'), + op => scalar $input->param('op'), + changed_framework => scalar $input->param('changed_framework'), + breedingid => scalar $input->param('breedingid'), tagslib => $tagslib, mandatory_z3950 => $mandatory_z3950, } @@ -380,6 +383,9 @@ sub build_tabs { index_tag => $index_tag, record => $record, hostitemnumber => scalar $input->param('hostitemnumber'), + op => scalar $input->param('op'), + changed_framework => scalar $input->param('changed_framework'), + breedingid => scalar $input->param('breedingid'), tagslib => $tagslib, mandatory_z3950 => $mandatory_z3950, } @@ -444,6 +450,9 @@ sub build_tabs { index_tag => $index_tag, record => $record, hostitemnumber => scalar $input->param('hostitemnumber'), + op => scalar $input->param('op'), + changed_framework => scalar $input->param('changed_framework'), + breedingid => scalar $input->param('breedingid'), tagslib => $tagslib, mandatory_z3950 => $mandatory_z3950, } -- 2.20.1