Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 48; |
20 |
use Test::More tests => 50; |
21 |
use DateTime::Duration; |
21 |
use DateTime::Duration; |
22 |
|
22 |
|
23 |
use t::lib::Mocks; |
23 |
use t::lib::Mocks; |
Lines 396-401
my $itemnumber = Koha::Item->new(
Link Here
|
396 |
)->store->itemnumber; |
396 |
)->store->itemnumber; |
397 |
|
397 |
|
398 |
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckin', q{} ); |
398 |
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckin', q{} ); |
|
|
399 |
t::lib::Mocks::mock_preference( 'CataloguingLog', 1 ); |
400 |
my $log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); |
401 |
|
399 |
AddReturn( 'barcode_3', $branchcode_1 ); |
402 |
AddReturn( 'barcode_3', $branchcode_1 ); |
400 |
my $item = Koha::Items->find( $itemnumber ); |
403 |
my $item = Koha::Items->find( $itemnumber ); |
401 |
ok( $item->notforloan eq 1, 'UpdateNotForLoanStatusOnCheckin does not modify value when not enabled' ); |
404 |
ok( $item->notforloan eq 1, 'UpdateNotForLoanStatusOnCheckin does not modify value when not enabled' ); |
Lines 404-409
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckin', '1: 9' );
Link Here
|
404 |
AddReturn( 'barcode_3', $branchcode_1 ); |
407 |
AddReturn( 'barcode_3', $branchcode_1 ); |
405 |
$item = Koha::Items->find( $itemnumber ); |
408 |
$item = Koha::Items->find( $itemnumber ); |
406 |
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin updates notforloan value from 1 to 9 with setting "1: 9"} ); |
409 |
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin updates notforloan value from 1 to 9 with setting "1: 9"} ); |
|
|
410 |
my $log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); |
411 |
is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckin is not logged"); |
407 |
|
412 |
|
408 |
AddReturn( 'barcode_3', $branchcode_1 ); |
413 |
AddReturn( 'barcode_3', $branchcode_1 ); |
409 |
$item = Koha::Items->find( $itemnumber ); |
414 |
$item = Koha::Items->find( $itemnumber ); |
Lines 427-436
my $item2 = Koha::Items->find( $itemnumber2 );
Link Here
|
427 |
ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' ); |
432 |
ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' ); |
428 |
|
433 |
|
429 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' ); |
434 |
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' ); |
|
|
435 |
$log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); |
430 |
AddReturn( 'barcode_4', $branchcode_1 ); |
436 |
AddReturn( 'barcode_4', $branchcode_1 ); |
431 |
$item2 = Koha::Items->find( $itemnumber2 ); |
437 |
$item2 = Koha::Items->find( $itemnumber2 ); |
432 |
is( $item2->location, 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
438 |
is( $item2->location, 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
433 |
is( $item2->permanent_location, 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
439 |
is( $item2->permanent_location, 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} ); |
|
|
440 |
$log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count(); |
441 |
is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckin is not logged"); |
434 |
AddReturn( 'barcode_4', $branchcode_1 ); |
442 |
AddReturn( 'barcode_4', $branchcode_1 ); |
435 |
$item2 = Koha::Items->find( $itemnumber2 ); |
443 |
$item2 = Koha::Items->find( $itemnumber2 ); |
436 |
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} ); |
444 |
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} ); |
437 |
- |
|
|