|
Lines 541-560
sub getRecords {
Link Here
|
| 541 |
|
541 |
|
| 542 |
# also, if it's a location code, use the name instead of the code |
542 |
# also, if it's a location code, use the name instead of the code |
| 543 |
if ( $link_value =~ /location/ ) { |
543 |
if ( $link_value =~ /location/ ) { |
| 544 |
|
544 |
$facet_label_value = Koha::AuthorisedValues->search( |
| 545 |
# TODO Retrieve all authorised values at once, instead of 1 query per entry |
545 |
{ kohafield => 'items.location', authorised_value => $one_facet } ); |
| 546 |
my $av = |
|
|
| 547 |
Koha::AuthorisedValues->search( { category => 'LOC', authorised_value => $one_facet } ); |
| 548 |
$facet_label_value = $av->count ? $av->next->opac_description : ''; |
| 549 |
} |
546 |
} |
| 550 |
|
547 |
|
| 551 |
# also, if it's a collection code, use the name instead of the code |
548 |
# also, if it's a collection code, use the name instead of the code |
| 552 |
if ( $link_value =~ /ccode/ ) { |
549 |
if ( $link_value =~ /ccode/ ) { |
| 553 |
|
550 |
$facet_label_value = Koha::AuthorisedValues->search( |
| 554 |
# TODO Retrieve all authorised values at once, instead of 1 query per entry |
551 |
{ kohafield => 'items.ccode', authorised_value => $one_facet } ); |
| 555 |
my $av = Koha::AuthorisedValues->search( |
|
|
| 556 |
{ category => 'CCODE', authorised_value => $one_facet } ); |
| 557 |
$facet_label_value = $av->count ? $av->next->opac_description : ''; |
| 558 |
} |
552 |
} |
| 559 |
|
553 |
|
| 560 |
# but we're down with the whole label being in the link's title. |
554 |
# but we're down with the whole label being in the link's title. |
|
Lines 1678-1701
sub searchResults {
Link Here
|
| 1678 |
my %branches = |
1672 |
my %branches = |
| 1679 |
map { $_->branchcode => $_->branchname } Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list; |
1673 |
map { $_->branchcode => $_->branchname } Koha::Libraries->search( {}, { order_by => 'branchname' } )->as_list; |
| 1680 |
|
1674 |
|
| 1681 |
# FIXME - We build an authorised values hash here, using the default framework |
|
|
| 1682 |
# though it is possible to have different authvals for different fws. |
| 1683 |
|
| 1684 |
my $shelflocations = { |
| 1685 |
map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( |
| 1686 |
{ frameworkcode => '', kohafield => 'items.location' } |
| 1687 |
) |
| 1688 |
}; |
| 1689 |
|
| 1690 |
# get notforloan authorised value list (see $shelflocations FIXME) |
| 1691 |
my $av = Koha::MarcSubfieldStructures->search( |
| 1692 |
{ |
| 1693 |
frameworkcode => '', kohafield => 'items.notforloan', |
| 1694 |
authorised_value => [ -and => { '!=' => undef }, { '!=' => '' } ] |
| 1695 |
} |
| 1696 |
); |
| 1697 |
my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef; |
| 1698 |
|
| 1699 |
#Get itemtype hash |
1675 |
#Get itemtype hash |
| 1700 |
my $itemtypes = Koha::ItemTypes->search_with_localization; |
1676 |
my $itemtypes = Koha::ItemTypes->search_with_localization; |
| 1701 |
my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed }; |
1677 |
my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed }; |
|
Lines 1912-1926
sub searchResults {
Link Here
|
| 1912 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
1888 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
| 1913 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
1889 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
| 1914 |
$onloan_items->{$key}->{branchcode} = $item->{branchcode}; |
1890 |
$onloan_items->{$key}->{branchcode} = $item->{branchcode}; |
| 1915 |
$onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
|
|
| 1916 |
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; |
1891 |
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; |
| 1917 |
$onloan_items->{$key}->{description} = $item->{description}; |
1892 |
$onloan_items->{$key}->{description} = $item->{description}; |
| 1918 |
$onloan_items->{$key}->{imageurl} = getitemtypeimagelocation( |
1893 |
$onloan_items->{$key}->{imageurl} = getitemtypeimagelocation( |
| 1919 |
$search_context->{'interface'}, |
1894 |
$search_context->{'interface'}, |
| 1920 |
$itemtypes{ $item->{itype} }->{imageurl} |
1895 |
$itemtypes{ $item->{itype} }->{imageurl} |
| 1921 |
); |
1896 |
); |
| 1922 |
$onloan_items->{$key}->{collectioncode} = |
1897 |
$onloan_items->{$key}->{collectioncode} = $item->{ccode}; |
| 1923 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
|
|
| 1924 |
|
1898 |
|
| 1925 |
# if something's checked out and lost, mark it as 'long overdue' |
1899 |
# if something's checked out and lost, mark it as 'long overdue' |
| 1926 |
if ( $item->{itemlost} ) { |
1900 |
if ( $item->{itemlost} ) { |
|
Lines 2026-2043
sub searchResults {
Link Here
|
| 2026 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
2000 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
| 2027 |
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0; |
2001 |
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0; |
| 2028 |
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; |
2002 |
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; |
| 2029 |
$other_items->{$key}->{notforloan} = |
|
|
| 2030 |
GetAuthorisedValueDesc( '', '', $item->{notforloan}, '', '', $notforloan_authorised_value ) |
| 2031 |
if $notforloan_authorised_value and $item->{notforloan}; |
| 2032 |
$other_items->{$key}->{count}++ if $item->{$hbranch}; |
2003 |
$other_items->{$key}->{count}++ if $item->{$hbranch}; |
| 2033 |
$other_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
|
|
| 2034 |
$other_items->{$key}->{description} = $item->{description}; |
2004 |
$other_items->{$key}->{description} = $item->{description}; |
| 2035 |
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( |
2005 |
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( |
| 2036 |
$search_context->{'interface'}, |
2006 |
$search_context->{'interface'}, |
| 2037 |
$itemtypes{ $item->{itype} // q{} }->{imageurl} |
2007 |
$itemtypes{ $item->{itype} // q{} }->{imageurl} |
| 2038 |
); |
2008 |
); |
| 2039 |
$other_items->{$key}->{collectioncode} = |
2009 |
$other_items->{$key}->{collectioncode} = $item->{ccode}; |
| 2040 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
|
|
| 2041 |
} |
2010 |
} |
| 2042 |
|
2011 |
|
| 2043 |
# item is available |
2012 |
# item is available |
|
Lines 2051-2064
sub searchResults {
Link Here
|
| 2051 |
} |
2020 |
} |
| 2052 |
$available_items->{$prefix}->{branchavailablecount} = $branch_available_count; |
2021 |
$available_items->{$prefix}->{branchavailablecount} = $branch_available_count; |
| 2053 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
2022 |
$available_items->{$prefix}->{branchcode} = $item->{branchcode}; |
| 2054 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } |
2023 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( |
| 2055 |
if $item->{location}; |
|
|
| 2056 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( |
| 2057 |
$search_context->{'interface'}, |
2024 |
$search_context->{'interface'}, |
| 2058 |
$itemtypes{ $item->{itype} // q{} }->{imageurl} |
2025 |
$itemtypes{ $item->{itype} // q{} }->{imageurl} |
| 2059 |
); |
2026 |
); |
| 2060 |
$available_items->{$prefix}->{collectioncode} = |
2027 |
$available_items->{$prefix}->{collectioncode} = $item->{ccode}; |
| 2061 |
GetAuthorisedValueDesc( '', '', $item->{ccode}, '', '', 'CCODE' ); |
|
|
| 2062 |
} |
2028 |
} |
| 2063 |
} |
2029 |
} |
| 2064 |
} # notforloan, item level and biblioitem level |
2030 |
} # notforloan, item level and biblioitem level |