From 28c5cd8615fb4551443d27793b67429f0807abf8 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 22 Apr 2024 18:12:47 +0000 Subject: [PATCH] Bug 36673: Filter used categories and item types to current branch To test: 1 - Define some circulation rules for default and specific branches 2 - Apply patch 3 - Confirm rules display as before PA amended: - bug->Bug in commit title - squashed tidy Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Pedro Amorim Signed-off-by: Katrin Fischer (cherry picked from commit f9effbfdb4a1221da4f05683a57946de01d0aa25) Signed-off-by: Fridolin Somers --- admin/smart-rules.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 3756fa3325..9a10ed38c8 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -739,12 +739,14 @@ my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['des my $itemtypes = Koha::ItemTypes->search_with_localization; +my $humanbranch = ( $branch ne '*' ? $branch : undef ); + my @used_categorycodes = - Koha::CirculationRules->search( {}, { columns => ['categorycode'], distinct => 1, } )->get_column('categorycode'); + Koha::CirculationRules->search( { branchcode => $humanbranch }, { columns => ['categorycode'], distinct => 1, } ) + ->get_column('categorycode'); my @used_itemtypes = - Koha::CirculationRules->search( {}, { columns => ['itemtype'], distinct => 1, } )->get_column('itemtype'); - -my $humanbranch = ( $branch ne '*' ? $branch : undef ); + Koha::CirculationRules->search( { branchcode => $humanbranch }, { columns => ['itemtype'], distinct => 1, } ) + ->get_column('itemtype'); my $all_rules = Koha::CirculationRules->search({ branchcode => $humanbranch }); my $definedbranch = $all_rules->count ? 1 : 0; -- 2.39.5