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

(-)a/Koha/Items.pm (-2 / +34 lines)
Lines 659-667 Filters items based on the specified status. Link Here
659
659
660
=cut
660
=cut
661
661
662
sub _extract_custom_attrs {
663
    my ($params) = @_;
664
    my %custom_attrs;
665
    my $clean_params = _process_params( $params, \%custom_attrs );
666
    return ( \%custom_attrs, $clean_params );
667
}
668
669
sub _process_params {
670
    my ( $params, $custom_attrs ) = @_;
671
672
    return $params unless ref $params;
673
674
    if ( ref $params eq 'HASH' ) {
675
        my %clean;
676
        for my $key ( keys %$params ) {
677
            if ( $key =~ /^_(.+)/ ) {
678
                $custom_attrs->{$key} = $params->{$key};
679
            } else {
680
                $clean{$key} = _process_params( $params->{$key}, $custom_attrs );
681
            }
682
        }
683
        return \%clean;
684
    } elsif ( ref $params eq 'ARRAY' ) {
685
        return [ map { _process_params( $_, $custom_attrs ) } @$params ];
686
    } else {
687
        return $params;
688
    }
689
}
690
662
sub search {
691
sub search {
663
    my ( $self, $params, $attributes ) = @_;
692
    my ( $self, $params, $attributes ) = @_;
664
    my $status = ( $params && ref($params) eq 'HASH' ) ? delete $params->{_status} : undef;
693
694
    my ( $custom_attrs, $clean_params ) = _extract_custom_attrs($params);
695
    $params = $clean_params;
696
697
    my $status = $custom_attrs->{_status};
665
    if ($status) {
698
    if ($status) {
666
        if ( $status eq 'checked_out' ) {
699
        if ( $status eq 'checked_out' ) {
667
            $self = $self->filter_by_checked_out( { onsite_checkout => 0 } );
700
            $self = $self->filter_by_checked_out( { onsite_checkout => 0 } );
668
- 

Return to bug 41602