|
Lines 46-51
use C4::XSLT qw( XSLTParse4Display );
Link Here
|
| 46 |
use C4::Reserves qw( GetReserveStatus ); |
46 |
use C4::Reserves qw( GetReserveStatus ); |
| 47 |
use C4::Charset qw( SetUTF8Flag ); |
47 |
use C4::Charset qw( SetUTF8Flag ); |
| 48 |
use Koha::AuthorisedValues; |
48 |
use Koha::AuthorisedValues; |
|
|
49 |
use Koha::Displays; |
| 50 |
use Koha::Items; |
| 49 |
use Koha::ItemTypes; |
51 |
use Koha::ItemTypes; |
| 50 |
use Koha::Libraries; |
52 |
use Koha::Libraries; |
| 51 |
use Koha::Logger; |
53 |
use Koha::Logger; |
|
Lines 1687-1692
sub searchResults {
Link Here
|
| 1687 |
) |
1689 |
) |
| 1688 |
}; |
1690 |
}; |
| 1689 |
|
1691 |
|
|
|
1692 |
# Cache for display lookups to avoid repeated queries |
| 1693 |
my $display_cache = {}; |
| 1694 |
|
| 1695 |
# Helper function to get effective location for search results |
| 1696 |
my $get_effective_location_display = sub { |
| 1697 |
my ($item) = @_; |
| 1698 |
return $shelflocations->{ $item->{location} } unless C4::Context->preference('UseDisplayModule'); |
| 1699 |
|
| 1700 |
my $item_obj = Koha::Items->find( $item->{itemnumber} ); |
| 1701 |
return $shelflocations->{ $item->{location} } unless $item_obj; |
| 1702 |
|
| 1703 |
my $effective_loc = $item_obj->effective_location; |
| 1704 |
|
| 1705 |
# If it starts with "DISPLAY:", validate against displays table |
| 1706 |
if ( $effective_loc =~ /^DISPLAY:\s*(.+)$/ ) { |
| 1707 |
my $display_name = $1; |
| 1708 |
|
| 1709 |
# Use cache to avoid repeated database queries |
| 1710 |
if ( !exists $display_cache->{$display_name} ) { |
| 1711 |
my $display = Koha::Displays->search( { display_name => $display_name } )->next; |
| 1712 |
$display_cache->{$display_name} = $display ? $display->display_name : undef; |
| 1713 |
} |
| 1714 |
return $display_cache->{$display_name} ? "DISPLAY: " . $display_cache->{$display_name} : $effective_loc; |
| 1715 |
} else { |
| 1716 |
return $shelflocations->{$effective_loc}; |
| 1717 |
} |
| 1718 |
}; |
| 1719 |
|
| 1690 |
# get notforloan authorised value list (see $shelflocations FIXME) |
1720 |
# get notforloan authorised value list (see $shelflocations FIXME) |
| 1691 |
my $av = Koha::MarcSubfieldStructures->search( |
1721 |
my $av = Koha::MarcSubfieldStructures->search( |
| 1692 |
{ |
1722 |
{ |
|
Lines 1891-1896
sub searchResults {
Link Here
|
| 1891 |
$item->{'branchcode'} = $item->{$otherbranch}; |
1921 |
$item->{'branchcode'} = $item->{$otherbranch}; |
| 1892 |
} |
1922 |
} |
| 1893 |
|
1923 |
|
|
|
1924 |
# items on display |
| 1925 |
my @displays; |
| 1926 |
my @display_items = Koha::DisplayItems->search( |
| 1927 |
{ itemnumber => $item->{itemnumber} }, |
| 1928 |
{ |
| 1929 |
order_by => { '-desc' => 'date_added' }, |
| 1930 |
} |
| 1931 |
)->as_list; |
| 1932 |
|
| 1933 |
foreach my $display_item (@display_items) { |
| 1934 |
push @displays, $display_item->display; |
| 1935 |
} |
| 1936 |
|
| 1937 |
$item->{displays} = \@displays |
| 1938 |
unless $#displays < 0; |
| 1939 |
|
| 1894 |
my $prefix = |
1940 |
my $prefix = |
| 1895 |
( $item->{$hbranch} ? $item->{$hbranch} . '--' : q{} ) |
1941 |
( $item->{$hbranch} ? $item->{$hbranch} . '--' : q{} ) |
| 1896 |
. ( $item->{location} ? $item->{location} : q{} ) |
1942 |
. ( $item->{location} ? $item->{location} : q{} ) |
|
Lines 1912-1918
sub searchResults {
Link Here
|
| 1912 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
1958 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
| 1913 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
1959 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
| 1914 |
$onloan_items->{$key}->{branchcode} = $item->{branchcode}; |
1960 |
$onloan_items->{$key}->{branchcode} = $item->{branchcode}; |
| 1915 |
$onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
1961 |
$onloan_items->{$key}->{location} = $get_effective_location_display->($item) if $item->{location}; |
| 1916 |
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; |
1962 |
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; |
| 1917 |
$onloan_items->{$key}->{description} = $item->{description}; |
1963 |
$onloan_items->{$key}->{description} = $item->{description}; |
| 1918 |
$onloan_items->{$key}->{imageurl} = getitemtypeimagelocation( |
1964 |
$onloan_items->{$key}->{imageurl} = getitemtypeimagelocation( |
|
Lines 1921-1926
sub searchResults {
Link Here
|
| 1921 |
); |
1967 |
); |
| 1922 |
$onloan_items->{$key}->{collectioncode} = |
1968 |
$onloan_items->{$key}->{collectioncode} = |
| 1923 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
1969 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
|
|
1970 |
$onloan_items->{$key}->{displays} = $item->{displays}; |
| 1924 |
|
1971 |
|
| 1925 |
# if something's checked out and lost, mark it as 'long overdue' |
1972 |
# if something's checked out and lost, mark it as 'long overdue' |
| 1926 |
if ( $item->{itemlost} ) { |
1973 |
if ( $item->{itemlost} ) { |
|
Lines 2030-2036
sub searchResults {
Link Here
|
| 2030 |
GetAuthorisedValueDesc( '', '', $item->{notforloan}, '', '', $notforloan_authorised_value ) |
2077 |
GetAuthorisedValueDesc( '', '', $item->{notforloan}, '', '', $notforloan_authorised_value ) |
| 2031 |
if $notforloan_authorised_value and $item->{notforloan}; |
2078 |
if $notforloan_authorised_value and $item->{notforloan}; |
| 2032 |
$other_items->{$key}->{count}++ if $item->{$hbranch}; |
2079 |
$other_items->{$key}->{count}++ if $item->{$hbranch}; |
| 2033 |
$other_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
2080 |
$other_items->{$key}->{location} = $get_effective_location_display->($item) if $item->{location}; |
| 2034 |
$other_items->{$key}->{description} = $item->{description}; |
2081 |
$other_items->{$key}->{description} = $item->{description}; |
| 2035 |
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( |
2082 |
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( |
| 2036 |
$search_context->{'interface'}, |
2083 |
$search_context->{'interface'}, |
|
Lines 2038-2043
sub searchResults {
Link Here
|
| 2038 |
); |
2085 |
); |
| 2039 |
$other_items->{$key}->{collectioncode} = |
2086 |
$other_items->{$key}->{collectioncode} = |
| 2040 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
2087 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
|
|
2088 |
$other_items->{$key}->{displays} = $item->{displays}; |
| 2041 |
} |
2089 |
} |
| 2042 |
|
2090 |
|
| 2043 |
# item is available |
2091 |
# item is available |
|
Lines 2051-2057
sub searchResults {
Link Here
|
| 2051 |
} |
2099 |
} |
| 2052 |
$available_items->{$prefix}->{branchavailablecount} = $branch_available_count; |
2100 |
$available_items->{$prefix}->{branchavailablecount} = $branch_available_count; |
| 2053 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
2101 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
| 2054 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } |
2102 |
$available_items->{$prefix}->{location} = $get_effective_location_display->($item) |
| 2055 |
if $item->{location}; |
2103 |
if $item->{location}; |
| 2056 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( |
2104 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( |
| 2057 |
$search_context->{'interface'}, |
2105 |
$search_context->{'interface'}, |
|
Lines 2059-2064
sub searchResults {
Link Here
|
| 2059 |
); |
2107 |
); |
| 2060 |
$available_items->{$prefix}->{collectioncode} = |
2108 |
$available_items->{$prefix}->{collectioncode} = |
| 2061 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
2109 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
|
|
2110 |
$available_items->{$prefix}->{displays} = $item->{displays}; |
| 2062 |
} |
2111 |
} |
| 2063 |
} |
2112 |
} |
| 2064 |
} # notforloan, item level and biblioitem level |
2113 |
} # notforloan, item level and biblioitem level |
| 2065 |
- |
|
|