From f9effbfdb4a1221da4f05683a57946de01d0aa25 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 --- admin/smart-rules.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 16faa8b06c..efe1b91dfb 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -739,13 +739,15 @@ my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['des my $itemtypes = Koha::ItemTypes->search_with_localization; -my @used_categorycodes = - Koha::CirculationRules->search( {}, { 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 ); +my @used_categorycodes = + Koha::CirculationRules->search( { branchcode => $humanbranch }, { columns => ['categorycode'], distinct => 1, } ) + ->get_column('categorycode'); +my @used_itemtypes = + 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;