From e9eabc0a66ded2258678734d4957466b933e0b8e 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. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer --- 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 81e5c93f1c..320be88961 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.39.5