From c126a5a7093ce4bc67023296d9749f91ea9a51cf Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 22 Oct 2024 10:48:14 +0000 Subject: [PATCH] Bug 38148: Revert back to get_effective_rule And update the first conditional logic. This patch aims to maintain the logic behind the first patch, but restore get_effective_rule. get_effective_rule_value is using cache and I believe that is the reason why Items.t fail when using that. Test plan: 1) Search for 'music' on OPAC 2) Notice records have the 'place hold' link 3) Visit circulation rules on Staff: /cgi-bin/koha/admin/smart-rules.pl 4) On 'Default checkout, hold and return policy' , under 'Hold policy' pick 'From any library'. Hit 'Save'. 5) Repeat 1). Notice the 'place hold' link is gone. 6) Apply patch. restart plack. Repeat 1). Notice the 'place hold' is shown again Run: $ prove t/db_dependent/Koha/Items.t Signed-off-by: andrewa Signed-off-by: Ray Delahunty Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer (cherry picked from commit c7c24aa8d3e856a21e50075f743a5abc39fa5797) Signed-off-by: Lucas Gass (cherry picked from commit 36cace8f70204b68f5a379adfbb10e47360177f8) Signed-off-by: Fridolin Somers --- Koha/Items.pm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Koha/Items.pm b/Koha/Items.pm index a8cf203acc..119ad7eedf 100644 --- a/Koha/Items.pm +++ b/Koha/Items.pm @@ -61,16 +61,13 @@ placing a hold on one of those items. sub filter_by_for_hold { my ($self) = @_; - my $default_rule = Koha::CirculationRules->get_effective_rule_value( + my $default_rule = Koha::CirculationRules->get_effective_rule( { rule_name => 'holdallowed', - itemtype => undef, - branchcode => undef, - categorycode => undef, } ); my @hold_not_allowed_itypes; - if ($default_rule eq 'not_allowed') { + if ( defined $default_rule && $default_rule->rule_value eq 'not_allowed' ) { @hold_not_allowed_itypes = Koha::ItemTypes->search->get_column('itemtype'); my @hold_allowed_itypes = Koha::CirculationRules->search( { -- 2.39.5