View | Details | Raw Unified | Return to bug 28764
Collapse All | Expand All

(-)a/opac/opac-shelves.pl (-4 / +6 lines)
Lines 260-275 if ( $op eq 'view' ) { Link Here
260
    if ( $shelf ) {
260
    if ( $shelf ) {
261
        if ( $shelf->can_be_viewed( $loggedinuser ) ) {
261
        if ( $shelf->can_be_viewed( $loggedinuser ) ) {
262
            $category = $shelf->category;
262
            $category = $shelf->category;
263
264
            # Sortfield param may still include sort order with :asc or :desc, but direction overrides it
263
            my( $sortfield, $direction );
265
            my( $sortfield, $direction );
264
            if( defined( $query->param('sortfield') ) ){ # Passed in sorting overrides default sorting
266
            if( $query->param('sortfield') ){
265
                ( $sortfield, $direction ) = split /:/, $query->param('sortfield');
267
                ( $sortfield, $direction ) = split /:/, $query->param('sortfield');
266
            } else {
268
            } else {
267
                $sortfield = $shelf->sortfield;
269
                $sortfield = $shelf->sortfield;
268
                $direction = 'asc';
270
                $direction = 'asc';
269
            }
271
            }
270
            if( defined( $query->param('direction') ) ){ $direction = $query->param('direction'); }
272
            $direction = $query->param('direction') if $query->param('direction');
271
            $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded );
272
            $direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' );
273
            $direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' );
274
            $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded );
275
273
            my ( $page, $rows );
276
            my ( $page, $rows );
274
            unless ( $query->param('print') or $query->param('rss') ) {
277
            unless ( $query->param('print') or $query->param('rss') ) {
275
                $rows = C4::Context->preference('OPACnumSearchResults') || 20;
278
                $rows = C4::Context->preference('OPACnumSearchResults') || 20;
276
- 

Return to bug 28764