Bugzilla – Attachment 53746 Details for
Bug 16365
Selectively introduce GetMarcStructure() "unsafe" variant for better performance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16365 - GetMarcStructure() "unsafe" variant in PrepareItemrecordDisplay()
Bug-16365---GetMarcStructure-unsafe-variant-in-Pre.patch (text/plain), 2.42 KB, created by
Jacek Ablewicz
on 2016-07-27 09:52:30 UTC
(
hide
)
Description:
Bug 16365 - GetMarcStructure() "unsafe" variant in PrepareItemrecordDisplay()
Filename:
MIME Type:
Creator:
Jacek Ablewicz
Created:
2016-07-27 09:52:30 UTC
Size:
2.42 KB
patch
obsolete
>From ab7ce74f66f4b4eb136a6691e2fd0201e209bb08 Mon Sep 17 00:00:00 2001 >From: Jacek Ablewicz <abl@biblos.pk.edu.pl> >Date: Wed, 27 Jul 2016 11:38:00 +0200 >Subject: [PATCH] Bug 16365 - GetMarcStructure() "unsafe" variant in > PrepareItemrecordDisplay() > >This sub is a good candidate for the "unsafe" treatment too, it doesn't >modyfy nor autovivify anything in the marc structure. > >Added a warning in the code regarding the $tagslib usage by the >custom item plugins, plus a small change to prevent possible >"Use of uninitialized value" warnings in the future. >--- > C4/Items.pm | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 2e08679..fdf432e 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -2822,10 +2822,11 @@ sub PrepareItemrecordDisplay { > $frameworkcode = &GetFrameworkCode($bibnum) if $bibnum; > my ( $itemtagfield, $itemtagsubfield ) = &GetMarcFromKohaField( "items.itemnumber", $frameworkcode ); > >- # it would be perhaps beneficial (?) to call GetMarcStructure with 'unsafe' parameter >- # for performance reasons, but $tagslib may be passed to $plugin->build(), and there >- # is no way to ensure that this structure is not getting corrupted somewhere in there >- my $tagslib = &GetMarcStructure( 1, $frameworkcode ); >+ # WARNING: note that $tagslib obtained from GetMarcStructure() >+ # in 'unsafe' mode is a shared data structure. As it may be passed >+ # to $plugin->build(), custom item plugins SHOULD NOT modify it's >+ # contents in any way, under any circumstances. >+ my $tagslib = &GetMarcStructure( 1, $frameworkcode, { unsafe => 1 } ); > > # return nothing if we don't have found an existing framework. > return q{} unless $tagslib; >@@ -2849,13 +2850,13 @@ sub PrepareItemrecordDisplay { > $query .= qq{ ORDER BY lib}; > my $authorised_values_sth = $dbh->prepare( $query ); > foreach my $tag ( sort keys %{$tagslib} ) { >- my $previous_tag = ''; > if ( $tag ne '' ) { > > # loop through each subfield > my $cntsubf; > foreach my $subfield ( sort keys %{ $tagslib->{$tag} } ) { > next if IsMarcStructureInternal($tagslib->{$tag}{$subfield}); >+ next unless ( $tagslib->{$tag}->{$subfield}->{'tab'} ); > next if ( $tagslib->{$tag}->{$subfield}->{'tab'} ne "10" ); > my %subfield_data; > $subfield_data{tag} = $tag; >-- >1.7.10.4
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 16365
:
50797
|
52409
|
53746
|
53761
|
53762
|
53763
|
53764
|
53847
|
53848
|
53849
|
53850