Lines 1705-1710
sub searchResults {
Link Here
|
1705 |
# set stuff for XSLT processing here once, not later again for every record we retrieved |
1705 |
# set stuff for XSLT processing here once, not later again for every record we retrieved |
1706 |
|
1706 |
|
1707 |
my $userenv = C4::Context->userenv; |
1707 |
my $userenv = C4::Context->userenv; |
|
|
1708 |
my $userenv_branch = $userenv->{'branch'}; |
1708 |
my $logged_in_user |
1709 |
my $logged_in_user |
1709 |
= ( defined $userenv and $userenv->{number} ) |
1710 |
= ( defined $userenv and $userenv->{number} ) |
1710 |
? Koha::Patrons->find( $userenv->{number} ) |
1711 |
? Koha::Patrons->find( $userenv->{number} ) |
Lines 1793-1813
sub searchResults {
Link Here
|
1793 |
my $onloan_items; |
1794 |
my $onloan_items; |
1794 |
my $other_items; |
1795 |
my $other_items; |
1795 |
|
1796 |
|
1796 |
my $ordered_count = 0; |
1797 |
my $ordered_count = 0; |
1797 |
my $available_count = 0; |
1798 |
my $available_count = 0; |
1798 |
my $onloan_count = 0; |
1799 |
my $branch_available_count = 0; |
1799 |
my $longoverdue_count = 0; |
1800 |
my $onloan_count = 0; |
1800 |
my $other_count = 0; |
1801 |
my $branch_onloan_count = 0; |
|
|
1802 |
my $longoverdue_count = 0; |
1803 |
my $other_count = 0; |
1804 |
my $branch_other_count = 0; |
1801 |
my $withdrawn_count = 0; |
1805 |
my $withdrawn_count = 0; |
1802 |
my $itemlost_count = 0; |
1806 |
my $itemlost_count = 0; |
1803 |
my $hideatopac_count = 0; |
1807 |
my $hideatopac_count = 0; |
1804 |
my $itembinding_count = 0; |
1808 |
my $itembinding_count = 0; |
1805 |
my $itemdamaged_count = 0; |
1809 |
my $itemdamaged_count = 0; |
1806 |
my $item_in_transit_count = 0; |
1810 |
my $item_in_transit_count = 0; |
1807 |
my $item_onhold_count = 0; |
1811 |
my $item_onhold_count = 0; |
1808 |
my $notforloan_count = 0; |
1812 |
my $notforloan_count = 0; |
1809 |
my $item_recalled_count = 0; |
1813 |
my $item_recalled_count = 0; |
1810 |
my $items_count = scalar(@fields); |
1814 |
my $items_count = scalar(@fields); |
1811 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
1815 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
1812 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
1816 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
1813 |
my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref |
1817 |
my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref |
Lines 1864-1870
sub searchResults {
Link Here
|
1864 |
and !( $patron_category_hide_lost_items and $item->{itemlost} ) ) |
1868 |
and !( $patron_category_hide_lost_items and $item->{itemlost} ) ) |
1865 |
{ |
1869 |
{ |
1866 |
$onloan_count++; |
1870 |
$onloan_count++; |
|
|
1871 |
$branch_onloan_count++ if $item->{'branchcode'} eq $userenv_branch; |
1867 |
my $key = $prefix . $item->{onloan} . $item->{barcode}; |
1872 |
my $key = $prefix . $item->{onloan} . $item->{barcode}; |
|
|
1873 |
$onloan_items->{$key}->{branchonloancount} = $branch_onloan_count; |
1868 |
$onloan_items->{$key}->{due_date} = $item->{onloan}; |
1874 |
$onloan_items->{$key}->{due_date} = $item->{onloan}; |
1869 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
1875 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
1870 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
1876 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
Lines 1961-1971
sub searchResults {
Link Here
|
1961 |
$item->{status} = ($item->{withdrawn}//q{}) . "-" . ($item->{itemlost}//q{}) . "-" . ($item->{damaged}//q{}) . "-" . ($item->{notforloan}//q{}); |
1967 |
$item->{status} = ($item->{withdrawn}//q{}) . "-" . ($item->{itemlost}//q{}) . "-" . ($item->{damaged}//q{}) . "-" . ($item->{notforloan}//q{}); |
1962 |
|
1968 |
|
1963 |
$other_count++; |
1969 |
$other_count++; |
1964 |
|
1970 |
$branch_other_count++ if $item->{branchcode} eq $userenv_branch; |
1965 |
my $key = $prefix . $item->{status}; |
1971 |
my $key = $prefix . $item->{status}; |
1966 |
foreach (qw(withdrawn itemlost damaged branchname itemcallnumber)) { |
1972 |
foreach (qw(withdrawn itemlost damaged branchname itemcallnumber)) { |
1967 |
$other_items->{$key}->{$_} = $item->{$_}; |
1973 |
$other_items->{$key}->{$_} = $item->{$_}; |
1968 |
} |
1974 |
} |
|
|
1975 |
$other_items->{$key}->{branchothercount} = $branch_other_count; |
1969 |
$other_items->{$key}->{branchcode} = $item->{branchcode}; |
1976 |
$other_items->{$key}->{branchcode} = $item->{branchcode}; |
1970 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
1977 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
1971 |
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0; |
1978 |
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0; |
Lines 1980-1989
sub searchResults {
Link Here
|
1980 |
# item is available |
1987 |
# item is available |
1981 |
else { |
1988 |
else { |
1982 |
$available_count++; |
1989 |
$available_count++; |
|
|
1990 |
$branch_available_count++ if $item->{branchcode} eq $userenv_branch; |
1983 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
1991 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
1984 |
foreach (qw(branchname itemcallnumber description)) { |
1992 |
foreach (qw(branchname itemcallnumber description)) { |
1985 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
1993 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
1986 |
} |
1994 |
} |
|
|
1995 |
$available_items->{$prefix}->{branchavailablecount} = $branch_available_count; |
1987 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
1996 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
1988 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
1997 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
1989 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype}//q{} }->{imageurl} ); |
1998 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype}//q{} }->{imageurl} ); |
Lines 2036-2042
sub searchResults {
Link Here
|
2036 |
} |
2045 |
} |
2037 |
); |
2046 |
); |
2038 |
} |
2047 |
} |
2039 |
|
2048 |
my $branch_count = $branch_available_count + $branch_onloan_count + $branch_other_count || 0; |
2040 |
my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} ); |
2049 |
my $biblio_object = Koha::Biblios->find( $oldbiblio->{biblionumber} ); |
2041 |
$oldbiblio->{biblio_object} = $biblio_object; |
2050 |
$oldbiblio->{biblio_object} = $biblio_object; |
2042 |
$oldbiblio->{coins} = eval { $biblio_object->get_coins } |
2051 |
$oldbiblio->{coins} = eval { $biblio_object->get_coins } |
Lines 2059-2064
sub searchResults {
Link Here
|
2059 |
$oldbiblio->{onloan_items_loop} = \@onloan_items_loop; |
2068 |
$oldbiblio->{onloan_items_loop} = \@onloan_items_loop; |
2060 |
$oldbiblio->{other_items_loop} = \@other_items_loop; |
2069 |
$oldbiblio->{other_items_loop} = \@other_items_loop; |
2061 |
$oldbiblio->{availablecount} = $available_count; |
2070 |
$oldbiblio->{availablecount} = $available_count; |
|
|
2071 |
|
2072 |
$oldbiblio->{branchavailablecount} = $branch_available_count || 0; |
2073 |
$oldbiblio->{branchonloancount} = $branch_onloan_count || 0; |
2074 |
$oldbiblio->{branchothercount} = $branch_other_count || 0; |
2075 |
$oldbiblio->{branchtotalcount} = $branch_count || 0; |
2076 |
|
2062 |
$oldbiblio->{availableplural} = 1 if $available_count > 1; |
2077 |
$oldbiblio->{availableplural} = 1 if $available_count > 1; |
2063 |
$oldbiblio->{onloancount} = $onloan_count; |
2078 |
$oldbiblio->{onloancount} = $onloan_count; |
2064 |
$oldbiblio->{onloanplural} = 1 if $onloan_count > 1; |
2079 |
$oldbiblio->{onloanplural} = 1 if $onloan_count > 1; |
2065 |
- |
|
|