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

(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 1919-1925 Returns the effective bookability of the current item, be that item or itemtype Link Here
1919
sub effective_bookable {
1919
sub effective_bookable {
1920
    my ($self) = @_;
1920
    my ($self) = @_;
1921
1921
1922
    return defined( $self->bookable ) ? $self->bookable : $self->itemtype->bookable;
1922
    return $self->bookable // $self->itemtype->bookable;
1923
}
1923
}
1924
1924
1925
=head3 orders
1925
=head3 orders
(-)a/Koha/Items.pm (-9 / +21 lines)
Lines 197-213 Returns a new resultset, containing only those items that are allowed to be book Link Here
197
sub filter_by_bookable {
197
sub filter_by_bookable {
198
    my ($self) = @_;
198
    my ($self) = @_;
199
199
200
    my @bookable_itemtypes = Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype');
200
    if ( !C4::Context->preference('item-level_itypes') ) {
201
201
        return $self->search(
202
    my ( $where, $attr );
202
            [
203
    if ( C4::Context->preference("item-level_itypes") ) {
203
                { bookable => 1 },
204
        $where = [ { bookable => 1 }, { bookable => undef, itype => { -in => \@bookable_itemtypes } } ];
204
                {
205
    } else {
205
                    bookable              => undef,
206
        $where = [ { bookable => 1 }, { bookable => undef, 'biblioitem.itemtype' => { -in => \@bookable_itemtypes } } ];
206
                    'biblioitem.itemtype' =>
207
        $attr  = { join => 'biblioitem' };
207
                        { -in => [ Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype') ] }
208
                },
209
            ],
210
            { join => 'biblioitem' }
211
        );
208
    }
212
    }
209
213
210
    return $self->search( $where, $attr );
214
    return $self->search(
215
        [
216
            { bookable => 1 },
217
            {
218
                bookable => undef,
219
                itype    => { -in => [ Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype') ] }
220
            },
221
        ]
222
    );
211
}
223
}
212
224
213
=head3 move_to_biblio
225
=head3 move_to_biblio
(-)a/catalogue/updateitem.pl (-2 / +1 lines)
Lines 77-83 elsif ( $op eq "cud-set_public_note" ) { # i.e., itemnotes parameter passed from Link Here
77
    $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
77
    $item->exclude_from_local_holds_priority($exclude_from_local_holds_priority);
78
    $messages = "updated_exclude_from_local_holds_priority=$exclude_from_local_holds_priority&";
78
    $messages = "updated_exclude_from_local_holds_priority=$exclude_from_local_holds_priority&";
79
} elsif ( $op eq "cud-set_bookable" && $bookable ne $item_data_hashref->{'bookable'} ) {
79
} elsif ( $op eq "cud-set_bookable" && $bookable ne $item_data_hashref->{'bookable'} ) {
80
    undef($bookable) if $bookable eq "";
80
    undef $bookable if $bookable eq q{};
81
    $item->bookable($bookable);
81
    $item->bookable($bookable);
82
} elsif ( $op eq "cud-set_damaged" && $damaged ne $item_data_hashref->{'damaged'}) {
82
} elsif ( $op eq "cud-set_damaged" && $damaged ne $item_data_hashref->{'damaged'}) {
83
    $item->damaged($damaged);
83
    $item->damaged($damaged);
84
- 

Return to bug 35906