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

(-)a/Koha/Patron.pm (-3 / +16 lines)
Lines 720-733 Return true if the patron (usually the logged in user) can see the patron's info Link Here
720
720
721
sub can_see_patron_infos {
721
sub can_see_patron_infos {
722
    my ( $self, $patron ) = @_;
722
    my ( $self, $patron ) = @_;
723
    return $self->can_see_patrons_from( $patron->library->branchcode );
724
}
725
726
=head3 can_see_patrons_from
727
728
my $can_see = $patron->can_see_patrons_from( $branchcode );
729
730
Return true if the patron (usually the logged in user) can see the patron's infos from a given library
731
732
=cut
733
734
sub can_see_patrons_from {
735
    my ( $self, $branchcode ) = @_;
723
    my $can = 0;
736
    my $can = 0;
724
    if ( $self->branchcode eq $patron->branchcode ) {
737
    if ( $self->branchcode eq $branchcode ) {
725
        $can = 1;
738
        $can = 1;
726
    } elsif ( $self->can( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) {
739
    } elsif ( $self->can( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) {
727
        $can = 1;
740
        $can = 1;
728
    } elsif ( my $library_groups = $self->library->library_groups ) {
741
    } elsif ( my $library_groups = $self->library->library_groups ) {
729
        while ( my $library_group = $library_groups->next ) {
742
        while ( my $library_group = $library_groups->next ) {
730
            if ( $library_group->parent->has_child( $patron->library->branchcode ) ) {
743
            if ( $library_group->parent->has_child( $branchcode ) ) {
731
                $can = 1;
744
                $can = 1;
732
                last;
745
                last;
733
            }
746
            }
Lines 777-782 sub libraries_where_can_see_patrons { Link Here
777
            }
790
            }
778
        }
791
        }
779
    }
792
    }
793
780
    return sort(uniq(@restricted_branchcodes));
794
    return sort(uniq(@restricted_branchcodes));
781
}
795
}
782
796
783
- 

Return to bug 18403