Bugzilla – Attachment 20964 Details for
Bug 10856
Improve the previous and next items on the shelf browser
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
MT11899: Improve the previous and next items on the shelf browser
MT11899-Improve-the-previous-and-next-items-on-the.patch (text/plain), 2.30 KB, created by
Jonathan Druart
on 2013-09-10 14:45:30 UTC
(
hide
)
Description:
MT11899: Improve the previous and next items on the shelf browser
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-09-10 14:45:30 UTC
Size:
2.30 KB
patch
obsolete
>From 5233ed07e4b6ca8698277a8915f520b800498b00 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 14 May 2013 15:11:11 +0200 >Subject: [PATCH] MT11899: Improve the previous and next items on the shelf > browser > >The next and previous links should be a link to the next and previous >items in the list. > >Before this patch, the previous was the first on the list and the next >was the last. > >For example: >[<] [1] [2] [3] [4] [5] [6] [>] >Before this patch, the next and previous links were the same as the 1 >and 6. >Now, the next and previous links are the same as ... 0 and 7. > >Test plan: >- On a detail biblio page, click on a "Browse shelf" link. >- Play with the next and previous links. > >http://bugs.koha-community.org/show_bug.cgi?id=10856 >--- > C4/ShelfBrowser.pm | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > >diff --git a/C4/ShelfBrowser.pm b/C4/ShelfBrowser.pm >index c885d90..067e8af 100644 >--- a/C4/ShelfBrowser.pm >+++ b/C4/ShelfBrowser.pm >@@ -172,7 +172,7 @@ sub GetNearbyItems { > > my $sth_prev_items = $dbh->prepare($prev_query . $query_cond . ' ORDER BY cn_sort DESC, itemnumber LIMIT ?'); > my $sth_next_items = $dbh->prepare($next_query . $query_cond . ' ORDER BY cn_sort, itemnumber LIMIT ?'); >- push @params, $num_each_side; >+ push @params, $num_each_side + 1; > $sth_prev_items->execute(@params); > $sth_next_items->execute(@params); > >@@ -185,11 +185,17 @@ sub GetNearbyItems { > $prev_itemnumber, $prev_biblionumber > ); > >- $next_itemnumber = $next_items[-1]->{itemnumber} if @next_items; >- $next_biblionumber = $next_items[-1]->{biblionumber} if @next_items; >+ if ( @next_items and $#next_items > $num_each_side - 1 ) { >+ my $next_item = pop @next_items; >+ $next_itemnumber = $next_item->{itemnumber}; >+ $next_biblionumber = $next_item->{biblionumber}; >+ } > >- $prev_itemnumber = $prev_items[0]->{itemnumber} if @prev_items; >- $prev_biblionumber = $prev_items[0]->{biblionumber} if @prev_items; >+ if ( @prev_items and $#prev_items > $num_each_side - 1 ) { >+ my $prev_item = shift @prev_items; >+ $prev_itemnumber = $prev_item->{itemnumber}; >+ $prev_biblionumber = $prev_item->{biblionumber}; >+ } > > my %result = ( > next => \@next_items, >-- >1.7.10.4
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 10856
:
20964
|
20965
|
21002
|
21071
|
21136
|
21137
|
21138
|
21211
|
21319
|
21320
|
21321
|
21508
|
21666
|
21670
|
21671
|
21672
|
21673