Lines 1431-1443
sub can_see_patrons_from {
Link Here
|
1431 |
$can = 1; |
1431 |
$can = 1; |
1432 |
} elsif ( $self->has_permission( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { |
1432 |
} elsif ( $self->has_permission( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { |
1433 |
$can = 1; |
1433 |
$can = 1; |
1434 |
} elsif ( my $library_groups = $self->library->library_groups ) { |
1434 |
} elsif ( my @branches = $self->libraries_where_can_see_patrons ) { |
1435 |
while ( my $library_group = $library_groups->next ) { |
1435 |
$can = any { $_ eq $branchcode } @branches; |
1436 |
if ( $library_group->parent->has_child( $branchcode ) ) { |
|
|
1437 |
$can = 1; |
1438 |
last; |
1439 |
} |
1440 |
} |
1441 |
} |
1436 |
} |
1442 |
return $can; |
1437 |
return $can; |
1443 |
} |
1438 |
} |
Lines 1483-1488
An empty array means no restriction, the patron can see patron's infos from any
Link Here
|
1483 |
|
1478 |
|
1484 |
sub libraries_where_can_see_patrons { |
1479 |
sub libraries_where_can_see_patrons { |
1485 |
my ( $self ) = @_; |
1480 |
my ( $self ) = @_; |
|
|
1481 |
return $self->{_restricted_branchcodes} if exists($self->{_restricted_branchcodes}); |
1482 |
|
1486 |
my $userenv = C4::Context->userenv; |
1483 |
my $userenv = C4::Context->userenv; |
1487 |
|
1484 |
|
1488 |
return () unless $userenv; # For tests, but userenv should be defined in tests... |
1485 |
return () unless $userenv; # For tests, but userenv should be defined in tests... |
Lines 1516-1522
sub libraries_where_can_see_patrons {
Link Here
|
1516 |
@restricted_branchcodes = grep { defined $_ } @restricted_branchcodes; |
1513 |
@restricted_branchcodes = grep { defined $_ } @restricted_branchcodes; |
1517 |
@restricted_branchcodes = uniq(@restricted_branchcodes); |
1514 |
@restricted_branchcodes = uniq(@restricted_branchcodes); |
1518 |
@restricted_branchcodes = sort(@restricted_branchcodes); |
1515 |
@restricted_branchcodes = sort(@restricted_branchcodes); |
1519 |
return @restricted_branchcodes; |
1516 |
|
|
|
1517 |
$self->{_restricted_branchcodes} = @restricted_branchcodes; |
1518 |
return $self->{_restricted_branchcodes}; |
1520 |
} |
1519 |
} |
1521 |
|
1520 |
|
1522 |
=head3 has_permission |
1521 |
=head3 has_permission |
1523 |
- |
|
|