use Koha::Libraries;
use Koha::Logger;
use Koha::Patrons;
+use Koha::Recalls;
use Koha::RecordProcessor;
use URI::Escape;
use Business::ISBN;
my $titleindex = 'ti,ext';
my $authorindex = 'au,ext';
- my $op = 'and';
+ my $op = 'AND';
$result->{title} =~ s /\\//g;
$result->{title} =~ s /\"//g;
my $fuzzy_enabled = C4::Context->preference("QueryFuzzy") || 0;
$operand =~ s/"/ /g; # Bug 7518: searches with quotation marks don't work
- my $weighted_query .= "(rk=("; # Specifies that we're applying rank
+ my $weighted_query = "(rk=("; # Specifies that we're applying rank
# Keyword, or, no index specified
if ( ( $index eq 'kw' ) || ( !$index ) ) {
my $operator = "";
if ($params->{previous_operand}){
#If there is a previous operand, add a supplied operator or the default 'and'
- $operator = ($params->{operator}) ? " ".($params->{operator})." " : ' AND ';
+ $operator = ($params->{operator}) ? ($params->{operator}) : 'AND';
}
#NOTE: indexes_set is typically set when doing truncation or field weighting
#e.g. "kw,wrdl:test"
#e.g. " and kw,wrdl:test"
- $params->{query} .= $operator . $operand;
+ $params->{query} .= " " . $operator . " " . $operand;
$params->{query_cgi} .= "&op=".uri_escape_utf8($operator) if $operator;
$params->{query_cgi} .= "&idx=".uri_escape_utf8($params->{index}) if $params->{index};
$params->{query_cgi} .= "&q=".uri_escape_utf8($params->{original_operand}) if ( $params->{original_operand} ne '' );
#e.g. " and kw,wrdl: test"
- $params->{query_desc} .= $operator . ( $params->{index_plus} // q{} ) . " " . ( $params->{original_operand} // q{} );
+ $params->{query_desc} .= " " . $operator . " " . ( $params->{index_plus} // q{} ) . " " . ( $params->{original_operand} // q{} );
$params->{previous_operand} = 1 unless $params->{previous_operand}; #If there is no previous operand, mark this as one
my $item_in_transit_count = 0;
my $item_onhold_count = 0;
my $notforloan_count = 0;
+ my $item_recalled_count = 0;
my $items_count = scalar(@fields);
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults');
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1;
if ($is_opac) {
# hidden because lost
if ($hidelostitems && $item->{itemlost}) {
+ push @hiddenitems, $item->{itemnumber};
$hideatopac_count++;
next;
}
# is item on the reserve shelf?
my $reservestatus = '';
+ # is item a waiting recall?
+ my $recallstatus = '';
+
unless ($item->{withdrawn}
|| $item->{itemlost}
|| $item->{damaged}
#
($transfertwhen, $transfertfrom, $transfertto) = C4::Circulation::GetTransfers($item->{itemnumber});
$reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} );
+ if ( C4::Context->preference('UseRecalls') ) {
+ if ( Koha::Recalls->search({ itemnumber => $item->{itemnumber}, status => 'waiting' })->count ) {
+ $recallstatus = 'Waiting';
+ }
+ }
}
# item is withdrawn, lost, damaged, not for loan, reserved or in transit
|| $item->{damaged}
|| $item->{notforloan}
|| $reservestatus eq 'Waiting'
+ || $recallstatus eq 'Waiting'
|| ($transfertwhen && $transfertwhen ne ''))
{
$withdrawn_count++ if $item->{withdrawn};
$itemdamaged_count++ if $item->{damaged};
$item_in_transit_count++ if $transfertwhen && $transfertwhen ne '';
$item_onhold_count++ if $reservestatus eq 'Waiting';
+ $item_recalled_count++ if $recallstatus eq 'Waiting';
$item->{status} = ($item->{withdrawn}//q{}) . "-" . ($item->{itemlost}//q{}) . "-" . ($item->{damaged}//q{}) . "-" . ($item->{notforloan}//q{});
$other_count++;
$other_items->{$key}->{$_} = $item->{$_};
}
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0;
+ $other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0;
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0;
$other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value and $item->{notforloan};
$other_items->{$key}->{count}++ if $item->{$hbranch};
$oldbiblio->{damagedcount} = $itemdamaged_count;
$oldbiblio->{intransitcount} = $item_in_transit_count;
$oldbiblio->{onholdcount} = $item_onhold_count;
+ $oldbiblio->{recalledcount} = $item_recalled_count;
$oldbiblio->{orderedcount} = $ordered_count;
$oldbiblio->{notforloancount} = $notforloan_count;