Lines 407-416
Search and sort items in a specific order, depending if serials are present or n
Link Here
|
407 |
=cut |
407 |
=cut |
408 |
|
408 |
|
409 |
sub search_ordered { |
409 |
sub search_ordered { |
410 |
my ($self) = @_; |
410 |
my ($self, $params, $attributes) = @_; |
|
|
411 |
|
412 |
$self = $self->search($params, $attributes); |
411 |
|
413 |
|
412 |
if ( $self->search({ select => ["enumchron IS NOT NULL"] }) ) { |
414 |
my @biblionumbers = $self->get_column('biblionumber'); |
413 |
return $self->search( {}, { order_by => 'enumchron' } ); |
415 |
|
|
|
416 |
if ( @biblionumbers == 1 |
417 |
&& Koha::Biblios->find( $biblionumbers[0] )->serial ) |
418 |
{ |
419 |
return $self->search( |
420 |
{}, |
421 |
{ |
422 |
order_by => [ 'serial.publisheddate', 'me.enumchron' ], |
423 |
join => 'serial' |
424 |
} |
425 |
); |
414 |
} else { |
426 |
} else { |
415 |
return $self->search( |
427 |
return $self->search( |
416 |
{}, |
428 |
{}, |
417 |
- |
|
|