@@ -, +, @@ feature per group of libraries --- Koha/Patron.pm | 12 +++++++----- t/db_dependent/Koha/Patrons.t | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -778,16 +778,18 @@ sub libraries_where_can_see_patrons { ) ) { - my $library_groups = $self->library->library_groups; + my $library_groups = $self->library->library_groups({ ft_hide_patron_info => 1 }); if ( $library_groups->count ) { while ( my $library_group = $library_groups->next ) { - push @restricted_branchcodes, $library_group->parent->children->get_column('branchcode'); + my $parent = $library_group->parent; + if ( $parent->has_child( $self->branchcode ) ) { + push @restricted_branchcodes, $parent->children->get_column('branchcode'); + } } } - else { - push @restricted_branchcodes, $self->branchcode; - } + + @restricted_branchcodes = ( $self->branchcode ) unless @restricted_branchcodes; } } --- a/t/db_dependent/Koha/Patrons.t +++ a/t/db_dependent/Koha/Patrons.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 23; +use Test::More tests => 24; use Test::Warn; use Time::Fake; use DateTime; @@ -947,8 +947,8 @@ subtest 'libraries_where_can_see_patrons + can_see_patron_infos + search_limited # + library_12 # group2 # + library21 - my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1' } )->store; - my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2' } )->store; + my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1', ft_hide_patron_info => 1 } )->store; + my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2', ft_hide_patron_info => 1 } )->store; my $library_11 = $builder->build( { source => 'Branch' } ); my $library_12 = $builder->build( { source => 'Branch' } ); my $library_21 = $builder->build( { source => 'Branch' } ); --