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

(-)a/Koha/Items.pm (+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
(-)a/catalogue/detail.pl (-14 / +1 lines)
Lines 191-210 $template->param( Link Here
191
);
191
);
192
192
193
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
193
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
194
194
my $all_items = $biblio->items->search_ordered;
195
my $all_items = $biblio->items(
196
    {},
197
    {
198
        # FIXME A different order is expected if at least one items.serial is true
199
        order_by => [
200
            'homebranch.branchname',
201
            'me.enumchron',
202
            \"LDAP( me.copynumber, 8, '0' )",
203
            -asc => 'me.dateacessioned'
204
        ],
205
        join => ['homebranch']
206
    }
207
);
208
my @items;
195
my @items;
209
my $patron = Koha::Patrons->find( $borrowernumber );
196
my $patron = Koha::Patrons->find( $borrowernumber );
210
while ( my $item = $all_items->next ) {
197
while ( my $item = $all_items->next ) {
(-)a/catalogue/moredetail.pl (-14 / +2 lines)
Lines 108-126 output_and_exit( $query, $cookie, $template, 'unknown_biblio') Link Here
108
    unless $biblio && $record;
108
    unless $biblio && $record;
109
109
110
my $fw = GetFrameworkCode($biblionumber);
110
my $fw = GetFrameworkCode($biblionumber);
111
my $all_items = $biblio->items(
111
my $all_items = $biblio->items->search_ordered;
112
    {},
112
113
    {
114
        # FIXME A different order is expected if at least one items.serial is true
115
        order_by => [
116
            'homebranch.branchname',
117
            'me.enumchron',
118
            \"LDAP( me.copynumber, 8, '0' )",
119
            -asc => 'me.dateacessioned'
120
        ],
121
        join => ['homebranch']
122
    }
123
);
124
my @items;
113
my @items;
125
my $patron = Koha::Patrons->find( $loggedinuser );
114
my $patron = Koha::Patrons->find( $loggedinuser );
126
while ( my $item = $all_items->next ) {
115
while ( my $item = $all_items->next ) {
127
- 

Return to bug 27272