Browse Source

Bug 21800: Check the correct framework for the repeatable tag

This depends on the framework parameter. Which should be added back to
the call in C4::Items.

Test plan:
[1] Mark in Default framework one subfield A repeatable and B not repeatable.
Go to item editor. (Work on a biblio in Default framework.)
Check saving and reopening these subfields with VAL1 | VAL2.
Subfield A should be cloned, B should be glued as entered.

[2] Mark in another Framework A not repeatable and B repeatable.
Change framework for this biblio.
Go to item editor again. Reopen item. Behavior subfields in reverse?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Marcel de Rooy 4 years ago
committed by Martin Renvoize
parent
commit
01219b09ba
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 22
      C4/Biblio.pm
  2. 2
      C4/Items.pm

22
C4/Biblio.pm

@ -1998,11 +1998,10 @@ sub TransformKohaToMarc {
my $tagsubfield = $fld->{tagsubfield};
next if !$tagfield;
# BZ 21800: split value if field is repeatable; NOTE that this also
# depends on the Default framework.
my @values = $params->{no_split} || !$fld->{repeatable}
? ( $value )
: split(/\s?\|\s?/, $value, -1);
# BZ 21800: split value if field is repeatable.
my @values = _check_split($params, $fld, $value)
? split(/\s?\|\s?/, $value, -1)
: ( $value );
foreach my $value ( @values ) {
next if $value eq '';
$tag_hr->{$tagfield} //= [];
@ -2023,6 +2022,19 @@ sub TransformKohaToMarc {
return $record;
}
sub _check_split {
my ($params, $fld, $value) = @_;
return if index($value,'|') == -1; # nothing to worry about
return if $params->{no_split};
# if we did not get a specific framework, check default in $mss
return $fld->{repeatable} if !$params->{framework};
# here we need to check the specific framework
my $mss = Koha::MarcSubfieldStructures->find( $params->{framework}, $fld->{tagfield}, $fld->{tagsubfield} );
return 1 if $mss && $mss->repeatable;
}
=head2 PrepHostMarcField
$hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$marcflavour )

2
C4/Items.pm

@ -1022,7 +1022,7 @@ sub Item2Marc {
} keys %{ $itemrecord }
};
my $framework = C4::Biblio::GetFrameworkCode( $biblionumber );
my $itemmarc = C4::Biblio::TransformKohaToMarc( $mungeditem ); # Bug 21774: no_split parameter removed to allow cloned subfields
my $itemmarc = C4::Biblio::TransformKohaToMarc( $mungeditem, { framework => $framework } );
my ( $itemtag, $itemsubfield ) = C4::Biblio::GetMarcFromKohaField(
"items.itemnumber", $framework,
);

Loading…
Cancel
Save