Lines 51-57
Koha::Items - Koha Item object set class
Link Here
|
51 |
|
51 |
|
52 |
my $filtered_items = $items->filter_by_for_hold; |
52 |
my $filtered_items = $items->filter_by_for_hold; |
53 |
|
53 |
|
54 |
Return the items of the set that are *potentially* holdable. |
54 |
Return the items of the set that are *potentially* holdable. This routine |
|
|
55 |
checks only rules defined in the 'Standard rules for all libraries' and |
56 |
should only be used in the context where we don't have a patron to check |
57 |
policies for specifically. |
55 |
|
58 |
|
56 |
Caller has the responsibility to call C4::Reserves::CanItemBeReserved before |
59 |
Caller has the responsibility to call C4::Reserves::CanItemBeReserved before |
57 |
placing a hold on one of those items. |
60 |
placing a hold on one of those items. |
Lines 68-73
sub filter_by_for_hold {
Link Here
|
68 |
); |
71 |
); |
69 |
my @hold_not_allowed_itypes; |
72 |
my @hold_not_allowed_itypes; |
70 |
if ( defined $default_rule && $default_rule->rule_value eq 'not_allowed' ) { |
73 |
if ( defined $default_rule && $default_rule->rule_value eq 'not_allowed' ) { |
|
|
74 |
# If the default rule is not allowed we get all itemtypes as not allowed |
71 |
@hold_not_allowed_itypes = Koha::ItemTypes->search->get_column('itemtype'); |
75 |
@hold_not_allowed_itypes = Koha::ItemTypes->search->get_column('itemtype'); |
72 |
my @hold_allowed_itypes = Koha::CirculationRules->search( |
76 |
my @hold_allowed_itypes = Koha::CirculationRules->search( |
73 |
{ |
77 |
{ |
Lines 77-84
sub filter_by_for_hold {
Link Here
|
77 |
categorycode => undef, |
81 |
categorycode => undef, |
78 |
} |
82 |
} |
79 |
)->get_column('itemtype'); |
83 |
)->get_column('itemtype'); |
|
|
84 |
# We then only allow those explicitly defined in hold policies at the all libraries level |
80 |
@hold_not_allowed_itypes = array_minus( @hold_not_allowed_itypes, @hold_allowed_itypes ); |
85 |
@hold_not_allowed_itypes = array_minus( @hold_not_allowed_itypes, @hold_allowed_itypes ); |
81 |
} else { |
86 |
} else { |
|
|
87 |
# If there is no default 'not_allowed' rule, then only those explicitly forbidden at the all libraries level are forbidden |
82 |
@hold_not_allowed_itypes = Koha::CirculationRules->search( |
88 |
@hold_not_allowed_itypes = Koha::CirculationRules->search( |
83 |
{ |
89 |
{ |
84 |
rule_name => 'holdallowed', |
90 |
rule_name => 'holdallowed', |
Lines 89-94
sub filter_by_for_hold {
Link Here
|
89 |
)->get_column('itemtype'); |
95 |
)->get_column('itemtype'); |
90 |
} |
96 |
} |
91 |
|
97 |
|
|
|
98 |
# We also forbid holds on any marked not for loan at the item level |
92 |
push @hold_not_allowed_itypes, Koha::ItemTypes->search({ notforloan => 1 })->get_column('itemtype'); |
99 |
push @hold_not_allowed_itypes, Koha::ItemTypes->search({ notforloan => 1 })->get_column('itemtype'); |
93 |
@hold_not_allowed_itypes = uniq @hold_not_allowed_itypes; |
100 |
@hold_not_allowed_itypes = uniq @hold_not_allowed_itypes; |
94 |
|
101 |
|
95 |
- |
|
|