Bug 3142: Add itype
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
4d63e9be18
commit
a9b306fa7c
1 changed files with 11 additions and 0 deletions
|
@ -23,6 +23,7 @@ use Modern::Perl;
|
||||||
use Koha::Database;
|
use Koha::Database;
|
||||||
|
|
||||||
use Koha::Item;
|
use Koha::Item;
|
||||||
|
use Koha::CirculationRules;
|
||||||
|
|
||||||
use base qw(Koha::Objects);
|
use base qw(Koha::Objects);
|
||||||
|
|
||||||
|
@ -49,6 +50,15 @@ Return the items of the set that are holdable
|
||||||
sub filter_by_for_hold {
|
sub filter_by_for_hold {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
|
my @hold_not_allowed_itypes = Koha::CirculationRules->search(
|
||||||
|
{
|
||||||
|
rule_name => 'holdallowed',
|
||||||
|
branchcode => undef,
|
||||||
|
categorycode => undef,
|
||||||
|
rule_value => 'not_allowed',
|
||||||
|
}
|
||||||
|
)->get_column('itemtype');
|
||||||
|
|
||||||
return $self->search(
|
return $self->search(
|
||||||
{
|
{
|
||||||
itemlost => 0,
|
itemlost => 0,
|
||||||
|
@ -56,6 +66,7 @@ sub filter_by_for_hold {
|
||||||
notforloan => { '<=' => 0 }
|
notforloan => { '<=' => 0 }
|
||||||
, # items with negative or zero notforloan value are holdable
|
, # items with negative or zero notforloan value are holdable
|
||||||
( C4::Context->preference('AllowHoldsOnDamagedItems') ? ( damaged => 0 ) : () ),
|
( C4::Context->preference('AllowHoldsOnDamagedItems') ? ( damaged => 0 ) : () ),
|
||||||
|
itype => { -not_in => \@hold_not_allowed_itypes },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue