Bugzilla – Attachment 120629 Details for
Bug 27837
Permanent location is reverted to location when location updated and permanent_location mapped to MARC field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27837: Always pass permanent location from items editor if it was defined
Bug-27837-Always-pass-permanent-location-from-item.patch (text/plain), 3.16 KB, created by
Kyle M Hall (khall)
on 2021-05-06 13:13:58 UTC
(
hide
)
Description:
Bug 27837: Always pass permanent location from items editor if it was defined
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-05-06 13:13:58 UTC
Size:
3.16 KB
patch
obsolete
>From ac3918c07475dd2b8afe1ec35e9eafd3897cc5fd Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 6 May 2021 09:09:03 -0400 >Subject: [PATCH] Bug 27837: Always pass permanent location from items editor > if it was defined > >By always passing permenent location from the items editor, we can know >if permanent location was defined in the framework. This means we can >know if we should update permanent location independently of location >even if permenent location has an empty value. >--- > C4/Biblio.pm | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index f6c89f92e8..603d19e5a0 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -2076,6 +2076,8 @@ sub TransformHtmlToXml { > my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_; > # NOTE: The parameter $ind_tag is NOT USED -- BZ 11247 > >+ my ( $perm_loc_tag, $perm_loc_subfield ) = C4::Biblio::GetMarcFromKohaField( "items.permanent_location" ); >+ > my $xml = MARC::File::XML::header('UTF-8'); > $xml .= "<record>\n"; > $auth_type = C4::Context->preference('marcflavour') unless $auth_type; >@@ -2091,7 +2093,6 @@ sub TransformHtmlToXml { > my $j = -1; > my $close_last_tag; > for ( my $i = 0 ; $i < @$tags ; $i++ ) { >- > if ( C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a" ) { > > # if we have a 100 field and it's values are not correct, skip them. >@@ -2109,6 +2110,13 @@ sub TransformHtmlToXml { > @$values[$i] =~ s/"/"/g; > @$values[$i] =~ s/'/'/g; > >+ my $skip = @$values[$i] eq q{}; >+ $skip = 0 >+ if $perm_loc_tag >+ && $perm_loc_subfield >+ && @$tags[$i] eq $perm_loc_tag >+ && @$subfields[$i] eq $perm_loc_subfield; >+ > if ( ( @$tags[$i] ne $prevtag ) ) { > $close_last_tag = 0; > $j++ unless ( @$tags[$i] eq "" ); >@@ -2118,7 +2126,7 @@ sub TransformHtmlToXml { > if ( !$first ) { > $xml .= "</datafield>\n"; > if ( ( @$tags[$i] && @$tags[$i] > 10 ) >- && ( @$values[$i] ne "" ) ) { >+ && ( !$skip ) ) { > $xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n"; > $xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n"; > $first = 0; >@@ -2127,7 +2135,7 @@ sub TransformHtmlToXml { > $first = 1; > } > } else { >- if ( @$values[$i] ne "" ) { >+ if ( !$skip ) { > > # leader > if ( @$tags[$i] eq "000" ) { >@@ -2147,8 +2155,7 @@ sub TransformHtmlToXml { > } > } > } else { # @$tags[$i] eq $prevtag >- if ( @$values[$i] eq "" ) { >- } else { >+ if ( !$skip ) { > if ($first) { > my $str = ( $indicator->[$j] // q{} ) . ' '; # extra space prevents substr outside of string warn > my $ind1 = _default_ind_to_space( substr( $str, 0, 1 ) ); >-- >2.24.3 (Apple Git-128)
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 27837
:
117570
|
117572
|
117625
|
117626
|
117627
|
117628
|
117634
|
117728
|
117729
|
117730
|
117735
|
117738
|
120361
|
120362
|
120363
|
120364
|
120562
|
120563
|
120564
|
120565
|
120566
|
120616
|
120628
|
120629
|
120832
|
121044
|
121045
|
121046
|
121047
|
121048
|
121049
|
121050
|
121051
|
121052