Bugzilla – Attachment 162717 Details for
Bug 35484
OPACShelfBrowser secondary sort should be biblio.title not item.itemnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35484: Make secondary sort use biblio.title
Bug-35484-Make-secondary-sort-use-bibliotitle.patch (text/plain), 3.04 KB, created by
Lucas Gass
on 2024-03-04 16:02:21 UTC
(
hide
)
Description:
Bug 35484: Make secondary sort use biblio.title
Filename:
MIME Type:
Creator:
Lucas Gass
Created:
2024-03-04 16:02:21 UTC
Size:
3.04 KB
patch
obsolete
>From 943dd9c1358e4b585b472cc82da7db55c88a9d3c Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Mon, 4 Mar 2024 16:01:00 +0000 >Subject: [PATCH] Bug 35484: Make secondary sort use biblio.title > >To test: >1. In k-t-d, set all item itemcallnumbers to the same thing, ie: 'abcdefg'; >2. Touch all items to update the cn_sort values >3. Turn on OPACShelfBrowser and view a record detail page on the OPAC. >4. Browse the shelf and see that all items are organized by itemnumber. >5. APPLY PATCH and restart_services >6. Try again, now the secondary sort should be using biblio.title, not itemnumber. >--- > C4/ShelfBrowser.pm | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > >diff --git a/C4/ShelfBrowser.pm b/C4/ShelfBrowser.pm >index 5c9159d002..6f7ce17be0 100644 >--- a/C4/ShelfBrowser.pm >+++ b/C4/ShelfBrowser.pm >@@ -139,41 +139,45 @@ sub GetNearbyItems { > > # Build the query for previous and next items > my $prev_query =' >- SELECT itemnumber, biblionumber, cn_sort, itemcallnumber >+ SELECT items.itemnumber, items.biblionumber, items.cn_sort, items.itemcallnumber > FROM items >+ LEFT JOIN biblio >+ ON ( items.biblionumber = biblio.biblionumber ) > WHERE >- ((cn_sort = ? AND itemnumber < ?) OR cn_sort < ?) '; >+ ((items.cn_sort = ? AND items.itemnumber < ?) OR items.cn_sort < ?) '; > my $next_query =' >- SELECT itemnumber, biblionumber, cn_sort, itemcallnumber >+ SELECT items.itemnumber, items.biblionumber, items.cn_sort, items.itemcallnumber > FROM items >+ LEFT JOIN biblio >+ ON ( items.biblionumber = biblio.biblionumber ) > WHERE >- ((cn_sort = ? AND itemnumber >= ?) OR cn_sort > ?) '; >+ ((items.cn_sort = ? AND items.itemnumber >= ?) OR items.cn_sort > ?) '; > my @params; > my $query_cond; > push @params, ($start_cn_sort, $itemnumber, $start_cn_sort); > if ($start_homebranch) { >- $query_cond .= 'AND homebranch = ? '; >+ $query_cond .= 'AND items.homebranch = ? '; > push @params, $start_homebranch->{code}; > } > if ($start_location) { >- $query_cond .= 'AND location = ? '; >+ $query_cond .= 'AND items.location = ? '; > push @params, $start_location->{code}; > } > if ($start_ccode) { >- $query_cond .= 'AND ccode = ? '; >+ $query_cond .= 'AND items.ccode = ? '; > push @params, $start_ccode->{code}; > } > > my @prev_items = @{ > $dbh->selectall_arrayref( >- $prev_query . $query_cond . ' ORDER BY cn_sort DESC, itemnumber DESC LIMIT ?', >+ $prev_query . $query_cond . ' ORDER BY items.cn_sort DESC, biblio.title DESC LIMIT ?', > { Slice => {} }, > ( @params, $gap ) > ) > }; > my @next_items = @{ > $dbh->selectall_arrayref( >- $next_query . $query_cond . ' ORDER BY cn_sort, itemnumber LIMIT ?', >+ $next_query . $query_cond . ' ORDER BY items.cn_sort, itemnumber LIMIT ?', > { Slice => {} }, > ( @params, $gap + 1 ) > ) >-- >2.30.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 35484
: 162717