Lines 1607-1619
sub can_see_things_from {
Link Here
|
1607 |
$can = 1; |
1607 |
$can = 1; |
1608 |
} elsif ( $self->has_permission( { $permission => $subpermission } ) ) { |
1608 |
} elsif ( $self->has_permission( { $permission => $subpermission } ) ) { |
1609 |
$can = 1; |
1609 |
$can = 1; |
1610 |
} elsif ( my $library_groups = $self->library->library_groups ) { |
1610 |
} elsif ( my @branches = $self->libraries_where_can_see_patrons ) { |
1611 |
while ( my $library_group = $library_groups->next ) { |
1611 |
$can = any { $_ eq $branchcode } @branches; |
1612 |
if ( $library_group->parent->has_child( $branchcode ) ) { |
|
|
1613 |
$can = 1; |
1614 |
last; |
1615 |
} |
1616 |
} |
1617 |
} |
1612 |
} |
1618 |
return $can; |
1613 |
return $can; |
1619 |
} |
1614 |
} |
Lines 1664-1669
sub libraries_where_can_see_things {
Link Here
|
1664 |
my $subpermission = $params->{subpermission}; |
1659 |
my $subpermission = $params->{subpermission}; |
1665 |
my $group_feature = $params->{group_feature}; |
1660 |
my $group_feature = $params->{group_feature}; |
1666 |
|
1661 |
|
|
|
1662 |
return $self->{_restricted_branchcodes} if exists($self->{_restricted_branchcodes}); |
1663 |
|
1667 |
my $userenv = C4::Context->userenv; |
1664 |
my $userenv = C4::Context->userenv; |
1668 |
|
1665 |
|
1669 |
return () unless $userenv; # For tests, but userenv should be defined in tests... |
1666 |
return () unless $userenv; # For tests, but userenv should be defined in tests... |
Lines 1690-1703
sub libraries_where_can_see_things {
Link Here
|
1690 |
} |
1687 |
} |
1691 |
} |
1688 |
} |
1692 |
|
1689 |
|
1693 |
@restricted_branchcodes = ( $self->branchcode ) unless @restricted_branchcodes; |
1690 |
@restricted_branchcodes = ( $self->branchcode ) unless @restricted_branchcodes; |
1694 |
} |
1691 |
} |
1695 |
} |
1692 |
} |
1696 |
|
1693 |
|
1697 |
@restricted_branchcodes = grep { defined $_ } @restricted_branchcodes; |
1694 |
@restricted_branchcodes = grep { defined $_ } @restricted_branchcodes; |
1698 |
@restricted_branchcodes = uniq(@restricted_branchcodes); |
1695 |
@restricted_branchcodes = uniq(@restricted_branchcodes); |
1699 |
@restricted_branchcodes = sort(@restricted_branchcodes); |
1696 |
@restricted_branchcodes = sort(@restricted_branchcodes); |
1700 |
return @restricted_branchcodes; |
1697 |
|
|
|
1698 |
$self->{_restricted_branchcodes} = \@restricted_branchcodes; |
1699 |
return @{$self->{_restricted_branchcodes}}; |
1701 |
} |
1700 |
} |
1702 |
|
1701 |
|
1703 |
=head3 has_permission |
1702 |
=head3 has_permission |
1704 |
- |
|
|