View | Details | Raw Unified | Return to bug 29523
Collapse All | Expand All

(-)a/Koha/Patron.pm (-10 / +8 lines)
Lines 1621-1633 sub can_see_things_from { Link Here
1621
        $can = 1;
1621
        $can = 1;
1622
    } elsif ( $self->has_permission( { $permission => $subpermission } ) ) {
1622
    } elsif ( $self->has_permission( { $permission => $subpermission } ) ) {
1623
        $can = 1;
1623
        $can = 1;
1624
    } elsif ( my $library_groups = $self->library->library_groups ) {
1624
    } elsif ( my @branches = $self->libraries_where_can_see_patrons ) {
1625
        while ( my $library_group = $library_groups->next ) {
1625
        $can = any { $_ eq $branchcode } @branches;
1626
            if ( $library_group->parent->has_child( $branchcode ) ) {
1627
                $can = 1;
1628
                last;
1629
            }
1630
        }
1631
    }
1626
    }
1632
    return $can;
1627
    return $can;
1633
}
1628
}
Lines 1678-1683 sub libraries_where_can_see_things { Link Here
1678
    my $subpermission = $params->{subpermission};
1673
    my $subpermission = $params->{subpermission};
1679
    my $group_feature = $params->{group_feature};
1674
    my $group_feature = $params->{group_feature};
1680
1675
1676
    return $self->{_restricted_branchcodes} if exists($self->{_restricted_branchcodes});
1677
1681
    my $userenv = C4::Context->userenv;
1678
    my $userenv = C4::Context->userenv;
1682
1679
1683
    return () unless $userenv; # For tests, but userenv should be defined in tests...
1680
    return () unless $userenv; # For tests, but userenv should be defined in tests...
Lines 1704-1717 sub libraries_where_can_see_things { Link Here
1704
                }
1701
                }
1705
            }
1702
            }
1706
1703
1707
            @restricted_branchcodes = ( $self->branchcode ) unless @restricted_branchcodes;
1704
             @restricted_branchcodes = ( $self->branchcode ) unless @restricted_branchcodes;
1708
        }
1705
        }
1709
    }
1706
    }
1710
1707
1711
    @restricted_branchcodes = grep { defined $_ } @restricted_branchcodes;
1708
    @restricted_branchcodes = grep { defined $_ } @restricted_branchcodes;
1712
    @restricted_branchcodes = uniq(@restricted_branchcodes);
1709
    @restricted_branchcodes = uniq(@restricted_branchcodes);
1713
    @restricted_branchcodes = sort(@restricted_branchcodes);
1710
    @restricted_branchcodes = sort(@restricted_branchcodes);
1714
    return @restricted_branchcodes;
1711
1712
    $self->{_restricted_branchcodes} = \@restricted_branchcodes;
1713
    return @{$self->{_restricted_branchcodes}};
1715
}
1714
}
1716
1715
1717
=head3 has_permission
1716
=head3 has_permission
1718
- 

Return to bug 29523