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

(-)a/Koha/REST/V1/Biblios.pm (-2 / +26 lines)
Lines 280-287 sub get_items { Link Here
280
            );
280
            );
281
        }
281
        }
282
282
283
        # FIXME We need to order_by serial.publisheddate if we have _order_by=+me.serial_issue_number
283
        my $items;
284
        my $items = $c->objects->search($items_rs);
284
285
        my $sort = $c->param('_order_by') // '';
286
        my $args = $c->validation->output;
287
288
        if ( $sort =~ /^[+-]me\._status$/ && $args->{_order_by} ) {
289
            my $order_by = $args->{_order_by};
290
            my @order_by = ref $order_by eq 'ARRAY' ? @$order_by : ($order_by);
291
292
            # Supprimer les tris sur champs virtuels comme me._status
293
            @order_by = grep { $_ !~ /^[-+]?me\._status$/ } @order_by;
294
295
            $args->{_order_by} = @order_by ? \@order_by : undef;
296
            delete $args->{_order_by} unless (@order_by);
297
            $items = $c->objects->search( $items_rs, $args );
298
            if ( $sort eq '+me._status' ) {
299
                @$items =
300
                    sort { join( ',', @{ $a->{_status} // [] } ) cmp join( ',', @{ $b->{_status} // [] } ) } @$items;
301
            } elsif ( $sort eq '-me._status' ) {
302
                @$items =
303
                    sort { join( ',', @{ $b->{_status} // [] } ) cmp join( ',', @{ $a->{_status} // [] } ) } @$items;
304
            }
305
        } else {
306
            # FIXME We need to order_by serial.publisheddate if we have _order_by=+me.serial_issue_number
307
            $items = $c->objects->search($items_rs);
308
        }
285
309
286
        return $c->render(
310
        return $c->render(
287
            status  => 200,
311
            status  => 200,
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc (-3 / +2 lines)
Lines 532-541 Link Here
532
                    }
532
                    }
533
                },
533
                },
534
                {
534
                {
535
                    data: "",
535
                    data: "_status",
536
                    className: "status",
536
                    className: "status",
537
                    searchable: false,
537
                    searchable: false,
538
                    orderable: false,
538
                    orderable: true,
539
                    render: function (data, type, row, meta) {
539
                    render: function (data, type, row, meta) {
540
                        let nodes = "";
540
                        let nodes = "";
541
                        row._status.forEach( status => {
541
                        row._status.forEach( status => {
542
- 

Return to bug 38122