Lines 1454-1466
sub can_see_patrons_from {
Link Here
|
1454 |
$can = 1; |
1454 |
$can = 1; |
1455 |
} elsif ( $self->has_permission( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { |
1455 |
} elsif ( $self->has_permission( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { |
1456 |
$can = 1; |
1456 |
$can = 1; |
1457 |
} elsif ( my $library_groups = $self->library->library_groups ) { |
1457 |
} elsif ( my @branches = $self->libraries_where_can_see_patrons ) { |
1458 |
while ( my $library_group = $library_groups->next ) { |
1458 |
$can = any { $_ eq $branchcode } @branches; |
1459 |
if ( $library_group->parent->has_child( $branchcode ) ) { |
|
|
1460 |
$can = 1; |
1461 |
last; |
1462 |
} |
1463 |
} |
1464 |
} |
1459 |
} |
1465 |
return $can; |
1460 |
return $can; |
1466 |
} |
1461 |
} |
Lines 1494-1500
sub can_log_into {
Link Here
|
1494 |
|
1489 |
|
1495 |
=head3 libraries_where_can_see_patrons |
1490 |
=head3 libraries_where_can_see_patrons |
1496 |
|
1491 |
|
1497 |
my $libraries = $patron-libraries_where_can_see_patrons; |
1492 |
my $libraries = $patron->libraries_where_can_see_patrons; |
1498 |
|
1493 |
|
1499 |
Return the list of branchcodes(!) of libraries the patron is allowed to see other patron's infos. |
1494 |
Return the list of branchcodes(!) of libraries the patron is allowed to see other patron's infos. |
1500 |
The branchcodes are arbitrarily returned sorted. |
1495 |
The branchcodes are arbitrarily returned sorted. |
Lines 1506-1511
An empty array means no restriction, the patron can see patron's infos from any
Link Here
|
1506 |
|
1501 |
|
1507 |
sub libraries_where_can_see_patrons { |
1502 |
sub libraries_where_can_see_patrons { |
1508 |
my ( $self ) = @_; |
1503 |
my ( $self ) = @_; |
|
|
1504 |
return $self->{_restricted_branchcodes} if exists($self->{_restricted_branchcodes}); |
1505 |
|
1509 |
my $userenv = C4::Context->userenv; |
1506 |
my $userenv = C4::Context->userenv; |
1510 |
|
1507 |
|
1511 |
return () unless $userenv; # For tests, but userenv should be defined in tests... |
1508 |
return () unless $userenv; # For tests, but userenv should be defined in tests... |
Lines 1539-1545
sub libraries_where_can_see_patrons {
Link Here
|
1539 |
@restricted_branchcodes = grep { defined $_ } @restricted_branchcodes; |
1536 |
@restricted_branchcodes = grep { defined $_ } @restricted_branchcodes; |
1540 |
@restricted_branchcodes = uniq(@restricted_branchcodes); |
1537 |
@restricted_branchcodes = uniq(@restricted_branchcodes); |
1541 |
@restricted_branchcodes = sort(@restricted_branchcodes); |
1538 |
@restricted_branchcodes = sort(@restricted_branchcodes); |
1542 |
return @restricted_branchcodes; |
1539 |
|
|
|
1540 |
$self->{_restricted_branchcodes} = \@restricted_branchcodes; |
1541 |
return @{$self->{_restricted_branchcodes}}; |
1543 |
} |
1542 |
} |
1544 |
|
1543 |
|
1545 |
=head3 has_permission |
1544 |
=head3 has_permission |
1546 |
- |
|
|