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

(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 1885-1891 Returns the effective bookability of the current item, be that item or itemtype Link Here
1885
sub effective_bookable {
1885
sub effective_bookable {
1886
    my ($self) = @_;
1886
    my ($self) = @_;
1887
1887
1888
    return defined( $self->bookable ) ? $self->bookable : $self->itemtype->bookable;
1888
    return $self->bookable // $self->itemtype->bookable;
1889
}
1889
}
1890
1890
1891
=head3 orders
1891
=head3 orders
(-)a/Koha/Items.pm (-9 / +21 lines)
Lines 191-207 Returns a new resultset, containing only those items that are allowed to be book Link Here
191
sub filter_by_bookable {
191
sub filter_by_bookable {
192
    my ($self) = @_;
192
    my ($self) = @_;
193
193
194
    my @bookable_itemtypes = Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype');
194
    if ( !C4::Context->preference('item-level_itypes') ) {
195
195
        return $self->search(
196
    my ( $where, $attr );
196
            [
197
    if ( C4::Context->preference("item-level_itypes") ) {
197
                { bookable => 1 },
198
        $where = [ { bookable => 1 }, { bookable => undef, itype => { -in => \@bookable_itemtypes } } ];
198
                {
199
    } else {
199
                    bookable              => undef,
200
        $where = [ { bookable => 1 }, { bookable => undef, 'biblioitem.itemtype' => { -in => \@bookable_itemtypes } } ];
200
                    'biblioitem.itemtype' =>
201
        $attr  = { join => 'biblioitem' };
201
                        { -in => [ Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype') ] }
202
                },
203
            ],
204
            { join => 'biblioitem' }
205
        );
202
    }
206
    }
203
207
204
    return $self->search( $where, $attr );
208
    return $self->search(
209
        [
210
            { bookable => 1 },
211
            {
212
                bookable => undef,
213
                itype    => { -in => [ Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype') ] }
214
            },
215
        ]
216
    );
205
}
217
}
206
218
207
=head3 move_to_biblio
219
=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