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 <andrewfh@dubcolib.org>

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Nick Clemens 2024-04-22 18:12:47 +00:00 committed by Katrin Fischer
parent 675c8263b7
commit f9effbfdb4
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 7 additions and 5 deletions

View File

@ -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;