Bug 17526: Change grep to deal with malformed sortfield
Giving sortfield a malformed value when viewing lists results in
Internal Server Error.
eg.
http://localhost:8080/cgi-bin/koha/opac-shelves.pl?op=view&shelfnumber=1&sortfield=title(
Note the trailing (
Before Patch: kaboom
apply patch
restart
After Patch: No kaboom
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 42a26a7580)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
cf1c06e8f0
commit
bf11cd06c5
|
|
@ -235,7 +235,7 @@ if ( $op eq 'view' ) {
|
|||
if ( $shelf->can_be_viewed( $loggedinuser ) ) {
|
||||
$category = $shelf->category;
|
||||
my $sortfield = $query->param('sortfield') || $shelf->sortfield; # Passed in sorting overrides default sorting
|
||||
$sortfield = 'title' unless grep {/^$sortfield$/}qw( title author copyrightdate itemcallnumber dateadded );
|
||||
$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 ( $page, $rows );
|
||||
|
|
|
|||
Loading…
Reference in New Issue