|
Lines 147-153
if ( $op eq 'add_form' ) {
Link Here
|
| 147 |
if ( $shelf ) { |
147 |
if ( $shelf ) { |
| 148 |
$op = $referer; |
148 |
$op = $referer; |
| 149 |
my $sortfield = $query->param('sortfield'); |
149 |
my $sortfield = $query->param('sortfield'); |
| 150 |
$sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); |
150 |
$sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned ); |
| 151 |
if ( $shelf->can_be_managed( $loggedinuser ) ) { |
151 |
if ( $shelf->can_be_managed( $loggedinuser ) ) { |
| 152 |
$shelf->shelfname( scalar $query->param('shelfname') ); |
152 |
$shelf->shelfname( scalar $query->param('shelfname') ); |
| 153 |
$shelf->sortfield( $sortfield ); |
153 |
$shelf->sortfield( $sortfield ); |
|
Lines 311-319
if ( $op eq 'view' ) {
Link Here
|
| 311 |
$sortfield = $shelf->sortfield; |
311 |
$sortfield = $shelf->sortfield; |
| 312 |
$direction = 'asc'; |
312 |
$direction = 'asc'; |
| 313 |
} |
313 |
} |
| 314 |
$direction = $query->param('direction') if $query->param('direction'); |
314 |
|
|
|
315 |
# By default order descending if sorting by dateaccessioned |
| 316 |
if ( $query->param('direction') ) { |
| 317 |
$direction = $query->param('direction'); |
| 318 |
} elsif ( $sortfield eq 'dateaccessioned' and !$query->param('direction') ) { |
| 319 |
$direction = 'desc'; |
| 320 |
} |
| 315 |
$direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' ); |
321 |
$direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' ); |
| 316 |
$sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); |
322 |
$sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned ); |
| 317 |
|
323 |
|
| 318 |
my ( $page, $rows ); |
324 |
my ( $page, $rows ); |
| 319 |
unless ( $query->param('print') or $query->param('rss') ) { |
325 |
unless ( $query->param('print') or $query->param('rss') ) { |
| 320 |
- |
|
|