|
Lines 113-119
if ( $op eq 'add_form' ) {
Link Here
|
| 113 |
if ( $shelf ) { |
113 |
if ( $shelf ) { |
| 114 |
$op = $referer; |
114 |
$op = $referer; |
| 115 |
my $sortfield = $query->param('sortfield'); |
115 |
my $sortfield = $query->param('sortfield'); |
| 116 |
$sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); |
116 |
$sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned ); |
| 117 |
if ( $shelf->can_be_managed( $loggedinuser ) ) { |
117 |
if ( $shelf->can_be_managed( $loggedinuser ) ) { |
| 118 |
$shelf->shelfname( scalar $query->param('shelfname') ); |
118 |
$shelf->shelfname( scalar $query->param('shelfname') ); |
| 119 |
$shelf->sortfield( $sortfield ); |
119 |
$shelf->sortfield( $sortfield ); |
|
Lines 268-276
if ( $op eq 'view' ) {
Link Here
|
| 268 |
if ( $shelf ) { |
268 |
if ( $shelf ) { |
| 269 |
if ( $shelf->can_be_viewed( $loggedinuser ) ) { |
269 |
if ( $shelf->can_be_viewed( $loggedinuser ) ) { |
| 270 |
my $sortfield = $query->param('sortfield') || $shelf->sortfield || 'title'; # Passed in sorting overrides default sorting |
270 |
my $sortfield = $query->param('sortfield') || $shelf->sortfield || 'title'; # Passed in sorting overrides default sorting |
| 271 |
$sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); |
271 |
$sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned ); |
| 272 |
my $direction = $query->param('direction') || 'asc'; |
272 |
my $direction = $query->param('direction') || 'asc'; |
| 273 |
$direction = 'asc' if $direction ne 'asc' and $direction ne 'desc'; |
273 |
|
|
|
274 |
# If sorting by dateaccessioned set direction to descending by default |
| 275 |
if ( $sortfield eq 'dateaccesioned' and $direction ne 'asc' and $direction ne 'desc' ) { |
| 276 |
$direction = 'desc'; |
| 277 |
} elsif ( $direction ne 'asc' and $direction ne 'desc' ) { |
| 278 |
$direction = 'asc'; |
| 279 |
} |
| 280 |
|
| 274 |
my ( $rows, $page ); |
281 |
my ( $rows, $page ); |
| 275 |
unless ( $query->param('print') ) { |
282 |
unless ( $query->param('print') ) { |
| 276 |
$rows = C4::Context->preference('numSearchResults') || 20; |
283 |
$rows = C4::Context->preference('numSearchResults') || 20; |
|
Lines 314-319
if ( $op eq 'view' ) {
Link Here
|
| 314 |
$this_item->{part_name} = $biblio->part_name; |
321 |
$this_item->{part_name} = $biblio->part_name; |
| 315 |
$this_item->{author} = $biblio->author; |
322 |
$this_item->{author} = $biblio->author; |
| 316 |
$this_item->{dateadded} = $content->dateadded; |
323 |
$this_item->{dateadded} = $content->dateadded; |
|
|
324 |
$this_item->{dateaccessioned} = $biblio->items->get_column("dateaccessioned"); |
| 317 |
$this_item->{imageurl} = $itemtype ? C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl ) : q{}; |
325 |
$this_item->{imageurl} = $itemtype ? C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl ) : q{}; |
| 318 |
$this_item->{description} = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ? |
326 |
$this_item->{description} = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ? |
| 319 |
$this_item->{notforloan} = $itemtype->notforloan if $itemtype; |
327 |
$this_item->{notforloan} = $itemtype->notforloan if $itemtype; |
| 320 |
- |
|
|