|
Lines 284-290
sub SimpleSearch {
Link Here
|
| 284 |
( undef, $results_hashref, \@facets_loop ) = getRecords ( |
284 |
( undef, $results_hashref, \@facets_loop ) = getRecords ( |
| 285 |
|
285 |
|
| 286 |
$koha_query, $simple_query, $sort_by_ref, $servers_ref, |
286 |
$koha_query, $simple_query, $sort_by_ref, $servers_ref, |
| 287 |
$results_per_page, $offset, $branches, $itemtypes, |
287 |
$results_per_page, $offset, $branches, |
| 288 |
$query_type, $scan, $opac |
288 |
$query_type, $scan, $opac |
| 289 |
); |
289 |
); |
| 290 |
|
290 |
|
|
Lines 298-304
See verbose embedded documentation.
Link Here
|
| 298 |
sub getRecords { |
298 |
sub getRecords { |
| 299 |
my ( |
299 |
my ( |
| 300 |
$koha_query, $simple_query, $sort_by_ref, $servers_ref, |
300 |
$koha_query, $simple_query, $sort_by_ref, $servers_ref, |
| 301 |
$results_per_page, $offset, $branches, $itemtypes, |
301 |
$results_per_page, $offset, $branches, |
| 302 |
$query_type, $scan, $opac |
302 |
$query_type, $scan, $opac |
| 303 |
) = @_; |
303 |
) = @_; |
| 304 |
|
304 |
|
|
Lines 411-416
sub getRecords {
Link Here
|
| 411 |
} |
411 |
} |
| 412 |
} # finished looping through servers |
412 |
} # finished looping through servers |
| 413 |
|
413 |
|
|
|
414 |
my $itemtypes = Koha::ItemTypes->get_from_cache; |
| 415 |
my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes }; |
| 416 |
|
| 414 |
# The big moment: asynchronously retrieve results from all servers |
417 |
# The big moment: asynchronously retrieve results from all servers |
| 415 |
_ZOOM_event_loop( |
418 |
_ZOOM_event_loop( |
| 416 |
\@zconns, |
419 |
\@zconns, |
|
Lines 533-545
sub getRecords {
Link Here
|
| 533 |
|
536 |
|
| 534 |
# if it's a itemtype, label by the name, not the code, |
537 |
# if it's a itemtype, label by the name, not the code, |
| 535 |
if ( $link_value =~ /itype/ ) { |
538 |
if ( $link_value =~ /itype/ ) { |
| 536 |
if ( defined $itemtypes |
539 |
if ( exists $itemtypes->{$one_facet} ) { |
| 537 |
&& ref($itemtypes) eq "HASH" |
540 |
$facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{translation_key}); |
| 538 |
&& defined $itemtypes->{$one_facet} |
|
|
| 539 |
&& ref( $itemtypes->{$one_facet} ) eq |
| 540 |
"HASH" ) |
| 541 |
{ |
| 542 |
$facet_label_value = db_t('itemtype', $itemtypes->{$one_facet}->{itemtype}); |
| 543 |
} |
541 |
} |
| 544 |
} |
542 |
} |
| 545 |
|
543 |
|
|
Lines 1669-1676
sub searchResults {
Link Here
|
| 1669 |
my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef; |
1667 |
my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef; |
| 1670 |
|
1668 |
|
| 1671 |
#Get itemtype hash |
1669 |
#Get itemtype hash |
| 1672 |
my $itemtypes = Koha::ItemTypes->search; |
1670 |
my $itemtypes = Koha::ItemTypes->get_from_cache; |
| 1673 |
my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed }; |
1671 |
my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes }; |
| 1674 |
|
1672 |
|
| 1675 |
#search item field code |
1673 |
#search item field code |
| 1676 |
my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber" ); |
1674 |
my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber" ); |
|
Lines 1748-1757
sub searchResults {
Link Here
|
| 1748 |
$oldbiblio->{edition} = $oldbiblio->{editionstatement}; |
1746 |
$oldbiblio->{edition} = $oldbiblio->{editionstatement}; |
| 1749 |
|
1747 |
|
| 1750 |
my $itemtype = $oldbiblio->{itemtype} ? $itemtypes{$oldbiblio->{itemtype}} : undef; |
1748 |
my $itemtype = $oldbiblio->{itemtype} ? $itemtypes{$oldbiblio->{itemtype}} : undef; |
| 1751 |
# add imageurl to itemtype if there is one |
1749 |
|
| 1752 |
$oldbiblio->{imageurl} = $itemtype ? getitemtypeimagelocation( $search_context->{'interface'}, $itemtype->{imageurl} ) : q{}; |
1750 |
$oldbiblio->{itemtype} = $itemtype; |
| 1753 |
# Build summary if there is one (the summary is defined in the itemtypes table) |
|
|
| 1754 |
$oldbiblio->{description} = $itemtype ? db_t('itemtype', $itemtype->{itemtype}) : q{}; |
| 1755 |
|
1751 |
|
| 1756 |
# Pull out the items fields |
1752 |
# Pull out the items fields |
| 1757 |
my @fields = $marcrecord->field($itemtag); |
1753 |
my @fields = $marcrecord->field($itemtag); |
|
Lines 1823-1829
sub searchResults {
Link Here
|
| 1823 |
next; |
1819 |
next; |
| 1824 |
} |
1820 |
} |
| 1825 |
|
1821 |
|
| 1826 |
$item->{description} = db_t('itemtype', $itemtypes{ $item->{itype} }{itemtype}) if $item->{itype}; |
1822 |
$item->{itemtype} = $itemtypes{ $item->{itype} } if $item->{itype}; |
| 1827 |
|
1823 |
|
| 1828 |
# OPAC hidden items |
1824 |
# OPAC hidden items |
| 1829 |
if ($is_opac) { |
1825 |
if ($is_opac) { |
|
Lines 1865-1873
sub searchResults {
Link Here
|
| 1865 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
1861 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
| 1866 |
$onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
1862 |
$onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
| 1867 |
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; |
1863 |
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; |
| 1868 |
$onloan_items->{$key}->{description} = $item->{description}; |
1864 |
$onloan_items->{$key}->{itemtype} = $itemtypes{ $item->{itype} }; |
| 1869 |
$onloan_items->{$key}->{imageurl} = |
|
|
| 1870 |
getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype} }->{imageurl} ); |
| 1871 |
|
1865 |
|
| 1872 |
# if something's checked out and lost, mark it as 'long overdue' |
1866 |
# if something's checked out and lost, mark it as 'long overdue' |
| 1873 |
if ( $item->{itemlost} ) { |
1867 |
if ( $item->{itemlost} ) { |
|
Lines 1965-1972
sub searchResults {
Link Here
|
| 1965 |
$other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value and $item->{notforloan}; |
1959 |
$other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value and $item->{notforloan}; |
| 1966 |
$other_items->{$key}->{count}++ if $item->{$hbranch}; |
1960 |
$other_items->{$key}->{count}++ if $item->{$hbranch}; |
| 1967 |
$other_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
1961 |
$other_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
| 1968 |
$other_items->{$key}->{description} = $item->{description}; |
1962 |
$other_items->{$key}->{itemtype} = $itemtypes{ $item->{itype} }; |
| 1969 |
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype}//q{} }->{imageurl} ); |
|
|
| 1970 |
} |
1963 |
} |
| 1971 |
# item is available |
1964 |
# item is available |
| 1972 |
else { |
1965 |
else { |
|
Lines 1976-1982
sub searchResults {
Link Here
|
| 1976 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
1969 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
| 1977 |
} |
1970 |
} |
| 1978 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
1971 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } if $item->{location}; |
| 1979 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype}//q{} }->{imageurl} ); |
1972 |
$available_items->{$prefix}->{itemtype} = $itemtypes{ $item->{itype} }; |
| 1980 |
} |
1973 |
} |
| 1981 |
} |
1974 |
} |
| 1982 |
} # notforloan, item level and biblioitem level |
1975 |
} # notforloan, item level and biblioitem level |