|
Lines 209-216
subtest '1 Issuingrule exist with onsiteissueqty=unlimited' => sub {
Link Here
|
| 209 |
is_deeply( |
209 |
is_deeply( |
| 210 |
$data, |
210 |
$data, |
| 211 |
{ |
211 |
{ |
| 212 |
reason => 'TOO_MANY_CHECKOUTS', |
212 |
reason => 'TOO_MANY_CHECKOUTS', |
| 213 |
count => 1, |
213 |
count => 1, |
| 214 |
max_allowed => 1, |
214 |
max_allowed => 1, |
| 215 |
}, |
215 |
}, |
| 216 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
216 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
|
Lines 289-303
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed. Do a CO' => sub {
Link Here
|
| 289 |
my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string() ); |
289 |
my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string() ); |
| 290 |
like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); |
290 |
like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); |
| 291 |
|
291 |
|
| 292 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
292 |
t::lib::Mocks::mock_preference( 'ConsiderOnSiteCheckoutsAsNormalCheckouts', 0 ); |
| 293 |
my $data = C4::Circulation::TooMany( $patron, $item ); |
293 |
my $data = C4::Circulation::TooMany( $patron, $item ); |
| 294 |
my $rule = delete $data->{circulation_rule}; |
294 |
my $rule = delete $data->{circulation_rule}; |
| 295 |
is( ref $rule, 'Koha::CirculationRule', 'Circulation rule was returned' ); |
295 |
is( ref $rule, 'Koha::CirculationRule', 'Circulation rule was returned' ); |
| 296 |
is_deeply( |
296 |
is_deeply( |
| 297 |
$data, |
297 |
$data, |
| 298 |
{ |
298 |
{ |
| 299 |
reason => 'TOO_MANY_CHECKOUTS', |
299 |
reason => 'TOO_MANY_CHECKOUTS', |
| 300 |
count => 1, |
300 |
count => 1, |
| 301 |
max_allowed => 1, |
301 |
max_allowed => 1, |
| 302 |
}, |
302 |
}, |
| 303 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
303 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
|
Lines 357-363
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub {
Link Here
|
| 357 |
my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string(), undef, undef, undef, { onsite_checkout => 1 } ); |
357 |
my $issue = C4::Circulation::AddIssue( $patron, $item->barcode, dt_from_string(), undef, undef, undef, { onsite_checkout => 1 } ); |
| 358 |
like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); |
358 |
like( $issue->issue_id, qr|^\d+$|, 'The issue should have been inserted' ); |
| 359 |
|
359 |
|
| 360 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 0); |
360 |
t::lib::Mocks::mock_preference( 'ConsiderOnSiteCheckoutsAsNormalCheckouts', 0 ); |
| 361 |
is( |
361 |
is( |
| 362 |
C4::Circulation::TooMany( $patron, $item ), |
362 |
C4::Circulation::TooMany( $patron, $item ), |
| 363 |
undef, |
363 |
undef, |
|
Lines 369-390
subtest '1 Issuingrule exist: 1 CO allowed, 1 OSCO allowed, Do a OSCO' => sub {
Link Here
|
| 369 |
is_deeply( |
369 |
is_deeply( |
| 370 |
$data, |
370 |
$data, |
| 371 |
{ |
371 |
{ |
| 372 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
372 |
reason => 'TOO_MANY_ONSITE_CHECKOUTS', |
| 373 |
count => 1, |
373 |
count => 1, |
| 374 |
max_allowed => 1, |
374 |
max_allowed => 1, |
| 375 |
}, |
375 |
}, |
| 376 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
376 |
'OSCO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 0' |
| 377 |
); |
377 |
); |
| 378 |
|
378 |
|
| 379 |
t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); |
379 |
t::lib::Mocks::mock_preference( 'ConsiderOnSiteCheckoutsAsNormalCheckouts', 1 ); |
| 380 |
$data = C4::Circulation::TooMany( $patron, $item ); |
380 |
$data = C4::Circulation::TooMany( $patron, $item ); |
| 381 |
$rule = delete $data->{circulation_rule}; |
381 |
$rule = delete $data->{circulation_rule}; |
| 382 |
is( ref $rule, 'Koha::CirculationRule', 'Circulation rule was returned' ); |
382 |
is( ref $rule, 'Koha::CirculationRule', 'Circulation rule was returned' ); |
| 383 |
is_deeply( |
383 |
is_deeply( |
| 384 |
$data, |
384 |
$data, |
| 385 |
{ |
385 |
{ |
| 386 |
reason => 'TOO_MANY_CHECKOUTS', |
386 |
reason => 'TOO_MANY_CHECKOUTS', |
| 387 |
count => 1, |
387 |
count => 1, |
| 388 |
max_allowed => 1, |
388 |
max_allowed => 1, |
| 389 |
}, |
389 |
}, |
| 390 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
390 |
'CO should not be allowed if ConsiderOnSiteCheckoutsAsNormalCheckouts == 1' |
| 391 |
- |
|
|