From 69e69658230f1761d099c895ba7890ccd2cec792 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 12 Jul 2024 15:14:01 +0100 Subject: [PATCH] Bug 36641: Ensure we return all keys When using the effective route, we were missing some rule kinds if a rule hadn't yet been defined for them. We should instead return the rule as undefined. --- Koha/REST/V1/CirculationRules.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/REST/V1/CirculationRules.pm b/Koha/REST/V1/CirculationRules.pm index 81e5c93f1ce..320be889611 100644 --- a/Koha/REST/V1/CirculationRules.pm +++ b/Koha/REST/V1/CirculationRules.pm @@ -122,7 +122,11 @@ sub list_rules { rules => $kinds } ) // {}; - push @{$rules}, $effective_rules; + my $return; + for my $kind ( @{$kinds} ) { + $return->{$kind} = $effective_rules->{$kind}; + } + push @{$rules}, $return; } else { my $select = [ { 'COALESCE' => [ 'branchcode', \["'*'"] ], -as => 'branchcode' }, -- 2.45.2