Bugzilla – Attachment 75195 Details for
Bug 20702
Bind results of GetHostItemsInfo to the EasyAnalyticalRecords pref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20702: Bind results of GetHostItemsInfo to the EasyAnalyticalRecords pref
Bug-20702-Bind-results-of-GetHostItemsInfo-to-the-.patch (text/plain), 3.48 KB, created by
Mark Tompsett
on 2018-05-08 22:39:14 UTC
(
hide
)
Description:
Bug 20702: Bind results of GetHostItemsInfo to the EasyAnalyticalRecords pref
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-05-08 22:39:14 UTC
Size:
3.48 KB
patch
obsolete
>From 4a44762c8140f15762440d03396fc8c3d1910746 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 3 May 2018 13:12:19 +0200 >Subject: [PATCH] Bug 20702: Bind results of GetHostItemsInfo to the > EasyAnalyticalRecords pref > >Triggered by the finding on bug 20697. >The three calls of GetHostItemsInfo should be controlled by the pref. This >patch makes the sub return an empty list when the pref is disabled. > >The patch simplifies the sub by merging the two identical foreach loops >depending on the field number in MARC21/UNIMARC. > >Will add a unit test on a follow-up patch. > >Test plan: >See next patch. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > C4/Items.pm | 62 +++++++++++++++++++++++++++++-------------------------------- > 1 file changed, 29 insertions(+), 33 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index e7279ff8a1..bf464c3e30 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1206,44 +1206,40 @@ sub GetItemsLocationInfo { > > =head2 GetHostItemsInfo > >- $hostiteminfo = GetHostItemsInfo($hostfield); >- Returns the iteminfo for items linked to records via a host field >+ $hostiteminfo = GetHostItemsInfo($hostfield); >+ Returns the iteminfo for items linked to records via a host field > > =cut > > sub GetHostItemsInfo { >- my ($record) = @_; >- my @returnitemsInfo; >- >- if (C4::Context->preference('marcflavour') eq 'MARC21' || >- C4::Context->preference('marcflavour') eq 'NORMARC'){ >- foreach my $hostfield ( $record->field('773') ) { >- my $hostbiblionumber = $hostfield->subfield("0"); >- my $linkeditemnumber = $hostfield->subfield("9"); >- my @hostitemInfos = GetItemsInfo($hostbiblionumber); >- foreach my $hostitemInfo (@hostitemInfos){ >- if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){ >- push (@returnitemsInfo,$hostitemInfo); >- last; >- } >- } >- } >- } elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC'){ >- foreach my $hostfield ( $record->field('461') ) { >- my $hostbiblionumber = $hostfield->subfield("0"); >- my $linkeditemnumber = $hostfield->subfield("9"); >- my @hostitemInfos = GetItemsInfo($hostbiblionumber); >- foreach my $hostitemInfo (@hostitemInfos){ >- if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){ >- push (@returnitemsInfo,$hostitemInfo); >- last; >- } >- } >- } >- } >- return @returnitemsInfo; >-} >+ my ($record) = @_; >+ my @returnitemsInfo; > >+ if( !C4::Context->preference('EasyAnalyticalRecords') ) { >+ return @returnitemsInfo; >+ } >+ >+ my @fields; >+ if( C4::Context->preference('marcflavour') eq 'MARC21' || >+ C4::Context->preference('marcflavour') eq 'NORMARC') { >+ @fields = $record->field('773'); >+ } elsif( C4::Context->preference('marcflavour') eq 'UNIMARC') { >+ @fields = $record->field('461'); >+ } >+ >+ foreach my $hostfield ( @fields ) { >+ my $hostbiblionumber = $hostfield->subfield("0"); >+ my $linkeditemnumber = $hostfield->subfield("9"); >+ my @hostitemInfos = GetItemsInfo($hostbiblionumber); >+ foreach my $hostitemInfo (@hostitemInfos) { >+ if( $hostitemInfo->{itemnumber} eq $linkeditemnumber ) { >+ push @returnitemsInfo, $hostitemInfo; >+ last; >+ } >+ } >+ } >+ return @returnitemsInfo; >+} > > =head2 GetLastAcquisitions > >-- >2.11.0
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 20702
:
75007
|
75008
|
75194
|
75195
|
76197
|
76198