Bugzilla – Attachment 43878 Details for
Bug 15054
Get items from database instead of search engine in search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
TEMP get items from database
TEMP-get-items-from-database.patch (text/plain), 4.42 KB, created by
Fridolin Somers
on 2015-10-23 15:16:13 UTC
(
hide
)
Description:
TEMP get items from database
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2015-10-23 15:16:13 UTC
Size:
4.42 KB
patch
obsolete
>From 55e335b74fa94ae0dbae10f233878a9bf17ba019 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 23 Oct 2015 16:09:03 +0200 >Subject: [PATCH] TEMP get items from database > >http://bugs.koha-community.org/show_bug.cgi?id=15054 >--- > C4/Search.pm | 53 ++++++++++++----------------------------------------- > 1 file changed, 12 insertions(+), 41 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index e0f34bf..e62887b 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -20,6 +20,7 @@ use strict; > require Exporter; > use C4::Context; > use C4::Biblio; # GetMarcFromKohaField, GetBiblioData >+use C4::Items; > use C4::Koha; # getFacets > use Lingua::Stem; > use C4::Search::PazPar2; >@@ -1933,11 +1934,11 @@ sub searchResults { > } > } > >- my $fw = $scan >- ? undef >- : $bibliotag < 10 >- ? GetFrameworkCode($marcrecord->field($bibliotag)->data) >- : GetFrameworkCode($marcrecord->subfield($bibliotag,$bibliosubf)); >+ my $biblionumber = >+ ( $bibliotag < 10 ) >+ ? $marcrecord->field($bibliotag)->data >+ : $marcrecord->subfield( $bibliotag, $bibliosubf ); >+ my $fw = $scan ? undef : GetFrameworkCode($biblionumber); > > SetUTF8Flag($marcrecord); > my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, $fw ); >@@ -1961,7 +1962,6 @@ sub searchResults { > # FIXME: is this used anywhere, I think it can be commented out? -- JF > if ( $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) { > my $summary = $itemtypes{ $oldbiblio->{itemtype} }->{summary}; >- my @fields = $marcrecord->fields(); > > my $newsummary; > foreach my $line ( "$summary\n" =~ /(.*)\n/g ){ >@@ -2003,34 +2003,10 @@ 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 eq undef){ >- my $hostbiblio = GetMarcBiblio($hostbiblionumber, 1); >- my ($itemfield, undef) = GetMarcFromKohaField( 'items.itemnumber', GetFrameworkCode($hostbiblionumber) ); >- if(!$hostbiblio eq undef){ >- my @hostitems = $hostbiblio->field($itemfield); >- foreach my $hostitem (@hostitems){ >- if ($hostitem->subfield("9") eq $linkeditemnumber){ >- my $linkeditem =$hostitem; >- # append linked items if they exist >- if (!$linkeditem eq undef){ >- push (@fields, $linkeditem);} >- } >- } >- } >- } >- } >+ my @items = GetItemsInfo($biblionumber); >+ # adding items linked via host biblios >+ my @hostitems = GetHostItemsInfo($marcrecord); >+ push ( @items, @hostitems ); > > # Setting item statuses for display > my @available_items_loop; >@@ -2055,19 +2031,14 @@ sub searchResults { > my $can_place_holds = 0; > my $item_onhold_count = 0; > my $notforloan_count = 0; >- my $items_count = scalar(@fields); >+ my $items_count = scalar(@items); > my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); > my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; > my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref > > # loop through every item >- foreach my $field (@fields) { >- my $item; >+ foreach my $item (@items) { > >- # populate the items hash >- foreach my $code ( keys %subfieldstosearch ) { >- $item->{$code} = $field->subfield( $subfieldstosearch{$code} ); >- } > $item->{description} = $itemtypes{ $item->{itype} }{description}; > > # OPAC hidden items >-- >2.1.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 15054
:
43878
|
43880