Bug 37004: Add branchcode as HTML class to each grouped result in search results
To test: 1. Apply patch and restart_all 2. Do a catalog search that returns results. 3. Using the browsers dev tools inscpet the page and look for the 'available_items_loop_items' class in the 'Location column'. 4. Each child <li> element should have a class that is the branchcode. 5. Make sure that branchcode is correct. 6. Change the StaffSearchResultsDisplayBranch system preference. Make sure that each branchcode is still correct. 7. Change the system preference 'noItemTypeImages' to 'Dont show'. 8. Make sure the branchcode is still correct. 9. Checkout an item that would show up in these search results. 10. Do steps 3-8 again excpet this time look for the HTML element 'onloan_items_loop_items'. 11. Put some items in transfer that would show up in these search resultss. 12. Do steps 3-8 again excpet this time look for the HTML element 'other_items_loop_items'. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
ca51e5d642
commit
084ed6e322
2 changed files with 7 additions and 3 deletions
|
@ -1842,13 +1842,14 @@ sub searchResults {
|
|||
|
||||
my $hbranch = C4::Context->preference('StaffSearchResultsDisplayBranch');
|
||||
my $otherbranch = $hbranch eq 'homebranch' ? 'holdingbranch' : 'homebranch';
|
||||
|
||||
# set item's branch name, use HomeOrHoldingBranch syspref first, fall back to the other one
|
||||
if ($item->{$hbranch}) {
|
||||
$item->{'branchname'} = $branches{$item->{$hbranch}};
|
||||
$item->{'branchcode'} = $item->{$hbranch};
|
||||
}
|
||||
elsif ($item->{$otherbranch}) { # Last resort
|
||||
$item->{'branchname'} = $branches{$item->{$otherbranch}};
|
||||
$item->{'branchcode'} = $item->{$otherbranch};
|
||||
}
|
||||
|
||||
my $prefix =
|
||||
|
@ -1867,6 +1868,7 @@ sub searchResults {
|
|||
$onloan_items->{$key}->{due_date} = $item->{onloan};
|
||||
$onloan_items->{$key}->{count}++ if $item->{$hbranch};
|
||||
$onloan_items->{$key}->{branchname} = $item->{branchname};
|
||||
$onloan_items->{$key}->{branchcode} = $item->{branchcode};
|
||||
$onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} } if $item->{location};
|
||||
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber};
|
||||
$onloan_items->{$key}->{description} = $item->{description};
|
||||
|
@ -1964,6 +1966,7 @@ sub searchResults {
|
|||
foreach (qw(withdrawn itemlost damaged branchname itemcallnumber)) {
|
||||
$other_items->{$key}->{$_} = $item->{$_};
|
||||
}
|
||||
$other_items->{$key}->{branchcode} = $item->{branchcode};
|
||||
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0;
|
||||
$other_items->{$key}->{recalled} = ($recallstatus) ? 1 : 0;
|
||||
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0;
|
||||
|
@ -1981,6 +1984,7 @@ sub searchResults {
|
|||
foreach (qw(branchname itemcallnumber description)) {
|
||||
$available_items->{$prefix}->{$_} = $item->{$_};
|
||||
}
|
||||
$available_items->{$prefix}->{branchcode} = $item->{branchcode};
|
||||
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} } if $item->{location};
|
||||
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype}//q{} }->{imageurl} );
|
||||
$available_items->{$prefix}->{collectioncode} = GetAuthorisedValueDesc('','',$item->{ccode},'','','CCODE');
|
||||
|
|
|
@ -632,10 +632,10 @@
|
|||
<ul class="[% items_loop | html %]_items">
|
||||
[% FOREACH items_loo IN SEARCH_RESULT.${items_loop} %]
|
||||
[% IF item_level_itypes && !noItemTypeImages && items_loo.imageurl %]
|
||||
<li class="result_itype_image">
|
||||
<li class="result_itype_image [% items_loo.branchcode | html %]">
|
||||
<img src="[% items_loo.imageurl | html %]" title="[% items_loo.description | html %]" alt="[% items_loo.description | html %]" />
|
||||
[% ELSE %]
|
||||
<li>
|
||||
<li class="[% items_loo.branchcode | html %]">
|
||||
[% END %]
|
||||
[% IF ( items_loo.branchname ) %]
|
||||
[% items_loo.branchname | html %]
|
||||
|
|
Loading…
Reference in a new issue