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

(-)a/Koha/Patron.pm (-2 / +2 lines)
Lines 124-135 sub guarantor { Link Here
124
sub image {
124
sub image {
125
    my ( $self ) = @_;
125
    my ( $self ) = @_;
126
126
127
    return Koha::Patron::Images->find( $self->borrowernumber )
127
    return Koha::Patron::Images->find( $self->borrowernumber );
128
}
128
}
129
129
130
sub library {
130
sub library {
131
    my ( $self ) = @_;
131
    my ( $self ) = @_;
132
    return Koha::Library->_new_from_dbic($self->_result->branchcode)
132
    return Koha::Library->_new_from_dbic($self->_result->branchcode);
133
}
133
}
134
134
135
=head3 guarantees
135
=head3 guarantees
(-)a/t/db_dependent/Koha/Patrons.t (-5 / +2 lines)
Lines 569-575 subtest 'search_upcoming_membership_expires' => sub { Link Here
569
569
570
    # Test with branch
570
    # Test with branch
571
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode} });
571
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode} });
572
    is( $upcoming_mem_expires->count, 1, );
572
    is( $upcoming_mem_expires->count, 1, 'Test with branch parameter' );
573
    my $expired = $upcoming_mem_expires->next;
573
    my $expired = $upcoming_mem_expires->next;
574
    is( $expired->surname, $patron_1->{surname}, 'Get upcoming membership expires should return the correct patron.' );
574
    is( $expired->surname, $patron_1->{surname}, 'Get upcoming membership expires should return the correct patron.' );
575
    is( $expired->library->branchemail, $library->{branchemail}, 'Get upcoming membership expires should return the correct patron.' );
575
    is( $expired->library->branchemail, $library->{branchemail}, 'Get upcoming membership expires should return the correct patron.' );
Lines 587-597 subtest 'search_upcoming_membership_expires' => sub { Link Here
587
    # Test the before parameter
587
    # Test the before parameter
588
    t::lib::Mocks::mock_preference( 'MembershipExpiryDaysNotice', 15 );
588
    t::lib::Mocks::mock_preference( 'MembershipExpiryDaysNotice', 15 );
589
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before });
589
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before });
590
    # Expect 29/6 and 30/6
590
    is( $upcoming_mem_expires->count, 2, 'Expect two results for before');
591
    is( $upcoming_mem_expires->count, 2, 'Expect two results for before==1');
592
    # Test after parameter also
591
    # Test after parameter also
593
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before, after => $nb_of_days_after });
592
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before, after => $nb_of_days_after });
594
    # Expect 29/6, 30/6 and 2/7
595
    is( $upcoming_mem_expires->count, 3, 'Expect three results when adding after' );
593
    is( $upcoming_mem_expires->count, 3, 'Expect three results when adding after' );
596
    Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete;
594
    Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete;
597
};
595
};
598
- 

Return to bug 17569