Lines 1686-1692
sub searchResults {
Link Here
|
1686 |
|
1686 |
|
1687 |
# set stuff for XSLT processing here once, not later again for every record we retrieved |
1687 |
# set stuff for XSLT processing here once, not later again for every record we retrieved |
1688 |
|
1688 |
|
1689 |
my $userenv = C4::Context->userenv; |
1689 |
my $userenv = C4::Context->userenv; |
|
|
1690 |
my $userenv_branch = $userenv->{'branch'}; |
1690 |
my $logged_in_user = |
1691 |
my $logged_in_user = |
1691 |
( defined $userenv and $userenv->{number} ) |
1692 |
( defined $userenv and $userenv->{number} ) |
1692 |
? Koha::Patrons->find( $userenv->{number} ) |
1693 |
? Koha::Patrons->find( $userenv->{number} ) |
Lines 1784-1806
sub searchResults {
Link Here
|
1784 |
my $onloan_items; |
1785 |
my $onloan_items; |
1785 |
my $other_items; |
1786 |
my $other_items; |
1786 |
|
1787 |
|
1787 |
my $ordered_count = 0; |
1788 |
my $ordered_count = 0; |
1788 |
my $available_count = 0; |
1789 |
my $available_count = 0; |
1789 |
my $onloan_count = 0; |
1790 |
my $branch_available_count = 0; |
1790 |
my $longoverdue_count = 0; |
1791 |
my $onloan_count = 0; |
1791 |
my $other_count = 0; |
1792 |
my $branch_onloan_count = 0; |
1792 |
my $withdrawn_count = 0; |
1793 |
my $longoverdue_count = 0; |
1793 |
my $itemlost_count = 0; |
1794 |
my $other_count = 0; |
1794 |
my $hideatopac_count = 0; |
1795 |
my $branch_other_count = 0; |
1795 |
my $itembinding_count = 0; |
1796 |
my $withdrawn_count = 0; |
1796 |
my $itemdamaged_count = 0; |
1797 |
my $itemlost_count = 0; |
1797 |
my $item_in_transit_count = 0; |
1798 |
my $hideatopac_count = 0; |
1798 |
my $item_onhold_count = 0; |
1799 |
my $itembinding_count = 0; |
1799 |
my $notforloan_count = 0; |
1800 |
my $itemdamaged_count = 0; |
1800 |
my $item_recalled_count = 0; |
1801 |
my $item_in_transit_count = 0; |
1801 |
my $items_count = scalar(@fields); |
1802 |
my $item_onhold_count = 0; |
1802 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
1803 |
my $notforloan_count = 0; |
1803 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
1804 |
my $item_recalled_count = 0; |
|
|
1805 |
my $items_count = scalar(@fields); |
1806 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
1807 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
1804 |
my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref |
1808 |
my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref |
1805 |
|
1809 |
|
1806 |
# loop through every item |
1810 |
# loop through every item |
Lines 1857-1864
sub searchResults {
Link Here
|
1857 |
and !( $patron_category_hide_lost_items and $item->{itemlost} ) ) |
1861 |
and !( $patron_category_hide_lost_items and $item->{itemlost} ) ) |
1858 |
{ |
1862 |
{ |
1859 |
$onloan_count++; |
1863 |
$onloan_count++; |
|
|
1864 |
$branch_onloan_count++ if $item->{'branchcode'} eq $userenv_branch; |
1860 |
my $key = $prefix . $item->{onloan} . $item->{barcode}; |
1865 |
my $key = $prefix . $item->{onloan} . $item->{barcode}; |
1861 |
$onloan_items->{$key}->{due_date} = $item->{onloan}; |
1866 |
$onloan_items->{$key}->{branchonloancount} = $branch_onloan_count; |
|
|
1867 |
$onloan_items->{$key}->{due_date} = $item->{onloan}; |
1862 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
1868 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
1863 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
1869 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
1864 |
$onloan_items->{$key}->{branchcode} = $item->{branchcode}; |
1870 |
$onloan_items->{$key}->{branchcode} = $item->{branchcode}; |
Lines 1965-1979
sub searchResults {
Link Here
|
1965 |
. ( $item->{notforloan} // q{} ); |
1971 |
. ( $item->{notforloan} // q{} ); |
1966 |
|
1972 |
|
1967 |
$other_count++; |
1973 |
$other_count++; |
1968 |
|
1974 |
$branch_other_count++ if $item->{branchcode} eq $userenv_branch; |
1969 |
my $key = $prefix . $item->{status}; |
1975 |
my $key = $prefix . $item->{status}; |
1970 |
foreach (qw(withdrawn itemlost damaged branchname itemcallnumber)) { |
1976 |
foreach (qw(withdrawn itemlost damaged branchname itemcallnumber)) { |
1971 |
$other_items->{$key}->{$_} = $item->{$_}; |
1977 |
$other_items->{$key}->{$_} = $item->{$_}; |
1972 |
} |
1978 |
} |
1973 |
$other_items->{$key}->{branchcode} = $item->{branchcode}; |
1979 |
$other_items->{$key}->{branchothercount} = $branch_other_count; |
1974 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
1980 |
$other_items->{$key}->{branchcode} = $item->{branchcode}; |
1975 |
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0; |
1981 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
1976 |
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; |
1982 |
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0; |
|
|
1983 |
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; |
1977 |
$other_items->{$key}->{notforloan} = |
1984 |
$other_items->{$key}->{notforloan} = |
1978 |
GetAuthorisedValueDesc( '', '', $item->{notforloan}, '', '', $notforloan_authorised_value ) |
1985 |
GetAuthorisedValueDesc( '', '', $item->{notforloan}, '', '', $notforloan_authorised_value ) |
1979 |
if $notforloan_authorised_value and $item->{notforloan}; |
1986 |
if $notforloan_authorised_value and $item->{notforloan}; |
Lines 1991-2002
sub searchResults {
Link Here
|
1991 |
# item is available |
1998 |
# item is available |
1992 |
else { |
1999 |
else { |
1993 |
$available_count++; |
2000 |
$available_count++; |
|
|
2001 |
$branch_available_count++ if $item->{branchcode} eq $userenv_branch; |
1994 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
2002 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
1995 |
foreach (qw(branchname itemcallnumber description)) { |
2003 |
foreach (qw(branchname itemcallnumber description)) { |
1996 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
2004 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
1997 |
} |
2005 |
} |
1998 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
2006 |
$available_items->{$prefix}->{branchavailablecount} = $branch_available_count; |
1999 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } |
2007 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
|
|
2008 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } |
2000 |
if $item->{location}; |
2009 |
if $item->{location}; |
2001 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( |
2010 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( |
2002 |
$search_context->{'interface'}, |
2011 |
$search_context->{'interface'}, |
Lines 2057-2063
sub searchResults {
Link Here
|
2057 |
} |
2066 |
} |
2058 |
); |
2067 |
); |
2059 |
} |
2068 |
} |
2060 |
|
2069 |
my $branch_count = $branch_available_count + $branch_onloan_count + $branch_other_count || 0; |
2061 |
my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} ); |
2070 |
my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} ); |
2062 |
$oldbiblio->{biblio_object} = $biblio_object; |
2071 |
$oldbiblio->{biblio_object} = $biblio_object; |
2063 |
$oldbiblio->{coins} = eval { $biblio_object->get_coins } |
2072 |
$oldbiblio->{coins} = eval { $biblio_object->get_coins } |
Lines 2081-2099
sub searchResults {
Link Here
|
2081 |
$oldbiblio->{onloan_items_loop} = \@onloan_items_loop; |
2090 |
$oldbiblio->{onloan_items_loop} = \@onloan_items_loop; |
2082 |
$oldbiblio->{other_items_loop} = \@other_items_loop; |
2091 |
$oldbiblio->{other_items_loop} = \@other_items_loop; |
2083 |
$oldbiblio->{availablecount} = $available_count; |
2092 |
$oldbiblio->{availablecount} = $available_count; |
2084 |
$oldbiblio->{availableplural} = 1 if $available_count > 1; |
2093 |
|
2085 |
$oldbiblio->{onloancount} = $onloan_count; |
2094 |
$oldbiblio->{branchavailablecount} = $branch_available_count || 0; |
2086 |
$oldbiblio->{onloanplural} = 1 if $onloan_count > 1; |
2095 |
$oldbiblio->{branchonloancount} = $branch_onloan_count || 0; |
2087 |
$oldbiblio->{othercount} = $other_count; |
2096 |
$oldbiblio->{branchothercount} = $branch_other_count || 0; |
2088 |
$oldbiblio->{otherplural} = 1 if $other_count > 1; |
2097 |
$oldbiblio->{branchtotalcount} = $branch_count || 0; |
2089 |
$oldbiblio->{withdrawncount} = $withdrawn_count; |
2098 |
|
2090 |
$oldbiblio->{itemlostcount} = $itemlost_count; |
2099 |
$oldbiblio->{availableplural} = 1 if $available_count > 1; |
2091 |
$oldbiblio->{damagedcount} = $itemdamaged_count; |
2100 |
$oldbiblio->{onloancount} = $onloan_count; |
2092 |
$oldbiblio->{intransitcount} = $item_in_transit_count; |
2101 |
$oldbiblio->{onloanplural} = 1 if $onloan_count > 1; |
2093 |
$oldbiblio->{onholdcount} = $item_onhold_count; |
2102 |
$oldbiblio->{othercount} = $other_count; |
2094 |
$oldbiblio->{recalledcount} = $item_recalled_count; |
2103 |
$oldbiblio->{otherplural} = 1 if $other_count > 1; |
2095 |
$oldbiblio->{orderedcount} = $ordered_count; |
2104 |
$oldbiblio->{withdrawncount} = $withdrawn_count; |
2096 |
$oldbiblio->{notforloancount} = $notforloan_count; |
2105 |
$oldbiblio->{itemlostcount} = $itemlost_count; |
|
|
2106 |
$oldbiblio->{damagedcount} = $itemdamaged_count; |
2107 |
$oldbiblio->{intransitcount} = $item_in_transit_count; |
2108 |
$oldbiblio->{onholdcount} = $item_onhold_count; |
2109 |
$oldbiblio->{recalledcount} = $item_recalled_count; |
2110 |
$oldbiblio->{orderedcount} = $ordered_count; |
2111 |
$oldbiblio->{notforloancount} = $notforloan_count; |
2097 |
|
2112 |
|
2098 |
if ( C4::Context->preference("AlternateHoldingsField") && $items_count == 0 ) { |
2113 |
if ( C4::Context->preference("AlternateHoldingsField") && $items_count == 0 ) { |
2099 |
my $fieldspec = C4::Context->preference("AlternateHoldingsField"); |
2114 |
my $fieldspec = C4::Context->preference("AlternateHoldingsField"); |
2100 |
- |
|
|