Bug 31154: (QA follow-up) Fix UI form builder

The change in batchMod.pl is not needed when we fix the builder.
But we could at least add a comment there!

Note that passing the biblionumber of the first item does not
make sense since we are modifying items from several biblio
records normally. We most probably do not want this MARC
record's itemcallnumber (via the syspref) in all our items.

Test plan:
Test batchMod with and without the Populate fields checkbox.
Fill syspref 'itemcallnumber' with e.g. 084a.
Check Populate, and try again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit eb29243140)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Marcel de Rooy 2022-09-16 08:58:51 +00:00 committed by Lucas Gass
parent babf0f118a
commit e5c11f9933
2 changed files with 4 additions and 6 deletions

View File

@ -161,7 +161,7 @@ sub generate_subfield_form {
my $CNsubfields =
substr( $pref_itemcallnumber_part, 3 ); # Any and all subfields
$CNsubfields = undef if $CNsubfields eq '';
my $temp2 = $marc_record->field($CNtag);
my $temp2 = $marc_record ? $marc_record->field($CNtag) : undef;
next unless $temp2;
$value = $temp2->as_string( $CNsubfields, ' ' );
@ -313,7 +313,7 @@ sub generate_subfield_form {
);
my $pars = {
dbh => $dbh,
record => $marc_record,
record => $marc_record, #Note: could be undefined
tagslib => $tagslib,
id => $subfield_data{id},
};
@ -562,7 +562,7 @@ sub edit_form {
value => $value,
tagslib => $tagslib,
libraries => $libraries,
marc_record => $marc_record,
marc_record => $marc_record, #Note: could be undefined
restricted_edition => $restricted_edition,
prefill_with_default_values => $prefill_with_default_values,
branch_limit => $branch_limit,

View File

@ -266,9 +266,7 @@ if ($op eq "show"){
# Getting list of subfields to keep when restricted batchmod edit is enabled
my @subfields_to_allow = $restrictededition ? split ' ', C4::Context->preference('SubfieldsToAllowForRestrictedBatchmod') : ();
$biblionumber = Koha::Items->find($itemnumbers[0])->unblessed->{biblionumber} if $itemnumbers[0];
my $subfields = Koha::UI::Form::Builder::Item->new(
{ biblionumber => $biblionumber } )->edit_form(
my $subfields = Koha::UI::Form::Builder::Item->new->edit_form( # NOTE: We are not passing a biblionumber intentionally !
{
restricted_editition => $restrictededition,
(