|
Lines 2111-2117
subtest 'EmailPatronWhenHoldIsPlaced tests' => sub {
Link Here
|
| 2111 |
}; |
2111 |
}; |
| 2112 |
|
2112 |
|
| 2113 |
subtest 'current_holds with future holds' => sub { |
2113 |
subtest 'current_holds with future holds' => sub { |
| 2114 |
plan tests => 2; |
2114 |
plan tests => 5; |
| 2115 |
$schema->storage->txn_begin; |
2115 |
$schema->storage->txn_begin; |
| 2116 |
|
2116 |
|
| 2117 |
t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 ); |
2117 |
t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 2 ); |
|
Lines 2130-2134
subtest 'current_holds with future holds' => sub {
Link Here
|
| 2130 |
t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 ); |
2130 |
t::lib::Mocks::mock_preference( 'ConfirmFutureHolds', 0 ); |
| 2131 |
is( $item->biblio->current_holds->count, 0, 'No future hold was counted when ConfirmFutureHolds is zero' ); |
2131 |
is( $item->biblio->current_holds->count, 0, 'No future hold was counted when ConfirmFutureHolds is zero' ); |
| 2132 |
|
2132 |
|
|
|
2133 |
# Test if renewal ignores future holds (until we decide otherwise; see bug 40435) |
| 2134 |
my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 2135 |
t::lib::Mocks::mock_userenv( { branchcode => $patron2->branchcode } ); |
| 2136 |
my $issue = C4::Circulation::AddIssue( $patron2, $item->barcode, dt_from_string() ); |
| 2137 |
my ( $ok, $err ) = CanBookBeRenewed( $patron2, $issue ); |
| 2138 |
is( $ok, 1, 'Hold does not block renewal' ); |
| 2139 |
|
| 2140 |
# Changing the reservedate should block the renewal |
| 2141 |
Koha::Holds->find($hold_id)->reservedate( dt_from_string() )->store; |
| 2142 |
( $ok, $err ) = CanBookBeRenewed( $patron2, $issue ); |
| 2143 |
is( $ok, 0, 'Hold now blocks renewal' ); |
| 2144 |
is( $err, 'on_reserve', 'Code for blocking renewal' ); |
| 2145 |
|
| 2133 |
$schema->storage->txn_rollback; |
2146 |
$schema->storage->txn_rollback; |
| 2134 |
}; |
2147 |
}; |
| 2135 |
- |
|
|