Lines 1413-1423
Format results in a form suitable for passing to the template
Link Here
|
1413 |
# IMO this subroutine is pretty messy still -- it's responsible for |
1413 |
# IMO this subroutine is pretty messy still -- it's responsible for |
1414 |
# building the HTML output for the template |
1414 |
# building the HTML output for the template |
1415 |
sub searchResults { |
1415 |
sub searchResults { |
1416 |
my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, @marcresults, $hidelostitems ) = @_; |
1416 |
my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, $marcresults ) = @_; |
1417 |
my $dbh = C4::Context->dbh; |
1417 |
my $dbh = C4::Context->dbh; |
1418 |
my @newresults; |
1418 |
my @newresults; |
1419 |
|
1419 |
|
1420 |
$search_context = 'opac' unless $search_context eq 'opac' or $search_context eq 'intranet'; |
1420 |
$search_context = 'opac' if !$search_context || $search_context ne 'intranet'; |
|
|
1421 |
my ($is_opac, $hidelostitems); |
1422 |
if ($search_context eq 'opac') { |
1423 |
$hidelostitems = C4::Context->preference('hidelostitems'); |
1424 |
$is_opac = 1; |
1425 |
} |
1421 |
|
1426 |
|
1422 |
#Build branchnames hash |
1427 |
#Build branchnames hash |
1423 |
#find branchname |
1428 |
#find branchname |
Lines 1484-1490
sub searchResults {
Link Here
|
1484 |
|
1489 |
|
1485 |
# loop through all of the records we've retrieved |
1490 |
# loop through all of the records we've retrieved |
1486 |
for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { |
1491 |
for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { |
1487 |
my $marcrecord = MARC::File::USMARC::decode( $marcresults[$i] ); |
1492 |
my $marcrecord = MARC::File::USMARC::decode( $marcresults->[$i] ); |
1488 |
$fw = $scan |
1493 |
$fw = $scan |
1489 |
? undef |
1494 |
? undef |
1490 |
: $bibliotag < 10 |
1495 |
: $bibliotag < 10 |
Lines 1576-1586
sub searchResults {
Link Here
|
1576 |
my $other_count = 0; |
1581 |
my $other_count = 0; |
1577 |
my $wthdrawn_count = 0; |
1582 |
my $wthdrawn_count = 0; |
1578 |
my $itemlost_count = 0; |
1583 |
my $itemlost_count = 0; |
|
|
1584 |
my $hideatopac_count = 0; |
1579 |
my $itembinding_count = 0; |
1585 |
my $itembinding_count = 0; |
1580 |
my $itemdamaged_count = 0; |
1586 |
my $itemdamaged_count = 0; |
1581 |
my $item_in_transit_count = 0; |
1587 |
my $item_in_transit_count = 0; |
1582 |
my $can_place_holds = 0; |
1588 |
my $can_place_holds = 0; |
1583 |
my $item_onhold_count = 0; |
1589 |
my $item_onhold_count = 0; |
1584 |
my $items_count = scalar(@fields); |
1590 |
my $items_count = scalar(@fields); |
1585 |
my $maxitems = |
1591 |
my $maxitems = |
1586 |
( C4::Context->preference('maxItemsinSearchResults') ) |
1592 |
( C4::Context->preference('maxItemsinSearchResults') ) |
Lines 1597-1605
sub searchResults {
Link Here
|
1597 |
} |
1603 |
} |
1598 |
|
1604 |
|
1599 |
# Hidden items |
1605 |
# Hidden items |
1600 |
my @items = ($item); |
1606 |
if ($is_opac) { |
1601 |
my (@hiddenitems) = GetHiddenItemnumbers(@items); |
1607 |
my @hiddenitems = GetHiddenItemnumbers($item); |
1602 |
$item->{'hideatopac'} = 1 if (@hiddenitems); |
1608 |
$item->{'hideatopac'} = @hiddenitems; |
|
|
1609 |
} |
1603 |
|
1610 |
|
1604 |
my $hbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'homebranch' : 'holdingbranch'; |
1611 |
my $hbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'homebranch' : 'holdingbranch'; |
1605 |
my $otherbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'holdingbranch' : 'homebranch'; |
1612 |
my $otherbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'holdingbranch' : 'homebranch'; |
Lines 1683-1688
sub searchResults {
Link Here
|
1683 |
$wthdrawn_count++ if $item->{wthdrawn}; |
1690 |
$wthdrawn_count++ if $item->{wthdrawn}; |
1684 |
$itemlost_count++ if $item->{itemlost}; |
1691 |
$itemlost_count++ if $item->{itemlost}; |
1685 |
$itemdamaged_count++ if $item->{damaged}; |
1692 |
$itemdamaged_count++ if $item->{damaged}; |
|
|
1693 |
$hideatopac_count++ if $item->{hideatopac}; |
1686 |
$item_in_transit_count++ if $transfertwhen ne ''; |
1694 |
$item_in_transit_count++ if $transfertwhen ne ''; |
1687 |
$item_onhold_count++ if $reservestatus eq 'Waiting'; |
1695 |
$item_onhold_count++ if $reservestatus eq 'Waiting'; |
1688 |
$item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; |
1696 |
$item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; |
Lines 1721-1726
sub searchResults {
Link Here
|
1721 |
} |
1729 |
} |
1722 |
} |
1730 |
} |
1723 |
} # notforloan, item level and biblioitem level |
1731 |
} # notforloan, item level and biblioitem level |
|
|
1732 |
|
1733 |
next if $is_opac && $hideatopac_count >= $items_count; |
1734 |
next if $hidelostitems && $itemlost_count >= $items_count; |
1735 |
|
1724 |
my ( $availableitemscount, $onloanitemscount, $otheritemscount ); |
1736 |
my ( $availableitemscount, $onloanitemscount, $otheritemscount ); |
1725 |
$maxitems = |
1737 |
$maxitems = |
1726 |
( C4::Context->preference('maxItemsinSearchResults') ) |
1738 |
( C4::Context->preference('maxItemsinSearchResults') ) |
Lines 1807-1816
sub searchResults {
Link Here
|
1807 |
$oldbiblio->{'alternateholdings_count'} = $alternateholdingscount; |
1819 |
$oldbiblio->{'alternateholdings_count'} = $alternateholdingscount; |
1808 |
} |
1820 |
} |
1809 |
|
1821 |
|
1810 |
push( @newresults, $oldbiblio ) |
1822 |
push( @newresults, $oldbiblio ); |
1811 |
if(not $hidelostitems |
|
|
1812 |
or (($items_count > $itemlost_count ) |
1813 |
&& $hidelostitems)); |
1814 |
} |
1823 |
} |
1815 |
|
1824 |
|
1816 |
return @newresults; |
1825 |
return @newresults; |