Bugzilla – Attachment 84820 Details for
Bug 22140
More use of EasyAnalyticalRecords pref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22140: Use of EasyAnalyticalRecords pref in search
Bug-22140-Use-of-EasyAnalyticalRecords-pref-in-sea.patch (text/plain), 5.48 KB, created by
Fridolin Somers
on 2019-02-06 14:30:37 UTC
(
hide
)
Description:
Bug 22140: Use of EasyAnalyticalRecords pref in search
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2019-02-06 14:30:37 UTC
Size:
5.48 KB
patch
obsolete
>From 864f0a69b92a330c70f7ef1bc01ace7704351299 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Wed, 16 Jan 2019 13:32:35 +0100 >Subject: [PATCH] Bug 22140: Use of EasyAnalyticalRecords pref in search > >Like Bug 20702 defined GetHostItemsInfo does nothing if EasyAnalyticalRecords pref is disabled, there are other places where code must be dependant on this pref. > >Test plan : >1) Build an analitical record with 773$0 and $9 >2) Enable EasyAnalyticalRecords >3) Don't apply patch >4) Go to OPAC >5) Perform a search that displays the record, check there is the linked item >6) Open record detail page, check there is the linked item >7) Apply patch and redo 5) and 6) >8) Disable EasyAnalyticalRecords >9) redo 5) and 6), you should not see the linked item >--- > C4/Search.pm | 45 ++++++++++++++++++++++++--------------------- > opac/opac-detail.pl | 31 ++++++++++++++++--------------- > 2 files changed, 40 insertions(+), 36 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index fac04b0079..ef81e19e7c 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -2008,28 +2008,31 @@ sub searchResults { > # Pull out the items fields > my @fields = $marcrecord->field($itemtag); > my $marcflavor = C4::Context->preference("marcflavour"); >+ > # adding linked items that belong to host records >- my $analyticsfield = '773'; >- if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') { >- $analyticsfield = '773'; >- } elsif ($marcflavor eq 'UNIMARC') { >- $analyticsfield = '461'; >- } >- foreach my $hostfield ( $marcrecord->field($analyticsfield)) { >- my $hostbiblionumber = $hostfield->subfield("0"); >- my $linkeditemnumber = $hostfield->subfield("9"); >- if( $hostbiblionumber ) { >- my $hostbiblio = GetMarcBiblio({ >- biblionumber => $hostbiblionumber, >- embed_items => 1 }); >- my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); >- if( $hostbiblio ) { >- my @hostitems = $hostbiblio->field($itemfield); >- foreach my $hostitem (@hostitems){ >- if ($hostitem->subfield("9") eq $linkeditemnumber){ >- my $linkeditem =$hostitem; >- # append linked items if they exist >- push @fields, $linkeditem if $linkeditem; >+ if ( C4::Context->preference('EasyAnalyticalRecords') ) { >+ my $analyticsfield = '773'; >+ if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') { >+ $analyticsfield = '773'; >+ } elsif ($marcflavor eq 'UNIMARC') { >+ $analyticsfield = '461'; >+ } >+ foreach my $hostfield ( $marcrecord->field($analyticsfield)) { >+ my $hostbiblionumber = $hostfield->subfield("0"); >+ my $linkeditemnumber = $hostfield->subfield("9"); >+ if( $hostbiblionumber ) { >+ my $hostbiblio = GetMarcBiblio({ >+ biblionumber => $hostbiblionumber, >+ embed_items => 1 }); >+ my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); >+ if( $hostbiblio ) { >+ my @hostitems = $hostbiblio->field($itemfield); >+ foreach my $hostitem (@hostitems){ >+ if ($hostitem->subfield("9") eq $linkeditemnumber){ >+ my $linkeditem =$hostitem; >+ # append linked items if they exist >+ push @fields, $linkeditem if $linkeditem; >+ } > } > } > } >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index a7c24ef3d9..51fa3af040 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -481,21 +481,22 @@ $template->param( > OPACShowCheckoutName => C4::Context->preference("OPACShowCheckoutName"), > ); > >-# adding items linked via host biblios >- >-my $analyticfield = '773'; >-if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){ >- $analyticfield = '773'; >-} elsif ($marcflavour eq 'UNIMARC') { >- $analyticfield = '461'; >-} >-foreach my $hostfield ( $record->field($analyticfield)) { >- my $hostbiblionumber = $hostfield->subfield("0"); >- my $linkeditemnumber = $hostfield->subfield("9"); >- my @hostitemInfos = GetItemsInfo($hostbiblionumber); >- foreach my $hostitemInfo (@hostitemInfos){ >- if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){ >- push(@all_items, $hostitemInfo); >+if ( C4::Context->preference('EasyAnalyticalRecords') ) { >+ # adding items linked via host biblios >+ my $analyticfield = '773'; >+ if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){ >+ $analyticfield = '773'; >+ } elsif ($marcflavour eq 'UNIMARC') { >+ $analyticfield = '461'; >+ } >+ foreach my $hostfield ( $record->field($analyticfield)) { >+ my $hostbiblionumber = $hostfield->subfield("0"); >+ my $linkeditemnumber = $hostfield->subfield("9"); >+ my @hostitemInfos = GetItemsInfo($hostbiblionumber); >+ foreach my $hostitemInfo (@hostitemInfos){ >+ if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){ >+ push(@all_items, $hostitemInfo); >+ } > } > } > } >-- >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 22140
:
84060
|
84820
|
84822
|
84828
|
84958
|
84959
|
84960
|
85143
|
85144
|
85145