|
Lines 1285-1291
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
Link Here
|
| 1285 |
plan tests => 8; |
1285 |
plan tests => 8; |
| 1286 |
|
1286 |
|
| 1287 |
my $library = $builder->build( { source => 'Branch' } ); |
1287 |
my $library = $builder->build( { source => 'Branch' } ); |
| 1288 |
my $patron = $builder->build( { source => 'Borrower' } ); |
1288 |
my $patron = $builder->build( { source => 'Borrower', value => { gonenoaddress => undef, lost => undef, debarred => undef, borrowernotes => "" } } ); |
| 1289 |
|
1289 |
|
| 1290 |
my $biblioitem_1 = $builder->build( { source => 'Biblioitem' } ); |
1290 |
my $biblioitem_1 = $builder->build( { source => 'Biblioitem' } ); |
| 1291 |
my $item_1 = $builder->build( |
1291 |
my $item_1 = $builder->build( |
|
Lines 1296-1301
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
Link Here
|
| 1296 |
notforloan => 0, |
1296 |
notforloan => 0, |
| 1297 |
itemlost => 0, |
1297 |
itemlost => 0, |
| 1298 |
withdrawn => 0, |
1298 |
withdrawn => 0, |
|
|
1299 |
restricted => 0, |
| 1299 |
biblionumber => $biblioitem_1->{biblionumber} |
1300 |
biblionumber => $biblioitem_1->{biblionumber} |
| 1300 |
} |
1301 |
} |
| 1301 |
} |
1302 |
} |
|
Lines 1309-1314
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
Link Here
|
| 1309 |
notforloan => 0, |
1310 |
notforloan => 0, |
| 1310 |
itemlost => 0, |
1311 |
itemlost => 0, |
| 1311 |
withdrawn => 0, |
1312 |
withdrawn => 0, |
|
|
1313 |
restricted => 0, |
| 1312 |
biblionumber => $biblioitem_2->{biblionumber} |
1314 |
biblionumber => $biblioitem_2->{biblionumber} |
| 1313 |
} |
1315 |
} |
| 1314 |
} |
1316 |
} |
|
Lines 1322-1346
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
Link Here
|
| 1322 |
|
1324 |
|
| 1323 |
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'confirmation' ); |
1325 |
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'confirmation' ); |
| 1324 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); |
1326 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); |
| 1325 |
is( keys(%$error) + keys(%$alerts), 0 ); |
1327 |
is( keys(%$error) + keys(%$alerts), 0, 'No key for error and alert ' . keys(%$error) . ' ' . keys(%$alerts) ); |
| 1326 |
is( $question->{USERBLOCKEDOVERDUE}, 1 ); |
1328 |
is( $question->{USERBLOCKEDOVERDUE}, 1, 'OverduesBlockCirc=confirmation, USERBLOCKEDOVERDUE should be set for question' ); |
| 1327 |
|
1329 |
|
| 1328 |
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'block' ); |
1330 |
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'block' ); |
| 1329 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); |
1331 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); |
| 1330 |
is( keys(%$question) + keys(%$alerts), 0 ); |
1332 |
is( keys(%$question) + keys(%$alerts), 0, 'No key for question and alert ' . keys(%$question) . ' ' . keys(%$alerts) ); |
| 1331 |
is( $error->{USERBLOCKEDOVERDUE}, 1 ); |
1333 |
is( $error->{USERBLOCKEDOVERDUE}, 1, 'OverduesBlockCirc=block, USERBLOCKEDOVERDUE should be set for error' ); |
| 1332 |
|
1334 |
|
| 1333 |
# Patron cannot issue item_1, they are debarred |
1335 |
# Patron cannot issue item_1, they are debarred |
| 1334 |
my $tomorrow = DateTime->today( time_zone => C4::Context->tz() )->add( days => 1 ); |
1336 |
my $tomorrow = DateTime->today( time_zone => C4::Context->tz() )->add( days => 1 ); |
| 1335 |
Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->{borrowernumber}, expiration => $tomorrow } ); |
1337 |
Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->{borrowernumber}, expiration => $tomorrow } ); |
| 1336 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); |
1338 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); |
| 1337 |
is( keys(%$question) + keys(%$alerts), 0 ); |
1339 |
is( keys(%$question) + keys(%$alerts), 0, 'No key for question and alert ' . keys(%$question) . ' ' . keys(%$alerts) ); |
| 1338 |
is( $error->{USERBLOCKEDWITHENDDATE}, output_pref( { dt => $tomorrow, dateformat => 'sql', dateonly => 1 } ) ); |
1340 |
is( $error->{USERBLOCKEDWITHENDDATE}, output_pref( { dt => $tomorrow, dateformat => 'sql', dateonly => 1 } ), 'USERBLOCKEDWITHENDDATE should be tomorrow' ); |
| 1339 |
|
1341 |
|
| 1340 |
Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->{borrowernumber} } ); |
1342 |
Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->{borrowernumber} } ); |
| 1341 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); |
1343 |
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); |
| 1342 |
is( keys(%$question) + keys(%$alerts), 0 ); |
1344 |
is( keys(%$question) + keys(%$alerts), 0, 'No key for question and alert ' . keys(%$question) . ' ' . keys(%$alerts) ); |
| 1343 |
is( $error->{USERBLOCKEDNOENDDATE}, '9999-12-31' ); |
1345 |
is( $error->{USERBLOCKEDNOENDDATE}, '9999-12-31', 'USERBLOCKEDNOENDDATE should be 9999-12-31 for unlimited debarments' ); |
| 1344 |
}; |
1346 |
}; |
| 1345 |
|
1347 |
|
| 1346 |
subtest 'MultipleReserves' => sub { |
1348 |
subtest 'MultipleReserves' => sub { |
| 1347 |
- |
|
|