|
Lines 1415-1421
sub buildQuery {
Link Here
|
| 1415 |
|
1415 |
|
| 1416 |
my @search_results = searchResults($search_context, $searchdesc, $hits, |
1416 |
my @search_results = searchResults($search_context, $searchdesc, $hits, |
| 1417 |
$results_per_page, $offset, $scan, |
1417 |
$results_per_page, $offset, $scan, |
| 1418 |
@marcresults, $hidelostitems); |
1418 |
@marcresults); |
| 1419 |
|
1419 |
|
| 1420 |
Format results in a form suitable for passing to the template |
1420 |
Format results in a form suitable for passing to the template |
| 1421 |
|
1421 |
|
|
Lines 1629-1637
sub searchResults {
Link Here
|
| 1629 |
my $items_count = scalar(@fields); |
1629 |
my $items_count = scalar(@fields); |
| 1630 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
1630 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
| 1631 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
1631 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
|
|
1632 |
my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref |
| 1632 |
|
1633 |
|
| 1633 |
# loop through every item |
1634 |
# loop through every item |
| 1634 |
my @hiddenitems; |
|
|
| 1635 |
foreach my $field (@fields) { |
1635 |
foreach my $field (@fields) { |
| 1636 |
my $item; |
1636 |
my $item; |
| 1637 |
|
1637 |
|
|
Lines 1641-1651
sub searchResults {
Link Here
|
| 1641 |
} |
1641 |
} |
| 1642 |
$item->{description} = $itemtypes{ $item->{itype} }{description}; |
1642 |
$item->{description} = $itemtypes{ $item->{itype} }{description}; |
| 1643 |
|
1643 |
|
| 1644 |
# Hidden items |
1644 |
# OPAC hidden items |
| 1645 |
if ($is_opac) { |
1645 |
if ($is_opac) { |
|
|
1646 |
# hidden because lost |
| 1647 |
if ($hidelostitems && $item->{itemlost}) { |
| 1648 |
$hideatopac_count++; |
| 1649 |
next; |
| 1650 |
} |
| 1651 |
# hidden based on OpacHiddenItems syspref |
| 1646 |
my @hi = C4::Items::GetHiddenItemnumbers($item); |
1652 |
my @hi = C4::Items::GetHiddenItemnumbers($item); |
| 1647 |
$item->{'hideatopac'} = @hi; |
1653 |
if (scalar @hi) { |
| 1648 |
push @hiddenitems, @hi; |
1654 |
push @hiddenitems, @hi; |
|
|
1655 |
$hideatopac_count++; |
| 1656 |
next; |
| 1657 |
} |
| 1649 |
} |
1658 |
} |
| 1650 |
|
1659 |
|
| 1651 |
my $hbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'homebranch' : 'holdingbranch'; |
1660 |
my $hbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'homebranch' : 'holdingbranch'; |
|
Lines 1724-1737
sub searchResults {
Link Here
|
| 1724 |
|| $item->{itemlost} |
1733 |
|| $item->{itemlost} |
| 1725 |
|| $item->{damaged} |
1734 |
|| $item->{damaged} |
| 1726 |
|| $item->{notforloan} > 0 |
1735 |
|| $item->{notforloan} > 0 |
| 1727 |
|| $item->{hideatopac} |
|
|
| 1728 |
|| $reservestatus eq 'Waiting' |
1736 |
|| $reservestatus eq 'Waiting' |
| 1729 |
|| ($transfertwhen ne '')) |
1737 |
|| ($transfertwhen ne '')) |
| 1730 |
{ |
1738 |
{ |
| 1731 |
$wthdrawn_count++ if $item->{wthdrawn}; |
1739 |
$wthdrawn_count++ if $item->{wthdrawn}; |
| 1732 |
$itemlost_count++ if $item->{itemlost}; |
1740 |
$itemlost_count++ if $item->{itemlost}; |
| 1733 |
$itemdamaged_count++ if $item->{damaged}; |
1741 |
$itemdamaged_count++ if $item->{damaged}; |
| 1734 |
$hideatopac_count++ if $item->{hideatopac}; |
|
|
| 1735 |
$item_in_transit_count++ if $transfertwhen ne ''; |
1742 |
$item_in_transit_count++ if $transfertwhen ne ''; |
| 1736 |
$item_onhold_count++ if $reservestatus eq 'Waiting'; |
1743 |
$item_onhold_count++ if $reservestatus eq 'Waiting'; |
| 1737 |
$item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; |
1744 |
$item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; |
|
Lines 1747-1753
sub searchResults {
Link Here
|
| 1747 |
$other_count++; |
1754 |
$other_count++; |
| 1748 |
|
1755 |
|
| 1749 |
my $key = $prefix . $item->{status}; |
1756 |
my $key = $prefix . $item->{status}; |
| 1750 |
foreach (qw(wthdrawn itemlost damaged branchname itemcallnumber hideatopac)) { |
1757 |
foreach (qw(wthdrawn itemlost damaged branchname itemcallnumber)) { |
| 1751 |
$other_items->{$key}->{$_} = $item->{$_}; |
1758 |
$other_items->{$key}->{$_} = $item->{$_}; |
| 1752 |
} |
1759 |
} |
| 1753 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
1760 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
|
Lines 1763-1769
sub searchResults {
Link Here
|
| 1763 |
$can_place_holds = 1; |
1770 |
$can_place_holds = 1; |
| 1764 |
$available_count++; |
1771 |
$available_count++; |
| 1765 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
1772 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
| 1766 |
foreach (qw(branchname itemcallnumber hideatopac description)) { |
1773 |
foreach (qw(branchname itemcallnumber description)) { |
| 1767 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
1774 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
| 1768 |
} |
1775 |
} |
| 1769 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; |
1776 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; |
|
Lines 1771-1780
sub searchResults {
Link Here
|
| 1771 |
} |
1778 |
} |
| 1772 |
} |
1779 |
} |
| 1773 |
} # notforloan, item level and biblioitem level |
1780 |
} # notforloan, item level and biblioitem level |
| 1774 |
if ($items_count > 0) { |
1781 |
|
| 1775 |
next if $is_opac && $hideatopac_count >= $items_count; |
1782 |
# if all items are hidden, do not show the record |
| 1776 |
next if $hidelostitems && $itemlost_count >= $items_count; |
1783 |
if ($items_count > 0 && $hideatopac_count == $items_count) { |
| 1777 |
} |
1784 |
next; |
|
|
1785 |
} |
| 1786 |
|
| 1778 |
my ( $availableitemscount, $onloanitemscount, $otheritemscount ); |
1787 |
my ( $availableitemscount, $onloanitemscount, $otheritemscount ); |
| 1779 |
for my $key ( sort keys %$onloan_items ) { |
1788 |
for my $key ( sort keys %$onloan_items ) { |
| 1780 |
(++$onloanitemscount > $maxitems) and last; |
1789 |
(++$onloanitemscount > $maxitems) and last; |