Lines 1692-1698
sub searchResults {
Link Here
|
1692 |
|
1692 |
|
1693 |
# set stuff for XSLT processing here once, not later again for every record we retrieved |
1693 |
# set stuff for XSLT processing here once, not later again for every record we retrieved |
1694 |
|
1694 |
|
1695 |
my $userenv = C4::Context->userenv; |
1695 |
my $userenv = C4::Context->userenv; |
|
|
1696 |
my $userenv_branch = $userenv->{'branch'}; |
1696 |
my $logged_in_user = |
1697 |
my $logged_in_user = |
1697 |
( defined $userenv and $userenv->{number} ) |
1698 |
( defined $userenv and $userenv->{number} ) |
1698 |
? Koha::Patrons->find( $userenv->{number} ) |
1699 |
? Koha::Patrons->find( $userenv->{number} ) |
Lines 1790-1812
sub searchResults {
Link Here
|
1790 |
my $onloan_items; |
1791 |
my $onloan_items; |
1791 |
my $other_items; |
1792 |
my $other_items; |
1792 |
|
1793 |
|
1793 |
my $ordered_count = 0; |
1794 |
my $ordered_count = 0; |
1794 |
my $available_count = 0; |
1795 |
my $available_count = 0; |
1795 |
my $onloan_count = 0; |
1796 |
my $branch_available_count = 0; |
1796 |
my $longoverdue_count = 0; |
1797 |
my $onloan_count = 0; |
1797 |
my $other_count = 0; |
1798 |
my $branch_onloan_count = 0; |
1798 |
my $withdrawn_count = 0; |
1799 |
my $longoverdue_count = 0; |
1799 |
my $itemlost_count = 0; |
1800 |
my $other_count = 0; |
1800 |
my $hideatopac_count = 0; |
1801 |
my $branch_other_count = 0; |
1801 |
my $itembinding_count = 0; |
1802 |
my $withdrawn_count = 0; |
1802 |
my $itemdamaged_count = 0; |
1803 |
my $itemlost_count = 0; |
1803 |
my $item_in_transit_count = 0; |
1804 |
my $hideatopac_count = 0; |
1804 |
my $item_onhold_count = 0; |
1805 |
my $itembinding_count = 0; |
1805 |
my $notforloan_count = 0; |
1806 |
my $itemdamaged_count = 0; |
1806 |
my $item_recalled_count = 0; |
1807 |
my $item_in_transit_count = 0; |
1807 |
my $items_count = scalar(@fields); |
1808 |
my $item_onhold_count = 0; |
1808 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
1809 |
my $notforloan_count = 0; |
1809 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
1810 |
my $item_recalled_count = 0; |
|
|
1811 |
my $items_count = scalar(@fields); |
1812 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
1813 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
1810 |
my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref |
1814 |
my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref |
1811 |
|
1815 |
|
1812 |
# loop through every item |
1816 |
# loop through every item |
Lines 1863-1870
sub searchResults {
Link Here
|
1863 |
and !( $patron_category_hide_lost_items and $item->{itemlost} ) ) |
1867 |
and !( $patron_category_hide_lost_items and $item->{itemlost} ) ) |
1864 |
{ |
1868 |
{ |
1865 |
$onloan_count++; |
1869 |
$onloan_count++; |
|
|
1870 |
$branch_onloan_count++ if $item->{'branchcode'} eq $userenv_branch; |
1866 |
my $key = $prefix . $item->{onloan} . $item->{barcode}; |
1871 |
my $key = $prefix . $item->{onloan} . $item->{barcode}; |
1867 |
$onloan_items->{$key}->{due_date} = $item->{onloan}; |
1872 |
$onloan_items->{$key}->{branchonloancount} = $branch_onloan_count; |
|
|
1873 |
$onloan_items->{$key}->{due_date} = $item->{onloan}; |
1868 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
1874 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
1869 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
1875 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
1870 |
$onloan_items->{$key}->{branchcode} = $item->{branchcode}; |
1876 |
$onloan_items->{$key}->{branchcode} = $item->{branchcode}; |
Lines 1971-1985
sub searchResults {
Link Here
|
1971 |
. ( $item->{notforloan} // q{} ); |
1977 |
. ( $item->{notforloan} // q{} ); |
1972 |
|
1978 |
|
1973 |
$other_count++; |
1979 |
$other_count++; |
1974 |
|
1980 |
$branch_other_count++ if $item->{branchcode} eq $userenv_branch; |
1975 |
my $key = $prefix . $item->{status}; |
1981 |
my $key = $prefix . $item->{status}; |
1976 |
foreach (qw(withdrawn itemlost damaged branchname itemcallnumber)) { |
1982 |
foreach (qw(withdrawn itemlost damaged branchname itemcallnumber)) { |
1977 |
$other_items->{$key}->{$_} = $item->{$_}; |
1983 |
$other_items->{$key}->{$_} = $item->{$_}; |
1978 |
} |
1984 |
} |
1979 |
$other_items->{$key}->{branchcode} = $item->{branchcode}; |
1985 |
$other_items->{$key}->{branchothercount} = $branch_other_count; |
1980 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
1986 |
$other_items->{$key}->{branchcode} = $item->{branchcode}; |
1981 |
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0; |
1987 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
1982 |
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; |
1988 |
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0; |
|
|
1989 |
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; |
1983 |
$other_items->{$key}->{notforloan} = |
1990 |
$other_items->{$key}->{notforloan} = |
1984 |
GetAuthorisedValueDesc( '', '', $item->{notforloan}, '', '', $notforloan_authorised_value ) |
1991 |
GetAuthorisedValueDesc( '', '', $item->{notforloan}, '', '', $notforloan_authorised_value ) |
1985 |
if $notforloan_authorised_value and $item->{notforloan}; |
1992 |
if $notforloan_authorised_value and $item->{notforloan}; |
Lines 1997-2008
sub searchResults {
Link Here
|
1997 |
# item is available |
2004 |
# item is available |
1998 |
else { |
2005 |
else { |
1999 |
$available_count++; |
2006 |
$available_count++; |
|
|
2007 |
$branch_available_count++ if $item->{branchcode} eq $userenv_branch; |
2000 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
2008 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
2001 |
foreach (qw(branchname itemcallnumber description)) { |
2009 |
foreach (qw(branchname itemcallnumber description)) { |
2002 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
2010 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
2003 |
} |
2011 |
} |
2004 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
2012 |
$available_items->{$prefix}->{branchavailablecount} = $branch_available_count; |
2005 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } |
2013 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
|
|
2014 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } |
2006 |
if $item->{location}; |
2015 |
if $item->{location}; |
2007 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( |
2016 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( |
2008 |
$search_context->{'interface'}, |
2017 |
$search_context->{'interface'}, |
Lines 2063-2069
sub searchResults {
Link Here
|
2063 |
} |
2072 |
} |
2064 |
); |
2073 |
); |
2065 |
} |
2074 |
} |
2066 |
|
2075 |
my $branch_count = $branch_available_count + $branch_onloan_count + $branch_other_count || 0; |
2067 |
my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} ); |
2076 |
my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} ); |
2068 |
$oldbiblio->{biblio_object} = $biblio_object; |
2077 |
$oldbiblio->{biblio_object} = $biblio_object; |
2069 |
$oldbiblio->{coins} = eval { $biblio_object->get_coins } |
2078 |
$oldbiblio->{coins} = eval { $biblio_object->get_coins } |
Lines 2087-2105
sub searchResults {
Link Here
|
2087 |
$oldbiblio->{onloan_items_loop} = \@onloan_items_loop; |
2096 |
$oldbiblio->{onloan_items_loop} = \@onloan_items_loop; |
2088 |
$oldbiblio->{other_items_loop} = \@other_items_loop; |
2097 |
$oldbiblio->{other_items_loop} = \@other_items_loop; |
2089 |
$oldbiblio->{availablecount} = $available_count; |
2098 |
$oldbiblio->{availablecount} = $available_count; |
2090 |
$oldbiblio->{availableplural} = 1 if $available_count > 1; |
2099 |
|
2091 |
$oldbiblio->{onloancount} = $onloan_count; |
2100 |
$oldbiblio->{branchavailablecount} = $branch_available_count || 0; |
2092 |
$oldbiblio->{onloanplural} = 1 if $onloan_count > 1; |
2101 |
$oldbiblio->{branchonloancount} = $branch_onloan_count || 0; |
2093 |
$oldbiblio->{othercount} = $other_count; |
2102 |
$oldbiblio->{branchothercount} = $branch_other_count || 0; |
2094 |
$oldbiblio->{otherplural} = 1 if $other_count > 1; |
2103 |
$oldbiblio->{branchtotalcount} = $branch_count || 0; |
2095 |
$oldbiblio->{withdrawncount} = $withdrawn_count; |
2104 |
|
2096 |
$oldbiblio->{itemlostcount} = $itemlost_count; |
2105 |
$oldbiblio->{availableplural} = 1 if $available_count > 1; |
2097 |
$oldbiblio->{damagedcount} = $itemdamaged_count; |
2106 |
$oldbiblio->{onloancount} = $onloan_count; |
2098 |
$oldbiblio->{intransitcount} = $item_in_transit_count; |
2107 |
$oldbiblio->{onloanplural} = 1 if $onloan_count > 1; |
2099 |
$oldbiblio->{onholdcount} = $item_onhold_count; |
2108 |
$oldbiblio->{othercount} = $other_count; |
2100 |
$oldbiblio->{recalledcount} = $item_recalled_count; |
2109 |
$oldbiblio->{otherplural} = 1 if $other_count > 1; |
2101 |
$oldbiblio->{orderedcount} = $ordered_count; |
2110 |
$oldbiblio->{withdrawncount} = $withdrawn_count; |
2102 |
$oldbiblio->{notforloancount} = $notforloan_count; |
2111 |
$oldbiblio->{itemlostcount} = $itemlost_count; |
|
|
2112 |
$oldbiblio->{damagedcount} = $itemdamaged_count; |
2113 |
$oldbiblio->{intransitcount} = $item_in_transit_count; |
2114 |
$oldbiblio->{onholdcount} = $item_onhold_count; |
2115 |
$oldbiblio->{recalledcount} = $item_recalled_count; |
2116 |
$oldbiblio->{orderedcount} = $ordered_count; |
2117 |
$oldbiblio->{notforloancount} = $notforloan_count; |
2103 |
|
2118 |
|
2104 |
if ( C4::Context->preference("AlternateHoldingsField") && $items_count == 0 ) { |
2119 |
if ( C4::Context->preference("AlternateHoldingsField") && $items_count == 0 ) { |
2105 |
my $fieldspec = C4::Context->preference("AlternateHoldingsField"); |
2120 |
my $fieldspec = C4::Context->preference("AlternateHoldingsField"); |
2106 |
- |
|
|