Lines 2034-2040
sub searchResults {
Link Here
|
2034 |
my $items_count = scalar(@fields); |
2034 |
my $items_count = scalar(@fields); |
2035 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
2035 |
my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); |
2036 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
2036 |
my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; |
2037 |
my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref |
|
|
2038 |
|
2037 |
|
2039 |
# loop through every item |
2038 |
# loop through every item |
2040 |
foreach my $field (@fields) { |
2039 |
foreach my $field (@fields) { |
Lines 2056-2062
sub searchResults {
Link Here
|
2056 |
# hidden based on OpacHiddenItems syspref |
2055 |
# hidden based on OpacHiddenItems syspref |
2057 |
my @hi = C4::Items::GetHiddenItemnumbers($item); |
2056 |
my @hi = C4::Items::GetHiddenItemnumbers($item); |
2058 |
if (scalar @hi) { |
2057 |
if (scalar @hi) { |
2059 |
push @hiddenitems, @hi; |
|
|
2060 |
$hideatopac_count++; |
2058 |
$hideatopac_count++; |
2061 |
next; |
2059 |
next; |
2062 |
} |
2060 |
} |
Lines 2073-2079
sub searchResults {
Link Here
|
2073 |
$item->{'branchname'} = $branches{$item->{$otherbranch}}; |
2071 |
$item->{'branchname'} = $branches{$item->{$otherbranch}}; |
2074 |
} |
2072 |
} |
2075 |
|
2073 |
|
2076 |
my $prefix = $item->{$hbranch} . '--' . $item->{location} . $item->{itype} . $item->{itemcallnumber}; |
2074 |
my $prefix = $item->{$hbranch} . '--' . $item->{location} . $item->{itype} . $item->{itemcallnumber}; |
2077 |
# For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item |
2075 |
# For each grouping of items (onloan, available, unavailable), we build a key to store relevant info about that item |
2078 |
my $userenv = C4::Context->userenv; |
2076 |
my $userenv = C4::Context->userenv; |
2079 |
if ( $item->{onloan} |
2077 |
if ( $item->{onloan} |
Lines 2081-2092
sub searchResults {
Link Here
|
2081 |
{ |
2079 |
{ |
2082 |
$onloan_count++; |
2080 |
$onloan_count++; |
2083 |
my $key = $prefix . $item->{onloan} . $item->{barcode}; |
2081 |
my $key = $prefix . $item->{onloan} . $item->{barcode}; |
|
|
2082 |
$onloan_items->{$key} = { %$item }; |
2084 |
$onloan_items->{$key}->{due_date} = output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } ); |
2083 |
$onloan_items->{$key}->{due_date} = output_pref( { dt => dt_from_string( $item->{onloan} ), dateonly => 1 } ); |
2085 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
2084 |
$onloan_items->{$key}->{count}++ if $item->{$hbranch}; |
2086 |
$onloan_items->{$key}->{branchname} = $item->{branchname}; |
|
|
2087 |
$onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} }; |
2085 |
$onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} }; |
2088 |
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber}; |
|
|
2089 |
$onloan_items->{$key}->{description} = $item->{description}; |
2090 |
$onloan_items->{$key}->{imageurl} = |
2086 |
$onloan_items->{$key}->{imageurl} = |
2091 |
getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); |
2087 |
getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); |
2092 |
|
2088 |
|
Lines 2172-2196
sub searchResults {
Link Here
|
2172 |
$other_count++; |
2168 |
$other_count++; |
2173 |
|
2169 |
|
2174 |
my $key = $prefix . $item->{status}; |
2170 |
my $key = $prefix . $item->{status}; |
2175 |
foreach (qw(withdrawn itemlost damaged branchname itemcallnumber)) { |
2171 |
$other_items->{$key} = { %$item }; |
2176 |
$other_items->{$key}->{$_} = $item->{$_}; |
|
|
2177 |
} |
2178 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
2172 |
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; |
2179 |
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; |
2173 |
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0; |
2180 |
$other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value and $item->{notforloan}; |
2174 |
$other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value and $item->{notforloan}; |
2181 |
$other_items->{$key}->{count}++ if $item->{$hbranch}; |
2175 |
$other_items->{$key}->{count}++ if $item->{$hbranch}; |
2182 |
$other_items->{$key}->{location} = $shelflocations->{ $item->{location} }; |
2176 |
$other_items->{$key}->{location} = $shelflocations->{ $item->{location} }; |
2183 |
$other_items->{$key}->{description} = $item->{description}; |
|
|
2184 |
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); |
2177 |
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); |
2185 |
} |
2178 |
} |
2186 |
# item is available |
2179 |
# item is available |
2187 |
else { |
2180 |
else { |
2188 |
$can_place_holds = 1; |
2181 |
$can_place_holds = 1; |
2189 |
$available_count++; |
2182 |
$available_count++; |
|
|
2183 |
$available_items->{$prefix} = { %$item }; |
2190 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
2184 |
$available_items->{$prefix}->{count}++ if $item->{$hbranch}; |
2191 |
foreach (qw(branchname itemcallnumber description)) { |
|
|
2192 |
$available_items->{$prefix}->{$_} = $item->{$_}; |
2193 |
} |
2194 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; |
2185 |
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; |
2195 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); |
2186 |
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $item->{itype} }->{imageurl} ); |
2196 |
} |
2187 |
} |
Lines 2219-2225
sub searchResults {
Link Here
|
2219 |
# XSLT processing of some stuff |
2210 |
# XSLT processing of some stuff |
2220 |
# we fetched the sysprefs already before the loop through all retrieved record! |
2211 |
# we fetched the sysprefs already before the loop through all retrieved record! |
2221 |
if (!$scan && $xslfile) { |
2212 |
if (!$scan && $xslfile) { |
2222 |
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, 1, \@hiddenitems, $sysxml, $xslfile, $lang); |
2213 |
$oldbiblio->{XSLTResultsRecord} = XSLTParse4Display($oldbiblio->{biblionumber}, $marcrecord, $xslsyspref, [@available_items_loop, @onloan_items_loop, @other_items_loop], 1, $sysxml, $xslfile, $lang); |
2223 |
# the last parameter tells Koha to clean up the problematic ampersand entities that Zebra outputs |
2214 |
# the last parameter tells Koha to clean up the problematic ampersand entities that Zebra outputs |
2224 |
} |
2215 |
} |
2225 |
|
2216 |
|