Bug 15760: Fix order by direction for shelves

The order_by parameters should not be "$direction $order_by" with
quote_names enabled. The correct syntax is { -$direction => $order_by }

Test plan for Opac + Staff interfces:
Sort list by title or whatever and change the direction

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
Jonathan Druart 2016-02-11 11:32:43 +00:00 committed by Brendan Gallagher
parent 16e55c1f32
commit 71d4942c30
3 changed files with 5 additions and 3 deletions

View File

@ -114,7 +114,7 @@ sub get_some_shelves {
{
join => [ 'virtualshelfshares' ],
group_by => 'shelfnumber',
order_by => 'lastmodified desc',
order_by => { -desc => 'lastmodified' },
}
);
}

View File

@ -223,6 +223,7 @@ if ( $op eq 'view' ) {
$category = $shelf->category;
my $sortfield = $query->param('sortfield') || $shelf->sortfield; # Passed in sorting overrides default sorting
my $direction = $query->param('direction') || 'asc';
$direction = 'asc' if $direction ne 'asc' and $direction ne 'desc';
my ( $page, $rows );
unless ( $query->param('print') or $query->param('rss') ) {
$rows = C4::Context->preference('OPACnumSearchResults') || 20;
@ -235,7 +236,7 @@ if ( $op eq 'view' ) {
prefetch => [ { 'biblionumber' => { 'biblioitems' => 'items' } } ],
page => $page,
rows => $rows,
order_by => "$order_by $direction",
order_by => { "-$direction" => $order_by },
}
);

View File

@ -195,6 +195,7 @@ if ( $op eq 'view' ) {
if ( $shelf->can_be_viewed( $loggedinuser ) ) {
my $sortfield = $query->param('sortfield') || $shelf->sortfield || 'title'; # Passed in sorting overrides default sorting
my $direction = $query->param('direction') || 'asc';
$direction = 'asc' if $direction ne 'asc' and $direction ne 'desc';
my ( $rows, $page );
unless ( $query->param('print') ) {
$rows = C4::Context->preference('numSearchResults') || 20;
@ -208,7 +209,7 @@ if ( $op eq 'view' ) {
prefetch => [ { 'biblionumber' => { 'biblioitems' => 'items' } } ],
page => $page,
rows => $rows,
order_by => "$order_by $direction",
order_by => { "-$direction" => $order_by },
}
);