Bugzilla – Attachment 167322 Details for
Bug 37004
Staff search results: Add a HTML class ( branchcode ) to each item entry in the results list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37004: Add branchcode as HTML class to each grouped result in search results
Bug-37004-Add-branchcode-as-HTML-class-to-each-gro.patch (text/plain), 5.79 KB, created by
David Nind
on 2024-06-01 20:59:49 UTC
(
hide
)
Description:
Bug 37004: Add branchcode as HTML class to each grouped result in search results
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-06-01 20:59:49 UTC
Size:
5.79 KB
patch
obsolete
>From 9338af2f6bba08995765c29312d60c84a147ddb4 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 31 May 2024 21:12:04 +0000 >Subject: [PATCH] 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> >--- > C4/Search.pm | 6 +++++- > .../intranet-tmpl/prog/en/modules/catalogue/results.tt | 4 ++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index ea70377373..ca8e79ab0f 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -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'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index 91db336895..19e987ff7c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -631,10 +631,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 %] >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37004
:
167317
| 167322