Bug 7847: OPAC search dies with Plack

Due to a dependency cycle between C4::Search and C4::Items, searches
in the OPAC die spectacularly under Plack. This counter-patch extends
dpavlin's solution and replaces use with require for C4::Search in
C4::Items and for C4::Items in C4::Search.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Jared Camins-Esakov 2012-05-28 19:27:45 -04:00 committed by Paul Poulain
parent bee2cc9d65
commit fab56d3257
2 changed files with 6 additions and 5 deletions

View file

@ -30,7 +30,6 @@ use MARC::Record;
use C4::ClassSource;
use C4::Log;
use List::MoreUtils qw/any/;
use C4::Search;
use Data::Dumper; # used as part of logging item record changes, not just for
# debugging; so please don't remove this
@ -2481,6 +2480,7 @@ counts Usage of itemnumber in Analytical bibliorecords.
sub GetAnalyticsCount {
my ($itemnumber) = @_;
require C4::Search;
if (C4::Context->preference('NoZebra')) {
# Read the index Koha-Auth-Number for this authid and count the lines
my $result = C4::Search::NZanalyse("hi=$itemnumber");

View file

@ -30,7 +30,6 @@ use C4::XSLT;
use C4::Branch;
use C4::Reserves; # CheckReserves
use C4::Debug;
use C4::Items;
use C4::Charset;
use YAML;
use URI::Escape;
@ -1418,6 +1417,8 @@ sub searchResults {
my $dbh = C4::Context->dbh;
my @newresults;
require C4::Items;
$search_context = 'opac' if !$search_context || $search_context ne 'intranet';
my ($is_opac, $hidelostitems);
if ($search_context eq 'opac') {
@ -1631,9 +1632,9 @@ sub searchResults {
# Hidden items
if ($is_opac) {
my @hi = GetHiddenItemnumbers($item);
$item->{'hideatopac'} = @hi;
push @hiddenitems, @hi;
my @hi = C4::Items::GetHiddenItemnumbers($item);
$item->{'hideatopac'} = @hi;
push @hiddenitems, @hi;
}
my $hbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'homebranch' : 'holdingbranch';