Bug 7690: hidelostitems not working in Normal Display
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Tested by toggling both the hidelostitems preference and the OpacHiddenItems preference. Both work as expected in the normal search results display. Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
parent
b20c00ee2d
commit
4792d78c19
33
C4/Search.pm
33
C4/Search.pm
|
|
@ -1627,9 +1627,9 @@ sub searchResults {
|
|||
my $items_count = scalar(@fields);
|
||||
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
|
||||
my @hiddenitems;
|
||||
foreach my $field (@fields) {
|
||||
my $item;
|
||||
|
||||
|
|
@ -1639,11 +1639,20 @@ sub searchResults {
|
|||
}
|
||||
$item->{description} = $itemtypes{ $item->{itype} }{description};
|
||||
|
||||
# Hidden items
|
||||
# OPAC hidden items
|
||||
if ($is_opac) {
|
||||
# hidden because lost
|
||||
if ($hidelostitems && $item->{itemlost}) {
|
||||
$hideatopac_count++;
|
||||
next;
|
||||
}
|
||||
# hidden based on OpacHiddenItems syspref
|
||||
my @hi = C4::Items::GetHiddenItemnumbers($item);
|
||||
$item->{'hideatopac'} = @hi;
|
||||
push @hiddenitems, @hi;
|
||||
if (scalar @hi) {
|
||||
push @hiddenitems, @hi;
|
||||
$hideatopac_count++;
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
my $hbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'homebranch' : 'holdingbranch';
|
||||
|
|
@ -1722,14 +1731,12 @@ sub searchResults {
|
|||
|| $item->{itemlost}
|
||||
|| $item->{damaged}
|
||||
|| $item->{notforloan} > 0
|
||||
|| $item->{hideatopac}
|
||||
|| $reservestatus eq 'Waiting'
|
||||
|| ($transfertwhen ne ''))
|
||||
{
|
||||
$wthdrawn_count++ if $item->{wthdrawn};
|
||||
$itemlost_count++ if $item->{itemlost};
|
||||
$itemdamaged_count++ if $item->{damaged};
|
||||
$hideatopac_count++ if $item->{hideatopac};
|
||||
$item_in_transit_count++ if $transfertwhen ne '';
|
||||
$item_onhold_count++ if $reservestatus eq 'Waiting';
|
||||
$item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan};
|
||||
|
|
@ -1745,7 +1752,7 @@ sub searchResults {
|
|||
$other_count++;
|
||||
|
||||
my $key = $prefix . $item->{status};
|
||||
foreach (qw(wthdrawn itemlost damaged branchname itemcallnumber hideatopac)) {
|
||||
foreach (qw(wthdrawn itemlost damaged branchname itemcallnumber)) {
|
||||
$other_items->{$key}->{$_} = $item->{$_};
|
||||
}
|
||||
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0;
|
||||
|
|
@ -1761,7 +1768,7 @@ sub searchResults {
|
|||
$can_place_holds = 1;
|
||||
$available_count++;
|
||||
$available_items->{$prefix}->{count}++ if $item->{$hbranch};
|
||||
foreach (qw(branchname itemcallnumber hideatopac description)) {
|
||||
foreach (qw(branchname itemcallnumber description)) {
|
||||
$available_items->{$prefix}->{$_} = $item->{$_};
|
||||
}
|
||||
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} };
|
||||
|
|
@ -1769,10 +1776,12 @@ sub searchResults {
|
|||
}
|
||||
}
|
||||
} # notforloan, item level and biblioitem level
|
||||
if ($items_count > 0) {
|
||||
next if $is_opac && $hideatopac_count >= $items_count;
|
||||
next if $hidelostitems && $itemlost_count >= $items_count;
|
||||
}
|
||||
|
||||
# if all items are hidden, do not show the record
|
||||
if ($items_count > 0 && $hideatopac_count == $items_count) {
|
||||
next;
|
||||
}
|
||||
|
||||
my ( $availableitemscount, $onloanitemscount, $otheritemscount );
|
||||
for my $key ( sort keys %$onloan_items ) {
|
||||
(++$onloanitemscount > $maxitems) and last;
|
||||
|
|
|
|||
|
|
@ -475,10 +475,9 @@ $(document).ready(function(){
|
|||
|
||||
<span class="results_summary">
|
||||
<span class="label">Availability:</span>
|
||||
[% IF ( SEARCH_RESULT.available_items_loop.0 ) %]
|
||||
[% IF ( SEARCH_RESULT.available_items_loop.size() ) %]
|
||||
<span class="available"><strong>Copies available:</strong>
|
||||
[% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
|
||||
[% UNLESS ( available_items_loo.hideatopac ) %]
|
||||
[% IF ( singleBranchMode ) %]
|
||||
[% available_items_loo.location %]
|
||||
[% ELSE %]
|
||||
|
|
@ -491,7 +490,6 @@ $(document).ready(function(){
|
|||
[% END %]
|
||||
([% available_items_loo.count %]),
|
||||
[% END %]
|
||||
[% END %]
|
||||
</span>
|
||||
[% ELSE %]
|
||||
[% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS ) %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue