Lines 33-39
Koha::Items - Koha Item object set class
Link Here
|
33 |
|
33 |
|
34 |
=head1 API |
34 |
=head1 API |
35 |
|
35 |
|
36 |
=head2 Class Methods |
36 |
=head2 Class methods |
37 |
|
37 |
|
38 |
=cut |
38 |
=cut |
39 |
|
39 |
|
Lines 50-56
sub filter_by_for_loan {
Link Here
|
50 |
return $self->search( { notforloan => [ 0, undef ] } ); |
50 |
return $self->search( { notforloan => [ 0, undef ] } ); |
51 |
} |
51 |
} |
52 |
|
52 |
|
53 |
=head3 type |
53 |
=head3 filter_by_visible_in_opac |
|
|
54 |
|
55 |
my $filered_items = $items->filter_by_visible_in_opac({ rules => $rules }); |
56 |
|
57 |
Returns a new resultset, containing those items that are not expected to be hidden in OPAC. |
58 |
If no I<rules> are passed, it returns the whole resultset, with the only caveat that the |
59 |
I<hidelostitems> system preference is honoured. |
60 |
|
61 |
=cut |
62 |
|
63 |
sub filter_by_visible_in_opac { |
64 |
my ($self, $params) = @_; |
65 |
|
66 |
my $rules = $params->{rules} // {}; |
67 |
|
68 |
my $search_params; |
69 |
foreach my $field (keys %$rules){ |
70 |
$search_params->{$field}->{'-not_in'} = $rules->{$field}; |
71 |
} |
72 |
|
73 |
$search_params->{itemlost}->{'<='} = 0 |
74 |
if C4::Context->preference('hidelostitems'); |
75 |
|
76 |
return $self->search( $search_params ); |
77 |
} |
78 |
|
79 |
=head2 Internal methods |
80 |
|
81 |
=head3 _type |
54 |
|
82 |
|
55 |
=cut |
83 |
=cut |
56 |
|
84 |
|
57 |
- |
|
|