Bugzilla – Attachment 167003 Details for
Bug 36858
Crash on wrong page number in opac-shelves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36858: Check page parameter for virtual shelves
Bug-36858-Check-page-parameter-for-virtual-shelves.patch (text/plain), 3.61 KB, created by
Jonathan Druart
on 2024-05-22 07:29:25 UTC
(
hide
)
Description:
Bug 36858: Check page parameter for virtual shelves
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-05-22 07:29:25 UTC
Size:
3.61 KB
patch
obsolete
>From 07c2031c4df09d461acd9471932a3864e051b43d Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 21 May 2024 14:20:18 +0000 >Subject: [PATCH] Bug 36858: Check page parameter for virtual shelves > >Test plan: >Try passing page=x now and verify different behavior (no 500). > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > opac/opac-shelves.pl | 10 +++++----- > virtualshelves/shelves.pl | 10 +++++----- > 2 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 85bfb38c6ba..2b0d245adc6 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -86,8 +86,9 @@ if (C4::Context->preference("BakerTaylorEnabled")) { > ); > } > >-my $referer = $query->param('referer') || $op; >-my $public = 0; >+my $referer = $query->param('referer') || $op; >+my $page = int( $query->param('page') // q{} ) || 1; >+my $public = 0; > $public = 1 if $query->param('public') && $query->param('public') == 1; > > my ( $shelf, $shelfnumber, @messages ); >@@ -315,10 +316,9 @@ if ( $op eq 'view' ) { > $direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' ); > $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); > >- my ( $page, $rows ); >+ my $rows; > unless ( $query->param('print') or $query->param('rss') ) { > $rows = C4::Context->preference('OPACnumSearchResults') || 20; >- $page = ( $query->param('page') ? $query->param('page') : 1 ); > } > my $order_by = $sortfield eq 'itemcallnumber' ? 'items.cn_sort' : $sortfield; > my $contents = $shelf->get_contents->search( >@@ -473,7 +473,7 @@ if ( $op eq 'view' ) { > } > } elsif ( $op eq 'list' ) { > my $shelves; >- my ( $page, $rows ) = ( $query->param('page') || 1, 20 ); >+ my ( $rows ) = ( 20 ); > if ( !$public ) { > $shelves = Koha::Virtualshelves->get_private_shelves({ page => $page, rows => $rows, borrowernumber => $loggedinuser, }); > } else { >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index ecf08fa9c7e..61a416632d1 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -54,9 +54,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >-my $op = $query->param('op') || 'list'; >-my $referer = $query->param('referer') || $op; >-my $public = $query->param('public') ? 1 : 0; >+my $op = $query->param('op') || 'list'; >+my $referer = $query->param('referer') || $op; >+my $page = int( $query->param('page') // q{} ) || 1; >+my $public = $query->param('public') ? 1 : 0; > my ( $shelf, $shelfnumber, @messages, $allow_transfer ); > > # PART1: Perform a few actions >@@ -274,10 +275,9 @@ if ( $op eq 'view' ) { > $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); > my $direction = $query->param('direction') || 'asc'; > $direction = 'asc' if $direction ne 'asc' and $direction ne 'desc'; >- my ( $rows, $page ); >+ my $rows; > unless ( $query->param('print') ) { > $rows = C4::Context->preference('numSearchResults') || 20; >- $page = ( $query->param('page') ? $query->param('page') : 1 ); > } > > my $order_by = $sortfield eq 'itemcallnumber' ? 'items.cn_sort' : $sortfield; >-- >2.34.1
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 36858
:
166978
|
167002
| 167003 |
167004