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 415-421 subtest 'search_upcoming_membership_expires' => sub { Link Here
415
415
416
    # Test with branch
416
    # Test with branch
417
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode} });
417
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode} });
418
    is( $upcoming_mem_expires->count, 1, );
418
    is( $upcoming_mem_expires->count, 1, 'Test with branch parameter' );
419
    my $expired = $upcoming_mem_expires->next;
419
    my $expired = $upcoming_mem_expires->next;
420
    is( $expired->surname, $patron_1->{surname}, 'Get upcoming membership expires should return the correct patron.' );
420
    is( $expired->surname, $patron_1->{surname}, 'Get upcoming membership expires should return the correct patron.' );
421
    is( $expired->library->branchemail, $library->{branchemail}, 'Get upcoming membership expires should return the correct patron.' );
421
    is( $expired->library->branchemail, $library->{branchemail}, 'Get upcoming membership expires should return the correct patron.' );
Lines 433-443 subtest 'search_upcoming_membership_expires' => sub { Link Here
433
    # Test the before parameter
433
    # Test the before parameter
434
    t::lib::Mocks::mock_preference( 'MembershipExpiryDaysNotice', 15 );
434
    t::lib::Mocks::mock_preference( 'MembershipExpiryDaysNotice', 15 );
435
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before });
435
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before });
436
    # Expect 29/6 and 30/6
436
    is( $upcoming_mem_expires->count, 2, 'Expect two results for before');
437
    is( $upcoming_mem_expires->count, 2, 'Expect two results for before==1');
438
    # Test after parameter also
437
    # Test after parameter also
439
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before, after => $nb_of_days_after });
438
    $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires({ 'me.branchcode' => $library->{branchcode}, before => $nb_of_days_before, after => $nb_of_days_after });
440
    # Expect 29/6, 30/6 and 2/7
441
    is( $upcoming_mem_expires->count, 3, 'Expect three results when adding after' );
439
    is( $upcoming_mem_expires->count, 3, 'Expect three results when adding after' );
442
    Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete;
440
    Koha::Patrons->search({ borrowernumber => { in => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}, $patron_3->{borrowernumber} ] } })->delete;
443
};
441
};
444
- 

Return to bug 17569