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

(-)a/Koha/Items.pm (-1 / +28 lines)
Lines 398-403 sub apply_regex { Link Here
398
    return $value;
398
    return $value;
399
}
399
}
400
400
401
=head3 search_ordered
402
403
 $items->search_ordered;
404
405
Search and sort items in a specific order, depending if serials are present or not
406
407
=cut
408
409
sub search_ordered {
410
    my ($self) = @_;
411
412
    if ( $self->search({ select => ["enumchron IS NOT NULL"] }) ) {
413
        return $self->search( {}, { order_by => 'enumchron' } );
414
    } else {
415
        return $self->search(
416
            {},
417
            {
418
                order_by => [
419
                    'homebranch.branchname',
420
                    'me.enumchron',
421
                    \"LPAD( me.copynumber, 8, '0' )",
422
                    {-desc => 'me.dateaccessioned'}
423
                ],
424
                join => ['homebranch']
425
            }
426
        );
427
    }
428
}
401
429
402
=head2 Internal methods
430
=head2 Internal methods
403
431
404
- 

Return to bug 31306