Bugzilla – Attachment 99519 Details for
Bug 21800
TransformKohaToMarc should respect non-repeatability of item subfields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21800: Check the correct framework for the repeatable tag
Bug-21800-Check-the-correct-framework-for-the-repe.patch (text/plain), 3.10 KB, created by
Ere Maijala
on 2020-02-24 13:38:28 UTC
(
hide
)
Description:
Bug 21800: Check the correct framework for the repeatable tag
Filename:
MIME Type:
Creator:
Ere Maijala
Created:
2020-02-24 13:38:28 UTC
Size:
3.10 KB
patch
obsolete
>From 16d926da941349f25ffd592eaa088f38cd8fcbca Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 13 Feb 2020 14:35:42 +0000 >Subject: [PATCH] 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> >--- > C4/Biblio.pm | 22 +++++++++++++++++----- > C4/Items.pm | 2 +- > 2 files changed, 18 insertions(+), 6 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index e1482cc41c..8b55886e4a 100644 >--- a/C4/Biblio.pm >+++ b/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 ) >diff --git a/C4/Items.pm b/C4/Items.pm >index f83851fcd2..e7f4aa1fd2 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1299,7 +1299,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, > ); >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21800
:
98816
|
98817
|
99309
|
99310
|
99311
|
99312
|
99313
|
99517
|
99518
|
99519
|
99520
|
101364
|
101365
|
101366
|
101367
|
101667