Lines 595-608
Return true if the patron (usually the logged in user) can see the patron's info
Link Here
|
595 |
|
595 |
|
596 |
sub can_see_patron_infos { |
596 |
sub can_see_patron_infos { |
597 |
my ( $self, $patron ) = @_; |
597 |
my ( $self, $patron ) = @_; |
|
|
598 |
return $self->can_see_patrons_from( $patron->library->branchcode ); |
599 |
} |
600 |
|
601 |
=head3 can_see_patrons_from |
602 |
|
603 |
my $can_see = $patron->can_see_patrons_from( $branchcode ); |
604 |
|
605 |
Return true if the patron (usually the logged in user) can see the patron's infos from a given library |
606 |
|
607 |
=cut |
608 |
|
609 |
sub can_see_patrons_from { |
610 |
my ( $self, $branchcode ) = @_; |
598 |
my $can = 0; |
611 |
my $can = 0; |
599 |
if ( $self->branchcode eq $patron->branchcode ) { |
612 |
if ( $self->branchcode eq $branchcode ) { |
600 |
$can = 1; |
613 |
$can = 1; |
601 |
} elsif ( $self->can( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { |
614 |
} elsif ( $self->can( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) { |
602 |
$can = 1; |
615 |
$can = 1; |
603 |
} elsif ( my $library_groups = $self->library->library_groups ) { |
616 |
} elsif ( my $library_groups = $self->library->library_groups ) { |
604 |
while ( my $library_group = $library_groups->next ) { |
617 |
while ( my $library_group = $library_groups->next ) { |
605 |
if ( $library_group->parent->has_child( $patron->library->branchcode ) ) { |
618 |
if ( $library_group->parent->has_child( $branchcode ) ) { |
606 |
$can = 1; |
619 |
$can = 1; |
607 |
last; |
620 |
last; |
608 |
} |
621 |
} |
Lines 652-657
sub libraries_where_can_see_patrons {
Link Here
|
652 |
} |
665 |
} |
653 |
} |
666 |
} |
654 |
} |
667 |
} |
|
|
668 |
|
655 |
return sort(uniq(@restricted_branchcodes)); |
669 |
return sort(uniq(@restricted_branchcodes)); |
656 |
} |
670 |
} |
657 |
|
671 |
|
658 |
- |
|
|