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

(-)a/Koha/Patron.pm (-1 / +33 lines)
Lines 584-589 sub holds { Link Here
584
    return Koha::Holds->_new_from_dbic($holds_rs);
584
    return Koha::Holds->_new_from_dbic($holds_rs);
585
}
585
}
586
586
587
=head3 can_see_patron_infos
588
589
my $can_see = $patron->can_see_patron_infos( $patron );
590
591
Return true if the patron (usually the logged in user) can see the patron's infos for a given patron
592
593
=cut
594
595
sub can_see_patron_infos {
596
    my ( $self, $patron ) = @_;
597
    my $can = 0;
598
    if ( $self->branchcode eq $patron->branchcode ) {
599
        $can = 1;
600
    } elsif ( $self->can( { borrowers => 'view_borrower_infos_from_any_libraries' } ) ) {
601
        $can = 1;
602
    } elsif ( my $library_groups = $self->library->library_groups ) {
603
        while ( my $library_group = $library_groups->next ) {
604
            if ( $library_group->parent->has_child( $patron->library->branchcode ) ) {
605
                $can = 1;
606
                last;
607
            }
608
        }
609
    }
610
    return $can;
611
}
612
613
sub can {
614
    my ( $self, $flagsrequired ) = @_;
615
    return unless $self->userid;
616
    # TODO code from haspermission needs to be moved here!
617
    return C4::Auth::haspermission( $self->userid, $flagsrequired );
618
}
619
587
=head3 type
620
=head3 type
588
621
589
=cut
622
=cut
590
- 

Return to bug 18403