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

(-)a/Koha/Patron.pm (-2 / +5 lines)
Lines 45-50 Returns a Koha::Patron object for this patron's guarantor Link Here
45
sub guarantor {
45
sub guarantor {
46
    my ( $self ) = @_;
46
    my ( $self ) = @_;
47
47
48
    return undef unless $self->guarantorid();
49
48
    return Koha::Patrons->find( $self->guarantorid() );
50
    return Koha::Patrons->find( $self->guarantorid() );
49
}
51
}
50
52
Lines 76-88 sub siblings { Link Here
76
    my ( $self ) = @_;
78
    my ( $self ) = @_;
77
79
78
    my $guarantor = $self->guarantor;
80
    my $guarantor = $self->guarantor;
79
    my $guarantorid = $guarantor ? $guarantor->borrowernumber : undef;
81
82
    return undef unless $guarantor;
80
83
81
    return Koha::Patrons->search(
84
    return Koha::Patrons->search(
82
        {
85
        {
83
            guarantorid => {
86
            guarantorid => {
84
                '!=' => undef,
87
                '!=' => undef,
85
                '=' => $guarantorid,
88
                '=' => $guarantor->id,
86
            },
89
            },
87
            borrowernumber => {
90
            borrowernumber => {
88
                '!=' => $self->borrowernumber,
91
                '!=' => $self->borrowernumber,
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +1 lines)
Lines 80-86 subtest 'guarantees' => sub { Link Here
80
subtest 'siblings' => sub {
80
subtest 'siblings' => sub {
81
    plan tests => 7;
81
    plan tests => 7;
82
    my $siblings = $new_patron_1->siblings;
82
    my $siblings = $new_patron_1->siblings;
83
    is( ref($siblings), 'Koha::Patrons', 'Koha::Patron->siblings should not crashed if the patron has not guarantor' );
83
    is( $siblings, undef, 'Koha::Patron->siblings should not crashed if the patron has no guarantor' );
84
    my $guarantee_1 = $builder->build( { source => 'Borrower', value => { guarantorid => $new_patron_1->borrowernumber } } );
84
    my $guarantee_1 = $builder->build( { source => 'Borrower', value => { guarantorid => $new_patron_1->borrowernumber } } );
85
    my $retrieved_guarantee_1 = Koha::Patrons->find($guarantee_1);
85
    my $retrieved_guarantee_1 = Koha::Patrons->find($guarantee_1);
86
    $siblings = $retrieved_guarantee_1->siblings;
86
    $siblings = $retrieved_guarantee_1->siblings;
87
- 

Return to bug 15656